From df7817d05563b061b58fca5810760bfdbc20a228 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 27 Feb 2023 11:46:16 +0000 Subject: [PATCH 001/375] Remove dead code --- kernels/ZendEngine3/memory.c | 11 ----------- kernels/ZendEngine3/memory.h | 1 - 2 files changed, 12 deletions(-) diff --git a/kernels/ZendEngine3/memory.c b/kernels/ZendEngine3/memory.c index ac1f012fd0..4fb7271bb2 100755 --- a/kernels/ZendEngine3/memory.c +++ b/kernels/ZendEngine3/memory.c @@ -306,17 +306,6 @@ int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key memcpy(&scope, &ZSTR_VAL(hash_key->key)[(len -1) - 2 * sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); -/* -#ifndef ZEPHIR_RELEASE - { - zend_class_entry *cls; - memcpy(&cls, &hash_key->arKey[len - sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); - - fprintf(stderr, "func: %s, cls: %s, scope: %s [%u]\n", (*entry)->f->common.function_name, (cls ? cls->name : "N/A"), (scope ? scope->name : "N/A"), (uint)(*entry)->times); - } -#endif -*/ - if ((*entry)->type != ZEND_INTERNAL_FUNCTION || (scope && scope->type != ZEND_INTERNAL_CLASS)) { return ZEND_HASH_APPLY_REMOVE; } diff --git a/kernels/ZendEngine3/memory.h b/kernels/ZendEngine3/memory.h index 269ed60920..76407bb5ae 100755 --- a/kernels/ZendEngine3/memory.h +++ b/kernels/ZendEngine3/memory.h @@ -175,7 +175,6 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); do { \ zval *orig_ptr = z; \ ZEPHIR_SEPARATE(orig_ptr); \ - /*zephir_memory_observe(orig_ptr);*/ \ } while (0) #endif From 01dde90f0350ff8d8743859fed56fdaa733acf2b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 27 Feb 2023 11:52:10 +0000 Subject: [PATCH 002/375] Remove .ci/memcheck.sh --- .ci/memcheck.sh | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100755 .ci/memcheck.sh diff --git a/.ci/memcheck.sh b/.ci/memcheck.sh deleted file mode 100755 index f5ce496833..0000000000 --- a/.ci/memcheck.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# -# This file is part of the Zephir. -# -# (c) Phalcon Team -# -# For the full copyright and license information, please view -# the LICENSE file that was distributed with this source code. - -if [ "$(command -v valgrind 2>/dev/null)" = "" ]; then - (>&2 echo "Valgring does not exist. Can not check for memory leaks.") - (>&2 echo "Aborting.") - exit 1 -fi - -# Correctly show the stack frames for extensions compiled as shared libraries -export ZEND_DONT_UNLOAD_MODULES=1 - -# Disable Zend memory manager before running PHP with valgrind -export USE_ZEND_ALLOC=0 - -# Do not stop testing on failures -export PHPUNIT_DONT_EXIT=1 - -if [ "$(php-config --vernum)" -lt "70200" ]; then - test_suite="Extension_Php70" -else - test_suite="Extension_Php72" -fi - -valgrind \ - --read-var-info=yes \ - --error-exitcode=1 \ - --fullpath-after= \ - --track-origins=yes \ - --leak-check=full \ - --num-callers=20 \ - --run-libc-freeres=no \ - php \ - -d "extension=ext/modules/stub.so" \ - "vendor/bin/simple-phpunit" \ - --no-coverage \ - --testsuite "$test_suite" From 6773f19d9b272cafee96b9a30f9b152c28e982ea Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 28 Feb 2023 10:27:43 +0000 Subject: [PATCH 003/375] Update action.yml --- .github/workflows/build-win-ext/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index 113c334a48..128782e8bf 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -46,7 +46,6 @@ runs: shell: powershell run: | Write-Output "::group::Install dependencies" - mkdir ${{ env.CACHE_DIR }}\Choco choco install --no-progress -y --cache-location=${{ env.CACHE_DIR }}\Choco re2c Write-Output "::endgroup::" From 82e7ded0525e1258e1c6a58eb016dc1d39daad4f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:42:28 +0000 Subject: [PATCH 004/375] #2407 - Add docker files for PHP8.3 --- docker-compose.yml | 10 ++++++++++ docker/8.3/.bashrc | 5 +++++ docker/8.3/Dockerfile | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 docker/8.3/.bashrc create mode 100644 docker/8.3/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 3bb2269d9a..be657105b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,3 +42,13 @@ services: - "USER=Zephir" volumes: - .:/srv + + zephir-8.3: + container_name: phalcon-zephir-8.3 + hostname: zephir-83 + build: docker/8.3 + working_dir: /srv + environment: + - "USER=Zephir" + volumes: + - .:/srv diff --git a/docker/8.3/.bashrc b/docker/8.3/.bashrc new file mode 100644 index 0000000000..fd3a636e58 --- /dev/null +++ b/docker/8.3/.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.3/Dockerfile b/docker/8.3/Dockerfile new file mode 100644 index 0000000000..3bc4b87b45 --- /dev/null +++ b/docker/8.3/Dockerfile @@ -0,0 +1,25 @@ +FROM composer:latest as composer +FROM php:8.3.0beta3-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"] From e01feca194a77cc996a4bcd87712adafa42b5fda Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:47:26 +0000 Subject: [PATCH 005/375] #2407 - Remove unused `unlink_recursive()` function --- Library/functions.php | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/Library/functions.php b/Library/functions.php index 910128f3e3..98c997c68e 100644 --- a/Library/functions.php +++ b/Library/functions.php @@ -16,31 +16,6 @@ use const PHP_INT_SIZE; use const PHP_OS; use const PHP_ZTS; -use const SCANDIR_SORT_ASCENDING; - -/** - * Attempts to remove recursively the directory with all subdirectories and files. - * - * A E_WARNING level error will be generated on failure. - * - * @param string $path - */ -function unlink_recursive($path) -{ - if (is_dir($path)) { - $objects = array_diff(scandir($path, SCANDIR_SORT_ASCENDING), ['.', '..']); - - foreach ($objects as $object) { - if (is_dir("{$path}/{$object}")) { - unlink_recursive("{$path}/{$object}"); - } else { - unlink("{$path}/{$object}"); - } - } - - rmdir($path); - } -} /** * Camelize a string. From be5ed57337865234224acca83b23ab9beb749cca Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:51:45 +0000 Subject: [PATCH 006/375] #2407 - Remove docker files of PHP7.4 --- docker-compose.yml | 10 ---------- docker/7.4/.bashrc | 5 ----- docker/7.4/Dockerfile | 25 ------------------------- 3 files changed, 40 deletions(-) delete mode 100644 docker/7.4/.bashrc delete mode 100644 docker/7.4/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index be657105b7..449c29c99b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,16 +3,6 @@ version: '3' services: - zephir-7.4: - container_name: phalcon-zephir-7.4 - hostname: zephir-74 - build: docker/7.4 - working_dir: /srv - environment: - - "USER=Zephir" - volumes: - - .:/srv - zephir-8.0: container_name: phalcon-zephir-8.0 hostname: zephir-80 diff --git a/docker/7.4/.bashrc b/docker/7.4/.bashrc deleted file mode 100644 index fd3a636e58..0000000000 --- a/docker/7.4/.bashrc +++ /dev/null @@ -1,5 +0,0 @@ -#!/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/7.4/Dockerfile b/docker/7.4/Dockerfile deleted file mode 100644 index a8e41fe611..0000000000 --- a/docker/7.4/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM composer:latest as composer -FROM php:7.4-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"] From faa52dcab055ea8214f35f380de4377e81e460cd Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:52:41 +0000 Subject: [PATCH 007/375] #2407 - Make minimum supported PHP version from `7.4` to `8.0` --- composer.json | 2 +- composer.lock | 278 +++++++++++++++++++++++++------------------------- 2 files changed, 142 insertions(+), 138 deletions(-) diff --git a/composer.json b/composer.json index 974932b774..9c796720a8 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ } ], "require": { - "php": ">=7.4.1", + "php": ">=8.0", "ext-ctype": "*", "ext-hash": "*", "ext-json": "*", diff --git a/composer.lock b/composer.lock index da93b3b90a..84653db5d7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3f5dd4044a9111ddb52745217aa41362", + "content-hash": "12ba06c84bf00534e75ea0d79e22a65b", "packages": [ { "name": "monolog/monolog", @@ -110,22 +110,27 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -152,9 +157,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/event-dispatcher", @@ -258,16 +263,16 @@ }, { "name": "symfony/console", - "version": "v5.4.19", + "version": "v5.4.28", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" + "reference": "f4f71842f24c2023b91237c72a365306f3c58827" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", + "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", + "reference": "f4f71842f24c2023b91237c72a365306f3c58827", "shasum": "" }, "require": { @@ -332,12 +337,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.19" + "source": "https://github.com/symfony/console/tree/v5.4.28" }, "funding": [ { @@ -353,29 +358,29 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-08-07T06:12:30+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -404,7 +409,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -420,20 +425,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.19", + "version": "v5.4.26", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c" + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/abf49cc084c087d94b4cb939c3f3672971784e0c", - "reference": "abf49cc084c087d94b4cb939c3f3672971784e0c", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5dcc00e03413f05c1e7900090927bb7247cb0aac", + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac", "shasum": "" }, "require": { @@ -489,7 +494,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.19" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.26" }, "funding": [ { @@ -505,24 +510,24 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-07-06T06:34:20+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "psr/event-dispatcher": "^1" }, "suggest": { @@ -531,7 +536,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -568,7 +573,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2" }, "funding": [ { @@ -584,20 +589,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -612,7 +617,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -650,7 +655,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -666,20 +671,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { @@ -691,7 +696,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -731,7 +736,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -747,20 +752,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -772,7 +777,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -815,7 +820,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -831,20 +836,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -859,7 +864,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -898,7 +903,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -914,20 +919,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { @@ -936,7 +941,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -977,7 +982,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -993,20 +998,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -1015,7 +1020,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1060,7 +1065,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -1076,26 +1081,25 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.0.2", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -1106,7 +1110,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1143,7 +1147,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, "funding": [ { @@ -1159,38 +1163,37 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2022-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v5.4.19", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb" + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb", + "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -1229,7 +1232,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.19" + "source": "https://github.com/symfony/string/tree/v6.0.19" }, "funding": [ { @@ -1245,7 +1248,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-01-01T08:36:10+00:00" } ], "packages-dev": [ @@ -1321,16 +1324,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -1368,7 +1371,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -1376,20 +1379,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -1430,9 +1433,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "phar-io/manifest", @@ -1547,23 +1550,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.24", + "version": "9.2.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1578,8 +1581,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -1612,7 +1615,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" }, "funding": [ { @@ -1620,7 +1624,7 @@ "type": "github" } ], - "time": "2023-01-26T08:26:55+00:00" + "time": "2023-07-26T13:44:30+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2265,16 +2269,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -2319,7 +2323,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -2327,7 +2331,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", @@ -2471,16 +2475,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { @@ -2523,7 +2527,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" }, "funding": [ { @@ -2531,7 +2535,7 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-08-02T09:26:13+00:00" }, { "name": "sebastian/lines-of-code", @@ -2986,7 +2990,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.4.1", + "php": ">=8.0", "ext-ctype": "*", "ext-hash": "*", "ext-json": "*", @@ -3001,5 +3005,5 @@ "ext-pdo_sqlite": "*", "ext-zip": "*" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } From c26fd79e289eb7f587ef71a6caa09ed82eb3222f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:54:30 +0000 Subject: [PATCH 008/375] #2407 - Remove `MethodCallWarmUp` class and it's calss --- Library/ClassMethod.php | 5 ----- Library/CompilationContext.php | 7 ------- Library/MethodCallWarmUp.php | 38 ---------------------------------- 3 files changed, 50 deletions(-) delete mode 100644 Library/MethodCallWarmUp.php diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 6071068c4c..1ee25f0a40 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -1593,11 +1593,6 @@ public function compile(CompilationContext $compilationContext): void */ $compilationContext->currentMethod = $this; - /** - * Initialize the method warm-up to null - */ - $compilationContext->methodWarmUp = null; - /** * Assign pre-made compilation passes. */ diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index db3b7d1622..915e0044a0 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -84,13 +84,6 @@ class CompilationContext */ public ?ClassMethod $currentMethod = null; - /** - * Methods warm-up. - * - * @var MethodCallWarmUp|null - */ - public ?MethodCallWarmUp $methodWarmUp = null; - /** * Represents the c-headers added to the file. * diff --git a/Library/MethodCallWarmUp.php b/Library/MethodCallWarmUp.php deleted file mode 100644 index 46d4d8223c..0000000000 --- a/Library/MethodCallWarmUp.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -/** - * MethodCallWarmUp. - * - * List of methods that require warm up - */ -class MethodCallWarmUp -{ - private $warmUps = []; - - /** - * @param ClassDefinition $classDefinition - * @param ClassMethod $method - */ - public function add(ClassDefinition $classDefinition, ClassMethod $method) - { - $this->warmUps[] = [ - $classDefinition, - $method, - ]; - } - - public function get() - { - } -} From c3b08ecff171dbb531ac1d95de97845e750817df Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:55:33 +0000 Subject: [PATCH 009/375] #2407 - Bump `ZEPHIR_PARSER_VERSION` to `1.6.0` --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 213579decb..9657cb401a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ on: env: RE2C_VERSION: 2.2 - ZEPHIR_PARSER_VERSION: 1.5.3 + ZEPHIR_PARSER_VERSION: 1.6.0 PSR_VERSION: 1.2.0 CACHE_DIR: .cache From 57eea2dfeb437792d7d462e28179baf70e8cb617 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:55:57 +0000 Subject: [PATCH 010/375] #2407 - Change PHP version to `8.0` --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9657cb401a..bdb7723698 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: env: PHP_CS_FIXER_VERSION: 3.2.0 with: - php-version: '7.4' + php-version: '8.0' coverage: none tools: php-cs-fixer:${{ env.PHP_CS_FIXER_VERSION }}, phpcs From e051dc921b0898f2062bb7a379e3f89abc317fe6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 21:56:38 +0000 Subject: [PATCH 011/375] #2407 - Adjust matrix of PHP versions --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bdb7723698..b5002f44c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,7 +61,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '7.4', '8.0' , '8.1', '8.2' ] + php: [ '8.0' , '8.1', '8.2', '8.3' ] ts: [ 'ts', 'nts' ] arch: [ 'x64' ] @@ -83,7 +83,7 @@ jobs: - { php: '8.0', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - { php: '8.1', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - { php: '8.1', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - # Disabled due PSR extension wasn't complied for 8.2 + # Disabled due PSR extension wasn't complied for >=8.2 #- { php: '8.2', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } #- { php: '8.2', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } From 8c4045bef35d9db191ab112a3259feac738330fc Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 22:03:34 +0000 Subject: [PATCH 012/375] #2407 - Reformat code with PHP8.0 syntax sugar --- Library/Cache/MethodCache.php | 8 -------- Library/Classes/Entry.php | 2 -- Library/Code/Builder/Struct.php | 2 +- Library/Compiler/FileInterface.php | 2 -- Library/EventsManager.php | 3 --- Library/Expression.php | 9 +-------- Library/FunctionCall.php | 2 +- Library/FunctionDefinition.php | 12 ++---------- Library/GlobalConstant.php | 16 ++++------------ Library/HeadersManager.php | 2 -- Library/MethodCall.php | 2 -- Library/SymbolTable.php | 27 +++------------------------ Library/Variable.php | 17 +---------------- 13 files changed, 13 insertions(+), 91 deletions(-) diff --git a/Library/Cache/MethodCache.php b/Library/Cache/MethodCache.php index 66238021c2..5b731a1ec3 100644 --- a/Library/Cache/MethodCache.php +++ b/Library/Cache/MethodCache.php @@ -17,7 +17,6 @@ use ReflectionException; use Zephir\ClassDefinition; use Zephir\CompilationContext; -use Zephir\MethodCallWarmUp; use Zephir\Passes\CallGathererPass; use Zephir\Variable; @@ -148,13 +147,6 @@ public function get(CompilationContext $compilationContext, string $methodName, $cacheable = false; } - // Recursive methods require warm-up - if ($compilationContext->currentMethod == $method) { - if (!$compilationContext->methodWarmUp) { - $compilationContext->methodWarmUp = new MethodCallWarmUp(); - } - } - if ('this_ptr' != $caller->getName()) { $associatedClass = $caller->getAssociatedClass(); if ($this->isClassCacheable($associatedClass)) { diff --git a/Library/Classes/Entry.php b/Library/Classes/Entry.php index 2b1466cea2..47ded83a52 100644 --- a/Library/Classes/Entry.php +++ b/Library/Classes/Entry.php @@ -14,7 +14,6 @@ namespace Zephir\Classes; use ReflectionClass; -use ReflectionException; use Zephir\ClassDefinition; use Zephir\CompilationContext; use Zephir\Exception; @@ -75,7 +74,6 @@ public function __construct(string $className, CompilationContext $compilationCo * @return string * * @throws Exception - * @throws ReflectionException */ public function get(): string { diff --git a/Library/Code/Builder/Struct.php b/Library/Code/Builder/Struct.php index 1d5c9472a1..7f62238fbf 100644 --- a/Library/Code/Builder/Struct.php +++ b/Library/Code/Builder/Struct.php @@ -86,7 +86,7 @@ public function __toString(): string * * @throws InvalidArgumentException */ - public function addProperty(string $field, array $global) + public function addProperty(string $field, array $global): void { if (!isset($global['type']) || !is_string($global['type'])) { throw new InvalidArgumentException('Property type must be string'); diff --git a/Library/Compiler/FileInterface.php b/Library/Compiler/FileInterface.php index 6485c41d01..588e2d19e7 100644 --- a/Library/Compiler/FileInterface.php +++ b/Library/Compiler/FileInterface.php @@ -15,8 +15,6 @@ use Zephir\Compiler; /** - * FileInterface. - * * Provides a common interface for compiler files */ interface FileInterface diff --git a/Library/EventsManager.php b/Library/EventsManager.php index 6db0dff1e4..b9c33e1262 100644 --- a/Library/EventsManager.php +++ b/Library/EventsManager.php @@ -11,9 +11,6 @@ namespace Zephir; -/** - * Class EventsManager. - */ class EventsManager { /** diff --git a/Library/Expression.php b/Library/Expression.php index 817612f408..8199d1816c 100644 --- a/Library/Expression.php +++ b/Library/Expression.php @@ -78,17 +78,10 @@ class Expression protected bool $expecting = true; protected bool $readOnly = false; protected bool $evalMode = false; - protected array $expression = []; protected ?Variable $expectingVariable = null; - /** - * Expression constructor. - * - * @param array $expression - */ - public function __construct(array $expression) + public function __construct(protected array $expression) { - $this->expression = $expression; } /** diff --git a/Library/FunctionCall.php b/Library/FunctionCall.php index e7c9ec1d9a..5bd9eee123 100644 --- a/Library/FunctionCall.php +++ b/Library/FunctionCall.php @@ -77,7 +77,7 @@ public function getReflector($funcName) * * @return bool */ - public function isBuiltInFunction($functionName) + public function isBuiltInFunction(string $functionName) { switch ($functionName) { case 'memstr': diff --git a/Library/FunctionDefinition.php b/Library/FunctionDefinition.php index 53116f1c75..814222700e 100644 --- a/Library/FunctionDefinition.php +++ b/Library/FunctionDefinition.php @@ -14,17 +14,10 @@ namespace Zephir; /** - * FunctionDefinition. - * * Represents a function */ class FunctionDefinition extends ClassMethod { - /** - * The namespace of the function. - */ - private string $namespace; - /** * Whether the function is declared in a global or namespaced scope. * @@ -35,7 +28,7 @@ class FunctionDefinition extends ClassMethod /** * FunctionDefinition constructor. * - * @param string $namespace + * @param string $namespace The namespace of the function. * @param string $name * @param ClassMethodParameters|null $parameters * @param StatementsBlock|null $statements @@ -43,14 +36,13 @@ class FunctionDefinition extends ClassMethod * @param array|null $expression */ public function __construct( - string $namespace, + private string $namespace, string $name, ClassMethodParameters $parameters = null, StatementsBlock $statements = null, array $returnType = null, array $expression = null ) { - $this->namespace = $namespace; $this->name = $name; $this->parameters = $parameters; $this->statements = $statements; diff --git a/Library/GlobalConstant.php b/Library/GlobalConstant.php index 6a5a330a51..f818b9d2dc 100644 --- a/Library/GlobalConstant.php +++ b/Library/GlobalConstant.php @@ -12,23 +12,15 @@ namespace Zephir; /** - * GlobalConstant. + * Creates a new global constant. * * Global constants are allocated one time at extension initialization * and are referenced across the C code saving memory */ class GlobalConstant { - protected $name; - - /** - * Creates a new global constant. - * - * @param string $name - */ - public function __construct($name) + public function __construct(protected string $name) { - $this->name = $name; } /** @@ -36,7 +28,7 @@ public function __construct($name) * * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -46,7 +38,7 @@ public function getName() * * @return bool */ - public function isTemporal() + public function isTemporal(): bool { return false; } diff --git a/Library/HeadersManager.php b/Library/HeadersManager.php index 10d078cd18..c6a7ad9a1d 100644 --- a/Library/HeadersManager.php +++ b/Library/HeadersManager.php @@ -12,8 +12,6 @@ namespace Zephir; /** - * Class HeadersManager. - * * Manages the c-headers that must be added to a file */ class HeadersManager diff --git a/Library/MethodCall.php b/Library/MethodCall.php index 2046bc120a..d840a8ffec 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -15,8 +15,6 @@ use Zephir\Exception\CompilerException; /** - * MethodCall. - * * Call methods in a non-static context */ class MethodCall extends Call diff --git a/Library/SymbolTable.php b/Library/SymbolTable.php index 7fe44386e9..dbd29a72f0 100644 --- a/Library/SymbolTable.php +++ b/Library/SymbolTable.php @@ -16,8 +16,6 @@ use Zephir\Variable\Globals; /** - * Zephir\SymbolTable. - * * A symbol table stores all the variables defined in a method, their data types and default values. */ class SymbolTable @@ -37,22 +35,12 @@ class SymbolTable */ protected $localContext; - /** - * @var CompilationContext - */ - protected $compilationContext; - /** * @var Globals */ protected $globalsManager; - /** - * SymbolTable. - * - * @param CompilationContext $compilationContext - */ - public function __construct(CompilationContext $compilationContext) + public function __construct(protected CompilationContext $compilationContext) { $this->globalsManager = new Globals(); @@ -85,7 +73,7 @@ public function resolveVariableToBranch($name, CompilationContext $compilationCo do { $currentId = $currentBranch->getUniqueId(); - if (isset($this->branchVariables[$currentId]) && isset($this->branchVariables[$currentId][$name])) { + if (isset($this->branchVariables[$currentId][$name])) { return $currentBranch; } $currentBranch = $currentBranch->getParentBranch(); @@ -222,7 +210,7 @@ public function getVariable($name, CompilationContext $compilationContext = null public function getVariables() { $ret = []; - foreach ($this->branchVariables as $branchId => $vars) { + foreach ($this->branchVariables as $vars) { foreach ($vars as $var) { $ret[$var->getName()] = $var; } @@ -231,15 +219,6 @@ public function getVariables() return $ret; } - public function getVariablesByBranch($branchId) - { - if (isset($this->branchVariables[$branchId])) { - return $this->branchVariables[$branchId]; - } - - return null; - } - /** * Return a variable in the symbol table, it will be used for a read operation. * diff --git a/Library/Variable.php b/Library/Variable.php index f0abe51c91..95ce6e1c37 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -40,13 +40,6 @@ class Variable implements TypeAwareInterface */ protected $name; - /** - * Branch where the variable was declared. - * - * @var Branch|null - */ - protected $branch; - /** * Branch where the variable was initialized for the first time. */ @@ -164,14 +157,7 @@ class Variable implements TypeAwareInterface 'object' => 1, ]; - /** - * Variable constructor. - * - * @param string $type - * @param string $name - * @param Branch $branch - */ - public function __construct(string $type, string $name, Branch $branch = null) + public function __construct(string $type, string $name, protected ?Branch $branch = null) { $this->globalsManager = new Globals(); @@ -181,7 +167,6 @@ public function __construct(string $type, string $name, Branch $branch = null) $this->type = $type; $this->name = $name; - $this->branch = $branch; } /** From 356c2561ca5545a9e990bbf30449b77bb247e57c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 28 Aug 2023 22:05:27 +0000 Subject: [PATCH 013/375] #2407 - Remove `EventsManager` class and it's usage --- Library/ClassDefinition.php | 17 ------------ Library/CompilationContext.php | 5 ---- Library/EventsManager.php | 48 ---------------------------------- 3 files changed, 70 deletions(-) delete mode 100644 Library/EventsManager.php diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 52a24656f6..bad769a004 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -142,11 +142,6 @@ final class ClassDefinition extends AbstractClassDefinition */ protected array $originalNode = []; - /** - * @var EventsManager - */ - protected EventsManager $eventsManager; - /** * @var bool */ @@ -174,8 +169,6 @@ public function __construct(string $namespace, string $name, ?string $shortName $this->namespace = $namespace; $this->name = $name; $this->shortName = $shortName ?: $name; - - $this->eventsManager = new EventsManager(); } /** @@ -218,16 +211,6 @@ public function isExternal(): bool return $this->external; } - /** - * Get eventsManager for class definition. - * - * @return EventsManager - */ - public function getEventsManager(): EventsManager - { - return $this->eventsManager; - } - /** * Set the class' type (class/interface). * diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 915e0044a0..bb34cb4098 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -23,11 +23,6 @@ */ class CompilationContext { - /** - * @var EventsManager|null - */ - public ?EventsManager $eventsManager = null; - /** * Compiler. * diff --git a/Library/EventsManager.php b/Library/EventsManager.php deleted file mode 100644 index b9c33e1262..0000000000 --- a/Library/EventsManager.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -class EventsManager -{ - /** - * @var array - */ - private $listeners = []; - - /** - * Attaches a listener to a specific event type. - * - * @param $event - * @param $callback - */ - public function listen($event, $callback) - { - if (!isset($this->listeners[$event])) { - $this->listeners[$event] = []; - } - - $this->listeners[$event][] = $callback; - } - - /** - * Triggers an event for the specified event type. - * - * @param $event - * @param array $param - */ - public function dispatch($event, array $param = []) - { - foreach ($this->listeners[$event] as $listener) { - \call_user_func_array($listener, $param); - } - } -} From 999cfa47ed443542e4507497c4b4c75aa53c3ae1 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 29 Aug 2023 09:42:24 +0100 Subject: [PATCH 014/375] #2407 - Remove unused `IsAnnotated` class --- .../ReturnType/Specification/IsAnnotated.php | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsAnnotated.php diff --git a/Library/FunctionLike/ReturnType/Specification/IsAnnotated.php b/Library/FunctionLike/ReturnType/Specification/IsAnnotated.php deleted file mode 100644 index 5ba517b7e5..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsAnnotated.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; - -final class IsAnnotated extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return ReturnType\TypeInterface::TYPE_ANNOTATION == $type->getType(); - } -} From 004ae2ed2400987c045e4e0de2fb280416c038f7 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 29 Aug 2023 09:57:47 +0100 Subject: [PATCH 015/375] #2407 - Reformat code with PHP8.0 syntax sugar --- .../Backends/ZendEngine3/StringsManager.php | 2 +- Library/BranchGraph.php | 10 -- Library/BranchManager.php | 8 -- Library/CacheManager.php | 6 +- Library/Call.php | 30 +---- Library/ClassDefinition.php | 2 +- Library/ClassMethod.php | 1 - Library/ClassMethodParameters.php | 2 - Library/ClassProperty.php | 115 +++++++----------- Library/CodePrinter.php | 59 --------- Library/CompilationContext.php | 10 +- Library/CompiledExpression.php | 12 +- Library/Compiler.php | 3 +- Library/CompilerFile.php | 12 +- Library/CompilerFileAnonymous.php | 2 +- Library/Console/Command/AbstractCommand.php | 2 +- Library/Console/Command/BuildCommand.php | 2 - Library/Console/Command/CleanCommand.php | 2 - Library/Console/Command/CompileCommand.php | 4 +- Library/Detectors/WriteDetector.php | 18 +-- Library/Documentation.php | 6 +- Library/Documentation/File/ClassFile.php | 30 +---- Library/Documentation/File/ClassesFile.php | 23 +--- .../EventListener/ConsoleErrorListener.php | 3 +- Library/Expression.php | 2 +- Library/FunctionLike/ReturnType/CastHint.php | 83 ++----------- .../Specification/ArrayCompatible.php | 11 +- .../Specification/IntCompatible.php | 26 +--- .../FunctionLike/ReturnType/TypeInterface.php | 2 +- .../Logger/Formatter/CompilerFormatter.php | 4 +- Library/MethodCall.php | 7 +- Library/Parser/Manager.php | 38 +----- Library/Passes/LocalContextPass.php | 10 +- Library/Passes/LoopBreakPass.php | 10 +- Library/Passes/MutateGathererPass.php | 70 +++-------- Library/Passes/SkipVariantInit.php | 36 +++--- Library/Statements/BreakStatement.php | 7 +- Library/Statements/ContinueStatement.php | 7 +- Library/Statements/DeclareStatement.php | 29 +---- Library/Statements/DoWhileStatement.php | 19 +-- Library/Statements/EchoStatement.php | 9 +- Library/Statements/ForStatement.php | 74 ++++++----- Library/Statements/LoopStatement.php | 12 +- Library/StatementsBlock.php | 15 +-- Library/StringsManager.php | 12 +- Library/Variable.php | 2 +- 46 files changed, 230 insertions(+), 619 deletions(-) diff --git a/Library/Backends/ZendEngine3/StringsManager.php b/Library/Backends/ZendEngine3/StringsManager.php index a1e19c70ea..7400d52b71 100644 --- a/Library/Backends/ZendEngine3/StringsManager.php +++ b/Library/Backends/ZendEngine3/StringsManager.php @@ -27,7 +27,7 @@ class StringsManager extends BaseStringsManager * * @param string $key */ - public function addConcatKey($key) + public function addConcatKey(string $key): void { $this->concatKeys[$key] = true; } diff --git a/Library/BranchGraph.php b/Library/BranchGraph.php index 5c765f7338..94be28d76c 100644 --- a/Library/BranchGraph.php +++ b/Library/BranchGraph.php @@ -49,14 +49,4 @@ public function addLeaf(Branch $branch): void } } } - - /** - * Returns the tree's root node. - * - * @return BranchGraphNode - */ - public function getRoot(): BranchGraphNode - { - return $this->root; - } } diff --git a/Library/BranchManager.php b/Library/BranchManager.php index 9cf041daa8..0c6379a7e0 100644 --- a/Library/BranchManager.php +++ b/Library/BranchManager.php @@ -84,12 +84,4 @@ public function setRootBranch(Branch $branch) { $this->rootBranch = $branch; } - - /** - * @return Branch|null - */ - public function getRootBranch() - { - return $this->rootBranch; - } } diff --git a/Library/CacheManager.php b/Library/CacheManager.php index cd2317308f..058d2b0cc3 100644 --- a/Library/CacheManager.php +++ b/Library/CacheManager.php @@ -54,7 +54,7 @@ class CacheManager * * @param CallGathererPass|null $gatherer */ - public function setGatherer(?CallGathererPass $gatherer = null) + public function setGatherer(?CallGathererPass $gatherer = null): void { $this->gatherer = $gatherer; } @@ -76,7 +76,7 @@ public function getClassEntryCache(): ClassEntryCache /** * Creates or returns an existing function cache. * - * @return FunctionCache + * @return FunctionCache|null */ public function getFunctionCache(): ?FunctionCache { @@ -90,7 +90,7 @@ public function getFunctionCache(): ?FunctionCache /** * Creates or returns an existing method cache. * - * @return MethodCache + * @return MethodCache|null */ public function getMethodCache(): ?MethodCache { diff --git a/Library/Call.php b/Library/Call.php index 2f1d7a3ce9..18da25c5cb 100644 --- a/Library/Call.php +++ b/Library/Call.php @@ -79,7 +79,7 @@ class Call * * @param CompilationContext $compilationContext */ - public function processExpectedReturn(CompilationContext $compilationContext) + public function processExpectedReturn(CompilationContext $compilationContext): void { $expr = $this->expression; $expression = $expr->getExpression(); @@ -300,34 +300,6 @@ public function getResolvedParams(array $parameters, CompilationContext $compila $codePrinter = $compilationContext->codePrinter; $exprParams = $this->getResolvedParamsAsExpr($parameters, $compilationContext, $expression); - /** - * Static typed parameters in final/private methods are promotable to read only parameters - * Recursive calls with static typed methods also also promotable. - */ - $readOnlyParameters = []; - if (\is_object($calleeDefinition)) { - if ($calleeDefinition instanceof ClassMethod) { - if ($calleeDefinition->isFinal() || $calleeDefinition->isPrivate() || $calleeDefinition->isInternal() || $compilationContext->currentMethod === $calleeDefinition) { - foreach ($calleeDefinition->getParameters() as $position => $parameter) { - if (isset($parameter['data-type'])) { - switch ($parameter['data-type']) { - case 'int': - case 'uint': - case 'double': - case 'long': - case 'char': - case 'uchar': - case 'boolean': - case 'bool': - $readOnlyParameters[$position] = true; - break; - } - } - } - } - } - } - $params = []; $types = []; $dynamicTypes = []; diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index bad769a004..4107d21c04 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -416,7 +416,7 @@ public function getImplementedInterfaceDefinitions(): array public function getDependencies(): array { $dependencies = []; - if ($this->extendsClassDefinition && $this->extendsClassDefinition instanceof self) { + if ($this->extendsClassDefinition instanceof self) { $dependencies[] = $this->extendsClassDefinition; } diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 1ee25f0a40..6f55470ff9 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -1784,7 +1784,6 @@ public function compile(CompilationContext $compilationContext): void if (isset($parameter['cast'])) { $symbol->setDynamicTypes('object'); $symbol->setClassTypes($compilationContext->getFullName($parameter['cast']['value'])); - $classCastChecks[] = [$symbol, $parameter]; } else { if (isset($parameter['data-type'])) { if ('variable' === $parameter['data-type']) { diff --git a/Library/ClassMethodParameters.php b/Library/ClassMethodParameters.php index 9337d68128..da36d86acb 100644 --- a/Library/ClassMethodParameters.php +++ b/Library/ClassMethodParameters.php @@ -21,8 +21,6 @@ use function count; /** - * Class Method Parameters - * * Represents the parameters defined in a method. */ class ClassMethodParameters implements Countable, Iterator, ArrayAccess diff --git a/Library/ClassProperty.php b/Library/ClassProperty.php index a4a0ee9436..039641043d 100644 --- a/Library/ClassProperty.php +++ b/Library/ClassProperty.php @@ -11,51 +11,31 @@ namespace Zephir; +use ReflectionException; use Zephir\Exception\CompilerException; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\BinaryOperator; use Zephir\Expression\Builder\Statements\LetStatement as ExpressionLetStatement; +use function in_array; +use function is_array; + /** * Represents a property class */ class ClassProperty { - /** - * @var ClassDefinition - */ - protected ClassDefinition $classDefinition; - - protected $visibility; - - protected $name; - - protected $defaultValue; - - protected $docblock; - - protected $original; - - /** - * @param ClassDefinition $classDefinition - * @param array $visibility - * @param string $name - * @param mixed $defaultValue - * @param string $docBlock - * @param array $original - */ - public function __construct(ClassDefinition $classDefinition, $visibility, $name, $defaultValue, $docBlock, $original) - { + public function __construct( + protected ClassDefinition $classDefinition, + protected array $visibility, + protected string $name, + protected ?array $defaultValue, + protected string $docBlock, + protected array $original, + ) { $this->checkVisibility($visibility, $name, $original); - $this->classDefinition = $classDefinition; - $this->visibility = $visibility; - $this->name = $name; - $this->defaultValue = $defaultValue; - $this->docblock = $docBlock; - $this->original = $original; - - if (!\is_array($this->defaultValue)) { + if (!is_array($this->defaultValue)) { $this->defaultValue = []; $this->defaultValue['type'] = 'null'; $this->defaultValue['value'] = null; @@ -67,7 +47,7 @@ public function __construct(ClassDefinition $classDefinition, $visibility, $name * * @return ClassDefinition */ - public function getClassDefinition() + public function getClassDefinition(): ClassDefinition { return $this->classDefinition; } @@ -77,7 +57,7 @@ public function getClassDefinition() * * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -85,7 +65,7 @@ public function getName() /** * @return mixed */ - public function getValue() + public function getValue(): mixed { if ('array' == $this->defaultValue['type']) { $result = []; @@ -108,7 +88,7 @@ public function getType() /** * @return mixed */ - public function getOriginal() + public function getOriginal(): mixed { return $this->original; } @@ -122,15 +102,15 @@ public function getOriginal() * * @throws CompilerException */ - public function checkVisibility($visibility, $name, $original) + public function checkVisibility($visibility, $name, $original): void { - if (\in_array('public', $visibility) && \in_array('protected', $visibility)) { + if (in_array('public', $visibility) && in_array('protected', $visibility)) { throw new CompilerException("Property '$name' cannot be 'public' and 'protected' at the same time", $original); } - if (\in_array('public', $visibility) && \in_array('private', $visibility)) { + if (in_array('public', $visibility) && in_array('private', $visibility)) { throw new CompilerException("Property '$name' cannot be 'public' and 'private' at the same time", $original); } - if (\in_array('private', $visibility) && \in_array('protected', $visibility)) { + if (in_array('private', $visibility) && in_array('protected', $visibility)) { throw new CompilerException("Property '$name' cannot be 'protected' and 'private' at the same time", $original); } } @@ -177,9 +157,9 @@ public function getVisibilityAccessor() * * @return string */ - public function getDocBlock() + public function getDocBlock(): string { - return $this->docblock; + return $this->docBlock; } /** @@ -187,9 +167,9 @@ public function getDocBlock() * * @return bool */ - public function isStatic() + public function isStatic(): bool { - return \in_array('static', $this->visibility); + return in_array('static', $this->visibility); } /** @@ -197,9 +177,9 @@ public function isStatic() * * @return bool */ - public function isPublic() + public function isPublic(): bool { - return \in_array('public', $this->visibility); + return in_array('public', $this->visibility); } /** @@ -207,9 +187,9 @@ public function isPublic() * * @return bool */ - public function isProtected() + public function isProtected(): bool { - return \in_array('protected', $this->visibility); + return in_array('protected', $this->visibility); } /** @@ -217,9 +197,9 @@ public function isProtected() * * @return bool */ - public function isPrivate() + public function isPrivate(): bool { - return \in_array('private', $this->visibility); + return in_array('private', $this->visibility); } /** @@ -227,9 +207,10 @@ public function isPrivate() * * @param CompilationContext $compilationContext * - * @throws CompilerException + * @throws Exception + * @throws ReflectionException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { switch ($this->defaultValue['type']) { case 'long': @@ -242,7 +223,7 @@ public function compile(CompilationContext $compilationContext) case 'array': case 'empty-array': - $this->initializeArray($compilationContext); + $this->initializeArray(); // no break case 'null': $this->declareProperty($compilationContext, $this->defaultValue['type'], null); @@ -265,7 +246,7 @@ public function compile(CompilationContext $compilationContext) * * @param array $statements */ - protected function removeInitializationStatements(&$statements) + protected function removeInitializationStatements(array &$statements): void { foreach ($statements as $index => $statement) { if (!$this->isStatic()) { @@ -328,14 +309,14 @@ protected function getLetStatement() * * @return bool|string */ - protected function getBooleanCode($value) + protected function getBooleanCode($value): bool|string { - if ($value && ('true' == $value || true === $value)) { + if ('true' == $value || true === $value) { return '1'; - } else { - if ('false' == $value || false === $value) { - return '0'; - } + } + + if ('false' == $value || false === $value) { + return '0'; } return (bool) $value; @@ -351,7 +332,7 @@ protected function getBooleanCode($value) * @throws Exception * @throws CompilerException */ - protected function declareProperty(CompilationContext $compilationContext, $type, $value) + protected function declareProperty(CompilationContext $compilationContext, $type, $value): void { $codePrinter = $compilationContext->codePrinter; @@ -435,7 +416,7 @@ protected function declareProperty(CompilationContext $compilationContext, $type } } - private function initializeArray($compilationContext) + private function initializeArray(): void { $classDefinition = $this->classDefinition; $parentClassDefinition = $classDefinition->getExtendsClassDefinition(); @@ -464,13 +445,7 @@ private function initializeArray($compilationContext) $this->removeInitializationStatements($statements); if ($needLetStatementAdded) { - $newStatements = []; - - /* - * Start from let statement - */ - $newStatements[] = $letStatement; - + $newStatements = [$letStatement]; foreach ($statements as $statement) { $newStatements[] = $statement; } diff --git a/Library/CodePrinter.php b/Library/CodePrinter.php index 0c4aa3a25b..93910aac00 100644 --- a/Library/CodePrinter.php +++ b/Library/CodePrinter.php @@ -26,17 +26,6 @@ class CodePrinter protected int $currentPrints = 0; - /** - * Adds a line to the output without the automatic line feed. - * - * @param string $code - */ - public function outputNoLineFeed(string $code): void - { - $this->lastLine = $code; - $this->code .= str_repeat("\t", $this->level).$code; - } - /** * Add code to the output at the beginning. * @@ -49,29 +38,6 @@ public function preOutput(string $code): void ++$this->currentPrints; } - /** - * Adds a line to the output without the automatic line feed. - * - * @param string $code - */ - public function preOutputNoLineFeed(string $code): void - { - $this->lastLine = $code; - $this->code = str_repeat("\t", $this->level).$code.$this->code; - } - - /** - * Adds code to the output without the indentation level. - * - * @param string $code - */ - public function preOutputNoLevel(string $code): void - { - $this->lastLine = $code; - $this->code = $code.PHP_EOL.$this->code; - ++$this->currentPrints; - } - /** * Add code to the output without indentation. * @@ -121,18 +87,6 @@ public function outputDocBlock($docblock, bool $replaceTab = true): void ++$this->currentPrints; } - /** - * Adds code to the output without the indentation level. - * - * @param string $code - */ - public function outputNoLevel(string $code): void - { - $this->lastLine = $code; - $this->code .= $code.PHP_EOL; - ++$this->currentPrints; - } - /** * Adds a blank line to the output * Optionally controlling if the blank link must be added if the @@ -193,11 +147,6 @@ public function decreaseLevel(): void --$this->level; } - public function setLevel(int $level): void - { - $this->level = $level; - } - /** * Returns the output in the buffer. * @@ -227,12 +176,4 @@ public function clear(): void $this->lastLine = ''; $this->level = 0; } - - public function duplicate(): self - { - $printer = new self(); - $printer->setLevel($this->level); - - return $printer; - } } diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index bb34cb4098..95dd041ed2 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -75,7 +75,7 @@ class CompilationContext /** * Current method or function that being compiled. * - * @var ClassMethod|FunctionDefinition|null + * @var ClassMethod|null */ public ?ClassMethod $currentMethod = null; @@ -94,21 +94,21 @@ class CompilationContext public ?StringsManager $stringsManager = null; /** - * Tells if the the compilation is being made inside a cycle/loop. + * Tells if the compilation is being made inside a cycle/loop. * * @var int */ public int $insideCycle = 0; /** - * Tells if the the compilation is being made inside a try/catch block. + * Tells if the compilation is being made inside a try/catch block. * * @var int */ public int $insideTryCatch = 0; /** - * Tells if the the compilation is being made inside a switch. + * Tells if the compilation is being made inside a switch. * * @var int */ @@ -192,7 +192,7 @@ class CompilationContext */ public function getFullName(string $className): string { - $isFunction = $this->currentMethod && $this->currentMethod instanceof FunctionDefinition; + $isFunction = $this->currentMethod instanceof FunctionDefinition; $namespace = $isFunction ? $this->currentMethod->getNamespace() : $this->classDefinition->getNamespace(); return fqcn($className, $namespace, $this->aliasManager); diff --git a/Library/CompiledExpression.php b/Library/CompiledExpression.php index 46442c1b60..ebb9431ebc 100644 --- a/Library/CompiledExpression.php +++ b/Library/CompiledExpression.php @@ -76,7 +76,7 @@ public function getOriginal(): ?array */ public function getBooleanCode(): string { - if ($this->code && ('true' == $this->code || true === $this->code)) { + if ('true' === $this->code || true === $this->code) { return '1'; } @@ -97,16 +97,6 @@ public function isIntCompatibleType(): bool return in_array($this->type, ['int', 'uint', 'long', 'ulong', 'char', 'uchar'], true); } - /** - * Checks if the compiled expression is a char or compatible type. - * - * @return bool - */ - public function isCharCompatibleType(): bool - { - return in_array($this->type, ['char', 'uchar'], true); - } - /** * Resolves an expression * diff --git a/Library/Compiler.php b/Library/Compiler.php index 601465ecf7..5c8a23b1cc 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -194,9 +194,8 @@ public function setPrototypesPath(string $prototypesPath): void /** * Resolves path to the internal prototypes. * - * @return string + * @return string|null * - * @throws IllegalStateException in case of absence internal prototypes directory */ private function resolvePrototypesPath(): ?string { diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index e634da6fd8..80afb793d1 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -146,11 +146,6 @@ public function getClassDefinition() return $this->classDefinition; } - public function getFunctionDefinitions() - { - return $this->functionDefinitions; - } - /** * Sets if the class belongs to an external dependency or not. * @@ -244,6 +239,7 @@ public function compileClass(CompilationContext $compilationContext): void * * @param CompilationContext $compilationContext * @param FunctionDefinition $functionDefinition + * @throws Exception */ public function compileFunction(CompilationContext $compilationContext, FunctionDefinition $functionDefinition) { @@ -858,7 +854,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) } /** - * If the file does not exists we create it for the first time + * If the file does not exist we create it for the first time */ if (!file_exists($filePath)) { file_put_contents($filePath, $codePrinter->getOutput()); @@ -954,10 +950,10 @@ public function getFilePath(): string * * @throws CompilerException */ - protected function processShortcuts(array $property, ClassDefinition $classDefinition) + protected function processShortcuts(array $property, ClassDefinition $classDefinition): void { foreach ($property['shortcuts'] as $shortcut) { - if ('_' == substr($property['name'], 0, 1)) { + if (str_starts_with($property['name'], '_')) { $name = substr($property['name'], 1); } else { $name = $property['name']; diff --git a/Library/CompilerFileAnonymous.php b/Library/CompilerFileAnonymous.php index b4b54557ef..89711ace2a 100644 --- a/Library/CompilerFileAnonymous.php +++ b/Library/CompilerFileAnonymous.php @@ -64,7 +64,7 @@ public function getClassDefinition(): ClassDefinition * * @param bool $external */ - public function setIsExternal($external) + public function setIsExternal($external): void { $this->external = (bool) $external; } diff --git a/Library/Console/Command/AbstractCommand.php b/Library/Console/Command/AbstractCommand.php index cc43e6120e..25b8afcdae 100644 --- a/Library/Console/Command/AbstractCommand.php +++ b/Library/Console/Command/AbstractCommand.php @@ -22,7 +22,7 @@ abstract class AbstractCommand extends Command /** * @param bool $mergeArgs */ - public function mergeApplicationDefinition($mergeArgs = true) + public function mergeApplicationDefinition(bool $mergeArgs = true): void { parent::mergeApplicationDefinition($mergeArgs); diff --git a/Library/Console/Command/BuildCommand.php b/Library/Console/Command/BuildCommand.php index 9e2740d655..6d45ca491c 100644 --- a/Library/Console/Command/BuildCommand.php +++ b/Library/Console/Command/BuildCommand.php @@ -21,8 +21,6 @@ use Symfony\Component\Console\Style\SymfonyStyle; /** - * Build Command - * * Generates/Compiles/Installs a Zephir extension. */ final class BuildCommand extends AbstractCommand diff --git a/Library/Console/Command/CleanCommand.php b/Library/Console/Command/CleanCommand.php index b620c1d3ad..070f601ab5 100644 --- a/Library/Console/Command/CleanCommand.php +++ b/Library/Console/Command/CleanCommand.php @@ -22,8 +22,6 @@ use function Zephir\is_windows; /** - * Zephir\Console\Command\CleanCommand. - * * Cleans any object files created by the extension. */ final class CleanCommand extends AbstractCommand diff --git a/Library/Console/Command/CompileCommand.php b/Library/Console/Command/CompileCommand.php index fc82d98caa..c53372f917 100644 --- a/Library/Console/Command/CompileCommand.php +++ b/Library/Console/Command/CompileCommand.php @@ -22,8 +22,6 @@ use Zephir\Exception\CompilerException; /** - * Compile Command - * * Compile a Zephir extension. */ final class CompileCommand extends AbstractCommand @@ -52,7 +50,7 @@ protected function configure() ->setHelp($this->getDevelopmentModeHelp().PHP_EOL.$this->getZflagsHelp()); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/Library/Detectors/WriteDetector.php b/Library/Detectors/WriteDetector.php index a16cf941ef..2bebfdc0bb 100644 --- a/Library/Detectors/WriteDetector.php +++ b/Library/Detectors/WriteDetector.php @@ -32,9 +32,9 @@ class WriteDetector public const DETECT_ALL = 255; - protected $detectionFlags = 0; + protected int $detectionFlags = 0; - protected $mutations = []; + protected array $mutations = []; /** * Do the detection pass on a single variable. @@ -44,7 +44,7 @@ class WriteDetector * * @return bool */ - public function detect($variable, array $statements) + public function detect(string $variable, array $statements) { $this->passStatementBlock($statements); @@ -56,7 +56,7 @@ public function detect($variable, array $statements) * * @param int $flags */ - public function setDetectionFlags($flags) + public function setDetectionFlags(int $flags): void { $this->detectionFlags = $flags; } @@ -68,7 +68,7 @@ public function setDetectionFlags($flags) * * @return WriteDetector */ - public function increaseMutations($variable): self + public function increaseMutations(string $variable): self { if (isset($this->mutations[$variable])) { ++$this->mutations[$variable]; @@ -86,7 +86,7 @@ public function increaseMutations($variable): self * * @return int */ - public function getNumberOfMutations($variable) + public function getNumberOfMutations(string $variable): int { if (isset($this->mutations[$variable])) { return $this->mutations[$variable]; @@ -100,7 +100,7 @@ public function getNumberOfMutations($variable) * * @param array $statement */ - public function passLetStatement(array $statement) + public function passLetStatement(array $statement): void { foreach ($statement['assignments'] as $assignment) { if (isset($assignment['expr'])) { @@ -142,7 +142,7 @@ public function passCall(array $expression) * * @param array $expression */ - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { $usePass = self::DETECT_ARRAY_USE == ($this->detectionFlags & self::DETECT_ARRAY_USE); @@ -202,7 +202,7 @@ public function declareVariables(array $statement): void * * @param array $expression */ - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': diff --git a/Library/Documentation.php b/Library/Documentation.php index 416f83b712..44691f507c 100644 --- a/Library/Documentation.php +++ b/Library/Documentation.php @@ -132,7 +132,7 @@ public function findThemePathByName($name) foreach ($this->themesDirectories as $themeDir) { $path = rtrim($themeDir, '\\/').\DIRECTORY_SEPARATOR.$name; - if (0 !== strpos($path, 'phar://')) { + if (!str_starts_with($path, 'phar://')) { $path = realpath($path); } @@ -151,7 +151,7 @@ public function build() { foreach ($this->classes as $class) { // class files (class/ns1/n2/class.html) - $cfile = new File\ClassFile($this->config, $class); + $cfile = new File\ClassFile($class); $this->theme->drawFile($cfile); // class source file (source/ns1/n2/class.html) @@ -160,7 +160,7 @@ public function build() } // classes file (classes.html) - $file = new File\ClassesFile($this->config, $this->classes); + $file = new File\ClassesFile($this->classes); $this->theme->drawFile($file); $namespaceAccessor = new NamespaceAccessor($this->classes); diff --git a/Library/Documentation/File/ClassFile.php b/Library/Documentation/File/ClassFile.php index 5c47251b95..8ec64417d4 100644 --- a/Library/Documentation/File/ClassFile.php +++ b/Library/Documentation/File/ClassFile.php @@ -18,37 +18,18 @@ class ClassFile implements FileInterface { - /** - * @var ClassDefinition - */ - protected $class; + protected ClassDefinition $class; - /** - * @var CompilerFile - */ - protected $compilerFile; - - public function __construct($config, CompilerFile $class) + public function __construct(protected CompilerFile $compilerFile) { - $this->compilerFile = $class; - $this->class = $class->getClassDefinition(); + $this->class = $compilerFile->getClassDefinition(); } - /** - * {@inheritdoc} - * - * @return string - */ public function getTemplateName(): string { return 'class.phtml'; } - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { $nsPieces = explode('\\', $this->class->getNamespace()); @@ -75,11 +56,6 @@ public function getData(): array ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return Documentation::classUrl($this->class); diff --git a/Library/Documentation/File/ClassesFile.php b/Library/Documentation/File/ClassesFile.php index 4035b1dfe5..56ec601f94 100644 --- a/Library/Documentation/File/ClassesFile.php +++ b/Library/Documentation/File/ClassesFile.php @@ -16,31 +16,15 @@ class ClassesFile implements FileInterface { - /** - * @var ClassDefinition - */ - protected $classes; - - public function __construct($config, $classList) + public function __construct(protected ClassDefinition $classes) { - $this->classes = $classList; } - /** - * {@inheritdoc} - * - * @return string - */ public function getTemplateName(): string { return 'classes.phtml'; } - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { return [ @@ -48,11 +32,6 @@ public function getData(): array ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return 'classes.html'; diff --git a/Library/EventListener/ConsoleErrorListener.php b/Library/EventListener/ConsoleErrorListener.php index 7c1d56acae..39a5e7841f 100644 --- a/Library/EventListener/ConsoleErrorListener.php +++ b/Library/EventListener/ConsoleErrorListener.php @@ -25,14 +25,13 @@ public function onCommandError(ConsoleErrorEvent $event): void return; } - $exitCode = $event->getExitCode(); $throwable = $event->getError(); $event->setError( new CompilerException( $event->getError()->getMessage(), $throwable instanceof ExceptionInterface ? $throwable->getExtra() : null, - $exitCode, + $event->getExitCode(), $event->getError() ) ); diff --git a/Library/Expression.php b/Library/Expression.php index 8199d1816c..6237876872 100644 --- a/Library/Expression.php +++ b/Library/Expression.php @@ -470,7 +470,7 @@ public function compile(CompilationContext $compilationContext): CompiledExpress $expr->setExpectReturn($this->expecting, $this->expectingVariable); $resolved = $expr->compile($compilationContext); if (($compilationContext->codePrinter->getNumberPrints() - $numberPrints) <= 1) { - if (false !== strpos($resolved->getCode(), ' ')) { + if (str_contains($resolved->getCode(), ' ')) { return new CompiledExpression($resolved->getType(), '('.$resolved->getCode().')', $expression); } } diff --git a/Library/FunctionLike/ReturnType/CastHint.php b/Library/FunctionLike/ReturnType/CastHint.php index a321b3e823..1f036beb6f 100644 --- a/Library/FunctionLike/ReturnType/CastHint.php +++ b/Library/FunctionLike/ReturnType/CastHint.php @@ -13,100 +13,41 @@ final class CastHint implements TypeInterface { - /** - * @var string - */ - private $dataType; - - /** - * @var string - */ - private $value; - - /** - * @var string - */ - private $type; - - /** - * @var bool - */ - private $collection; - - /** - * Real return type constructor. - * - * @param string $dataType - * @param string|null $value - * @param string|null $type - * @param int|bool $collection - */ - public function __construct($dataType, $value, $type = null, $collection = false) - { - $this->dataType = $dataType; - $this->value = $value; + public function __construct( + private string $dataType, + private ?string $value = null, + private ?string $type = null, + private bool $collection = false + ) { $this->type = $type ?: TypeInterface::TYPE_PARAMETER; - $this->collection = (bool) $collection; } - /** - * {@inheritdoc} - * - * @return string - */ - public function getType() + public function getType(): string { return $this->type; } - /** - * {@inheritdoc} - * - * @return string - */ - public function getDataType() + public function getDataType(): string { return $this->dataType; } - /** - * {@inheritdoc} - * - * @return string|null - */ - public function getValue() + public function getValue(): ?string { return $this->value; } - /** - * {@inheritdoc} - * - * The cast hint is always not mandatory. - * - * @return mixed - */ - public function isMandatory() + public function isMandatory(): bool { return false; } - /** - * {@inheritdoc} - * - * @return bool - */ - public function isCollection() + public function isCollection(): bool { return $this->collection; } - /** - * {@inheritdoc} - * - * @return bool - */ - public function isRealType() + public function isRealType(): bool { return false; } diff --git a/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php b/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php index 8ddf7435f2..6d6680efd0 100644 --- a/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php +++ b/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php @@ -16,17 +16,10 @@ final class ArrayCompatible extends ReturnType\CompositeSpecification { - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) + public function isSatisfiedBy(ReturnType\TypeInterface $type): bool { if ($type->isRealType()) { - return Types::T_ARRAY == $type->getDataType(); + return Types::T_ARRAY === $type->getDataType(); } return $type->isCollection(); diff --git a/Library/FunctionLike/ReturnType/Specification/IntCompatible.php b/Library/FunctionLike/ReturnType/Specification/IntCompatible.php index 2828284c74..dff00ba38d 100644 --- a/Library/FunctionLike/ReturnType/Specification/IntCompatible.php +++ b/Library/FunctionLike/ReturnType/Specification/IntCompatible.php @@ -16,29 +16,15 @@ final class IntCompatible extends ReturnType\CompositeSpecification { - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) + public function isSatisfiedBy(ReturnType\TypeInterface $type): bool { - if (false == $type->isRealType()) { + if (!$type->isRealType()) { return false; } - switch ($type->getDataType()) { - case Types::T_INT: - case Types::T_UINT: - case Types::T_CHAR: - case Types::T_UCHAR: - case Types::T_LONG: - case Types::T_ULONG: - return true; - default: - return false; - } + return match ($type->getDataType()) { + Types::T_INT, Types::T_UINT, Types::T_CHAR, Types::T_UCHAR, Types::T_LONG, Types::T_ULONG => true, + default => false, + }; } } diff --git a/Library/FunctionLike/ReturnType/TypeInterface.php b/Library/FunctionLike/ReturnType/TypeInterface.php index a4c849247b..d06fbce8c5 100644 --- a/Library/FunctionLike/ReturnType/TypeInterface.php +++ b/Library/FunctionLike/ReturnType/TypeInterface.php @@ -34,7 +34,7 @@ public function getType(); public function getDataType(); /** - * Gets casted return type. + * Gets cast return type. * * @return string|null */ diff --git a/Library/Logger/Formatter/CompilerFormatter.php b/Library/Logger/Formatter/CompilerFormatter.php index edb940f9bc..f8d5fe3374 100644 --- a/Library/Logger/Formatter/CompilerFormatter.php +++ b/Library/Logger/Formatter/CompilerFormatter.php @@ -119,7 +119,7 @@ private function replacePlaceholders(array $vars, $output) $placeholder = '%'.$var.'%'; $realValue = $this->stringify($val); - if (false === strpos($output, $placeholder)) { + if (!str_contains($output, $placeholder)) { continue; } @@ -148,7 +148,7 @@ private function replacePlaceholders(array $vars, $output) */ private function cleanExtraPlaceholders(string $output): string { - if (false !== strpos($output, '%')) { + if (str_contains($output, '%')) { $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); $output = preg_replace('/ %type%\n/', "\n", $output); $output = preg_replace('/on line %line%/', '', $output); diff --git a/Library/MethodCall.php b/Library/MethodCall.php index d840a8ffec..66ae65c099 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -37,10 +37,13 @@ class MethodCall extends Call /** * Compiles a method call. * - * @param Expression $expr + * @param Expression $expr * @param CompilationContext $compilationContext + * @return mixed|CompiledExpression + * @throws Exception + * @throws \ReflectionException */ - public function compile(Expression $expr, CompilationContext $compilationContext) + public function compile(Expression $expr, CompilationContext $compilationContext): mixed { $expression = $expr->getExpression(); diff --git a/Library/Parser/Manager.php b/Library/Parser/Manager.php index 8d746db18a..70cf7160cf 100644 --- a/Library/Parser/Manager.php +++ b/Library/Parser/Manager.php @@ -13,32 +13,14 @@ class Manager { - const MINIMUM_PARSER_VERSION = '1.5.0'; - const PARSER_HOME_PAGE = 'https://github.com/zephir-lang/php-zephir-parser'; + public const MINIMUM_PARSER_VERSION = '1.5.0'; + public const PARSER_HOME_PAGE = 'https://github.com/zephir-lang/php-zephir-parser'; - /** - * Zephir Parser. - * - * @var Parser - */ - protected $parser; - - /** - * Manager constructor. - * - * @param Parser $parser The Zephir Parser - */ - public function __construct(Parser $parser) + public function __construct(protected Parser $parser) { - $this->parser = $parser; } - /** - * Get Zephir Parser. - * - * @return Parser - */ - public function getParser() + public function getParser(): Parser { return $this->parser; } @@ -48,21 +30,13 @@ public function getParser() * * @return bool */ - public function isAvailable() + public function isAvailable(): bool { return $this->parser->isAvailable() && version_compare(self::MINIMUM_PARSER_VERSION, $this->parser->getVersion(), '<='); } - /** - * @return string|null - */ - public function getParserVersion() - { - return $this->parser->getVersion(); - } - - public function requirements() + public function requirements(): string { $template = <<passStatementBlock($block->getStatements()); } - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { @@ -55,7 +53,7 @@ public function passStatementBlock(array $statements) } } - public function hasBreak() + public function hasBreak(): bool { return $this->hasBreak; } diff --git a/Library/Passes/MutateGathererPass.php b/Library/Passes/MutateGathererPass.php index e7cdc4a212..7ac8c3af09 100644 --- a/Library/Passes/MutateGathererPass.php +++ b/Library/Passes/MutateGathererPass.php @@ -14,28 +14,26 @@ use Zephir\StatementsBlock; /** - * MutateGathererPass. - * * Counts variables mutated inside a specific statement block * Non-mutated variables can be promoted to use an inline cache */ class MutateGathererPass { - protected $variables = []; + protected array $variables = []; - protected $mutations = []; + protected array $mutations = []; /** * Do the compilation pass. * * @param StatementsBlock $block */ - public function pass(StatementsBlock $block) + public function pass(StatementsBlock $block): void { $this->passStatementBlock($block->getStatements()); } - public function declareVariables(array $statement) + public function declareVariables(array $statement): void { foreach ($statement['variables'] as $variable) { if (!isset($this->variables[$variable['variable']])) { @@ -51,7 +49,7 @@ public function declareVariables(array $statement) * * @return MutateGathererPass */ - public function increaseMutations($variable) + public function increaseMutations(string $variable): static { if (isset($this->mutations[$variable])) { ++$this->mutations[$variable]; @@ -62,28 +60,12 @@ public function increaseMutations($variable) return $this; } - /** - * Returns the number of assignment instructions that mutated a variable. - * - * @param string $variable - * - * @return int - */ - public function getNumberOfMutations($variable) - { - if (isset($this->mutations[$variable])) { - return $this->mutations[$variable]; - } - - return 0; - } - /** * Pass let statements. * * @param array $statement */ - public function passLetStatement(array $statement) + public function passLetStatement(array $statement): void { foreach ($statement['assignments'] as $assignment) { if (isset($assignment['expr'])) { @@ -98,7 +80,7 @@ public function passLetStatement(array $statement) * * @param array $expression */ - public function passCall(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -116,7 +98,7 @@ public function passCall(array $expression) * * @param array $expression */ - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { if ('variable' != $item['value']['type']) { @@ -130,7 +112,7 @@ public function passArray(array $expression) * * @param array $expression */ - public function passNew(array $expression) + public function passNew(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -146,7 +128,7 @@ public function passNew(array $expression) * * @param array $expression */ - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': @@ -197,6 +179,13 @@ public function passExpression(array $expression) break; case 'typeof': + case 'minus': + case 'list': + case 'array-access': + case 'static-property-access': + case 'property-string-access': + case 'property-dynamic-access': + case 'property-access': case 'not': $this->passExpression($expression['left']); break; @@ -215,14 +204,6 @@ public function passExpression(array $expression) $this->passNew($expression); break; - case 'property-access': - case 'property-dynamic-access': - case 'property-string-access': - case 'static-property-access': - case 'array-access': - $this->passExpression($expression['left']); - break; - case 'isset': case 'empty': case 'instanceof': @@ -241,14 +222,6 @@ public function passExpression(array $expression) $this->passExpression($expression['right']); break; - case 'minus': - $this->passExpression($expression['left']); - break; - - case 'list': - $this->passExpression($expression['left']); - break; - case 'cast': case 'type-hint': $this->passExpression($expression['right']); @@ -265,7 +238,7 @@ public function passExpression(array $expression) * * @param array $statements */ - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { @@ -341,6 +314,7 @@ public function passStatementBlock(array $statements) } break; + case 'throw': case 'return': if (isset($statement['expr'])) { $this->passExpression($statement['expr']); @@ -369,12 +343,6 @@ public function passStatementBlock(array $statements) } break; - case 'throw': - if (isset($statement['expr'])) { - $this->passExpression($statement['expr']); - } - break; - case 'fetch': $this->passExpression($statement['expr']); break; diff --git a/Library/Passes/SkipVariantInit.php b/Library/Passes/SkipVariantInit.php index e6ad7beb83..2843a5a5c0 100644 --- a/Library/Passes/SkipVariantInit.php +++ b/Library/Passes/SkipVariantInit.php @@ -13,27 +13,25 @@ use Zephir\StatementsBlock; +use function count; + /** - * SkipVariantInit. - * * In 'if'/'else' statements sometimes dynamical variables are initialized in every branch * Same case in 'switch' statements */ class SkipVariantInit { - protected $branches = []; - - protected $variablesToSkip = []; + protected array $branches = []; - protected $ignoredVariables; + protected array $variablesToSkip = []; /** * Do the compilation pass. * - * @param int $branchNumber + * @param int $branchNumber * @param StatementsBlock $block */ - public function pass($branchNumber, StatementsBlock $block) + public function pass(int $branchNumber, StatementsBlock $block): void { $this->passStatementBlock($branchNumber, $block->getStatements()); $this->branches[$branchNumber] = 0; @@ -42,10 +40,10 @@ public function pass($branchNumber, StatementsBlock $block) /** * Check assignment types for possible skip. * - * @param int $branchNumber + * @param int $branchNumber * @param array $statement */ - public function passLetStatement($branchNumber, $statement) + public function passLetStatement(int $branchNumber, array $statement): void { foreach ($statement['assignments'] as $assignment) { if ('variable' == $assignment['assign-type']) { @@ -68,17 +66,15 @@ public function passLetStatement($branchNumber, $statement) } } - public function passStatementBlock($branchNumber, array $statements) + public function passStatementBlock($branchNumber, array $statements): void { foreach ($statements as $statement) { if (!isset($statement['type'])) { continue; } - switch ($statement['type']) { - case 'let': - $this->passLetStatement($branchNumber, $statement); - break; + if ($statement['type'] === 'let') { + $this->passLetStatement($branchNumber, $statement); } } } @@ -88,11 +84,11 @@ public function passStatementBlock($branchNumber, array $statements) * * @return array */ - public function getVariables() + public function getVariables(): array { $variableStats = []; - foreach ($this->variablesToSkip as $branchNumber => $variables) { + foreach ($this->variablesToSkip as $variables) { foreach ($variables as $variable => $one) { if (!isset($variableStats[$variable])) { $variableStats[$variable] = 1; @@ -103,7 +99,7 @@ public function getVariables() } $variables = []; - $numberBranches = \count($this->branches); + $numberBranches = count($this->branches); foreach ($variableStats as $variable => $number) { if ($number == $numberBranches) { $variables[] = $variable; @@ -114,10 +110,10 @@ public function getVariables() } /** - * @param int $branchNumber + * @param int $branchNumber * @param array $variablesToSkip */ - public function setVariablesToSkip($branchNumber, $variablesToSkip) + public function setVariablesToSkip(int $branchNumber, array $variablesToSkip): void { $this->variablesToSkip[$branchNumber] = $variablesToSkip; } diff --git a/Library/Statements/BreakStatement.php b/Library/Statements/BreakStatement.php index 5876df9cc0..f0e0e3bbde 100644 --- a/Library/Statements/BreakStatement.php +++ b/Library/Statements/BreakStatement.php @@ -14,11 +14,6 @@ use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -/** - * BreakStatement. - * - * Break statement - */ class BreakStatement extends StatementAbstract { /** @@ -26,7 +21,7 @@ class BreakStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { if ($compilationContext->insideCycle || $compilationContext->insideSwitch) { $compilationContext->codePrinter->output('break;'); diff --git a/Library/Statements/ContinueStatement.php b/Library/Statements/ContinueStatement.php index dcccf2d09b..1313f57ecb 100644 --- a/Library/Statements/ContinueStatement.php +++ b/Library/Statements/ContinueStatement.php @@ -14,11 +14,6 @@ use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -/** - * ContinueStatement. - * - * Continue statement - */ class ContinueStatement extends StatementAbstract { /** @@ -26,7 +21,7 @@ class ContinueStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { if ($compilationContext->insideCycle) { $compilationContext->codePrinter->output('continue;'); diff --git a/Library/Statements/DeclareStatement.php b/Library/Statements/DeclareStatement.php index 6095d2ca86..61aabe1c58 100644 --- a/Library/Statements/DeclareStatement.php +++ b/Library/Statements/DeclareStatement.php @@ -16,8 +16,6 @@ use Zephir\Expression\Builder\BuilderFactory; /** - * DeclareStatement. - * * This creates variables in the current symbol table */ class DeclareStatement extends StatementAbstract @@ -27,7 +25,7 @@ class DeclareStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $statement = $this->statement; @@ -46,11 +44,11 @@ public function compile(CompilationContext $compilationContext) $currentType = $statement['data-type']; - /* + /** * Replace original data type by the pre-processed infered type */ if ($typeInference) { - if ('variable' == $currentType) { + if ('variable' === $currentType) { $type = $typeInference->getInferedType($varName); if (\is_string($type)) { $currentType = $type; @@ -76,19 +74,16 @@ public function compile(CompilationContext $compilationContext) $symbolVariable = $symbolTable->addVariable($currentType, $varName, $compilationContext); $varName = $symbolVariable->getName(); - /* + /** * Set the node where the variable is declared */ $symbolVariable->setOriginal($variable); - $symbolVariable->setIsInitialized(true, $compilationContext); - //$symbolVariable->increaseMutates(); - if ('variable' == $currentType) { + if ('variable' === $currentType) { $symbolVariable->setMustInitNull(true); $symbolVariable->setLocalOnly(false); } - //$symbolVariable->increaseVariantIfNull(); if (isset($variable['expr'])) { $builder = BuilderFactory::getInstance(); @@ -104,18 +99,4 @@ public function compile(CompilationContext $compilationContext) } } } - - /** - * throw exception for invalid default type. - * - * @param $defaultType - * @param $dateType - * @param $variable - * - * @throws CompilerException - */ - public static function invalidDefaultTypeException($defaultType, $dateType, $variable) - { - throw new CompilerException('Invalid default type: '.$defaultType.' for data type: '.$dateType, $variable); - } } diff --git a/Library/Statements/DoWhileStatement.php b/Library/Statements/DoWhileStatement.php index 1654a64be1..bf33f534d4 100644 --- a/Library/Statements/DoWhileStatement.php +++ b/Library/Statements/DoWhileStatement.php @@ -11,33 +11,35 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; /** - * DoWhileStatement. - * * DoWhile statement, the same as in PHP/C */ class DoWhileStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $exprRaw = $this->statement['expr']; $codePrinter = $compilationContext->codePrinter; $codePrinter->output('do {'); - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; - /* + /** * Compile statements in the 'while' block */ if (isset($this->statement['statements'])) { @@ -46,16 +48,15 @@ public function compile(CompilationContext $compilationContext) } $compilationContext->codePrinter->increaseLevel(); - $expr = new EvalExpression(); - $condition = $expr->optimize($exprRaw, $compilationContext); + $condition = (new EvalExpression())->optimize($exprRaw, $compilationContext); $compilationContext->codePrinter->decreaseLevel(); - /* + /** * Restore the cycle counter */ --$compilationContext->insideCycle; - /* + /** * Compound conditions can be evaluated in a single line of the C-code */ $codePrinter->output('} while ('.$condition.');'); diff --git a/Library/Statements/EchoStatement.php b/Library/Statements/EchoStatement.php index 216efe6032..87f442fb8c 100644 --- a/Library/Statements/EchoStatement.php +++ b/Library/Statements/EchoStatement.php @@ -11,15 +11,15 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use function Zephir\add_slashes; /** - * EchoStatement. - * * Produce output according to the type */ class EchoStatement extends StatementAbstract @@ -27,9 +27,10 @@ class EchoStatement extends StatementAbstract /** * @param CompilationContext $compilationContext * - * @throws CompilerException + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { foreach ($this->statement['expressions'] as $echoExpr) { $expr = new Expression($echoExpr); diff --git a/Library/Statements/ForStatement.php b/Library/Statements/ForStatement.php index f528947fbb..ecd1ab2bf2 100644 --- a/Library/Statements/ForStatement.php +++ b/Library/Statements/ForStatement.php @@ -11,8 +11,10 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; use Zephir\Detectors\ForValueUseDetector; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; @@ -23,22 +25,19 @@ use function Zephir\add_slashes; -/** - * ForStatement. - * - * For statement - */ class ForStatement extends StatementAbstract { /** * Compiles a for statement that use a 'range' as expression. * - * @param array $exprRaw + * @param array $exprRaw * @param CompilationContext $compilationContext * * @return bool + * @throws ReflectionException + * @throws Exception */ - public function compileRange($exprRaw, CompilationContext $compilationContext) + public function compileRange(array $exprRaw, CompilationContext $compilationContext): bool { if (!\count($exprRaw['parameters'])) { return false; @@ -70,7 +69,7 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $codePrinter = $compilationContext->codePrinter; $exprBuilder = BuilderFactory::getInstance(); - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { @@ -93,7 +92,7 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $tempVariable = $compilationContext->symbolTable->addTemp($rangeVariable->getType(), $compilationContext); } - /* + /** * Create a copy of the current value in the end of the range to avoid modify the range * inside the cycle */ @@ -122,7 +121,7 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $statement->compile($compilationContext); if ($this->statement['reverse']) { - /* + /** * Create an implicit 'let' operation for the initialize expression */ $builderLet->setAssignments([$exprBuilder->operators() @@ -136,7 +135,7 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) ]); $statement = new LetStatement($builderLet->build()); } else { - /* + /** * Create an implicit 'let' operation for the initialize expression */ $builderLet->setAssignments([$exprBuilder->operators() @@ -153,7 +152,7 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $statement->compile($compilationContext); - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { @@ -181,7 +180,7 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $codePrinter->output('if ('.$condition.') {'); $codePrinter->increaseLevel(); - /* + /** * Inside a cycle */ ++$compilationContext->insideCycle; @@ -286,11 +285,11 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $codePrinter->output("\t".$flagVariable->getName().' = 1;'); $codePrinter->output('}'); - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { - /* + /** * Check for anonymous variables */ if ('_' != $this->statement['key']) { @@ -326,11 +325,11 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $statement->compile($compilationContext); } - /* + /** * Initialize 'value' variable */ if (isset($this->statement['value'])) { - /* + /** * Check for anonymous variables */ if ('_' != $this->statement['value']) { @@ -368,7 +367,7 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $codePrinter->decreaseLevel(); - /* + /** * Compile statements in the 'for' block */ if (isset($this->statement['statements'])) { @@ -381,32 +380,30 @@ public function compileRange($exprRaw, CompilationContext $compilationContext) $st->compile($compilationContext); } - /* + /** * Restore the cycle counter */ --$compilationContext->insideCycle; $codePrinter->output('}'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); } /** * Compiles a 'for' statement that use an 'iterator' as expression. * - * @param array $exprRaw + * @param array $exprRaw * @param CompilationContext $compilationContext * * @return bool + * @throws Exception + * @throws ReflectionException */ - public function compileIterator(array $exprRaw, CompilationContext $compilationContext) + public function compileIterator(array $exprRaw, CompilationContext $compilationContext): bool { $iteratorVariable = $compilationContext->symbolTable->getTempVariableForWrite('zend_object_iterator', $compilationContext); - $compilationContext->headersManager->add('kernel/iterator'); - $codePrinter = $compilationContext->codePrinter; /** @@ -426,7 +423,7 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC break; } - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { @@ -448,7 +445,7 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC $keyVariable->setDynamicTypes('undefined'); } - /* + /** * Initialize 'value' variable */ if (isset($this->statement['value'])) { @@ -470,7 +467,7 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC $variable->setDynamicTypes('undefined'); } - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; @@ -496,7 +493,7 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC $codePrinter->decreaseLevel(); } - /* + /** * Compile statements in the 'for' block */ if (isset($this->statement['statements'])) { @@ -509,7 +506,7 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC $st->compile($compilationContext); } - /* + /** * Restore the cycle counter */ --$compilationContext->insideCycle; @@ -525,9 +522,11 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC * - Every key must be an integer or compatible * - Every value must be a char/integer or compatible. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext - * @param Variable $exprVariable + * @param Variable $exprVariable + * @throws Exception + * @throws ReflectionException */ public function compileStringTraverse($expression, CompilationContext $compilationContext, $exprVariable) { @@ -692,13 +691,11 @@ public function compileHashTraverse($expression, CompilationContext $compilation $variable->setDynamicTypes('undefined'); } - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; -// $compilationContext->headersManager->add('kernel/hash'); - $duplicateHash = '0'; $duplicateKey = true; @@ -717,7 +714,7 @@ public function compileHashTraverse($expression, CompilationContext $compilation $duplicateHash = '1'; } - /* + /** * Detect if the key is modified or passed to an external scope */ if (isset($this->statement['key'])) { @@ -741,7 +738,7 @@ public function compileHashTraverse($expression, CompilationContext $compilation $compilationContext ); - /* + /** * Restore the cycle counter */ --$compilationContext->insideCycle; @@ -750,7 +747,8 @@ public function compileHashTraverse($expression, CompilationContext $compilation /** * @param CompilationContext $compilationContext * - * @throws CompilerException + * @throws Exception + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext) { diff --git a/Library/Statements/LoopStatement.php b/Library/Statements/LoopStatement.php index 525182745c..67dfda1526 100644 --- a/Library/Statements/LoopStatement.php +++ b/Library/Statements/LoopStatement.php @@ -13,13 +13,12 @@ use Zephir\Branch; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Passes\LoopBreakPass; use Zephir\StatementsBlock; /** - * LoopStatement. - * * Loop statement, infinite loop */ class LoopStatement extends StatementAbstract @@ -27,18 +26,19 @@ class LoopStatement extends StatementAbstract /** * @param CompilationContext $compilationContext * - * @throws CompilerException + * @throws \ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $compilationContext->codePrinter->output('while (1) {'); - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; - /* + /** * Compile statements in the 'loop' block */ if (!isset($this->statement['statements'])) { diff --git a/Library/StatementsBlock.php b/Library/StatementsBlock.php index 5067263589..9722a40601 100644 --- a/Library/StatementsBlock.php +++ b/Library/StatementsBlock.php @@ -38,8 +38,6 @@ */ class StatementsBlock { - protected $statements; - protected ?bool $unreachable = null; protected $debug = false; @@ -53,15 +51,8 @@ class StatementsBlock */ protected $lastStatement; - /** - * StatementsBlock constructor. - * - * @param array $statements - */ - public function __construct(array $statements) + public function __construct(protected $statements) { - $this->statements = $statements; - $debug = false; if (getenv('ZEPHIR_DEBUG')) { // Do not use this feature for typical use case. @@ -80,13 +71,13 @@ public function __construct(array $statements) } /** - * Sets whether the statements blocks belongs to a loop. + * Sets whether the statements block belongs to a loop. * * @param bool $loop * * @return StatementsBlock */ - public function isLoop($loop) + public function isLoop(bool $loop): static { $this->loop = $loop; diff --git a/Library/StringsManager.php b/Library/StringsManager.php index f94a7bbd2f..2e007e3965 100644 --- a/Library/StringsManager.php +++ b/Library/StringsManager.php @@ -34,7 +34,7 @@ abstract class StringsManager * * @param string $key */ - public function addConcatKey(string $key) + public function addConcatKey(string $key): void { $this->concatKeys[$key] = true; } @@ -45,14 +45,4 @@ public function addConcatKey(string $key) * @return void */ abstract public function genConcatCode(): void; - - /** - * Obtains the existing concatenation keys. - * - * @return array - */ - public function getConcatKeys(): array - { - return $this->concatKeys; - } } diff --git a/Library/Variable.php b/Library/Variable.php index 95ce6e1c37..2e2227c8fc 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -148,7 +148,7 @@ class Variable implements TypeAwareInterface * * @var array */ - protected $complexTypes = [ + protected array $complexTypes = [ 'variable' => 1, 'string' => 1, 'array' => 1, From 3cfc8519cd3ac19a1ff791150727b20696d7f4cc Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 29 Aug 2023 11:37:44 +0100 Subject: [PATCH 016/375] #2407 - Simplify condition --- tests/Extension/ExitDieTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Extension/ExitDieTest.php b/tests/Extension/ExitDieTest.php index c704df77fc..fb5896289f 100644 --- a/tests/Extension/ExitDieTest.php +++ b/tests/Extension/ExitDieTest.php @@ -107,7 +107,7 @@ private function prepareOutput(array $output): string return '(empty output)'; } - if (isset($output[0]) && !empty($output[0])) { + if (!empty($output[0])) { return $output[0]; } From fec8f761588721199e3aebc9659fd8cb23e17ad3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 11:05:37 +0100 Subject: [PATCH 017/375] #2407 - Simplify declaration --- Library/Backends/BackendFactory.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Library/Backends/BackendFactory.php b/Library/Backends/BackendFactory.php index 837481a1bb..12c4b01518 100644 --- a/Library/Backends/BackendFactory.php +++ b/Library/Backends/BackendFactory.php @@ -51,8 +51,7 @@ public function createBackend() */ private function resolveBackendClass(): string { - $parser = new ArgvInput(); - $backend = $parser->getParameterOption('--backend', null); + $backend = (new ArgvInput())->getParameterOption('--backend', null); if (null === $backend) { // Do not use this feature for typical use case. From 25ce077e2092666d9b5225295306bb31bda3a292 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 11:06:21 +0100 Subject: [PATCH 018/375] #2407 - Adjust definition --- Library/ClassProperty.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Library/ClassProperty.php b/Library/ClassProperty.php index 039641043d..84f7c87dbe 100644 --- a/Library/ClassProperty.php +++ b/Library/ClassProperty.php @@ -30,8 +30,8 @@ public function __construct( protected array $visibility, protected string $name, protected ?array $defaultValue, - protected string $docBlock, - protected array $original, + protected ?string $docBlock = null, + protected ?array $original = null, ) { $this->checkVisibility($visibility, $name, $original); @@ -96,13 +96,11 @@ public function getOriginal(): mixed /** * Checks for visibility congruence. * - * @param array $visibility + * @param array $visibility * @param string $name - * @param array $original - * - * @throws CompilerException + * @param array|null $original */ - public function checkVisibility($visibility, $name, $original): void + public function checkVisibility(array $visibility, string $name, ?array $original = null): void { if (in_array('public', $visibility) && in_array('protected', $visibility)) { throw new CompilerException("Property '$name' cannot be 'public' and 'protected' at the same time", $original); @@ -122,7 +120,7 @@ public function checkVisibility($visibility, $name, $original): void * * @return string */ - public function getVisibilityAccessor() + public function getVisibilityAccessor(): string { $modifiers = []; @@ -155,9 +153,9 @@ public function getVisibilityAccessor() /** * Returns the docblock related to the property. * - * @return string + * @return string|null */ - public function getDocBlock(): string + public function getDocBlock(): ?string { return $this->docBlock; } @@ -422,10 +420,10 @@ private function initializeArray(): void $parentClassDefinition = $classDefinition->getExtendsClassDefinition(); if (!$this->isStatic()) { - $constructParentMethod = $parentClassDefinition ? $parentClassDefinition->getInitMethod() : null; + $constructParentMethod = $parentClassDefinition?->getInitMethod(); $constructMethod = $classDefinition->getInitMethod(); } else { - $constructParentMethod = $parentClassDefinition ? $parentClassDefinition->getStaticInitMethod() : null; + $constructParentMethod = $parentClassDefinition?->getStaticInitMethod(); $constructMethod = $classDefinition->getStaticInitMethod(); } From 6af9e8a2e27997476c5ce39219f8d7301df6908f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 11:07:22 +0100 Subject: [PATCH 019/375] #2407 - Remove dead code --- Library/Statements/ForStatement.php | 10 ++++------ tests/fixtures/exit.php | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Library/Statements/ForStatement.php b/Library/Statements/ForStatement.php index ecd1ab2bf2..e2639a38eb 100644 --- a/Library/Statements/ForStatement.php +++ b/Library/Statements/ForStatement.php @@ -388,6 +388,8 @@ public function compileRange(array $exprRaw, CompilationContext $compilationCont $codePrinter->output('}'); $codePrinter->decreaseLevel(); $codePrinter->output('}'); + + return true; } /** @@ -396,11 +398,11 @@ public function compileRange(array $exprRaw, CompilationContext $compilationCont * @param array $exprRaw * @param CompilationContext $compilationContext * - * @return bool + * @return void * @throws Exception * @throws ReflectionException */ - public function compileIterator(array $exprRaw, CompilationContext $compilationContext): bool + public function compileIterator(array $exprRaw, CompilationContext $compilationContext): void { $iteratorVariable = $compilationContext->symbolTable->getTempVariableForWrite('zend_object_iterator', $compilationContext); $compilationContext->headersManager->add('kernel/iterator'); @@ -418,10 +420,6 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC } $exprVariable = $compilationContext->symbolTable->getVariableForRead($expression->getCode(), $compilationContext, $this->statement['expr']); - switch ($exprVariable->getType()) { - case 'variable': - break; - } /** * Initialize 'key' variable diff --git a/tests/fixtures/exit.php b/tests/fixtures/exit.php index 22bec8f9e5..58fd7d9493 100644 --- a/tests/fixtures/exit.php +++ b/tests/fixtures/exit.php @@ -8,6 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + use Stub\ExitDie; if (!extension_loaded('stub')) { From 03a167619d3042f84feb51267797c7edbed1c90c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 11:07:41 +0100 Subject: [PATCH 020/375] #2407 - Revert removed `getNumberOfMutations()` method --- Library/Passes/MutateGathererPass.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Passes/MutateGathererPass.php b/Library/Passes/MutateGathererPass.php index 7ac8c3af09..587f01e9c7 100644 --- a/Library/Passes/MutateGathererPass.php +++ b/Library/Passes/MutateGathererPass.php @@ -233,6 +233,18 @@ public function passExpression(array $expression): void } } + /** + * Returns the number of assignment instructions that mutated a variable. + * + * @param string $variable + * + * @return int + */ + public function getNumberOfMutations(string $variable): int + { + return $this->mutations[$variable] ?? 0; + } + /** * Pass statement block. * From ed4ed64dfe8fc702521be91fab9ea387c0b6d643 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 11:45:35 +0100 Subject: [PATCH 021/375] #2407 - Remove all usages of `isZE3()` method --- Library/Backends/ZendEngine2/Backend.php | 22 +++---------------- Library/Backends/ZendEngine3/Backend.php | 10 --------- Library/BaseBackend.php | 7 ------ Library/Cache/StaticMethodCache.php | 20 +++-------------- Library/ClassDefinition.php | 12 ++++------ Library/ClassMethod.php | 18 +++++---------- Library/Compiler.php | 8 +++---- Library/FunctionCall.php | 3 +-- .../Operators/Other/InstanceOfOperator.php | 2 +- Library/Statements/TryCatchStatement.php | 6 +---- 10 files changed, 22 insertions(+), 86 deletions(-) diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php index e317542532..57f83a765e 100644 --- a/Library/Backends/ZendEngine2/Backend.php +++ b/Library/Backends/ZendEngine2/Backend.php @@ -31,16 +31,6 @@ class Backend extends BaseBackend { protected $name = 'ZendEngine2'; - /** - * {@inheritdoc} - * - * @return bool - */ - public function isZE3() - { - return false; - } - /** * {@inheritdoc} * @@ -963,12 +953,8 @@ public function checkStrictType($type, $var, CompilationContext $context) $conditions[] = $cond.'IS_LONG'; break; case 'bool': - if (!$this->isZE3()) { - $conditions[] = $cond.'IS_BOOL'; - } else { - $conditions[] = $cond.'IS_TRUE'; - $conditions[] = $cond.'IS_FALSE'; - } + $conditions[] = $cond.'IS_TRUE'; + $conditions[] = $cond.'IS_FALSE'; break; case 'double': $conditions[] = $cond.'IS_DOUBLE'; @@ -1031,9 +1017,7 @@ public function checkStrictType($type, $var, CompilationContext $context) $codePrinter->output('if (EXPECTED(Z_TYPE_P('.$parameterCode.') == IS_STRING)) {'); $codePrinter->increaseLevel(); $targetVar = $var['name']; - if ($this->isZE3()) { - $targetVar = '&'.$targetVar; - } + $targetVar = '&'.$targetVar; $codePrinter->output('zephir_get_strval('.$targetVar.', '.$var['name'].'_param);'); $codePrinter->decreaseLevel(); $codePrinter->output('} else {'); diff --git a/Library/Backends/ZendEngine3/Backend.php b/Library/Backends/ZendEngine3/Backend.php index 61c53b8cea..6775f05fdc 100644 --- a/Library/Backends/ZendEngine3/Backend.php +++ b/Library/Backends/ZendEngine3/Backend.php @@ -31,16 +31,6 @@ class Backend extends BackendZendEngine2 { protected $name = 'ZendEngine3'; - /** - * {@inheritdoc} - * - * @return bool - */ - public function isZE3() - { - return true; - } - /** * {@inheritdoc} * diff --git a/Library/BaseBackend.php b/Library/BaseBackend.php index cebe1eba59..9a45e42db7 100644 --- a/Library/BaseBackend.php +++ b/Library/BaseBackend.php @@ -49,13 +49,6 @@ public function __construct(Config $config, $kernelsPath, $templatesPath) $this->templatesPath = $templatesPath; } - /** - * TODO: This should not be used, temporary (until its completely refactored). - * - * @return bool - */ - abstract public function isZE3(); - public function getName() { return $this->name; diff --git a/Library/Cache/StaticMethodCache.php b/Library/Cache/StaticMethodCache.php index 6b88dc831a..bedc9de9fc 100644 --- a/Library/Cache/StaticMethodCache.php +++ b/Library/Cache/StaticMethodCache.php @@ -66,27 +66,13 @@ public function get(CompilationContext $compilationContext, $method, bool $allow } } - $mustBeCached = false; - if (!$compilationContext->insideCycle) { - if (!($method instanceof ReflectionMethod)) { - $classDefinition = $method->getClassDefinition(); - if (!$classDefinition->isBundled() && $allowNtsCache) { - $mustBeCached = !$compilationContext->backend->isZE3(); - } else { - if (!$method->isPrivate() && !$method->isFinal()) { - return 'NULL, 0'; - } - } - } else { - if (!$method->isPrivate() && !$method->isFinal()) { - return 'NULL, 0'; - } - } + if (!$compilationContext->insideCycle && !$method->isPrivate() && !$method->isFinal()) { + return 'NULL, 0'; } $functionCache = $compilationContext->symbolTable->getTempVariableForWrite('zephir_fcall_cache_entry', $compilationContext); - if ($method->isPrivate() || $method->isFinal() || $mustBeCached) { + if ($method->isPrivate() || $method->isFinal()) { $cacheSlot = SlotsCache::getMethodSlot($method); } else { $cacheSlot = '0'; diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 4107d21c04..09521adbdf 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -1296,8 +1296,8 @@ public function compile(CompilationContext $compilationContext): void $compilationContext ); - $argInfo->setBooleanDefinition($this->compiler->backend->isZE3() ? '_IS_BOOL' : 'IS_BOOL'); - $argInfo->setRichFormat($this->compiler->backend->isZE3()); + $argInfo->setBooleanDefinition('_IS_BOOL'); + $argInfo->setRichFormat(true); $argInfo->render(); } @@ -1314,9 +1314,7 @@ public function compile(CompilationContext $compilationContext): void foreach ($methods as $method) { if (self::TYPE_CLASS === $this->getType()) { if (!$method->isInternal()) { - $richFormat = $this->compiler->backend->isZE3() && - $method->isReturnTypesHintDetermined() && - $method->areReturnTypesCompatible(); + $richFormat = $method->isReturnTypesHintDetermined() && $method->areReturnTypesCompatible(); if ($richFormat || $method->hasParameters()) { $codePrinter->output( @@ -1358,9 +1356,7 @@ public function compile(CompilationContext $compilationContext): void } } } else { - $richFormat = $this->compiler->backend->isZE3() && - $method->isReturnTypesHintDetermined() && - $method->areReturnTypesCompatible(); + $richFormat = $method->isReturnTypesHintDetermined() && $method->areReturnTypesCompatible(); if ($method->isStatic()) { if ($richFormat || $method->hasParameters()) { diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 6f55470ff9..4852563186 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -1690,19 +1690,15 @@ public function compile(CompilationContext $compilationContext): void case 'mixed': $symbol = $symbolTable->addVariable($parameter['data-type'], $parameter['name'], $compilationContext); /* TODO: Move this to the respective backend, which requires refactoring how this works */ - if ($compilationContext->backend->isZE3()) { - $symbol->setIsDoublePointer(true); - $substituteVars[$parameter['name']] = $symbolTable->addVariable('variable', $parameter['name'].'_sub', $compilationContext); - } + $symbol->setIsDoublePointer(true); + $substituteVars[$parameter['name']] = $symbolTable->addVariable('variable', $parameter['name'].'_sub', $compilationContext); break; default: $symbol = $symbolTable->addVariable($parameter['data-type'], $parameter['name'], $compilationContext); $symbolParam = $symbolTable->addVariable('variable', $parameter['name'].'_param', $compilationContext); /* TODO: Move this to the respective backend, which requires refactoring how this works */ - if ($compilationContext->backend->isZE3()) { - $symbolParam->setIsDoublePointer(true); - } + $symbolParam->setIsDoublePointer(true); if ('string' == $parameter['data-type'] || 'array' == $parameter['data-type']) { $symbol->setMustInitNull(true); @@ -1928,11 +1924,9 @@ public function compile(CompilationContext $compilationContext): void $targetVar = $compilationContext->symbolTable->getVariableForWrite($name, $compilationContext); $initCode .= "\t".$compilationContext->backend->ifVariableValueUndefined($targetVar, $compilationContext, false, false).PHP_EOL; - if ($compilationContext->backend->isZE3()) { - if ($targetVar->isDoublePointer() && isset($substituteVars[$parameter['name']])) { - $substituteVar = $substituteVars[$parameter['name']]; - $initCode .= "\t\t".$targetVar->getName().' = &'.$substituteVar->getName().';'.PHP_EOL; - } + if ($targetVar->isDoublePointer() && isset($substituteVars[$parameter['name']])) { + $substituteVar = $substituteVars[$parameter['name']]; + $initCode .= "\t\t".$targetVar->getName().' = &'.$substituteVar->getName().';'.PHP_EOL; } $initCode .= $this->assignDefaultValue($parameter, $compilationContext); diff --git a/Library/Compiler.php b/Library/Compiler.php index 5c8a23b1cc..1c4f125138 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -1884,17 +1884,15 @@ public function generateFunctionInformation(): array $headerPrinter->output('PHP_FUNCTION('.$funcName.');'); - $argInfo->setBooleanDefinition($this->backend->isZE3() ? '_IS_BOOL' : 'IS_BOOL'); - $argInfo->setRichFormat($this->backend->isZE3()); + $argInfo->setBooleanDefinition('_IS_BOOL'); + $argInfo->setRichFormat(true); $argInfo->render(); /** Generate FE's */ $paramData = 'NULL'; - $richFormat = $this->backend->isZE3() && - $func->isReturnTypesHintDetermined() && - $func->areReturnTypesCompatible(); + $richFormat = $func->isReturnTypesHintDetermined() && $func->areReturnTypesCompatible(); if ($richFormat || $func->hasParameters()) { $paramData = $argInfoName; diff --git a/Library/FunctionCall.php b/Library/FunctionCall.php index 5bd9eee123..61f418f23f 100644 --- a/Library/FunctionCall.php +++ b/Library/FunctionCall.php @@ -269,12 +269,11 @@ protected function markReferences( if ($numberParameters > 0) { $n = 1; $funcParameters = $reflector->getParameters(); - $isZendEngine3 = $compilationContext->backend->isZE3(); foreach ($funcParameters as $parameter) { if ($numberParameters >= $n) { if ($parameter->isPassedByReference()) { /* TODO hack, fix this better */ - if ($isZendEngine3 && '&' == $parameters[$n - 1][0]) { + if ('&' === $parameters[$n - 1][0]) { $parameters[$n - 1] = substr($parameters[$n - 1], 1); } diff --git a/Library/Operators/Other/InstanceOfOperator.php b/Library/Operators/Other/InstanceOfOperator.php index 1a7bc683e0..c124e1357e 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/Library/Operators/Other/InstanceOfOperator.php @@ -131,7 +131,7 @@ private function prepareBackendSpecificCode($variable, CompilationContext $conte { return strtr('Z_STRVAL_P(:p:name), Z_STRLEN_P(:p:name)', [ ':name' => $variable, - ':p' => $context->backend->isZE3() ? '&' : '', + ':p' => '&', ]); } } diff --git a/Library/Statements/TryCatchStatement.php b/Library/Statements/TryCatchStatement.php index 5625d05086..c2f5cf4f87 100644 --- a/Library/Statements/TryCatchStatement.php +++ b/Library/Statements/TryCatchStatement.php @@ -76,11 +76,7 @@ public function compile(CompilationContext $compilationContext) $variable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $compilationContext); } - if ($compilationContext->backend->isZE3()) { - $assignExceptionVarStmt = $exprBuilder->statements()->rawC('ZEPHIR_CPY_WRT(&'.$variable->getName().', &'.$exc_var->getName().');'); - } else { - $assignExceptionVarStmt = $exprBuilder->statements()->rawC('ZEPHIR_CPY_WRT('.$variable->getName().', '.$exc_var->getName().');'); - } + $assignExceptionVarStmt = $exprBuilder->statements()->rawC('ZEPHIR_CPY_WRT(&'.$variable->getName().', &'.$exc_var->getName().');'); /* * TODO:, use a builder here From e51d4043c51606bb39667a163b8bd62022ee9e79 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 13:49:50 +0100 Subject: [PATCH 022/375] #2407 - Merge Zend Engine Backends with it's kernels --- .php-cs-fixer.dist.php | 2 +- .../ZendEngine3 => Backend}/Backend.php | 717 +++++++++- .../ZendEngine3 => Backend}/FcallManager.php | 2 +- .../StringsManager.php | 5 +- .../VariablesManager.php | 25 +- Library/Backends/BackendFactory.php | 78 -- Library/Backends/ZendEngine2/Backend.php | 1196 ----------------- Library/BaseBackend.php | 345 ----- Library/CompilationContext.php | 5 +- Library/Compiler.php | 14 +- Library/Console/Command/ApiCommand.php | 7 - Library/Console/Command/BuildCommand.php | 14 +- Library/Console/Command/CompileCommand.php | 12 +- Library/Console/Command/GenerateCommand.php | 17 - Library/Console/Command/InitCommand.php | 25 +- Library/Console/Command/StubsCommand.php | 13 +- .../FunctionCall/StripcslashesOptimizer.php | 6 +- .../FunctionCall/StripslashesOptimizer.php | 6 +- {kernels/ZendEngine3 => kernel}/README.md | 0 {kernels/ZendEngine3 => kernel}/array.c | 0 {kernels/ZendEngine3 => kernel}/array.h | 0 {kernels/ZendEngine3 => kernel}/backtrace.c | 0 {kernels/ZendEngine3 => kernel}/backtrace.h | 0 {kernels/ZendEngine3 => kernel}/debug.c | 0 {kernels/ZendEngine3 => kernel}/debug.h | 0 {kernels/ZendEngine3 => kernel}/exception.c | 0 {kernels/ZendEngine3 => kernel}/exception.h | 0 {kernels/ZendEngine3 => kernel}/exit.c | 0 {kernels/ZendEngine3 => kernel}/exit.h | 0 {kernels/ZendEngine3 => kernel}/fcall.c | 0 {kernels/ZendEngine3 => kernel}/fcall.h | 0 {kernels/ZendEngine3 => kernel}/file.c | 0 {kernels/ZendEngine3 => kernel}/file.h | 0 {kernels/ZendEngine3 => kernel}/filter.c | 0 {kernels/ZendEngine3 => kernel}/filter.h | 0 {kernels/ZendEngine3 => kernel}/globals.h | 0 {kernels/ZendEngine3 => kernel}/iterator.c | 0 {kernels/ZendEngine3 => kernel}/iterator.h | 0 {kernels/ZendEngine3 => kernel}/main.c | 0 {kernels/ZendEngine3 => kernel}/main.h | 0 {kernels/ZendEngine3 => kernel}/math.c | 0 {kernels/ZendEngine3 => kernel}/math.h | 0 {kernels/ZendEngine3 => kernel}/memory.c | 0 {kernels/ZendEngine3 => kernel}/memory.h | 0 {kernels/ZendEngine3 => kernel}/object.c | 0 {kernels/ZendEngine3 => kernel}/object.h | 0 {kernels/ZendEngine3 => kernel}/operators.c | 0 {kernels/ZendEngine3 => kernel}/operators.h | 0 {kernels/ZendEngine3 => kernel}/require.c | 0 {kernels/ZendEngine3 => kernel}/require.h | 0 {kernels/ZendEngine3 => kernel}/string.c | 0 {kernels/ZendEngine3 => kernel}/string.h | 0 {kernels/ZendEngine3 => kernel}/time.c | 0 {kernels/ZendEngine3 => kernel}/time.h | 0 {kernels/ZendEngine3 => kernel}/variables.c | 0 {kernels/ZendEngine3 => kernel}/variables.h | 0 templates/{ZendEngine3 => engine}/clean | 0 templates/{ZendEngine3 => engine}/config.m4 | 0 templates/{ZendEngine3 => engine}/config.w32 | 0 templates/{ZendEngine3 => engine}/ext.h | 0 .../{ZendEngine3 => engine}/ext_config.h | 0 templates/{ZendEngine3 => engine}/install | 0 templates/{ZendEngine3 => engine}/php_ext.h | 0 .../{ZendEngine3 => engine}/php_project.h | 0 .../pkg-config-check.m4 | 0 .../{ZendEngine3 => engine}/pkg-config.m4 | 0 templates/{ZendEngine3 => engine}/project.c | 0 templates/{ZendEngine3 => engine}/project.h | 0 .../Backends/ZendEngine3/BackendTest.php | 2 +- .../CompilerFile/CheckDependenciesTest.php | 4 +- tests/sharness/t0002-generate.sh | 6 +- zephir | 5 +- 72 files changed, 714 insertions(+), 1792 deletions(-) rename Library/{Backends/ZendEngine3 => Backend}/Backend.php (59%) rename Library/{Backends/ZendEngine3 => Backend}/FcallManager.php (99%) rename Library/{Backends/ZendEngine3 => Backend}/StringsManager.php (98%) rename Library/{Backends/ZendEngine3 => Backend}/VariablesManager.php (89%) delete mode 100644 Library/Backends/BackendFactory.php delete mode 100644 Library/Backends/ZendEngine2/Backend.php delete mode 100644 Library/BaseBackend.php rename {kernels/ZendEngine3 => kernel}/README.md (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/array.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/array.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/backtrace.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/backtrace.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/debug.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/debug.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/exception.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/exception.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/exit.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/exit.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/fcall.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/fcall.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/file.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/file.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/filter.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/filter.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/globals.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/iterator.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/iterator.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/main.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/main.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/math.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/math.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/memory.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/memory.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/object.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/object.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/operators.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/operators.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/require.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/require.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/string.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/string.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/time.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/time.h (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/variables.c (100%) mode change 100755 => 100644 rename {kernels/ZendEngine3 => kernel}/variables.h (100%) mode change 100755 => 100644 rename templates/{ZendEngine3 => engine}/clean (100%) rename templates/{ZendEngine3 => engine}/config.m4 (100%) rename templates/{ZendEngine3 => engine}/config.w32 (100%) rename templates/{ZendEngine3 => engine}/ext.h (100%) rename templates/{ZendEngine3 => engine}/ext_config.h (100%) rename templates/{ZendEngine3 => engine}/install (100%) rename templates/{ZendEngine3 => engine}/php_ext.h (100%) rename templates/{ZendEngine3 => engine}/php_project.h (100%) rename templates/{ZendEngine3 => engine}/pkg-config-check.m4 (100%) rename templates/{ZendEngine3 => engine}/pkg-config.m4 (100%) rename templates/{ZendEngine3 => engine}/project.c (100%) rename templates/{ZendEngine3 => engine}/project.h (100%) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index d65f15480c..53e460990f 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -31,7 +31,7 @@ 'ext', 'ide', 'config/class-entries', - 'templates/ZendEngine3', + 'templates/engine', 'templates/Api', 'tests/ext-bootstrap', 'tests/fixtures', diff --git a/Library/Backends/ZendEngine3/Backend.php b/Library/Backend/Backend.php similarity index 59% rename from Library/Backends/ZendEngine3/Backend.php rename to Library/Backend/Backend.php index 6775f05fdc..45e2442e75 100644 --- a/Library/Backends/ZendEngine3/Backend.php +++ b/Library/Backend/Backend.php @@ -9,15 +9,16 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Backends\ZendEngine3; +namespace Zephir\Backend; -use Zephir\Backends\ZendEngine2\Backend as BackendZendEngine2; use Zephir\ClassDefinition; use Zephir\ClassMethod; use Zephir\CodePrinter; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Compiler; +use Zephir\Config; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Fcall\FcallManagerInterface; use Zephir\FunctionDefinition; @@ -27,24 +28,99 @@ use function Zephir\add_slashes; -class Backend extends BackendZendEngine2 +class Backend { - protected $name = 'ZendEngine3'; + protected FcallManagerInterface $fcallManager; /** - * {@inheritdoc} + * BaseBackend constructor. + * + * @param Config $config + * @param string $kernelsPath + * @param string $templatesPath + */ + public function __construct(protected Config $config, protected string $kernelsPath, protected string $templatesPath) + { + $this->fcallManager = new FcallManager(); + } + + /** + * Resolves the path to the source kernel files of the backend. * - * @return FcallManagerInterface + * @return string */ - public function getFcallManager() + public function getInternalKernelPath(): string { - if (!$this->fcallManager) { - $this->setFcallManager(new FcallManager()); + return $this->kernelsPath; + } + + /** + * Resolves the path to the source template file of the backend. + * + * @param string $filename + * + * @return string + */ + public function getTemplateFileContents(string $filename): string + { + $templatePath = rtrim((string) $this->config->get('templatepath', 'backend'), '\\/'); + if (empty($templatepath)) { + $templatePath = $this->templatesPath; } + return file_get_contents("$templatePath/engine/$filename"); + } + + public function getFcallManager(): FcallManagerInterface + { return $this->fcallManager; } + public function declareVariables($method, $typeToVariables, CompilationContext $compilationContext) + { + $varInitCode = []; + $additionalCode = $method ? $this->onPreInitVar($method, $compilationContext) : ''; + + foreach ($typeToVariables as $type => $variables) { + list($pointer, $code) = $this->getTypeDefinition($type); + $code .= ' '; + $groupVariables = []; + + /** + * @var Variable[] + */ + foreach ($variables as $variable) { + $nextCode = $this->generateInitCode($groupVariables, $type, $pointer, $variable); + if ($nextCode && $additionalCode) { + $additionalCode .= PHP_EOL.$nextCode; + } else { + $additionalCode .= $nextCode; + } + } + + $varInitCode[] = $code.implode(', ', $groupVariables).';'; + } + + /* Keep order consistent with previous zephir versions (BC-only) */ + $varInitCode = array_reverse($varInitCode); + if ($additionalCode) { + $varInitCode[] = $additionalCode; + } + + return $varInitCode; + } + + public function initVar(Variable $variable, CompilationContext $context, $useCodePrinter = true, $second = false): string + { + $macro = !$second ? 'ZEPHIR_INIT_VAR' : 'ZEPHIR_INIT_NVAR'; + $code = $macro.'('.$this->getVariableCode($variable).');'; + if ($useCodePrinter) { + $context->codePrinter->output($code); + } + + return $code; + } + /** * {@inheritdoc} */ @@ -82,14 +158,6 @@ public function getBoolCode(Variable $variable, CompilationContext $context, $us return $code; } - /** - * {@inheritdoc} - */ - public function getStringsManager() - { - return new StringsManager(); - } - /** * {@inheritdoc} */ @@ -277,17 +345,16 @@ public function onPreInitVar(ClassMethod $method, CompilationContext $context): public function onPreCompile(ClassMethod $method, CompilationContext $context) { - $codePrinter = $context->codePrinter; - /* + /** * Initialize the properties within create_object, handler code */ - if (preg_match('/^zephir_init_properties/', $method->getName())) { - $codePrinter->increaseLevel(); - $codePrinter->output('{'); - $codePrinter->increaseLevel(); - $codePrinter->output('zval local_this_ptr, *this_ptr = &local_this_ptr;'); - $codePrinter->output('ZEPHIR_CREATE_OBJECT(this_ptr, class_type);'); - $codePrinter->decreaseLevel(); + if (str_starts_with($method->getName(), 'zephir_init_properties')) { + $context->codePrinter->increaseLevel(); + $context->codePrinter->output('{'); + $context->codePrinter->increaseLevel(); + $context->codePrinter->output('zval local_this_ptr, *this_ptr = &local_this_ptr;'); + $context->codePrinter->output('ZEPHIR_CREATE_OBJECT(this_ptr, class_type);'); + $context->codePrinter->decreaseLevel(); } } @@ -567,6 +634,31 @@ public function returnString($value, CompilationContext $context, $useCodePrinte return $this->returnHelper('RETURN_MM_STRING', $value, $context, $useCodePrinter); } + public function assignLong(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) + { + return $this->assignHelper('ZVAL_LONG', $this->getVariableCode($variable), $value, $context, $useCodePrinter); + } + + public function assignDouble(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) + { + return $this->assignHelper('ZVAL_DOUBLE', $this->getVariableCode($variable), $value, $context, $useCodePrinter); + } + + public function assignBool(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) + { + return $this->assignHelper('ZVAL_BOOL', $this->getVariableCode($variable), $value, $context, $useCodePrinter); + } + + public function assignNull(Variable $variable, CompilationContext $context, $useCodePrinter = true) + { + $output = 'ZVAL_NULL('.$this->getVariableCode($variable).');'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + public function createClosure(Variable $variable, $classDefinition, CompilationContext $context) { $symbol = $this->getVariableCode($variable); @@ -672,7 +764,26 @@ public function arrayIsset(Variable $var, $resolvedExpr, $expression, Compilatio } } - return parent::arrayIsset($var, $resolvedExpr, $expression, $context); + return $this->arrayIsset2($var, $resolvedExpr, $expression, $context); + } + + public function arrayIsset2(Variable $var, $resolvedExpr, $expression, CompilationContext $context) + { + if (!($resolvedExpr instanceof Variable)) { + if ('string' == $resolvedExpr->getType()) { + return new CompiledExpression('bool', 'zephir_array_isset_string('.$this->getVariableCode($var).', SS("'.$resolvedExpr->getCode().'"))', $expression); + } else { + return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$resolvedExpr->getCode().')', $expression); + } + } + + if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { + return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); + } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType() || 'mixed' === $resolvedExpr->getType()) { + return new CompiledExpression('bool', 'zephir_array_isset('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); + } + + throw new CompilerException('['.$resolvedExpr->getType().']', $expression); } public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context) @@ -684,7 +795,30 @@ public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, } } - return parent::arrayIssetFetch($target, $var, $resolvedExpr, $flags, $expression, $context); + return $this->arrayIssetFetch2($target, $var, $resolvedExpr, $flags, $expression, $context); + } + + public function arrayIssetFetch2(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context) + { + $code = $this->getVariableCodePointer($target).', '.$this->getVariableCode($var); + + if (!($resolvedExpr instanceof Variable)) { + if ('string' === $resolvedExpr->getType()) { + return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); + } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { + return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression); + } else { + $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); + } + } + + if (in_array($resolvedExpr->getType(), ['int', 'long'])) { + return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); + } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { + return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); + } + + throw new CompilerException('arrayIssetFetch ['.$resolvedExpr->getType().']', $expression); } public function propertyIsset(Variable $var, $key, CompilationContext $context) @@ -702,7 +836,48 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo return; } - parent::arrayUnset($variable, $exprIndex, $flags, $context); + $this->arrayUnset2($variable, $exprIndex, $flags, $context); + } + + public function arrayUnset2(Variable $variable, $exprIndex, $flags, CompilationContext $context) + { + $context->headersManager->add('kernel/array'); + $variableCode = $this->getVariableCodePointer($variable); + switch ($exprIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $context->codePrinter->output('zephir_array_unset_long('.$variableCode.', '.$exprIndex->getCode().', '.$flags.');'); + break; + + case 'string': + $context->codePrinter->output('zephir_array_unset_string('.$variableCode.', SS("'.$exprIndex->getCode().'"), '.$flags.');'); + break; + + case 'variable': + $variableIndex = $context->symbolTable->getVariableForRead($exprIndex->getCode(), $context, $exprIndex->getOriginal()); + $indexCode = $this->getVariableCode($variableIndex); + switch ($variableIndex->getType()) { + case 'int': + case 'uint': + case 'long': + $context->codePrinter->output('zephir_array_unset_long('.$variableCode.', '.$indexCode.', '.$flags.');'); + break; + + case 'string': + case 'variable': + case 'mixed': + $context->codePrinter->output('zephir_array_unset('.$variableCode.', '.$indexCode.', '.$flags.');'); + break; + + default: + throw new CompilerException('Variable type: '.$variableIndex->getType().' cannot be used as array index without cast'); + } + break; + + default: + throw new CompilerException('Cannot use expression: '.$exprIndex->getType().' as array index without cast'); + } } public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true) @@ -781,13 +956,14 @@ public function fetchProperty( } /** - * @param Variable $symbolVariable + * @param Variable $symbolVariable * @param ClassDefinition $classDefinition * @param $property - * @param bool $readOnly + * @param bool $readOnly * @param CompilationContext $context + * @throws Exception */ - public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context) + public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context): void { // TODO: maybe optimizations as well as above $context->codePrinter->output( @@ -805,13 +981,12 @@ public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, /** * @param $value * @param CompilationContext $context - * @param bool $usePointer * * @throws CompilerException * * @return bool|string|Variable */ - public function resolveValue($value, CompilationContext $context, $usePointer = false) + public function resolveValue($value, CompilationContext $context): Variable|bool|string { if ($value instanceof GlobalConstant) { switch ($value->getName()) { @@ -825,9 +1000,7 @@ public function resolveValue($value, CompilationContext $context, $usePointer = $value = 'false'; break; default: - throw new CompilerException( - $this->name.': Unknown constant '.$value->getName() - ); + throw new CompilerException('Unknown constant '.$value->getName()); } } @@ -904,26 +1077,26 @@ public function updateProperty(Variable $variable, $property, $value, Compilatio ); } - public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context) + public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context): void { // TODO(serghei): Sort out as well as above $value = $this->resolveValue($value, $context); $context->codePrinter->output('zephir_update_static_property_ce('.$classEntry.', ZEND_STRL("'.$property.'"), '.$value.');'); } - public function addStaticProperty($classEntry, $property, $value, CompilationContext $context) + public function addStaticProperty($classEntry, $property, $value, CompilationContext $context): void { $value = $this->resolveValue($value, $context); $context->codePrinter->output('zephir_add_static_property_ce('.$classEntry.', ZEND_STRL("'.$property.'"), '.$value.');'); } - public function subStaticProperty($classEntry, $property, $value, CompilationContext $context) + public function subStaticProperty($classEntry, $property, $value, CompilationContext $context): void { $value = $this->resolveValue($value, $context); $context->codePrinter->output('zephir_sub_static_property_ce('.$classEntry.', ZEND_STRL("'.$property.'"), '.$value.');'); } - public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context) + public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context): void { $resolveValue = $this->resolveValue($value, $context); if (isset($key)) { @@ -953,13 +1126,6 @@ public function callMethod($symbolVariable, Variable $variable, $methodName, $ca } } - public function setSymbolIfSeparated(Variable $variableTempSeparated, Variable $variable, CompilationContext $context) - { - $context->codePrinter->output('if ('.$variableTempSeparated->getName().') {'); - $context->codePrinter->output("\t".'ZEPHIR_SET_SYMBOL(&EG(symbol_table), "'.$variable->getName().'", &'.$variable->getName().');'); - $context->codePrinter->output('}'); - } - public function copyOnWrite(Variable $target, $var, CompilationContext $context) { if ('EG(exception)' == $var) { @@ -1143,7 +1309,7 @@ public function destroyIterator(Variable $iteratorVariable, CompilationContext $ public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $useBody = false, $useCodePrinter = true) { if ($var->isDoublePointer()) { - return parent::ifVariableValueUndefined($var, $context, $useBody, $useCodePrinter); + return $this->ifVariableValueUndefined2($var, $context, $useBody, $useCodePrinter); } $body = 'ZEPHIR_IS_EMPTY('.$this->getVariableCode($var).')'; $output = 'if ('.$body.') {'; @@ -1154,6 +1320,17 @@ public function ifVariableValueUndefined(Variable $var, CompilationContext $cont return $useBody ? $body : $output; } + public function ifVariableValueUndefined2(Variable $var, CompilationContext $context, $onlyBody = false, $useCodePrinter = true) + { + $body = '!'.$var->getName(); + $output = 'if ('.$body.') {'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $onlyBody ? $body : $output; + } + public function fetchClassEntry($str) { return 'zephir_get_internal_ce(SL("'.$str.'"))'; @@ -1199,4 +1376,446 @@ public function initArray(Variable $variable, CompilationContext $context, ?int $context->codePrinter->output($output); } + + public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context) + { + $variable = $this->getVariableCodePointer($variable); + $itemVariable = $this->getVariableCode($itemVariable); + $context->codePrinter->output('zephir_concat_self('.$variable.', '.$itemVariable.');'); + } + + public function updateArray(Variable $symbolVariable, $key, $value, CompilationContext $compilationContext, $flags = null) + { + $value = $this->resolveValue($value, $compilationContext, true); + if (!isset($flags)) { + $flags = 'PH_COPY'; + } + + if ($key instanceof Variable) { + switch ($key->getType()) { + case 'string': + case 'variable': + $compilationContext->codePrinter->output('zephir_array_update_zval('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($key).', '.$value.', '.$flags.');'); + break; + + case 'int': + case 'uint': + case 'long': + $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getName().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); + break; + + default: + throw new CompilerException('updateArray: Found a variable with unsupported type '.$key->getType()); + } + } elseif ($key instanceof CompiledExpression) { + switch ($key->getType()) { + case 'string': + $compilationContext->codePrinter->output('zephir_array_update_string('.$this->getVariableCodePointer($symbolVariable).', SL("'.$key->getCode().'"), '.$value.', '.$flags.');'); + break; + + case 'int': + $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getCode().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); + break; + + case 'variable': + $this->updateArray($symbolVariable, $compilationContext->symbolTable->getVariableForRead($key->getCode()), $value, $compilationContext, $flags); + break; + + default: + throw new CompilerException('updateArray: Found an expression with unsupported type '.$key->getType()); + } + } else { + throw new CompilerException('?'); + } + } + + public function initObject(Variable $variable, $ce, CompilationContext $context, $useCodePrinter = true) + { + $variableAccess = $this->getVariableCode($variable); + if (!isset($ce)) { + $output = 'object_init('.$variableAccess.');'; + } else { + $output = 'object_init_ex('.$variableAccess.', '.$ce.');'; + } + + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayAccess, CompilationContext $context, $useCodePrinter = true) + { + $context->headersManager->add('kernel/array'); + $isVariable = $index instanceof Variable; + + switch ($index->getType()) { + case 'int': + case 'uint': + case 'long': + $type = 'long'; + break; + + /* Types which map to the same */ + case 'variable': + case 'mixed': + case 'string': + $type = $index->getType(); + break; + + default: + throw new CompilerException( + sprintf('Variable type: %s cannot be used as array index without cast', $index->getType()), + $arrayAccess['right'] + ); + } + if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { + $output = 'zephir_array_fetch('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; + } else { + if ($isVariable) { + $indexAccess = $this->getVariableCode($index); + } else { + $indexAccess = $index->getCode(); + if ('string' == $type) { + $indexAccess = 'SL("'.$indexAccess.'")'; + } + } + $output = 'zephir_array_fetch_'.$type.'('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$indexAccess.', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; + } + + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $compilationContext) + { + list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + + $symbol = $this->resolveValue($symbolVariable, $compilationContext, true); + $varCode = $this->getVariableCodePointer($variable); + $compilationContext->codePrinter->output( + sprintf( + 'zephir_array_update_multi(%s, %s, SL("%s"), %d, %s);', + $varCode, + $symbol, + $keys, + $numberParams, + implode(', ', $offsetItems) + ) + ); + } + + public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) + { + list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); + + $compilationContext->codePrinter->output( + sprintf( + 'zephir_update_property_array_multi(%s, SL("%s"), %s, SL("%s"), %d, %s);', + $variable->getName(), + $propertyName, + $valueVariable, + $keys, + $numberParams, + implode(', ', $offsetItems) + ) + ); + } + + public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) + { + list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); + + $offsetStr = $offsetItems ? ', '.implode(', ', $offsetItems) : ''; + $compilationContext->codePrinter->output( + sprintf( + 'zephir_update_static_property_array_multi_ce(%s, SL("%s"), %s, SL("%s"), %d%s);', + $classEntry, + $propertyName, + $valueVariable, + $keys, + $numberParams, + $offsetStr + ) + ); + } + + public function checkConstructor(Variable $var, CompilationContext $context) + { + $context->codePrinter->output('if (zephir_has_constructor('.$this->getVariableCode($var).')) {'); + } + + public function callDynamicFunction($symbolVariable, Variable $variable, CompilationContext $context, $params = [], $cache = 'NULL', $cacheSlot = 0) + { + $paramStr = null != $params ? ', '.implode(', ', $params) : ''; + if (!isset($symbolVariable)) { + $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION(NULL, '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); + } elseif ('return_value' == $symbolVariable->getName()) { + $context->codePrinter->output('ZEPHIR_RETURN_CALL_ZVAL_FUNCTION('.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); + } else { + $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); + } + } + + public function zvalOperator($zvalOperator, Variable $expected, Variable $variableLeft, Variable $variableRight, CompilationContext $compilationContext) + { + $expected = $this->getVariableCode($expected); + $op1 = $this->getVariableCode($variableLeft); + $op2 = $this->getVariableCode($variableRight); + + $compilationContext->codePrinter->output($zvalOperator.'('.$expected.', '.$op1.', '.$op2.');'); + } + + public function checkStrictType($type, $var, CompilationContext $context) + { + $codePrinter = $context->codePrinter; + $conditions = []; + + $inputParamVariable = $context->symbolTable->getVariableForWrite($var['name'], $context); + $inputParamCode = $this->getVariableCode($inputParamVariable); + $cond = 'Z_TYPE_P('.$inputParamCode.') != '; + if ($context->symbolTable->hasVariable($var['name'].'_param')) { + $parameterVariable = $context->symbolTable->getVariableForWrite($var['name'].'_param', $context); + $parameterCode = $context->backend->getVariableCode($parameterVariable); + $cond = 'Z_TYPE_P('.$parameterCode.') != '; + } + + switch ($type) { + case 'int': + case 'uint': + case 'long': + $conditions[] = $cond.'IS_LONG'; + break; + case 'bool': + $conditions[] = $cond.'IS_TRUE'; + $conditions[] = $cond.'IS_FALSE'; + break; + case 'double': + $conditions[] = $cond.'IS_DOUBLE'; + break; + case 'string': + case 'ulong': + $conditions[] = $cond.'IS_STRING'; + $conditions[] = $cond.'IS_NULL'; + break; + case 'array': + break; + case 'object': + case 'resource': + $conditions[] = $cond.'IS_'.strtoupper($type); + break; + case 'callable': + $conditions[] = 'zephir_is_callable('.$inputParamCode.') != 1'; + break; + default: + throw new CompilerException('Unknown type '.$type); + } + + /* Generate verification code */ + if (\count($conditions)) { + $codePrinter->output('if (UNEXPECTED('.implode(' && ', $conditions).')) {'); + $codePrinter->increaseLevel(); + + $exceptionMessage = sprintf('SL("Parameter \'%s\' must be of the type %s")', $var['name'], $type); + $codePrinter->output( + sprintf( + 'zephir_throw_exception_string(spl_ce_InvalidArgumentException, %s);', + $exceptionMessage + ) + ); + + $codePrinter->output('RETURN_MM_NULL();'); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + } + + /* Assign param */ + switch ($type) { + case 'int': + case 'long': + $codePrinter->output($var['name'].' = Z_LVAL_P('.$parameterCode.');'); + break; + case 'uint': + $codePrinter->output($var['name'].' = ZEND_ABS(Z_LVAL_P('.$parameterCode.'));'); + break; + case 'bool': + $codePrinter->output($var['name'].' = '.$this->getBoolCode($parameterVariable, $context, false).';'); + break; + case 'double': + $codePrinter->output($var['name'].' = Z_DVAL_P('.$parameterCode.');'); + break; + case 'string': + case 'ulong': + $context->headersManager->add('kernel/operators'); + $context->symbolTable->mustGrownStack(true); + $codePrinter->output('if (EXPECTED(Z_TYPE_P('.$parameterCode.') == IS_STRING)) {'); + $codePrinter->increaseLevel(); + $targetVar = $var['name']; + $targetVar = '&'.$targetVar; + $codePrinter->output('zephir_get_strval('.$targetVar.', '.$var['name'].'_param);'); + $codePrinter->decreaseLevel(); + $codePrinter->output('} else {'); + $codePrinter->increaseLevel(); + $this->initVar($inputParamVariable, $context); + $codePrinter->decreaseLevel(); + $codePrinter->output('}'); + break; + case 'array': + $context->backend->assignZval($inputParamVariable, $parameterVariable, $context); + break; + case 'object': + case 'resource': + case 'callable': + case 'mixed': + break; + default: + throw new CompilerException('Unknown type: '.$type); + } + } + + /** + * Assign value to variable helper. + * + * @param string $macro + * @param string $variableName + * @param string|Variable|null $value + * @param CompilationContext $context + * @param bool $useCodePrinter + * + * @return string + */ + protected function assignHelper( + string $macro, + string $variableName, + $value, + CompilationContext $context, + bool $useCodePrinter + ): string { + if ($value === null && $macro === 'ZVAL_STRING') { + return ''; + } + + if ($value instanceof Variable) { + $value = $value->getName(); + } else { + $value = 'ZVAL_STRING' === $macro ? '"'.$value.'"' : $value; + } + + $output = $macro.'('.$variableName.', '.$value.');'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + protected function returnHelper(string $macro, $value, CompilationContext $context, $useCodePrinter, $doCopy = null): string + { + if ($value instanceof Variable) { + $value = $value->getName(); + } elseif ($macro === 'RETURN_MM_STRING' && !preg_match('/^ZEPHIR_GLOBAL/', $value)) { + $value = '"'.$value.'"'; + } + + $copyStr = ''; + if (true === $doCopy) { + $copyStr = ', 1'; + } elseif (false === $doCopy) { + $copyStr = ', 0'; + } elseif (isset($doCopy)) { + $copyStr = ', '.$doCopy; + } + + $output = $macro.'('.$value.$copyStr.');'; + if ($useCodePrinter) { + $context->codePrinter->output($output); + } + + return $output; + } + + /** + * Resolve expressions. + * + * @param CompiledExpression[]|string[] $offsetExprs + * @param CompilationContext $compilationContext + * + * @throws CompilerException + * + * @return array + */ + private function resolveOffsetExprs($offsetExprs, CompilationContext $compilationContext) + { + $keys = ''; + $offsetItems = []; + $numberParams = 0; + + foreach ($offsetExprs as $offsetExpr) { + if ('a' == $offsetExpr) { + $keys .= 'a'; + ++$numberParams; + continue; + } + switch ($offsetExpr->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + $keys .= 'l'; + $offsetItems[] = $offsetExpr->getCode(); + ++$numberParams; + break; + + case 'string': + $keys .= 's'; + $offsetItems[] = 'SL("'.$offsetExpr->getCode().'")'; + $numberParams += 2; + break; + + case 'variable': + $variableIndex = $compilationContext->symbolTable->getVariableForRead( + $offsetExpr->getCode(), + $compilationContext, + null + ); + + switch ($variableIndex->getType()) { + case 'int': + case 'uint': + case 'long': + case 'ulong': + $keys .= 'l'; + $offsetItems[] = $this->getVariableCode($variableIndex); + ++$numberParams; + break; + case 'string': + case 'variable': + $keys .= 'z'; + $offsetItems[] = $this->getVariableCode($variableIndex); + ++$numberParams; + break; + default: + throw new CompilerException( + sprintf('Variable: %s cannot be used as array index', $variableIndex->getType()), + $offsetExpr->getOriginal() + ); + } + break; + + default: + throw new CompilerException( + sprintf('Value: %s cannot be used as array index', $offsetExpr->getType()), + $offsetExpr->getOriginal() + ); + } + } + + return [$keys, $offsetItems, $numberParams]; + } } diff --git a/Library/Backends/ZendEngine3/FcallManager.php b/Library/Backend/FcallManager.php similarity index 99% rename from Library/Backends/ZendEngine3/FcallManager.php rename to Library/Backend/FcallManager.php index 5647c3f2d5..a48e4f4b23 100644 --- a/Library/Backends/ZendEngine3/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Backends\ZendEngine3; +namespace Zephir\Backend; use Zephir\CodePrinter; use Zephir\Fcall\FcallManagerInterface; diff --git a/Library/Backends/ZendEngine3/StringsManager.php b/Library/Backend/StringsManager.php similarity index 98% rename from Library/Backends/ZendEngine3/StringsManager.php rename to Library/Backend/StringsManager.php index 7400d52b71..29c6942bcd 100644 --- a/Library/Backends/ZendEngine3/StringsManager.php +++ b/Library/Backend/StringsManager.php @@ -11,10 +11,9 @@ declare(strict_types=1); -namespace Zephir\Backends\ZendEngine3; +namespace Zephir\Backend; use Zephir\StringsManager as BaseStringsManager; - use function Zephir\file_put_contents_ex; /** @@ -66,7 +65,6 @@ public function genConcatCode(): void $useCopy = []; $avars = []; $zvars = []; - $svars = []; $lengths = []; $sparams = []; $lparams = []; @@ -78,7 +76,6 @@ public function genConcatCode(): void $params[] = 'const char *op'.$n.', uint32_t op'.$n.'_len'; $lparams[] = 'op'.$n.', sizeof(op'.$n.')-1'; $lengths[] = 'op'.$n.'_len'; - $svars[] = $n; $avars[$n] = 's'; } else { $params[] = 'zval *op'.$n; diff --git a/Library/Backends/ZendEngine3/VariablesManager.php b/Library/Backend/VariablesManager.php similarity index 89% rename from Library/Backends/ZendEngine3/VariablesManager.php rename to Library/Backend/VariablesManager.php index a6b62356a5..dd12119955 100644 --- a/Library/Backends/ZendEngine3/VariablesManager.php +++ b/Library/Backend/VariablesManager.php @@ -9,16 +9,17 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Backends\ZendEngine3; +namespace Zephir\Backend; use Zephir\CompilationContext as Context; use Zephir\Exception\CompilerException as Exception; use Zephir\Types; use Zephir\Variable; +use function Zephir\Backend\ZendEngine3\add_slashes; class VariablesManager { - const RESERVED_NAMES = [ + public const RESERVED_NAMES = [ 'this_ptr', 'return_value', 'return_value_ptr', @@ -38,7 +39,7 @@ class VariablesManager * * @return void */ - public function initializeDefaults(Variable $variable, array $value, Context $context) + public function initializeDefaults(Variable $variable, array $value, Context $context): void { switch ($variable->getType()) { case Types::T_VARIABLE: @@ -63,9 +64,9 @@ public function initializeDefaults(Variable $variable, array $value, Context $co * * @return void */ - private function initDynamicVar(Variable $variable, array $value, Context $context) + private function initDynamicVar(Variable $variable, array $value, Context $context): void { - /* These ones are system variables, do not add default values. + /* These are system variables, do not add default values. Also see: https://github.com/zephir-lang/zephir/issues/1660 */ if (\in_array($variable->getName(), self::RESERVED_NAMES, true)) { return; @@ -111,7 +112,7 @@ private function initDynamicVar(Variable $variable, array $value, Context $conte break; default: - throw $this->invalidDefaulTypeException($variable, $value); + throw $this->invalidDefaultTypeException($variable, $value); } } @@ -125,7 +126,7 @@ private function initDynamicVar(Variable $variable, array $value, Context $conte * * @return void */ - private function initStringVar(Variable $variable, array $value, Context $context) + private function initStringVar(Variable $variable, array $value, Context $context): void { $context->symbolTable->mustGrownStack(true); $context->backend->initVar($variable, $context); @@ -141,7 +142,7 @@ private function initStringVar(Variable $variable, array $value, Context $contex break; default: - throw $this->invalidDefaulTypeException($variable, $value); + throw $this->invalidDefaultTypeException($variable, $value); } } @@ -155,7 +156,7 @@ private function initStringVar(Variable $variable, array $value, Context $contex * * @return void */ - private function initArrayVar(Variable $variable, array $value, Context $context) + private function initArrayVar(Variable $variable, array $value, Context $context): void { $context->symbolTable->mustGrownStack(true); $context->backend->initVar($variable, $context); @@ -171,7 +172,7 @@ private function initArrayVar(Variable $variable, array $value, Context $context break; default: - throw $this->invalidDefaulTypeException($variable, $value); + throw $this->invalidDefaultTypeException($variable, $value); } } @@ -183,7 +184,7 @@ private function initArrayVar(Variable $variable, array $value, Context $context * * @return Exception */ - private function invalidDefaulTypeException(Variable $variable, array $value): Exception + private function invalidDefaultTypeException(Variable $variable, array $value): Exception { new Exception( sprintf( @@ -204,7 +205,7 @@ private function invalidDefaulTypeException(Variable $variable, array $value): E * * @return void */ - private function validateCharValue(array $value) + private function validateCharValue(array $value): void { if (\strlen($value['value']) > 2) { throw new Exception( diff --git a/Library/Backends/BackendFactory.php b/Library/Backends/BackendFactory.php deleted file mode 100644 index 12c4b01518..0000000000 --- a/Library/Backends/BackendFactory.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Backends; - -use Symfony\Component\Console\Input\ArgvInput; -use Zephir\BaseBackend; -use Zephir\Config; -use Zephir\Exception\IllegalStateException; - -final class BackendFactory -{ - private Config $config; - private string $kernelsPath; - private string $templatesPath; - - public function __construct(Config $config, string $kernelsPath, string $templatesPath) - { - $this->config = $config; - $this->kernelsPath = $kernelsPath; - $this->templatesPath = $templatesPath; - } - - public function createBackend() - { - $backendClassName = $this->resolveBackendClass(); - - return new $backendClassName( - $this->config, - $this->kernelsPath, - $this->templatesPath - ); - } - - /** - * Resolve backend class. - * - * @throws IllegalStateException - * - * @return string - */ - private function resolveBackendClass(): string - { - $backend = (new ArgvInput())->getParameterOption('--backend', null); - - if (null === $backend) { - // Do not use this feature for typical use case. - // Overriding backend using env var provided only for - // testing purposes and may be removed in the future. - // You SHOULD NOT rely on this possibility. - if (getenv('ZEPHIR_BACKEND')) { - $backend = getenv('ZEPHIR_BACKEND'); - } - } - - if (null === $backend) { - $backend = BaseBackend::getActiveBackend(); - } - - $className = "Zephir\\Backends\\{$backend}\\Backend"; - - if (!class_exists($className) || 'ZendEngine2' === $backend) { - throw new IllegalStateException(sprintf('Backend class "%s" does not exist.', $backend)); - } - - return $className; - } -} diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php deleted file mode 100644 index 57f83a765e..0000000000 --- a/Library/Backends/ZendEngine2/Backend.php +++ /dev/null @@ -1,1196 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Backends\ZendEngine2; - -use Zephir\BaseBackend; -use Zephir\ClassMethod; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Compiler; -use Zephir\Exception\CompilerException; -use Zephir\Fcall\FcallManagerInterface; -use Zephir\GlobalConstant; -use Zephir\Variable; - -use function in_array; - -/** - * NOTE: ZendEngine2 backend is no longer supported - * and this class will be removed in the future. - */ -class Backend extends BaseBackend -{ - protected $name = 'ZendEngine2'; - - /** - * {@inheritdoc} - * - * @return FcallManagerInterface - */ - public function getFcallManager() - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getVariableCodePointer(Variable $variable) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getVariableCode(Variable $variable): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getStringsManager() - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function getTypeDefinition($type) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function getTypeofCondition( - Variable $variableVariable, - string $operator, - string $value, - CompilationContext $context - ): string { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function onPreInitVar(ClassMethod $method, CompilationContext $context): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function onPreCompile(ClassMethod $method, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function onPostCompile(ClassMethod $method, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - */ - public function initializeVariableDefaults(array $variables, CompilationContext $context): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function declareConstant($type, $name, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function declareVariables($method, $typeToVariables, CompilationContext $compilationContext) - { - $varInitCode = []; - $additionalCode = $method ? $this->onPreInitVar($method, $compilationContext) : ''; - - foreach ($typeToVariables as $type => $variables) { - list($pointer, $code) = $this->getTypeDefinition($type); - $code .= ' '; - $groupVariables = []; - - /** - * @var Variable[] - */ - foreach ($variables as $variable) { - $nextCode = $this->generateInitCode($groupVariables, $type, $pointer, $variable); - if ($nextCode && $additionalCode) { - $additionalCode .= PHP_EOL.$nextCode; - } else { - $additionalCode .= $nextCode; - } - } - - $varInitCode[] = $code.implode(', ', $groupVariables).';'; - } - /* Keep order consistent with previous zephir versions (BC-only) */ - $varInitCode = array_reverse($varInitCode); - if ($additionalCode) { - $varInitCode[] = $additionalCode; - } - - return $varInitCode; - } - - public function initVar(Variable $variable, CompilationContext $context, $useCodePrinter = true, $second = false) - { - $macro = !$second ? 'ZEPHIR_INIT_VAR' : 'ZEPHIR_INIT_NVAR'; - $code = $macro.'('.$this->getVariableCode($variable).');'; - if ($useCodePrinter) { - $context->codePrinter->output($code); - } - - return $code; - } - - /** - * {@inheritdoc} - */ - public function getInternalSignature(ClassMethod $method, CompilationContext $context): string - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * {@inheritdoc} - * - * @param Variable $variable - * @param string|Variable $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string - */ - public function assignString( - Variable $variable, - $value, - CompilationContext $context, - bool $useCodePrinter = true - ): string { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function returnString($value, CompilationContext $context, $useCodePrinter = true, $doCopy = true) - { - return $this->returnHelper('RETURN_MM_STRING', $value, $context, $useCodePrinter, $doCopy); - } - - public function assignLong(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) - { - return $this->assignHelper('ZVAL_LONG', $this->getVariableCode($variable), $value, $context, $useCodePrinter); - } - - public function assignDouble(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) - { - return $this->assignHelper('ZVAL_DOUBLE', $this->getVariableCode($variable), $value, $context, $useCodePrinter); - } - - public function assignBool(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true) - { - return $this->assignHelper('ZVAL_BOOL', $this->getVariableCode($variable), $value, $context, $useCodePrinter); - } - - public function assignNull(Variable $variable, CompilationContext $context, $useCodePrinter = true) - { - $output = 'ZVAL_NULL('.$this->getVariableCode($variable).');'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function assignZval(Variable $variable, $code, CompilationContext $context) - { - $code = $this->resolveValue($code, $context); - $context->codePrinter->output($this->getVariableCode($variable).' = '.$code.';'); - } - - public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context) - { - $variable = $this->getVariableCodePointer($variable); - $itemVariable = $this->getVariableCode($itemVariable); - $context->codePrinter->output('zephir_concat_self('.$variable.', '.$itemVariable.');'); - } - - public function initArray(Variable $variable, CompilationContext $context, int $size = null) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function createClosure(Variable $variable, $classDefinition, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function addArrayEntry(Variable $variable, $key, $value, CompilationContext $context, $statement = null, $useCodePrinter = true) - { - $type = null; - $keyType = 'assoc'; - if (!isset($key)) { - $keyType = 'append'; - } elseif ($key instanceof CompiledExpression) { - $typeKey = $key->getType(); - if ('variable' == $typeKey) { - $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); - $typeKey = $var->getType(); - } - if (in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { - $keyType = 'index'; - } - } - - if ('null' == $value) { - if (!isset($key)) { - $context->codePrinter->output('zephir_array_append('.$this->getVariableCodePointer($variable).', ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'); - - return; - } - } - switch ($value->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $type = 'long'; - break; - case 'double': - $type = 'double'; - break; - case 'string': - $type = 'stringl'; - break; - case 'variable': - case 'array': - $type = 'zval'; - break; - } - if (!$type) { - throw new CompilerException('Unknown type mapping: '.$value->getType()); - } - - if (isset($key)) { - if ('variable' == $key->getType()) { - $keyStr = 'string' == $typeKey ? 'Z_STRVAL_P('.$this->getVariableCode($var).'), Z_STRLEN_P('.$this->getVariableCode($var).') + 1' : $this->getVariableCode($var); - } else { - $keyStr = 'string' == $key->getType() ? 'SS("'.$key->getCode().'")' : $key->getCode(); - } - } - if ('stringl' == $type) { - if ($value instanceof Variable) { - $valueStr = 'Z_STRVAL_P('.$this->getVariableCode($value).'), Z_STRLEN_P('.$this->getVariableCode($value).')'; - } else { - $valueStr = 'SL("'.$value->getCode().'")'; - } - } elseif ('zval' == $type) { - $valueStr = $this->getVariableCode($value); - } else { - $valueStr = $value->getCode(); - } - $doCopy = 'stringl' == $type ? ', 1' : ''; - - if ('assoc' == $keyType) { - $output = 'add_assoc_'.$type.'_ex('.$this->getVariableCode($variable).', '.$keyStr.', '.$valueStr.$doCopy.');'; - } elseif ('append' == $keyType) { - $output = 'zephir_array_append('.$this->getVariableCodePointer($variable).', '.$this->resolveValue($value, $context).', PH_SEPARATE, "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'; - } else { - $output = 'add_index_'.$type.'('.$this->getVariableCode($variable).', '.$keyStr.', '.$valueStr.$doCopy.');'; - } - - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function updateArray(Variable $symbolVariable, $key, $value, CompilationContext $compilationContext, $flags = null) - { - $value = $this->resolveValue($value, $compilationContext, true); - if (!isset($flags)) { - $flags = 'PH_COPY'; - } - - if ($key instanceof Variable) { - switch ($key->getType()) { - case 'string': - case 'variable': - $compilationContext->codePrinter->output('zephir_array_update_zval('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($key).', '.$value.', '.$flags.');'); - break; - - case 'int': - case 'uint': - case 'long': - $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getName().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); - break; - - default: - throw new CompilerException('updateArray: Found a variable with unsupported type '.$key->getType()); - } - } elseif ($key instanceof CompiledExpression) { - switch ($key->getType()) { - case 'string': - $compilationContext->codePrinter->output('zephir_array_update_string('.$this->getVariableCodePointer($symbolVariable).', SL("'.$key->getCode().'"), '.$value.', '.$flags.');'); - break; - - case 'int': - $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getCode().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); - break; - - case 'variable': - $this->updateArray($symbolVariable, $compilationContext->symbolTable->getVariableForRead($key->getCode()), $value, $compilationContext, $flags); - break; - - default: - throw new CompilerException('updateArray: Found an expression with unsupported type '.$key->getType()); - } - } else { - throw new CompilerException('?'); - } - } - - public function initObject(Variable $variable, $ce, CompilationContext $context, $useCodePrinter = true) - { - $variableAccess = $this->getVariableCode($variable); - if (!isset($ce)) { - $output = 'object_init('.$variableAccess.');'; - } else { - $output = 'object_init_ex('.$variableAccess.', '.$ce.');'; - } - - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayAccess, CompilationContext $context, $useCodePrinter = true) - { - $context->headersManager->add('kernel/array'); - $isVariable = $index instanceof Variable; - - switch ($index->getType()) { - case 'int': - case 'uint': - case 'long': - $type = 'long'; - break; - - /* Types which map to the same */ - case 'variable': - case 'mixed': - case 'string': - $type = $index->getType(); - break; - - default: - throw new CompilerException( - sprintf('Variable type: %s cannot be used as array index without cast', $index->getType()), - $arrayAccess['right'] - ); - } - if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { - $output = 'zephir_array_fetch('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; - } else { - if ($isVariable) { - $indexAccess = $this->getVariableCode($index); - } else { - $indexAccess = $index->getCode(); - if ('string' == $type) { - $indexAccess = 'SL("'.$indexAccess.'")'; - } - } - $output = 'zephir_array_fetch_'.$type.'('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$indexAccess.', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; - } - - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context) - { - if (!($resolvedExpr instanceof Variable)) { - if ('string' == $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_string('.$this->getVariableCode($var).', SS("'.$resolvedExpr->getCode().'"))', $expression); - } else { - return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$resolvedExpr->getCode().')', $expression); - } - } - - if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); - } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType() || 'mixed' === $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); - } - - throw new CompilerException('['.$resolvedExpr->getType().']', $expression); - } - - public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context) - { - $code = $this->getVariableCodePointer($target).', '.$this->getVariableCode($var); - - if (!($resolvedExpr instanceof Variable)) { - if ('string' === $resolvedExpr->getType()) { - return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { - return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression); - } else { - $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); - } - } - - if (in_array($resolvedExpr->getType(), ['int', 'long'])) { - return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { - return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } - - throw new CompilerException('arrayIssetFetch ['.$resolvedExpr->getType().']', $expression); - } - - public function propertyIsset(Variable $var, $key, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context) - { - $context->headersManager->add('kernel/array'); - $variableCode = $this->getVariableCodePointer($variable); - switch ($exprIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $context->codePrinter->output('zephir_array_unset_long('.$variableCode.', '.$exprIndex->getCode().', '.$flags.');'); - break; - - case 'string': - $context->codePrinter->output('zephir_array_unset_string('.$variableCode.', SS("'.$exprIndex->getCode().'"), '.$flags.');'); - break; - - case 'variable': - $variableIndex = $context->symbolTable->getVariableForRead($exprIndex->getCode(), $context, $exprIndex->getOriginal()); - $indexCode = $this->getVariableCode($variableIndex); - switch ($variableIndex->getType()) { - case 'int': - case 'uint': - case 'long': - $context->codePrinter->output('zephir_array_unset_long('.$variableCode.', '.$indexCode.', '.$flags.');'); - break; - - case 'string': - case 'variable': - case 'mixed': - $context->codePrinter->output('zephir_array_unset('.$variableCode.', '.$indexCode.', '.$flags.');'); - break; - - default: - throw new CompilerException('Variable type: '.$variableIndex->getType().' cannot be used as array index without cast'); - } - break; - - default: - throw new CompilerException('Cannot use expression: '.$exprIndex->getType().' as array index without cast'); - } - } - - public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $compilationContext) - { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); - - $symbol = $this->resolveValue($symbolVariable, $compilationContext, true); - $varCode = $this->getVariableCodePointer($variable); - $compilationContext->codePrinter->output( - sprintf( - 'zephir_array_update_multi(%s, %s, SL("%s"), %d, %s);', - $varCode, - $symbol, - $keys, - $numberParams, - implode(', ', $offsetItems) - ) - ); - } - - public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) - { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); - $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); - - $compilationContext->codePrinter->output( - sprintf( - 'zephir_update_property_array_multi(%s, SL("%s"), %s, SL("%s"), %d, %s);', - $variable->getName(), - $propertyName, - $valueVariable, - $keys, - $numberParams, - implode(', ', $offsetItems) - ) - ); - } - - public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) - { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); - $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); - - $offsetStr = $offsetItems ? ', '.implode(', ', $offsetItems) : ''; - $compilationContext->codePrinter->output( - sprintf( - 'zephir_update_static_property_array_multi_ce(%s, SL("%s"), %s, SL("%s"), %d%s);', - $classEntry, - $propertyName, - $valueVariable, - $keys, - $numberParams, - $offsetStr - ) - ); - } - - public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function fetchClass(Variable $zendClassEntry, $className, $guarded, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function fetchProperty( - Variable $symbolVariable, - Variable $variableVariable, - $property, - $readOnly, - CompilationContext $context - ) { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function fetchStaticProperty( - Variable $symbolVariable, - $classDefinition, - $property, - $readOnly, - CompilationContext $context - ) { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function resolveValue($value, CompilationContext $context, $usePointer = false) - { - if ('null' == $value) { - $value = ($usePointer ? '&' : '').'ZEPHIR_GLOBAL(global_null)'; - } elseif ('true' == $value) { - $value = ($usePointer ? '&' : '').'ZEPHIR_GLOBAL(global_true)'; - } elseif ('false' == $value) { - $value = ($usePointer ? '&' : '').'ZEPHIR_GLOBAL(global_false)'; - } elseif ($value instanceof GlobalConstant) { - return ($usePointer ? '&' : '').$value->getName(); - } elseif ($value instanceof CompiledExpression) { - if ('array' == $value->getType()) { - $var = $context->symbolTable->getVariableForWrite($value->getCode(), $context, null); - $value = $usePointer ? $this->getVariableCodePointer($var) : $this->getVariableCode($var); - } elseif ('variable' == $value->getType()) { - $value = $context->symbolTable->getVariableForWrite($value->getCode(), $context); - } else { - return $value->getCode(); - } - } - if ($value instanceof Variable) { - $value = $usePointer ? $this->getVariableCodePointer($value) : $this->getVariableCode($value); - } - - return $value; - } - - /** - * {@inheritdoc} - * - * @param Variable $variable - * @param string|Variable $property - * @param mixed $value - * @param CompilationContext $context - * - * @return void - */ - public function updateProperty(Variable $variable, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function addStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function subStaticProperty($classEntry, $property, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function checkConstructor(Variable $var, CompilationContext $context) - { - $context->codePrinter->output('if (zephir_has_constructor('.$this->getVariableCode($var).')) {'); - } - - public function callMethod($symbolVariable, Variable $variable, $methodName, $cachePointer, $params, CompilationContext $context) - { - $paramStr = null != $params ? ', '.implode(', ', $params) : ''; - $macro = 'CALL_METHOD'; - if ($methodName instanceof Variable) { - $macro = 'CALL_METHOD_ZVAL'; - $methodName = $this->getVariableCode($methodName); - } else { - $methodName = '"'.$methodName.'"'; - } - if (!isset($symbolVariable)) { - $context->codePrinter->output('ZEPHIR_'.$macro.'(NULL, '.$variable->getName().', '.$methodName.', '.$cachePointer.$paramStr.');'); - } elseif ('return_value' == $symbolVariable->getName()) { - $context->codePrinter->output('ZEPHIR_RETURN_'.$macro.'('.$variable->getName().', '.$methodName.', '.$cachePointer.$paramStr.');'); - } else { - $context->codePrinter->output('ZEPHIR_'.$macro.'(&'.$symbolVariable->getName().', '.$variable->getName().', '.$methodName.', '.$cachePointer.$paramStr.');'); - } - } - - public function callDynamicFunction($symbolVariable, Variable $variable, CompilationContext $context, $params = [], $cache = 'NULL', $cacheSlot = 0) - { - $paramStr = null != $params ? ', '.implode(', ', $params) : ''; - if (!isset($symbolVariable)) { - $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION(NULL, '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); - } elseif ('return_value' == $symbolVariable->getName()) { - $context->codePrinter->output('ZEPHIR_RETURN_CALL_ZVAL_FUNCTION('.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); - } else { - $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); - } - } - - public function zvalOperator($zvalOperator, Variable $expected, Variable $variableLeft, Variable $variableRight, CompilationContext $compilationContext) - { - $expected = $this->getVariableCode($expected); - $op1 = $this->getVariableCode($variableLeft); - $op2 = $this->getVariableCode($variableRight); - - $compilationContext->codePrinter->output($zvalOperator.'('.$expected.', '.$op1.', '.$op2.');'); - } - - public function maybeSeparate(Variable $variableTempSeparated, Variable $variable, CompilationContext $context) - { - $context->codePrinter->output($variableTempSeparated->getName().' = zephir_maybe_separate_zval('.$this->getVariableCodePointer($variable).');'); - } - - public function setSymbolIfSeparated(Variable $variableTempSeparated, Variable $variable, CompilationContext $context) - { - $context->codePrinter->output('if ('.$variableTempSeparated->getName().') {'); - $context->codePrinter->output("\t".'ZEND_SET_SYMBOL(&EG(symbol_table), "'.$variable->getName().'", '.$variable->getName().');'); - $context->codePrinter->output('}'); - } - - public function copyOnWrite(Variable $target, $var, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function forStatement(Variable $exprVariable, $keyVariable, $variable, $duplicateKey, $duplicateHash, $statement, $statementBlock, CompilationContext $compilationContext) - { - /* - * Create a hash table and hash pointer temporary variables. - */ - $arrayPointer = $compilationContext->symbolTable->addTemp('HashPosition', $compilationContext); - $arrayHash = $compilationContext->symbolTable->addTemp('HashTable', $compilationContext); - /* - * Create a temporary zval to fetch the items from the hash. - */ - $compilationContext->headersManager->add('kernel/fcall'); - $compilationContext->symbolTable->mustGrownStack(true); - if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) { - $callStatus = new Variable('int', 'ZEPHIR_LAST_CALL_STATUS', $compilationContext->branchManager->getCurrentBranch()); - $callStatus->setIsInitialized(true, $compilationContext); - $callStatus->increaseUses(); - $callStatus->setReadOnly(true); - $compilationContext->symbolTable->addRawVariable($callStatus); - } - $tempVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); - $tempVariable->setIsDoublePointer(true); - $tempValidVariable = $compilationContext->symbolTable->addTemp('variable', $compilationContext); - $tempValidVariable->setMustInitNull(true); - $codePrinter = $compilationContext->codePrinter; - - $codePrinter->output('if (Z_TYPE_P('.$this->getVariableCode($exprVariable).') == IS_ARRAY) {'); - $codePrinter->increaseLevel(); - - $reverse = $statement['reverse'] ? 1 : 0; - - $codePrinter->output('zephir_is_iterable('.$this->getVariableCode($exprVariable).', &'.$arrayHash->getName().', &'.$arrayPointer->getName().', '.$duplicateHash.', '.$reverse.', "'.Compiler::getShortUserPath($statement['file']).'", '.$statement['line'].');'); - - $codePrinter->output('for ('); - $codePrinter->output(' ; zend_hash_get_current_data_ex('.$arrayHash->getName().', (void**) &'.$tempVariable->getName().', &'.$arrayPointer->getName().') == SUCCESS'); - if ($reverse) { - $codePrinter->output(' ; zend_hash_move_backwards_ex('.$arrayHash->getName().', &'.$arrayPointer->getName().')'); - } else { - $codePrinter->output(' ; zend_hash_move_forward_ex('.$arrayHash->getName().', &'.$arrayPointer->getName().')'); - } - $codePrinter->output(') {'); - - if (isset($keyVariable)) { - if ($duplicateKey) { - $compilationContext->symbolTable->mustGrownStack(true); - $codePrinter->output("\t".'ZEPHIR_GET_HMKEY('.$keyVariable->getName().', '.$arrayHash->getName().', '.$arrayPointer->getName().');'); - } else { - $codePrinter->output("\t".'ZEPHIR_GET_HKEY('.$keyVariable->getName().', '.$arrayHash->getName().', '.$arrayPointer->getName().');'); - } - } - - if (isset($variable)) { - $compilationContext->symbolTable->mustGrownStack(true); - $codePrinter->output("\t".'ZEPHIR_GET_HVALUE('.$variable->getName().', '.$tempVariable->getName().');'); - } - - /* - * Compile statements in the 'for' block - */ - if (isset($statement['statements'])) { - $statementBlock->isLoop(true); - if (isset($statement['key'])) { - $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); - } - $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); - $statementBlock->compile($compilationContext); - } - - $codePrinter->output('}'); - /* Make sure to free the duplicated hash table */ - if ($duplicateHash) { - $codePrinter->output('zend_hash_destroy('.$arrayHash->getName().');'); - $codePrinter->output('FREE_HASHTABLE('.$arrayHash->getName().');'); - } - $codePrinter->decreaseLevel(); - - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - - $codePrinter->output('ZEPHIR_CALL_METHOD(NULL, '.$this->getVariableCode($exprVariable).', "rewind", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - - $codePrinter->output('while (1) {'); - $codePrinter->increaseLevel(); - $compilationContext->headersManager->add('kernel/operators'); - - $codePrinter->output('ZEPHIR_CALL_METHOD(&'.$tempValidVariable->getName().', '.$this->getVariableCode($exprVariable).', "valid", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - $codePrinter->output('if (!zephir_is_true('.$tempValidVariable->getName().')) {'); - $codePrinter->increaseLevel(); - $codePrinter->output('break;'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - - if (isset($keyVariable)) { - $codePrinter->output('ZEPHIR_CALL_METHOD(&'.$this->getVariableCode($keyVariable).', '.$this->getVariableCode($exprVariable).', "key", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - } - - if (isset($variable)) { - $codePrinter->output('ZEPHIR_CALL_METHOD(&'.$this->getVariableCode($variable).', '.$this->getVariableCode($exprVariable).', "current", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - } - - if (isset($statement['statements'])) { - $statementBlock->isLoop(true); - if (isset($statement['key'])) { - $statementBlock->getMutateGatherer()->increaseMutations($statement['key']); - } - $statementBlock->getMutateGatherer()->increaseMutations($statement['value']); - $statementBlock->compile($compilationContext); - } - - $codePrinter->output('ZEPHIR_CALL_METHOD(NULL, '.$this->getVariableCode($exprVariable).', "next", NULL, 0);'); - $codePrinter->output('zephir_check_call_status();'); - - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - } - - public function forStatementIterator(Variable $iteratorVariable, Variable $targetVariable, CompilationContext $compilationContext) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function destroyIterator(Variable $iteratorVariable, CompilationContext $context) - { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $onlyBody = false, $useCodePrinter = true) - { - $body = '!'.$var->getName(); - $output = 'if ('.$body.') {'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $onlyBody ? $body : $output; - } - - public function checkStrictType($type, $var, CompilationContext $context) - { - $codePrinter = $context->codePrinter; - $conditions = []; - - $inputParamVariable = $context->symbolTable->getVariableForWrite($var['name'], $context); - $inputParamCode = $this->getVariableCode($inputParamVariable); - $cond = 'Z_TYPE_P('.$inputParamCode.') != '; - if ($context->symbolTable->hasVariable($var['name'].'_param')) { - $parameterVariable = $context->symbolTable->getVariableForWrite($var['name'].'_param', $context); - $parameterCode = $context->backend->getVariableCode($parameterVariable); - $cond = 'Z_TYPE_P('.$parameterCode.') != '; - } - - switch ($type) { - case 'int': - case 'uint': - case 'long': - $conditions[] = $cond.'IS_LONG'; - break; - case 'bool': - $conditions[] = $cond.'IS_TRUE'; - $conditions[] = $cond.'IS_FALSE'; - break; - case 'double': - $conditions[] = $cond.'IS_DOUBLE'; - break; - case 'string': - case 'ulong': - $conditions[] = $cond.'IS_STRING'; - $conditions[] = $cond.'IS_NULL'; - break; - case 'array': - break; - case 'object': - case 'resource': - $conditions[] = $cond.'IS_'.strtoupper($type); - break; - case 'callable': - $conditions[] = 'zephir_is_callable('.$inputParamCode.') != 1'; - break; - default: - throw new CompilerException('Unknown type '.$type); - } - - /* Generate verification code */ - if (\count($conditions)) { - $codePrinter->output('if (UNEXPECTED('.implode(' && ', $conditions).')) {'); - $codePrinter->increaseLevel(); - - $exceptionMessage = sprintf('SL("Parameter \'%s\' must be of the type %s")', $var['name'], $type); - $codePrinter->output( - sprintf( - 'zephir_throw_exception_string(spl_ce_InvalidArgumentException, %s);', - $exceptionMessage - ) - ); - - $codePrinter->output('RETURN_MM_NULL();'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - } - - /* Assign param */ - switch ($type) { - case 'int': - case 'long': - $codePrinter->output($var['name'].' = Z_LVAL_P('.$parameterCode.');'); - break; - case 'uint': - $codePrinter->output($var['name'].' = ZEND_ABS(Z_LVAL_P('.$parameterCode.'));'); - break; - case 'bool': - $codePrinter->output($var['name'].' = '.$this->getBoolCode($parameterVariable, $context, false).';'); - break; - case 'double': - $codePrinter->output($var['name'].' = Z_DVAL_P('.$parameterCode.');'); - break; - case 'string': - case 'ulong': - $context->headersManager->add('kernel/operators'); - $context->symbolTable->mustGrownStack(true); - $codePrinter->output('if (EXPECTED(Z_TYPE_P('.$parameterCode.') == IS_STRING)) {'); - $codePrinter->increaseLevel(); - $targetVar = $var['name']; - $targetVar = '&'.$targetVar; - $codePrinter->output('zephir_get_strval('.$targetVar.', '.$var['name'].'_param);'); - $codePrinter->decreaseLevel(); - $codePrinter->output('} else {'); - $codePrinter->increaseLevel(); - $this->initVar($inputParamVariable, $context); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - break; - case 'array': - $context->backend->assignZval($inputParamVariable, $parameterVariable, $context); - break; - case 'object': - case 'resource': - case 'callable': - case 'mixed': - break; - default: - throw new CompilerException('Unknown type: '.$type); - } - } - - public function fetchClassEntry($str) - { - return 'zephir_get_internal_ce(SS("'.$str.'"))'; - } - - public function getScalarTempVariable( - string $type, - CompilationContext $compilationContext, - $isLocal = false - ): Variable { - throw new CompilerException( - 'ZendEngine2 backend is no longer supported' - ); - } - - /** - * Assign value to variable helper. - * - * @param string $macro - * @param string $variableName - * @param string|Variable|null $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string - */ - protected function assignHelper( - string $macro, - string $variableName, - $value, - CompilationContext $context, - bool $useCodePrinter - ): string { - if ($value === null && $macro === 'ZVAL_STRING') { - return ''; - } - - if ($value instanceof Variable) { - $value = $value->getName(); - } else { - $value = 'ZVAL_STRING' === $macro ? '"'.$value.'"' : $value; - } - - $output = $macro.'('.$variableName.', '.$value.');'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - protected function returnHelper(string $macro, $value, CompilationContext $context, $useCodePrinter, $doCopy = null): string - { - if ($value instanceof Variable) { - $value = $value->getName(); - } elseif ($macro === 'RETURN_MM_STRING' && !preg_match('/^ZEPHIR_GLOBAL/', $value)) { - $value = '"'.$value.'"'; - } - - $copyStr = ''; - if (true === $doCopy) { - $copyStr = ', 1'; - } elseif (false === $doCopy) { - $copyStr = ', 0'; - } elseif (isset($doCopy)) { - $copyStr = ', '.$doCopy; - } - - $output = $macro.'('.$value.$copyStr.');'; - if ($useCodePrinter) { - $context->codePrinter->output($output); - } - - return $output; - } - - /** - * Resolve expressions. - * - * @param CompiledExpression[]|string[] $offsetExprs - * @param CompilationContext $compilationContext - * - * @throws CompilerException - * - * @return array - */ - private function resolveOffsetExprs($offsetExprs, CompilationContext $compilationContext) - { - $keys = ''; - $offsetItems = []; - $numberParams = 0; - - foreach ($offsetExprs as $offsetExpr) { - if ('a' == $offsetExpr) { - $keys .= 'a'; - ++$numberParams; - continue; - } - switch ($offsetExpr->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $keys .= 'l'; - $offsetItems[] = $offsetExpr->getCode(); - ++$numberParams; - break; - - case 'string': - $keys .= 's'; - $offsetItems[] = 'SL("'.$offsetExpr->getCode().'")'; - $numberParams += 2; - break; - - case 'variable': - $variableIndex = $compilationContext->symbolTable->getVariableForRead( - $offsetExpr->getCode(), - $compilationContext, - null - ); - - switch ($variableIndex->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $keys .= 'l'; - $offsetItems[] = $this->getVariableCode($variableIndex); - ++$numberParams; - break; - case 'string': - case 'variable': - $keys .= 'z'; - $offsetItems[] = $this->getVariableCode($variableIndex); - ++$numberParams; - break; - default: - throw new CompilerException( - sprintf('Variable: %s cannot be used as array index', $variableIndex->getType()), - $offsetExpr->getOriginal() - ); - } - break; - - default: - throw new CompilerException( - sprintf('Value: %s cannot be used as array index', $offsetExpr->getType()), - $offsetExpr->getOriginal() - ); - } - } - - return [$keys, $offsetItems, $numberParams]; - } -} diff --git a/Library/BaseBackend.php b/Library/BaseBackend.php deleted file mode 100644 index 9a45e42db7..0000000000 --- a/Library/BaseBackend.php +++ /dev/null @@ -1,345 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -use Zephir\Fcall\FcallAwareInterface; -use Zephir\Fcall\FcallManagerInterface; - -abstract class BaseBackend implements FcallAwareInterface -{ - /** @var Config */ - protected $config; - - /** - * The name of the backend (e.g. ZendEngine2). - * - * @var string - */ - protected $name; - - /** @var FcallManagerInterface */ - protected $fcallManager; - - /** @var string */ - protected $kernelsPath; - - /** @var string */ - protected $templatesPath; - - /** - * BaseBackend constructor. - * - * @param Config $config - * @param string $kernelsPath - * @param string $templatesPath - */ - public function __construct(Config $config, $kernelsPath, $templatesPath) - { - $this->config = $config; - $this->kernelsPath = $kernelsPath; - $this->templatesPath = $templatesPath; - } - - public function getName() - { - return $this->name; - } - - /** - * Resolves the path to the source kernel files of the backend. - * - * @return string - */ - public function getInternalKernelPath(): string - { - return "$this->kernelsPath/{$this->name}"; - } - - /** - * Resolves the path to the source template files of the backend. - * - * @return string - */ - public function getInternalTemplatePath(): string - { - return "$this->templatesPath/{$this->name}"; - } - - /** - * Resolves the path to the source template file of the backend. - * - * @param string $filename - * - * @return string - */ - public function getTemplateFileContents(string $filename): string - { - $templatePath = rtrim((string) $this->config->get('templatepath', 'backend'), '\\/'); - if (empty($templatepath)) { - $templatePath = $this->templatesPath; - } - - return file_get_contents("{$templatePath}/{$this->name}/{$filename}"); - } - - /** - * @return StringsManager - */ - abstract public function getStringsManager(); - - abstract public function getTypeDefinition($type); - - /** - * Checks the type of a variable using the ZendEngine constants. - * - * @param Variable $variableVariable - * @param string $operator - * @param string $value - * @param CompilationContext $context - * - * @return string - */ - abstract public function getTypeofCondition( - Variable $variableVariable, - string $operator, - string $value, - CompilationContext $context - ): string; - - /** - * Initialize variable defaults. - * - * @param Variable[] $variables - * @param CompilationContext $context - * - * @return string - */ - abstract public function initializeVariableDefaults(array $variables, CompilationContext $context): string; - - abstract public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable); - - /** - * Returns the signature of an internal method. - * - * @param ClassMethod $method - * @param CompilationContext $context - * - * @return string - */ - abstract public function getInternalSignature(ClassMethod $method, CompilationContext $context): string; - - abstract public function checkStrictType($type, $var, CompilationContext $context); - - abstract public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true); - - /** - * Creates a temporary variable to be used to point to a heap variable. - * - * @param string $type - * @param CompilationContext $compilationContext - * @param bool $isLocal - * - * @return Variable - */ - abstract public function getScalarTempVariable( - string $type, - CompilationContext $compilationContext, - $isLocal = true - ): Variable; - - abstract public function declareConstant($type, $name, $value, CompilationContext $context); - - /** - * Assign value to variable. - * - * @param Variable $variable - * @param string|Variable|null $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string - */ - abstract public function assignString( - Variable $variable, - $value, - CompilationContext $context, - bool $useCodePrinter = true - ): string; - - abstract public function assignLong(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignDouble(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignBool(Variable $variable, $value, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignNull(Variable $variable, CompilationContext $context, $useCodePrinter = true); - - abstract public function assignZval(Variable $variable, $code, CompilationContext $context); - - abstract public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context); - - abstract public function returnString($value, CompilationContext $context, $useCodePrinter = true); - - /** - * Generate the code to initialize array typed variable. - * - * @param Variable $variable - * @param CompilationContext $context - * @param int $size - * - * @return void - */ - abstract public function initArray(Variable $variable, CompilationContext $context, int $size = null); - - abstract public function createClosure(Variable $variable, $classDefinition, CompilationContext $context); - - abstract public function addArrayEntry(Variable $variable, $key, $value, CompilationContext $context, $statement = null, $useCodePrinter = true); - - abstract public function updateArray(Variable $symbolVariable, $key, $value, CompilationContext $compilationContext, $flags = null); - - abstract public function initObject(Variable $variable, $ce, CompilationContext $context, $useCodePrinter = true); - - abstract public function initVar(Variable $variable, CompilationContext $context, $useCodePrinter = true, $second = false); - - abstract public function zvalOperator($zvalOperator, Variable $expected, Variable $variableLeft, Variable $variableRight, CompilationContext $compilationContext); - - abstract public function fetchGlobal(Variable $globalVar, CompilationContext $compilationContext, $useCodePrinter = true); - - abstract public function fetchClass(Variable $var, $name, $guarded, CompilationContext $context); - - /** - * Fetch object's property. - * - * @param Variable $symbolVariable - * @param Variable $variableVariable - * @param Variable|string $property - * @param bool $readOnly - * @param CompilationContext $context - */ - abstract public function fetchProperty( - Variable $symbolVariable, - Variable $variableVariable, - $property, - $readOnly, - CompilationContext $context - ); - - abstract public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context); - - /** - * Update object property. - * - * object->property = value - * - * @param Variable $variable - * @param string|Variable $property - * @param mixed $value - * @param CompilationContext $context - * - * @return void - */ - abstract public function updateProperty(Variable $variable, $property, $value, CompilationContext $context); - - abstract public function updateStaticProperty($classEntry, $property, $value, CompilationContext $context); - - abstract public function addStaticProperty($classEntry, $property, $value, CompilationContext $context); - - abstract public function subStaticProperty($classEntry, $property, $value, CompilationContext $context); - - abstract public function assignArrayProperty(Variable $variable, $property, $key, $value, CompilationContext $context); - - abstract public function checkConstructor(Variable $var, CompilationContext $context); - - /* Method calling */ - abstract public function callDynamicFunction($symbolVariable, Variable $variable, CompilationContext $compilationContext, $params = [], $cache = 'NULL', $cacheSlot = 0); - - abstract public function callMethod($symbolVariable, Variable $variable, $methodName, $cachePointer, $params, CompilationContext $context); - - /* Read from array */ - abstract public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayAccess, CompilationContext $context, $useCodePrinter = true); - - abstract public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context); - - abstract public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context); - - abstract public function propertyIsset(Variable $var, $key, CompilationContext $context); - - /* Unset array */ - abstract public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context); - - /* Array update multi */ - abstract public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $context); - - abstract public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $context); - - abstract public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext); - - abstract public function maybeSeparate(Variable $variableTempSeparated, Variable $variable, CompilationContext $context); - - abstract public function setSymbolIfSeparated(Variable $variableTempSeparated, Variable $variable, CompilationContext $context); - - abstract public function fetchClassEntry($str); - - abstract public function copyOnWrite(Variable $target, $var, CompilationContext $context); - - abstract public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $onlyBody = false, $useCodePrinter = true); - - /* For statement */ - abstract public function forStatement(Variable $exprVariable, $keyVariable, $variable, $duplicateKey, $duplicateHash, $statement, $statementBlock, CompilationContext $context); - - abstract public function forStatementIterator(Variable $iteratorVariable, Variable $targetVariable, CompilationContext $compilationContext); - - abstract public function destroyIterator(Variable $iteratorVariable, CompilationContext $context); - - abstract public function onPreInitVar(ClassMethod $method, CompilationContext $context): string; - - abstract public function onPreCompile(ClassMethod $method, CompilationContext $context); - - abstract public function onPostCompile(ClassMethod $method, CompilationContext $context); - - /** - * @param Variable $variable - * - * @return string - */ - abstract public function getVariableCode(Variable $variable): string; - - /** - * Get a double pointer to the variable. - * - * @param Variable $variable - * - * @return string - */ - abstract public function getVariableCodePointer(Variable $variable); - - abstract public function resolveValue($value, CompilationContext $context, $usePointer = false); - - public static function getActiveBackend() - { - if (version_compare(PHP_VERSION, '7.0', '>=')) { - return 'ZendEngine3'; - } - - return 'ZendEngine2'; - } - - /** - * {@inheritdoc} - * - * @param FcallManagerInterface $fcallManager - */ - public function setFcallManager(FcallManagerInterface $fcallManager) - { - $this->fcallManager = $fcallManager; - } -} diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 95dd041ed2..1e839ce79d 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -14,6 +14,7 @@ namespace Zephir; use Psr\Log\LoggerInterface; +use Zephir\Backend\Backend; use Zephir\Cache\FunctionCache; use Zephir\Exception\CompilerException; use Zephir\Passes\StaticTypeInference; @@ -179,9 +180,9 @@ class CompilationContext /** * The current backend. * - * @var BaseBackend|null + * @var Backend|null */ - public ?BaseBackend $backend = null; + public ?Backend $backend = null; /** * Transform class/interface name to FQN format. diff --git a/Library/Compiler.php b/Library/Compiler.php index 1c4f125138..dfb978150d 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -19,6 +19,8 @@ use RecursiveDirectoryIterator; use RecursiveIteratorIterator; use ReflectionException; +use Zephir\Backend\Backend; +use Zephir\Backend\StringsManager; use Zephir\Code\Builder\Struct; use Zephir\Compiler\CompilerFileFactory; use Zephir\Compiler\FileInterface; @@ -30,13 +32,11 @@ use Zephir\Exception\RuntimeException; use Zephir\Fcall\FcallManagerInterface; use Zephir\FileSystem\FileSystemInterface; - use function count; use function dirname; use function extension_loaded; use function is_array; use function is_string; - use const DIRECTORY_SEPARATOR; final class Compiler @@ -44,9 +44,9 @@ final class Compiler use LoggerAwareTrait; /** - * @var BaseBackend + * @var Backend */ - public BaseBackend $backend; + public Backend $backend; /** * @var FunctionDefinition[] @@ -151,7 +151,7 @@ final class Compiler * Compiler constructor. * * @param Config $config - * @param BaseBackend $backend + * @param Backend $backend * @param Parser\Manager $manager * @param FileSystemInterface $filesystem * @param CompilerFileFactory $compilerFileFactory @@ -160,7 +160,7 @@ final class Compiler */ public function __construct( Config $config, - BaseBackend $backend, + Backend $backend, Parser\Manager $manager, FileSystemInterface $filesystem, CompilerFileFactory $compilerFileFactory @@ -172,7 +172,7 @@ public function __construct( $this->compilerFileFactory = $compilerFileFactory; $this->logger = new NullLogger(); - $this->stringManager = $this->backend->getStringsManager(); + $this->stringManager = new StringsManager(); $this->fcallManager = $this->backend->getFcallManager(); try { diff --git a/Library/Console/Command/ApiCommand.php b/Library/Console/Command/ApiCommand.php index e19477ac6b..578ff463dc 100644 --- a/Library/Console/Command/ApiCommand.php +++ b/Library/Console/Command/ApiCommand.php @@ -99,13 +99,6 @@ protected function createDefinition(): InputDefinition { return new InputDefinition( [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to generate HTML API for the extension', - 'ZendEngine3' - ), new InputOption( 'path', 'p', diff --git a/Library/Console/Command/BuildCommand.php b/Library/Console/Command/BuildCommand.php index 6d45ca491c..a7f10a0aac 100644 --- a/Library/Console/Command/BuildCommand.php +++ b/Library/Console/Command/BuildCommand.php @@ -47,7 +47,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $arguments = [ 'command' => 'generate', - '--backend' => $input->getOption('backend'), ]; try { @@ -64,7 +63,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $arguments = [ 'command' => 'compile', - '--backend' => $input->getOption('backend'), '--dev' => $this->isDevelopmentModeEnabled($input), ]; @@ -96,17 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function createDefinition(): InputDefinition { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to build extension', - 'ZendEngine3' - ), - ] - ); + return new InputDefinition([]); } /** diff --git a/Library/Console/Command/CompileCommand.php b/Library/Console/Command/CompileCommand.php index c53372f917..d5e7bcf695 100644 --- a/Library/Console/Command/CompileCommand.php +++ b/Library/Console/Command/CompileCommand.php @@ -73,17 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int protected function createDefinition(): InputDefinition { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to compile extension', - 'ZendEngine3' - ), - ] - ); + return new InputDefinition([]); } /** diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index 8ca92df7e3..a05cd17d86 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -13,7 +13,6 @@ namespace Zephir\Console\Command; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -48,7 +47,6 @@ protected function configure() $this ->setName('generate') ->setDescription('Generates C code from the Zephir code without compiling it') - ->setDefinition($this->createDefinition()) ->addOption('trace', 't', InputOption::VALUE_NONE, 'Show trace message output (in case of exception error)') ->setHelp(sprintf('%s.', $this->getDescription()).PHP_EOL.PHP_EOL.$this->getZflagsHelp()); } @@ -101,19 +99,4 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - - protected function createDefinition(): InputDefinition - { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to generate extension', - 'ZendEngine3' - ), - ] - ); - } } diff --git a/Library/Console/Command/InitCommand.php b/Library/Console/Command/InitCommand.php index 63f1bf2105..ccda306918 100644 --- a/Library/Console/Command/InitCommand.php +++ b/Library/Console/Command/InitCommand.php @@ -21,7 +21,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Zephir\BaseBackend; +use Zephir\Backend\Backend; use Zephir\Config; use function chdir; @@ -30,7 +30,6 @@ use function is_readable; use function mkdir; use function preg_match; - use const DIRECTORY_SEPARATOR; /** @@ -40,11 +39,11 @@ */ final class InitCommand extends AbstractCommand { - private BaseBackend $backend; + private Backend $backend; private Config $config; private LoggerInterface $logger; - public function __construct(BaseBackend $backend, Config $config, LoggerInterface $logger) + public function __construct(Backend $backend, Config $config, LoggerInterface $logger) { $this->backend = $backend; $this->config = $config; @@ -53,7 +52,7 @@ public function __construct(BaseBackend $backend, Config $config, LoggerInterfac parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('init') @@ -62,7 +61,7 @@ protected function configure() ->setHelp(sprintf('%s.', $this->getDescription())); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $namespace = $this->sanitizeNamespace($input->getArgument('namespace')); @@ -87,7 +86,6 @@ protected function execute(InputInterface $input, OutputInterface $output) // Copy the latest kernel files $this->recursiveProcess($this->backend->getInternalKernelPath(), 'ext/kernel'); - // Dump initial configuration on project creation $this->config->dumpToFile(); @@ -103,13 +101,6 @@ protected function createDefinition(): InputDefinition InputArgument::REQUIRED, 'The extension namespace' ), - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to create extension', - 'ZendEngine3' - ), ] ); } @@ -139,9 +130,9 @@ private function sanitizeNamespace(string $namespace): string * @param string|null $pattern * @param string $callback * - * @return bool + * @return void */ - private function recursiveProcess(string $src, string $dst, ?string $pattern = null, string $callback = 'copy'): bool + private function recursiveProcess(string $src, string $dst, ?string $pattern = null, string $callback = 'copy'): void { $success = true; $iterator = new DirectoryIterator($src); @@ -167,7 +158,5 @@ private function recursiveProcess(string $src, string $dst, ?string $pattern = n $success = $success && $callback($pathName, $path); } } - - return $success; } } diff --git a/Library/Console/Command/StubsCommand.php b/Library/Console/Command/StubsCommand.php index 6e0d6602ae..3613595b4a 100644 --- a/Library/Console/Command/StubsCommand.php +++ b/Library/Console/Command/StubsCommand.php @@ -15,7 +15,6 @@ use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zephir\Compiler; @@ -66,16 +65,6 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function createDefinition(): InputDefinition { - return new InputDefinition( - [ - new InputOption( - 'backend', - null, - InputOption::VALUE_REQUIRED, - 'Used backend to generate stubs for the extension', - 'ZendEngine3' - ), - ] - ); + return new InputDefinition([]); } } diff --git a/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php b/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php index e1031cf49a..102130fd20 100644 --- a/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php +++ b/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php @@ -64,11 +64,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } $symbol = $context->backend->getVariableCode($symbolVariable); - if ('ZendEngine2' == $context->backend->getName()) { - $context->codePrinter->output('zephir_stripcslashes('.$symbol.', '.$resolvedParams[0].');'); - } else { - $context->codePrinter->output('zephir_stripcslashes('.$symbol.', '.$resolvedParams[0].');'); - } + $context->codePrinter->output('zephir_stripcslashes('.$symbol.', '.$resolvedParams[0].');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/Library/Optimizers/FunctionCall/StripslashesOptimizer.php b/Library/Optimizers/FunctionCall/StripslashesOptimizer.php index 1095fe306b..6bf84bbce6 100644 --- a/Library/Optimizers/FunctionCall/StripslashesOptimizer.php +++ b/Library/Optimizers/FunctionCall/StripslashesOptimizer.php @@ -63,11 +63,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } $symbol = $context->backend->getVariableCode($symbolVariable); - if ('ZendEngine2' == $context->backend->getName()) { - $context->codePrinter->output('zephir_stripslashes('.$symbol.', '.$resolvedParams[0].');'); - } else { - $context->codePrinter->output('zephir_stripslashes('.$symbol.', '.$resolvedParams[0].');'); - } + $context->codePrinter->output('zephir_stripslashes('.$symbol.', '.$resolvedParams[0].');'); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } diff --git a/kernels/ZendEngine3/README.md b/kernel/README.md old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/README.md rename to kernel/README.md diff --git a/kernels/ZendEngine3/array.c b/kernel/array.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/array.c rename to kernel/array.c diff --git a/kernels/ZendEngine3/array.h b/kernel/array.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/array.h rename to kernel/array.h diff --git a/kernels/ZendEngine3/backtrace.c b/kernel/backtrace.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/backtrace.c rename to kernel/backtrace.c diff --git a/kernels/ZendEngine3/backtrace.h b/kernel/backtrace.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/backtrace.h rename to kernel/backtrace.h diff --git a/kernels/ZendEngine3/debug.c b/kernel/debug.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/debug.c rename to kernel/debug.c diff --git a/kernels/ZendEngine3/debug.h b/kernel/debug.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/debug.h rename to kernel/debug.h diff --git a/kernels/ZendEngine3/exception.c b/kernel/exception.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/exception.c rename to kernel/exception.c diff --git a/kernels/ZendEngine3/exception.h b/kernel/exception.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/exception.h rename to kernel/exception.h diff --git a/kernels/ZendEngine3/exit.c b/kernel/exit.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/exit.c rename to kernel/exit.c diff --git a/kernels/ZendEngine3/exit.h b/kernel/exit.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/exit.h rename to kernel/exit.h diff --git a/kernels/ZendEngine3/fcall.c b/kernel/fcall.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/fcall.c rename to kernel/fcall.c diff --git a/kernels/ZendEngine3/fcall.h b/kernel/fcall.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/fcall.h rename to kernel/fcall.h diff --git a/kernels/ZendEngine3/file.c b/kernel/file.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/file.c rename to kernel/file.c diff --git a/kernels/ZendEngine3/file.h b/kernel/file.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/file.h rename to kernel/file.h diff --git a/kernels/ZendEngine3/filter.c b/kernel/filter.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/filter.c rename to kernel/filter.c diff --git a/kernels/ZendEngine3/filter.h b/kernel/filter.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/filter.h rename to kernel/filter.h diff --git a/kernels/ZendEngine3/globals.h b/kernel/globals.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/globals.h rename to kernel/globals.h diff --git a/kernels/ZendEngine3/iterator.c b/kernel/iterator.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/iterator.c rename to kernel/iterator.c diff --git a/kernels/ZendEngine3/iterator.h b/kernel/iterator.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/iterator.h rename to kernel/iterator.h diff --git a/kernels/ZendEngine3/main.c b/kernel/main.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/main.c rename to kernel/main.c diff --git a/kernels/ZendEngine3/main.h b/kernel/main.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/main.h rename to kernel/main.h diff --git a/kernels/ZendEngine3/math.c b/kernel/math.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/math.c rename to kernel/math.c diff --git a/kernels/ZendEngine3/math.h b/kernel/math.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/math.h rename to kernel/math.h diff --git a/kernels/ZendEngine3/memory.c b/kernel/memory.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/memory.c rename to kernel/memory.c diff --git a/kernels/ZendEngine3/memory.h b/kernel/memory.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/memory.h rename to kernel/memory.h diff --git a/kernels/ZendEngine3/object.c b/kernel/object.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/object.c rename to kernel/object.c diff --git a/kernels/ZendEngine3/object.h b/kernel/object.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/object.h rename to kernel/object.h diff --git a/kernels/ZendEngine3/operators.c b/kernel/operators.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/operators.c rename to kernel/operators.c diff --git a/kernels/ZendEngine3/operators.h b/kernel/operators.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/operators.h rename to kernel/operators.h diff --git a/kernels/ZendEngine3/require.c b/kernel/require.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/require.c rename to kernel/require.c diff --git a/kernels/ZendEngine3/require.h b/kernel/require.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/require.h rename to kernel/require.h diff --git a/kernels/ZendEngine3/string.c b/kernel/string.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/string.c rename to kernel/string.c diff --git a/kernels/ZendEngine3/string.h b/kernel/string.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/string.h rename to kernel/string.h diff --git a/kernels/ZendEngine3/time.c b/kernel/time.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/time.c rename to kernel/time.c diff --git a/kernels/ZendEngine3/time.h b/kernel/time.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/time.h rename to kernel/time.h diff --git a/kernels/ZendEngine3/variables.c b/kernel/variables.c old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/variables.c rename to kernel/variables.c diff --git a/kernels/ZendEngine3/variables.h b/kernel/variables.h old mode 100755 new mode 100644 similarity index 100% rename from kernels/ZendEngine3/variables.h rename to kernel/variables.h diff --git a/templates/ZendEngine3/clean b/templates/engine/clean similarity index 100% rename from templates/ZendEngine3/clean rename to templates/engine/clean diff --git a/templates/ZendEngine3/config.m4 b/templates/engine/config.m4 similarity index 100% rename from templates/ZendEngine3/config.m4 rename to templates/engine/config.m4 diff --git a/templates/ZendEngine3/config.w32 b/templates/engine/config.w32 similarity index 100% rename from templates/ZendEngine3/config.w32 rename to templates/engine/config.w32 diff --git a/templates/ZendEngine3/ext.h b/templates/engine/ext.h similarity index 100% rename from templates/ZendEngine3/ext.h rename to templates/engine/ext.h diff --git a/templates/ZendEngine3/ext_config.h b/templates/engine/ext_config.h similarity index 100% rename from templates/ZendEngine3/ext_config.h rename to templates/engine/ext_config.h diff --git a/templates/ZendEngine3/install b/templates/engine/install similarity index 100% rename from templates/ZendEngine3/install rename to templates/engine/install diff --git a/templates/ZendEngine3/php_ext.h b/templates/engine/php_ext.h similarity index 100% rename from templates/ZendEngine3/php_ext.h rename to templates/engine/php_ext.h diff --git a/templates/ZendEngine3/php_project.h b/templates/engine/php_project.h similarity index 100% rename from templates/ZendEngine3/php_project.h rename to templates/engine/php_project.h diff --git a/templates/ZendEngine3/pkg-config-check.m4 b/templates/engine/pkg-config-check.m4 similarity index 100% rename from templates/ZendEngine3/pkg-config-check.m4 rename to templates/engine/pkg-config-check.m4 diff --git a/templates/ZendEngine3/pkg-config.m4 b/templates/engine/pkg-config.m4 similarity index 100% rename from templates/ZendEngine3/pkg-config.m4 rename to templates/engine/pkg-config.m4 diff --git a/templates/ZendEngine3/project.c b/templates/engine/project.c similarity index 100% rename from templates/ZendEngine3/project.c rename to templates/engine/project.c diff --git a/templates/ZendEngine3/project.h b/templates/engine/project.h similarity index 100% rename from templates/ZendEngine3/project.h rename to templates/engine/project.h diff --git a/tests/Zephir/Backends/ZendEngine3/BackendTest.php b/tests/Zephir/Backends/ZendEngine3/BackendTest.php index 41b8b6fd29..bd5bbd39df 100644 --- a/tests/Zephir/Backends/ZendEngine3/BackendTest.php +++ b/tests/Zephir/Backends/ZendEngine3/BackendTest.php @@ -14,7 +14,7 @@ namespace Zephir\Test\Backends\ZendEngine3; use PHPUnit\Framework\TestCase; -use Zephir\Backends\ZendEngine3\Backend; +use Zephir\Backend\Backend; use Zephir\CompilationContext; use Zephir\Config; use Zephir\Variable; diff --git a/tests/Zephir/CompilerFile/CheckDependenciesTest.php b/tests/Zephir/CompilerFile/CheckDependenciesTest.php index 1201582e70..14175745f0 100644 --- a/tests/Zephir/CompilerFile/CheckDependenciesTest.php +++ b/tests/Zephir/CompilerFile/CheckDependenciesTest.php @@ -17,7 +17,7 @@ use Psr\Log\Test\TestLogger; use ReflectionException; use Zephir\AliasManager; -use Zephir\Backends\ZendEngine3\Backend; +use Zephir\Backend\Backend; use Zephir\Compiler; use Zephir\CompilerFile; use Zephir\Config; @@ -34,7 +34,7 @@ public function testExtendsClassThatDoesNotExist(): void { $logger = new TestLogger(); $config = new Config(); - $backend = new Backend($config, 'kernels', 'templates'); + $backend = new Backend($config, 'kernel', 'templates'); $disk = new HardDisk(realpath('..').'/tests/output'); $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); diff --git a/tests/sharness/t0002-generate.sh b/tests/sharness/t0002-generate.sh index 651f4ccb2a..fff3dddc4f 100755 --- a/tests/sharness/t0002-generate.sh +++ b/tests/sharness/t0002-generate.sh @@ -9,7 +9,7 @@ source ./setup.sh test_expect_success "Should correctly specify ARGINFO" " cd $FIXTURESDIR/typehints && zephirc fullclean 2>&1 >/dev/null && - zephirc generate --backend=ZendEngine3 2>&1 >/dev/null && + zephirc generate 2>&1 >/dev/null && test_cmp ext/typehints.c expected3.c && test_cmp ext/typehints/args.zep.h expected_args3.h && test_cmp ext/typehints/retval.zep.h expected_retval3.h && @@ -19,7 +19,7 @@ test_expect_success "Should correctly specify ARGINFO" " test_expect_success "Life Cycle Test" " cd $FIXTURESDIR/lifecycle && zephirc fullclean 2>&1 >/dev/null && - zephirc generate --backend=ZendEngine3 2>&1 >/dev/null && + zephirc generate 2>&1 >/dev/null && test_cmp ext/lifecycle.c expected3.c " @@ -27,7 +27,7 @@ test_expect_success "Life Cycle Test" " test_expect_success "Should generate valid code with inheritance of prototype interfaces" " cd $FIXTURESDIR/protodir && zephirc fullclean 2>&1 >/dev/null && - zephirc generate --backend=ZendEngine3 2>&1 >/dev/null && + zephirc generate 2>&1 >/dev/null && test_cmp ext/protodir/connectionexception.zep.h connectionexception.h " diff --git a/zephir b/zephir index 22e654a3db..76e90909f4 100755 --- a/zephir +++ b/zephir @@ -14,7 +14,7 @@ declare(strict_types=1); use Monolog\Handler\StreamHandler; use Monolog\Logger; -use Zephir\Backends\BackendFactory; +use Zephir\Backend\Backend; use Zephir\Compiler; use Zephir\Config; use Zephir\Console\Application; @@ -107,8 +107,7 @@ $logger = new Logger('zephir', [ $consoleStdOutHandler, ]); $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); -$backend = (new BackendFactory($config, $rootPath.'/kernels', $rootPath.'/templates')) - ->createBackend(); +$backend = new Backend($config, $rootPath.'/kernel', $rootPath.'/templates'); $compiler = new Compiler($config, $backend, new Manager($parser), $disk, $compilerFactory); $compiler->setPrototypesPath($rootPath.'/prototypes'); From e9a8831f3d3360c6a8baffedee3ea3504a7df6f1 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 13:55:27 +0100 Subject: [PATCH 023/375] #2407 - Adjust test case --- tests/Zephir/Backends/ZendEngine3/BackendTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Zephir/Backends/ZendEngine3/BackendTest.php b/tests/Zephir/Backends/ZendEngine3/BackendTest.php index bd5bbd39df..dbe6ce76ca 100644 --- a/tests/Zephir/Backends/ZendEngine3/BackendTest.php +++ b/tests/Zephir/Backends/ZendEngine3/BackendTest.php @@ -41,7 +41,7 @@ public function stringDataProvider(): array */ public function testShouldEscapeStringWithRegexp(string $testString, string $expectedString): void { - $backend = new Backend(new Config(), null, null); + $backend = new Backend(new Config(), '', ''); $variable = new Variable('variable', 'name'); $context = new CompilationContext(); From 0c1d61e28b53107182fb7e03ef2a2ca03ca7a083 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Thu, 31 Aug 2023 14:12:02 +0100 Subject: [PATCH 024/375] #2407 - Remove wrapped method `getVariableCodePointer()` --- Library/Backend/Backend.php | 36 +++++++------------ Library/FunctionCall.php | 2 +- Library/MethodCall.php | 2 +- Library/Operators/Other/FetchOperator.php | 4 +-- .../Operators/Other/RequireOnceOperator.php | 2 +- Library/Operators/Other/RequireOperator.php | 2 +- .../FunctionCall/StrReplaceOptimizer.php | 2 +- .../FunctionCall/VarDumpOptimizer.php | 2 +- .../FunctionCall/VarExportOptimizer.php | 2 +- Library/StaticCall.php | 8 ++--- 10 files changed, 25 insertions(+), 37 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 45e2442e75..767647f547 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -33,8 +33,6 @@ class Backend protected FcallManagerInterface $fcallManager; /** - * BaseBackend constructor. - * * @param Config $config * @param string $kernelsPath * @param string $templatesPath @@ -135,16 +133,6 @@ public function getVariableCode(Variable $variable): string return '&'.$variable->getName(); } - /** - * {@inheritdoc} - * - * TODO: Do we need this method at all? - */ - public function getVariableCodePointer(Variable $variable) - { - return $this->getVariableCode($variable); - } - /** * {@inheritdoc} */ @@ -800,7 +788,7 @@ public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, public function arrayIssetFetch2(Variable $target, Variable $var, $resolvedExpr, $flags, $expression, CompilationContext $context) { - $code = $this->getVariableCodePointer($target).', '.$this->getVariableCode($var); + $code = $this->getVariableCode($target).', '.$this->getVariableCode($var); if (!($resolvedExpr instanceof Variable)) { if ('string' === $resolvedExpr->getType()) { @@ -829,7 +817,7 @@ public function propertyIsset(Variable $var, $key, CompilationContext $context) public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context) { $context->headersManager->add('kernel/array'); - $variableCode = $this->getVariableCodePointer($variable); + $variableCode = $this->getVariableCode($variable); if ('string' == $exprIndex->getType()) { $context->codePrinter->output('zephir_array_unset_string('.$variableCode.', SL("'.$exprIndex->getCode().'"), '.$flags.');'); @@ -842,7 +830,7 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo public function arrayUnset2(Variable $variable, $exprIndex, $flags, CompilationContext $context) { $context->headersManager->add('kernel/array'); - $variableCode = $this->getVariableCodePointer($variable); + $variableCode = $this->getVariableCode($variable); switch ($exprIndex->getType()) { case 'int': case 'uint': @@ -1379,7 +1367,7 @@ public function initArray(Variable $variable, CompilationContext $context, ?int public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context) { - $variable = $this->getVariableCodePointer($variable); + $variable = $this->getVariableCode($variable); $itemVariable = $this->getVariableCode($itemVariable); $context->codePrinter->output('zephir_concat_self('.$variable.', '.$itemVariable.');'); } @@ -1395,13 +1383,13 @@ public function updateArray(Variable $symbolVariable, $key, $value, CompilationC switch ($key->getType()) { case 'string': case 'variable': - $compilationContext->codePrinter->output('zephir_array_update_zval('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($key).', '.$value.', '.$flags.');'); + $compilationContext->codePrinter->output('zephir_array_update_zval('.$this->getVariableCode($symbolVariable).', '.$this->getVariableCode($key).', '.$value.', '.$flags.');'); break; case 'int': case 'uint': case 'long': - $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getName().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); + $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCode($symbolVariable).', '.$key->getName().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); break; default: @@ -1410,11 +1398,11 @@ public function updateArray(Variable $symbolVariable, $key, $value, CompilationC } elseif ($key instanceof CompiledExpression) { switch ($key->getType()) { case 'string': - $compilationContext->codePrinter->output('zephir_array_update_string('.$this->getVariableCodePointer($symbolVariable).', SL("'.$key->getCode().'"), '.$value.', '.$flags.');'); + $compilationContext->codePrinter->output('zephir_array_update_string('.$this->getVariableCode($symbolVariable).', SL("'.$key->getCode().'"), '.$value.', '.$flags.');'); break; case 'int': - $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCodePointer($symbolVariable).', '.$key->getCode().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); + $compilationContext->codePrinter->output('zephir_array_update_long('.$this->getVariableCode($symbolVariable).', '.$key->getCode().', '.$value.', '.$flags.' ZEPHIR_DEBUG_PARAMS_DUMMY);'); break; case 'variable': @@ -1471,7 +1459,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA ); } 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'].');'; + $output = 'zephir_array_fetch('.$this->getVariableCode($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; } else { if ($isVariable) { $indexAccess = $this->getVariableCode($index); @@ -1481,7 +1469,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA $indexAccess = 'SL("'.$indexAccess.'")'; } } - $output = 'zephir_array_fetch_'.$type.'('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$indexAccess.', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; + $output = 'zephir_array_fetch_'.$type.'('.$this->getVariableCode($var).', '.$this->getVariableCode($src).', '.$indexAccess.', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; } if ($useCodePrinter) { @@ -1496,7 +1484,7 @@ public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExp list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); $symbol = $this->resolveValue($symbolVariable, $compilationContext, true); - $varCode = $this->getVariableCodePointer($variable); + $varCode = $this->getVariableCode($variable); $compilationContext->codePrinter->output( sprintf( 'zephir_array_update_multi(%s, %s, SL("%s"), %d, %s);', @@ -1559,7 +1547,7 @@ public function callDynamicFunction($symbolVariable, Variable $variable, Compila } elseif ('return_value' == $symbolVariable->getName()) { $context->codePrinter->output('ZEPHIR_RETURN_CALL_ZVAL_FUNCTION('.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); } else { - $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION('.$this->getVariableCodePointer($symbolVariable).', '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); + $context->codePrinter->output('ZEPHIR_CALL_ZVAL_FUNCTION('.$this->getVariableCode($symbolVariable).', '.$this->getVariableCode($variable).', '.$cache.', '.$cacheSlot.$paramStr.');'); } } diff --git a/Library/FunctionCall.php b/Library/FunctionCall.php index 61f418f23f..f6ea9c2887 100644 --- a/Library/FunctionCall.php +++ b/Library/FunctionCall.php @@ -443,7 +443,7 @@ protected function _callNormal(array $expression, CompilationContext $compilatio * We don't know the exact dynamic type returned by the method call */ $symbolVariable->setDynamicTypes('undefined'); - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } /** diff --git a/Library/MethodCall.php b/Library/MethodCall.php index 66ae65c099..47995a1653 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -746,7 +746,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext } else { //TODO: also move to backend if ($isExpecting) { - $symbolCode = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbolCode = $compilationContext->backend->getVariableCode($symbolVariable); } $variableCode = $compilationContext->backend->getVariableCode($variableVariable); $paramCount = \count($params); diff --git a/Library/Operators/Other/FetchOperator.php b/Library/Operators/Other/FetchOperator.php index 4bb93c1f57..b5076c3057 100644 --- a/Library/Operators/Other/FetchOperator.php +++ b/Library/Operators/Other/FetchOperator.php @@ -136,7 +136,7 @@ public function compile(array $expression, CompilationContext $compilationContex $property = $expression['right']['right']['value']; $compilationContext->headersManager->add('kernel/object'); - $symbol = $compilationContext->backend->getVariableCodePointer($variable); + $symbol = $compilationContext->backend->getVariableCode($variable); $evalSymbol = $compilationContext->backend->getVariableCode($evalVariable); return new CompiledExpression('bool', 'zephir_fetch_property('.$symbol.', '.$evalSymbol.', SL("'.$property.'"), PH_SILENT_CC)', $expression); @@ -178,7 +178,7 @@ public function compile(array $expression, CompilationContext $compilationContex $compilationContext->headersManager->add('kernel/object'); - $symbol = $compilationContext->backend->getVariableCodePointer($variable); + $symbol = $compilationContext->backend->getVariableCode($variable); $evalSymbol = $compilationContext->backend->getVariableCode($evalVariable); $evalPropertySymbol = $compilationContext->backend->getVariableCode($evalVariableProperty); diff --git a/Library/Operators/Other/RequireOnceOperator.php b/Library/Operators/Other/RequireOnceOperator.php index d68f38b7d2..a28c72e4c3 100644 --- a/Library/Operators/Other/RequireOnceOperator.php +++ b/Library/Operators/Other/RequireOnceOperator.php @@ -68,7 +68,7 @@ public function compile(array $expression, CompilationContext $compilationContex if ($symbolVariable) { $codePrinter->output('ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&'.$symbolVariable->getName().');'); - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); $codePrinter->output('if (zephir_require_once_zval_ret('.$symbol.', '.$exprVar.') == FAILURE) {'); } else { $codePrinter->output('if (zephir_require_once_zval('.$exprVar.') == FAILURE) {'); diff --git a/Library/Operators/Other/RequireOperator.php b/Library/Operators/Other/RequireOperator.php index 29ce296d2c..3f237536b1 100644 --- a/Library/Operators/Other/RequireOperator.php +++ b/Library/Operators/Other/RequireOperator.php @@ -68,7 +68,7 @@ public function compile(array $expression, CompilationContext $compilationContex if ($symbolVariable) { $codePrinter->output('ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&'.$symbolVariable->getName().');'); - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); $codePrinter->output('if (zephir_require_zval_ret('.$symbol.', '.$exprVar.') == FAILURE) {'); } else { $codePrinter->output('if (zephir_require_zval('.$exprVar.') == FAILURE) {'); diff --git a/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php b/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php index 4b6e666a1f..0e6535308e 100644 --- a/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php +++ b/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php @@ -70,7 +70,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } } - $symbol = $context->backend->getVariableCodePointer($symbolVariable); + $symbol = $context->backend->getVariableCode($symbolVariable); $context->codePrinter->output('zephir_fast_str_replace('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].', '.$resolvedParams[2].');'); diff --git a/Library/Optimizers/FunctionCall/VarDumpOptimizer.php b/Library/Optimizers/FunctionCall/VarDumpOptimizer.php index a628fedfee..2e3f204ab2 100644 --- a/Library/Optimizers/FunctionCall/VarDumpOptimizer.php +++ b/Library/Optimizers/FunctionCall/VarDumpOptimizer.php @@ -86,7 +86,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression); } - $symbol = $context->backend->getVariableCodePointer($variable); + $symbol = $context->backend->getVariableCode($variable); $context->codePrinter->output('zephir_var_dump('.$symbol.');'); } diff --git a/Library/Optimizers/FunctionCall/VarExportOptimizer.php b/Library/Optimizers/FunctionCall/VarExportOptimizer.php index bd92e6cab0..f99f0c3d4f 100644 --- a/Library/Optimizers/FunctionCall/VarExportOptimizer.php +++ b/Library/Optimizers/FunctionCall/VarExportOptimizer.php @@ -99,7 +99,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont */ $variable = $context->symbolTable->getVariableForRead($resolvedParam->getCode(), $context, $expression); } - $variableSymbol = $context->backend->getVariableCodePointer($variable); + $variableSymbol = $context->backend->getVariableCode($variable); /* * let a = var_export(val); diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 86329d27e8..38052a1682 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -301,7 +301,7 @@ protected function call( } if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } $paramCount = count($params); @@ -462,7 +462,7 @@ protected function callFromClass($methodName, array $expression, $symbolVariable } if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } $paramCount = count($params); @@ -556,7 +556,7 @@ protected function callFromDynamicClass($methodName, array $expression, $symbolV $classEntry = $classEntryVariable->getName(); if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } if (!count($params)) { @@ -652,7 +652,7 @@ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolV } if ($symbolVariable) { - $symbol = $compilationContext->backend->getVariableCodePointer($symbolVariable); + $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } if (!count($params)) { From 3d469651f3cc6e93567e163ef860dbe462bebab8 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 2 Sep 2023 20:17:33 +0100 Subject: [PATCH 025/375] #2407 - Mass code refactor and reformat --- Library/Backend/Backend.php | 91 +++------ Library/Backend/FcallManager.php | 8 +- Library/Backend/StringsManager.php | 10 +- Library/BranchManager.php | 29 ++- Library/CacheManager.php | 2 +- Library/Call.php | 10 +- Library/ClassMethod.php | 3 +- Library/CompilationContext.php | 6 +- Library/Console/Application.php | 14 +- Library/Console/Command/InitCommand.php | 1 - Library/Documentation.php | 6 +- Library/Documentation/Annotation.php | 13 +- Library/Documentation/Docblock.php | 12 +- Library/Documentation/File/IndexFile.php | 25 +-- Library/Documentation/File/NamespaceFile.php | 14 +- Library/Documentation/File/NamespacesFile.php | 23 +-- Library/Documentation/File/SourceFile.php | 15 +- Library/Documentation/NamespaceAccessor.php | 2 +- Library/Documentation/Template.php | 4 +- Library/Documentation/Theme.php | 21 -- .../Exception/ExceptionExtraAwareTrait.php | 3 - .../Exception/IllegalOperationException.php | 3 - Library/Exception/IllegalStateException.php | 3 - .../Exception/InvalidArgumentException.php | 3 - Library/Exception/InvalidCallException.php | 3 - Library/Exception/LogicException.php | 2 +- Library/Exception/NotImplementedException.php | 2 - Library/Exception/OutOfBoundsException.php | 20 -- Library/Exception/ParseException.php | 2 - Library/Exception/RuntimeException.php | 2 - .../Exception/UnknownPropertyException.php | 3 - Library/Exception/ValidationException.php | 19 -- .../Expression/Builder/AbstractBuilder.php | 3 - Library/Expression/Builder/BuilderFactory.php | 3 - .../Builder/Factory/OperatorsFactory.php | 9 +- .../Builder/Factory/StatementsFactory.php | 48 +---- .../Builder/Operators/AbstractOperator.php | 3 - .../Operators/AssignPropertyOperator.php | 20 +- .../Operators/AssignVariableOperator.php | 15 -- .../Builder/Operators/BinaryOperator.php | 2 - .../Builder/Operators/RawOperator.php | 3 - .../Builder/Operators/UnaryOperator.php | 2 - Library/Expression/Builder/RawExpression.php | 2 - .../Builder/Statements/AbstractStatement.php | 3 - .../Statements/CallFunctionStatement.php | 6 +- .../Statements/CallMethodStatement.php | 2 - .../Statements/CallStaticStatement.php | 2 - .../Builder/Statements/IfStatement.php | 2 - .../Builder/Statements/LetStatement.php | 2 - .../Builder/Statements/RawStatement.php | 3 - .../Builder/Statements/StatementsBlock.php | 2 - Library/Expression/NativeArray.php | 12 +- Library/Expression/NativeArrayAccess.php | 10 +- Library/Expression/PropertyAccess.php | 36 ++-- Library/Expression/PropertyDynamicAccess.php | 17 +- Library/Expression/Reference.php | 127 ++---------- Library/Expression/StaticConstantAccess.php | 88 ++++---- Library/Expression/StaticPropertyAccess.php | 53 ++--- Library/Fcall/FcallAwareInterface.php | 32 --- Library/Fcall/FcallManagerInterface.php | 5 - Library/LiteralCompiledExpression.php | 2 +- Library/MethodCall.php | 12 +- Library/Operators/AbstractOperator.php | 45 +++-- .../Comparison/ComparisonBaseOperator.php | 6 +- Library/Operators/Logical/AndOperator.php | 2 + Library/Operators/Other/CloneOperator.php | 1 - Library/Operators/Other/IssetOperator.php | 2 +- Library/Statements/ForStatement.php | 3 +- Library/Statements/IfStatement.php | 21 +- .../Let/ObjectPropertyArrayIndexAppend.php | 19 +- Library/Statements/ReturnStatement.php | 2 - Library/Statements/StatementAbstract.php | 39 +--- Library/Statements/SwitchStatement.php | 16 +- Library/Statements/ThrowStatement.php | 6 +- Library/Statements/TryCatchStatement.php | 19 +- Library/StaticCall.php | 25 +-- Library/Variable.php | 190 ++++++++---------- 77 files changed, 380 insertions(+), 916 deletions(-) delete mode 100644 Library/Exception/OutOfBoundsException.php delete mode 100644 Library/Exception/ValidationException.php delete mode 100644 Library/Fcall/FcallAwareInterface.php diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 767647f547..1b2687b174 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -26,6 +26,7 @@ use Zephir\Variable; use Zephir\Variable\Globals; +use function in_array; use function Zephir\add_slashes; class Backend @@ -74,10 +75,10 @@ public function getFcallManager(): FcallManagerInterface return $this->fcallManager; } - public function declareVariables($method, $typeToVariables, CompilationContext $compilationContext) + public function declareVariables($method, $typeToVariables) { $varInitCode = []; - $additionalCode = $method ? $this->onPreInitVar($method, $compilationContext) : ''; + $additionalCode = $method ? $this->onPreInitVar($method) : ''; foreach ($typeToVariables as $type => $variables) { list($pointer, $code) = $this->getTypeDefinition($type); @@ -119,24 +120,18 @@ public function initVar(Variable $variable, CompilationContext $context, $useCod return $code; } - /** - * {@inheritdoc} - */ public function getVariableCode(Variable $variable): string { if ($variable->isDoublePointer() || - \in_array($variable->getName(), ['this_ptr', 'return_value']) || - \in_array($variable->getType(), ['int', 'long'])) { + in_array($variable->getName(), ['this_ptr', 'return_value']) || + in_array($variable->getType(), ['int', 'long'])) { return $variable->getName(); } return '&'.$variable->getName(); } - /** - * {@inheritdoc} - */ - public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true) + public function getBoolCode(Variable $variable, CompilationContext $context, $useCodePrinter = true): string { $code = '(Z_TYPE_P('.$this->getVariableCode($variable).') == IS_TRUE)'; if ($useCodePrinter) { @@ -146,9 +141,6 @@ public function getBoolCode(Variable $variable, CompilationContext $context, $us return $code; } - /** - * {@inheritdoc} - */ public function getTypeDefinition($type): array { switch ($type) { @@ -252,12 +244,9 @@ public function getTypeDefinition($type): array } /** - * {@inheritdoc} - * * @param Variable $variableVariable * @param string $operator * @param string $value - * @param CompilationContext $context * * @throws CompilerException * @@ -267,7 +256,6 @@ public function getTypeofCondition( Variable $variableVariable, string $operator, string $value, - CompilationContext $context ): string { $variableName = $this->getVariableCode($variableVariable); @@ -319,10 +307,7 @@ public function getTypeofCondition( return $condition; } - /** - * {@inheritdoc} - */ - public function onPreInitVar(ClassMethod $method, CompilationContext $context): string + public function onPreInitVar(ClassMethod $method): string { if (!$method instanceof FunctionDefinition && !$method->isInternal()) { return "zval *this_ptr = getThis();\n"; //TODO: think about a better way to solve this. @@ -360,7 +345,7 @@ public function onPostCompile(ClassMethod $method, CompilationContext $context) public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) { - $isComplex = \in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); + $isComplex = in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); if ($isComplex && !$variable->isDoublePointer()) { /* && $variable->mustInitNull() */ $groupVariables[] = $variable->getName(); @@ -441,8 +426,6 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va } /** - * {@inheritdoc} - * * @param Variable[] $variables * @param CompilationContext $context * @@ -522,8 +505,6 @@ public function declareConstant($type, $name, $value, CompilationContext $contex } /** - * {@inheritdoc} - * * @param ClassMethod $method * @param CompilationContext $context * @@ -574,8 +555,6 @@ public function getInternalSignature(ClassMethod $method, CompilationContext $co } /** - * {@inheritdoc} - * * @param Variable $variable * @param string|Variable|null $value * @param CompilationContext $context @@ -617,7 +596,7 @@ public function assignZval(Variable $variable, $code, CompilationContext $contex } } - public function returnString($value, CompilationContext $context, $useCodePrinter = true, $doCopy = true) + public function returnString($value, CompilationContext $context, $useCodePrinter = true) { return $this->returnHelper('RETURN_MM_STRING', $value, $context, $useCodePrinter); } @@ -668,7 +647,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'; } } @@ -809,7 +788,7 @@ public function arrayIssetFetch2(Variable $target, Variable $var, $resolvedExpr, throw new CompilerException('arrayIssetFetch ['.$resolvedExpr->getType().']', $expression); } - public function propertyIsset(Variable $var, $key, CompilationContext $context) + public function propertyIsset(Variable $var, $key) { return new CompiledExpression('bool', 'zephir_isset_property('.$this->getVariableCode($var).', SL("'.$key.'"))', null); } @@ -893,8 +872,6 @@ public function fetchClass(Variable $zendClassEntry, $className, $guarded, Compi } /** - * {@inheritdoc} - * * @param Variable $symbolVariable * @param Variable $variableVariable * @param Variable|string $property @@ -1028,8 +1005,6 @@ public function resolveValue($value, CompilationContext $context): Variable|bool } /** - * {@inheritdoc} - * * @param Variable $variable * @param string|Variable $property * @param mixed $value @@ -1037,7 +1012,7 @@ public function resolveValue($value, CompilationContext $context): Variable|bool * * @return void */ - public function updateProperty(Variable $variable, $property, $value, CompilationContext $context) + public function updateProperty(Variable $variable, $property, $value, CompilationContext $context): void { $value = $this->resolveValue($value, $context); @@ -1094,7 +1069,7 @@ public function assignArrayProperty(Variable $variable, $property, $key, $value, } } - public function callMethod($symbolVariable, Variable $variable, $methodName, $cachePointer, $params, CompilationContext $context) + public function callMethod($symbolVariable, Variable $variable, $methodName, $cachePointer, $params, CompilationContext $context): void { $paramStr = null != $params ? ', '.implode(', ', $params) : ''; $macro = 'CALL_METHOD'; @@ -1104,6 +1079,7 @@ public function callMethod($symbolVariable, Variable $variable, $methodName, $ca } else { $methodName = '"'.$methodName.'"'; } + if (!isset($symbolVariable)) { $context->codePrinter->output('ZEPHIR_'.$macro.'(NULL, '.$this->getVariableCode($variable).', '.$methodName.', '.$cachePointer.$paramStr.');'); } elseif ('return_value' == $symbolVariable->getName()) { @@ -1114,9 +1090,9 @@ public function callMethod($symbolVariable, Variable $variable, $methodName, $ca } } - public function copyOnWrite(Variable $target, $var, CompilationContext $context) + public function copyOnWrite(Variable $target, $var, CompilationContext $context): void { - if ('EG(exception)' == $var) { + if ('EG(exception)' === $var) { $context->codePrinter->output('ZVAL_OBJ('.$this->getVariableCode($target).', EG(exception));'); $context->codePrinter->output('Z_ADDREF_P('.$this->getVariableCode($target).');'); @@ -1275,26 +1251,16 @@ public function forStatement(Variable $exprVariable, $keyVariable, $variable, $d $codePrinter->output('}'); /* Since we do not observe, still do cleanup */ - if (isset($variable)) { - $variable->initVariant($compilationContext); - } - if (isset($keyVariable)) { - $keyVariable->initVariant($compilationContext); - } + $variable?->initVariant($compilationContext); + $keyVariable?->initVariant($compilationContext); } - public function forStatementIterator(Variable $iteratorVariable, Variable $targetVariable, CompilationContext $compilationContext) - { - $compilationContext->symbolTable->mustGrownStack(true); - $compilationContext->codePrinter->output('ZEPHIR_ITERATOR_COPY('.$this->getVariableCode($targetVariable).', '.$iteratorVariable->getName().');'); - } - - public function destroyIterator(Variable $iteratorVariable, CompilationContext $context) + public function destroyIterator(Variable $iteratorVariable, CompilationContext $context): void { $context->codePrinter->output('zend_iterator_dtor('.$iteratorVariable->getName().');'); } - public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $useBody = false, $useCodePrinter = true) + public function ifVariableValueUndefined(Variable $var, CompilationContext $context, $useBody = false, $useCodePrinter = true): string { if ($var->isDoublePointer()) { return $this->ifVariableValueUndefined2($var, $context, $useBody, $useCodePrinter); @@ -1308,7 +1274,7 @@ public function ifVariableValueUndefined(Variable $var, CompilationContext $cont return $useBody ? $body : $output; } - public function ifVariableValueUndefined2(Variable $var, CompilationContext $context, $onlyBody = false, $useCodePrinter = true) + public function ifVariableValueUndefined2(Variable $var, CompilationContext $context, $onlyBody = false, $useCodePrinter = true): string { $body = '!'.$var->getName(); $output = 'if ('.$body.') {'; @@ -1319,24 +1285,20 @@ public function ifVariableValueUndefined2(Variable $var, CompilationContext $con return $onlyBody ? $body : $output; } - public function fetchClassEntry($str) + public function fetchClassEntry(string $str): string { return 'zephir_get_internal_ce(SL("'.$str.'"))'; } /** - * {@inheritdoc} - * * @param string $type * @param CompilationContext $compilationContext - * @param bool $isLocal * * @return Variable */ public function getScalarTempVariable( string $type, CompilationContext $compilationContext, - $isLocal = true ): Variable { return $compilationContext->symbolTable->getTempNonTrackedVariable($type, $compilationContext); } @@ -1707,7 +1669,7 @@ protected function returnHelper(string $macro, $value, CompilationContext $conte { if ($value instanceof Variable) { $value = $value->getName(); - } elseif ($macro === 'RETURN_MM_STRING' && !preg_match('/^ZEPHIR_GLOBAL/', $value)) { + } elseif ($macro === 'RETURN_MM_STRING' && !str_starts_with($value, 'ZEPHIR_GLOBAL')) { $value = '"'.$value.'"'; } @@ -1734,11 +1696,10 @@ protected function returnHelper(string $macro, $value, CompilationContext $conte * @param CompiledExpression[]|string[] $offsetExprs * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return array + * @throws CompilerException */ - private function resolveOffsetExprs($offsetExprs, CompilationContext $compilationContext) + private function resolveOffsetExprs(array $offsetExprs, CompilationContext $compilationContext): array { $keys = ''; $offsetItems = []; @@ -1750,6 +1711,7 @@ private function resolveOffsetExprs($offsetExprs, CompilationContext $compilatio ++$numberParams; continue; } + switch ($offsetExpr->getType()) { case 'int': case 'uint': @@ -1770,7 +1732,6 @@ private function resolveOffsetExprs($offsetExprs, CompilationContext $compilatio $variableIndex = $compilationContext->symbolTable->getVariableForRead( $offsetExpr->getCode(), $compilationContext, - null ); switch ($variableIndex->getType()) { diff --git a/Library/Backend/FcallManager.php b/Library/Backend/FcallManager.php index a48e4f4b23..5b53197395 100644 --- a/Library/Backend/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -13,17 +13,13 @@ use Zephir\CodePrinter; use Zephir\Fcall\FcallManagerInterface; + use function Zephir\file_put_contents_ex; class FcallManager implements FcallManagerInterface { protected array $requiredMacros = []; - public function macroIsRequired($macro): bool - { - return isset($this->requiredMacros[$macro]); - } - /** * {@inheritdoc} * @@ -47,7 +43,7 @@ public function getMacro($static, $doReturn, $paramCount) $macroName = 'ZEPHIR_'.($scope ? $scope.'_' : '').$mode.$paramCount; - if (!$this->macroIsRequired($macroName)) { + if (!isset($this->requiredMacros[$macroName])) { $this->requiredMacros[$macroName] = [$scope, $mode, $paramCount]; } diff --git a/Library/Backend/StringsManager.php b/Library/Backend/StringsManager.php index 29c6942bcd..70ef092ebd 100644 --- a/Library/Backend/StringsManager.php +++ b/Library/Backend/StringsManager.php @@ -14,6 +14,8 @@ namespace Zephir\Backend; use Zephir\StringsManager as BaseStringsManager; + +use function strlen; use function Zephir\file_put_contents_ex; /** @@ -59,7 +61,7 @@ public function genConcatCode(): void $macros = []; ksort($this->concatKeys, SORT_STRING); foreach ($this->concatKeys as $key => $one) { - $len = \strlen($key); + $len = strlen($key); $params = []; $zvalCopy = []; $useCopy = []; @@ -94,7 +96,7 @@ public function genConcatCode(): void $proto = 'void zephir_concat_'.$key.'(zval *result, '.implode(', ', $params).', int self_var)'; - $codeh .= ''.$proto.';'.PHP_EOL; + $codeh .= $proto.';'.PHP_EOL; $code .= $proto.'{'.PHP_EOL.PHP_EOL; @@ -118,7 +120,7 @@ public function genConcatCode(): void $code .= "\t".'length = '.implode(' + ', $lengths).';'.PHP_EOL; $code .= "\t".'if (self_var) {'.PHP_EOL; - $code .= ''.PHP_EOL; + $code .= PHP_EOL; $code .= "\t\t".'if (Z_TYPE_P(result) != IS_STRING) {'.PHP_EOL; $code .= "\t\t\t".'use_copy = zend_make_printable_zval(result, &result_copy);'.PHP_EOL; $code .= "\t\t\t".'if (use_copy) {'.PHP_EOL; @@ -128,7 +130,7 @@ public function genConcatCode(): void $code .= "\t\t".'offset = Z_STRLEN_P(result);'.PHP_EOL; $code .= "\t\t".'length += offset;'.PHP_EOL; $code .= "\t\t".'Z_STR_P(result) = zend_string_realloc(Z_STR_P(result), length, 0);'.PHP_EOL; - $code .= ''.PHP_EOL; + $code .= PHP_EOL; $code .= "\t".'} else {'.PHP_EOL; $code .= "\t\t".'ZVAL_STR(result, zend_string_alloc(length, 0));'.PHP_EOL; $code .= "\t".'}'.PHP_EOL.PHP_EOL; diff --git a/Library/BranchManager.php b/Library/BranchManager.php index 0c6379a7e0..f5fd84ce9e 100644 --- a/Library/BranchManager.php +++ b/Library/BranchManager.php @@ -9,39 +9,36 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; /** - * BranchManager. - * - * Records every branch created within a method allowing analyze conditional variable assignment + * Records every branch created within a method allowing to analyze conditional variable assignment */ class BranchManager { - /** @var Branch|null */ - protected $currentBranch; + protected ?Branch $currentBranch = null; - protected $level = 0; + protected int $level = 0; - protected $uniqueId = 1; + protected int $uniqueId = 1; - /** @var Branch|null */ - protected $rootBranch; + protected ?Branch $rootBranch; /** * Sets the current active branch in the manager. * * @param Branch $branch */ - public function addBranch(Branch $branch) + public function addBranch(Branch $branch): void { if ($this->currentBranch) { $branch->setParentBranch($this->currentBranch); - $this->currentBranch = $branch; - } else { - $this->currentBranch = $branch; } + $this->currentBranch = $branch; + $branch->setUniqueId($this->uniqueId); $branch->setLevel($this->level); @@ -58,7 +55,7 @@ public function addBranch(Branch $branch) * * @param Branch $branch */ - public function removeBranch(Branch $branch) + public function removeBranch(Branch $branch): void { $parentBranch = $branch->getParentBranch(); $this->currentBranch = $parentBranch; @@ -70,7 +67,7 @@ public function removeBranch(Branch $branch) * * @return Branch|null */ - public function getCurrentBranch() + public function getCurrentBranch(): ?Branch { return $this->currentBranch; } @@ -80,7 +77,7 @@ public function getCurrentBranchId() return $this->currentBranch->getUniqueId(); } - public function setRootBranch(Branch $branch) + public function setRootBranch(Branch $branch): void { $this->rootBranch = $branch; } diff --git a/Library/CacheManager.php b/Library/CacheManager.php index 058d2b0cc3..02cbb8efe0 100644 --- a/Library/CacheManager.php +++ b/Library/CacheManager.php @@ -104,7 +104,7 @@ public function getMethodCache(): ?MethodCache /** * Creates or returns an existing method cache. * - * @return StaticMethodCache + * @return StaticMethodCache|null */ public function getStaticMethodCache(): ?StaticMethodCache { diff --git a/Library/Call.php b/Library/Call.php index 18da25c5cb..5ba45d1349 100644 --- a/Library/Call.php +++ b/Library/Call.php @@ -488,7 +488,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext case 'int': case 'uint': case 'long': - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); + $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); $compilationContext->backend->assignLong($parameterVariable, $compiledExpression->getCode(), $compilationContext); $this->temporalVariables[] = $parameterVariable; $params[] = '&'.$parameterVariable->getName(); @@ -520,7 +520,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext break; case 'double': - $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); + $parameterVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); $codePrinter->output('ZVAL_DOUBLE(&'.$parameterVariable->getName().', '.$compiledExpression->getCode().');'); $this->temporalVariables[] = $parameterVariable; $params[] = '&'.$parameterVariable->getName(); @@ -559,7 +559,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext case 'uint': case 'long': case 'ulong': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); $codePrinter->output('ZVAL_LONG(&'.$parameterTempVariable->getName().', '.$compiledExpression->getCode().');'); $params[] = '&'.$parameterTempVariable->getName(); $types[] = $parameterTempVariable->getType(); @@ -589,7 +589,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext break; case 'double': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); $codePrinter->output('ZVAL_DOUBLE(&'.$parameterTempVariable->getName().', '.$compiledExpression->getCode().');'); $params[] = '&'.$parameterTempVariable->getName(); $types[] = $parameterTempVariable->getType(); @@ -598,7 +598,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext break; case 'bool': - $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext, true); + $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); $compilationContext->backend->assignBool($parameterTempVariable, '('.$parameterVariable->getName().' ? 1 : 0)', $compilationContext); $params[] = $compilationContext->backend->getVariableCode($parameterTempVariable); $dynamicTypes[] = $parameterTempVariable->getType(); diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 4852563186..a7e793a93a 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -2128,8 +2128,7 @@ public function compile(CompilationContext $compilationContext): void PHP_EOL."\t", $compilationContext->backend->declareVariables( $this, - $usedVariables, - $compilationContext + $usedVariables ) ) ); diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 1e839ce79d..1b0580cd48 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -19,6 +19,8 @@ use Zephir\Exception\CompilerException; use Zephir\Passes\StaticTypeInference; +use function in_array; + /** * This class encapsulates important entities required during compilation */ @@ -209,7 +211,7 @@ public function getFullName(string $className): string */ public function classLookup(string $className, array $statement = null): ClassDefinition { - if (!\in_array($className, ['self', 'static', 'parent'])) { + if (!in_array($className, ['self', 'static', 'parent'])) { $className = $this->getFullName($className); if ($this->compiler->isClass($className)) { return $this->compiler->getClassDefinition($className); @@ -218,7 +220,7 @@ public function classLookup(string $className, array $statement = null): ClassDe throw new CompilerException("Cannot locate class '{$className}'", $statement); } - if (\in_array($className, ['self', 'static'])) { + if (in_array($className, ['self', 'static'])) { return $this->classDefinition; } diff --git a/Library/Console/Application.php b/Library/Console/Application.php index 32cfa2d96d..de663fa1f4 100644 --- a/Library/Console/Application.php +++ b/Library/Console/Application.php @@ -50,7 +50,7 @@ public function __construct() * * @return string */ - public function getHelp() + public function getHelp(): string { return Zephir::LOGO.parent::getHelp(); } @@ -77,7 +77,7 @@ public function getVersion(): string { $version = explode('-', parent::getVersion()); - if (isset($version[1]) && 0 === strpos($version[1], '$')) { + if (isset($version[1]) && str_starts_with($version[1], '$')) { return "{$version[0]}-source"; } @@ -131,7 +131,7 @@ public function doRun(InputInterface $input, OutputInterface $output) try { // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument. $input->bind($this->getDefinition()); - } catch (ExceptionInterface $e) { + } catch (ExceptionInterface) { // Errors must be ignored, full binding/validation happens later when the command is known. } @@ -152,11 +152,7 @@ public function doRun(InputInterface $input, OutputInterface $output) try { return parent::doRun($input, $output); - } catch (CommandNotFoundException $e) { - fprintf(STDERR, $e->getMessage().PHP_EOL); - - return 1; - } catch (RuntimeException $e) { + } catch (CommandNotFoundException|RuntimeException $e) { fprintf(STDERR, $e->getMessage().PHP_EOL); return 1; @@ -168,7 +164,7 @@ public function doRun(InputInterface $input, OutputInterface $output) * * @return Command[] An array of default Command instances */ - protected function getDefaultCommands() + protected function getDefaultCommands(): array { return [new HelpCommand(), new ListCommand()]; } diff --git a/Library/Console/Command/InitCommand.php b/Library/Console/Command/InitCommand.php index ccda306918..e9685daaab 100644 --- a/Library/Console/Command/InitCommand.php +++ b/Library/Console/Command/InitCommand.php @@ -19,7 +19,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Zephir\Backend\Backend; use Zephir\Config; diff --git a/Library/Documentation.php b/Library/Documentation.php index 44691f507c..9d604421db 100644 --- a/Library/Documentation.php +++ b/Library/Documentation.php @@ -170,7 +170,7 @@ public function build() foreach ($byNamespace as $namespaceName => $nh) { // namespace files (namespace/ns1/n2/namespace.html) - $nfile = new File\NamespaceFile($this->config, $nh); + $nfile = new File\NamespaceFile($nh); $this->theme->drawFile($nfile); } @@ -184,11 +184,11 @@ public function build() $this->theme->drawFile($sitemapFile); // namespaces files (namespaces.html) - $nsfile = new File\NamespacesFile($this->config, $namespaceAccessor); + $nsfile = new File\NamespacesFile($namespaceAccessor); $this->theme->drawFile($nsfile); // index (index.html) - $indexfile = new File\IndexFile($this->config, $namespaceAccessor); + $indexfile = new File\IndexFile($namespaceAccessor); $this->theme->drawFile($indexfile); $this->theme->buildStaticDirectory(); diff --git a/Library/Documentation/Annotation.php b/Library/Documentation/Annotation.php index 7e0231b45d..43f81b8323 100644 --- a/Library/Documentation/Annotation.php +++ b/Library/Documentation/Annotation.php @@ -12,21 +12,14 @@ namespace Zephir\Documentation; /** - * Annotation. - * * A parsed Annotation */ class Annotation { - protected $name; - - protected $string; - - protected $contentParsed = false; + protected bool $contentParsed = false; - public function __construct(string $name, string $string) + public function __construct(protected string $name, protected string $string) { - $this->name = $name; $this->string = trim($string); } @@ -35,7 +28,7 @@ public function getString(): string return $this->string; } - public function setString(string $string) + public function setString(string $string): void { $this->string = $string; } diff --git a/Library/Documentation/Docblock.php b/Library/Documentation/Docblock.php index f6ebd296de..2d66ccadc0 100644 --- a/Library/Documentation/Docblock.php +++ b/Library/Documentation/Docblock.php @@ -12,8 +12,6 @@ namespace Zephir\Documentation; /** - * Annotation. - * * A parsed Annotation */ class Docblock @@ -21,17 +19,17 @@ class Docblock /** * @var string */ - protected $description; + protected string $description; /** * @var Annotation[] */ - protected $annotations = []; + protected array $annotations = []; /** * @var string */ - protected $summary; + protected string $summary; /** * @return string @@ -110,7 +108,7 @@ public function getSummary(): string /** * @param string $summary */ - public function setSummary(string $summary) + public function setSummary(string $summary): void { $this->summary = $summary; } @@ -133,7 +131,7 @@ public function generate(): string $docBlock .= PHP_EOL.' *'; $docBlock .= PHP_EOL.' *'; - foreach ((array) explode("\n", $descriptionBlock) as $line) { + foreach (explode("\n", $descriptionBlock) as $line) { $docBlock .= PHP_EOL.' * '.trim($line); } diff --git a/Library/Documentation/File/IndexFile.php b/Library/Documentation/File/IndexFile.php index a90f729b28..e2f0595fea 100644 --- a/Library/Documentation/File/IndexFile.php +++ b/Library/Documentation/File/IndexFile.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\File; use Zephir\Documentation\FileInterface; @@ -16,31 +18,15 @@ class IndexFile implements FileInterface { - /** - * @var NamespaceAccessor - */ - protected $namespaceAccessor; - - public function __construct($config, NamespaceAccessor $namespaceAccessor) + public function __construct(protected NamespaceAccessor $namespaceAccessor) { - $this->namespaceAccessor = $namespaceAccessor; } - /** - * {@inheritdoc} - * - * @return string - */ public function getTemplateName(): string { return 'index.phtml'; } - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { return [ @@ -50,11 +36,6 @@ public function getData(): array ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return 'index.html'; diff --git a/Library/Documentation/File/NamespaceFile.php b/Library/Documentation/File/NamespaceFile.php index 9eb3f21438..0316f6d7cf 100644 --- a/Library/Documentation/File/NamespaceFile.php +++ b/Library/Documentation/File/NamespaceFile.php @@ -11,26 +11,14 @@ namespace Zephir\Documentation\File; -use Zephir\CompilerFile; use Zephir\Documentation; use Zephir\Documentation\FileInterface; use Zephir\Documentation\NamespaceHelper; class NamespaceFile implements FileInterface { - /** - * @var NamespaceHelper - */ - protected $namespaceHelper; - - /** - * @var CompilerFile - */ - protected $compilerFile; - - public function __construct($config, NamespaceHelper $nh) + public function __construct(protected NamespaceHelper $namespaceHelper) { - $this->namespaceHelper = $nh; } /** diff --git a/Library/Documentation/File/NamespacesFile.php b/Library/Documentation/File/NamespacesFile.php index 1ac54c9861..5a58c8a371 100644 --- a/Library/Documentation/File/NamespacesFile.php +++ b/Library/Documentation/File/NamespacesFile.php @@ -16,31 +16,15 @@ class NamespacesFile implements FileInterface { - /** - * @var NamespaceAccessor - */ - protected $namespaceAccessor; - - public function __construct($config, NamespaceAccessor $namespaceAccessor) + public function __construct(protected NamespaceAccessor $namespaceAccessor) { - $this->namespaceAccessor = $namespaceAccessor; } - /** - * {@inheritdoc} - * - * @return string - */ public function getTemplateName(): string { return 'namespaces.phtml'; } - /** - * {@inheritdoc} - * - * @return array - */ public function getData(): array { return [ @@ -50,11 +34,6 @@ public function getData(): array ]; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return 'namespaces.html'; diff --git a/Library/Documentation/File/SourceFile.php b/Library/Documentation/File/SourceFile.php index 37e03662db..069ff8c23e 100644 --- a/Library/Documentation/File/SourceFile.php +++ b/Library/Documentation/File/SourceFile.php @@ -16,26 +16,13 @@ class SourceFile extends ClassFile { - /** - * @var ClassDefinition - */ - protected $class; + protected ClassDefinition $class; - /** - * {@inheritdoc} - * - * @return string - */ public function getTemplateName(): string { return 'source.phtml'; } - /** - * {@inheritdoc} - * - * @return string - */ public function getOutputFile(): string { return Documentation::sourceUrl($this->class); diff --git a/Library/Documentation/NamespaceAccessor.php b/Library/Documentation/NamespaceAccessor.php index 0825adce75..a2de18db50 100644 --- a/Library/Documentation/NamespaceAccessor.php +++ b/Library/Documentation/NamespaceAccessor.php @@ -48,7 +48,7 @@ public function build() $byNamespace = []; $tree = []; - foreach ($this->classes as $className => $class) { + foreach ($this->classes as $class) { $ns = explode('\\', $class->getClassDefinition()->getNamespace()); $actualStr = ''; foreach ($ns as $n) { diff --git a/Library/Documentation/Template.php b/Library/Documentation/Template.php index 19e893ce55..1e95855b79 100644 --- a/Library/Documentation/Template.php +++ b/Library/Documentation/Template.php @@ -24,7 +24,6 @@ class Template protected $nestedLevel; protected $pathToRoot = './'; protected $themeOptions; - protected $theme; /** * @var Config */ @@ -40,14 +39,13 @@ class Template * * @throws Exception */ - public function __construct(Theme $theme, array $data, string $template, int $nestedLevel = 0) + public function __construct(protected Theme $theme, array $data, string $template, int $nestedLevel = 0) { // todo clean buffer before exception if ($nestedLevel > 800) { throw new Exception('Recursive inclusion detected in theme creation'); } - $this->theme = $theme; $this->data = $data; $this->template = $template; $this->nestedLevel = $nestedLevel; diff --git a/Library/Documentation/Theme.php b/Library/Documentation/Theme.php index 4e6ee9c633..ad942b7204 100644 --- a/Library/Documentation/Theme.php +++ b/Library/Documentation/Theme.php @@ -61,27 +61,6 @@ public function __construct($themeDir, $outputDir, $themeConfig, $config, Docume } } - private function __namespaceTreeHelper(NamespaceHelper $ns) - { - $output = [ - 'classes' => [], - 'namespaces' => [], - ]; - - $subNs = $ns->getNamespaces(); - $subCs = $ns->getClasses(); - - foreach ($subCs as $c) { - $output['classes'][] = $c->getClassDefinition()->getCompleteName(); - } - - foreach ($subNs as $sns) { - $output['namespaces'][$sns->getFullNamespace()] = $this->__namespaceTreeHelper($sns); - } - - return $output; - } - /** * from : https://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php. * diff --git a/Library/Exception/ExceptionExtraAwareTrait.php b/Library/Exception/ExceptionExtraAwareTrait.php index 470f55c1dc..4edf38baef 100644 --- a/Library/Exception/ExceptionExtraAwareTrait.php +++ b/Library/Exception/ExceptionExtraAwareTrait.php @@ -11,9 +11,6 @@ namespace Zephir\Exception; -/** - * Zephir\Exception\ExceptionInterface. - */ trait ExceptionExtraAwareTrait { /** diff --git a/Library/Exception/IllegalOperationException.php b/Library/Exception/IllegalOperationException.php index 0255fa4143..4e96e1861a 100644 --- a/Library/Exception/IllegalOperationException.php +++ b/Library/Exception/IllegalOperationException.php @@ -13,9 +13,6 @@ use Zephir\TypeAwareInterface; -/** - * Zephir\Exception\IllegalOperationException. - */ class IllegalOperationException extends CompilerException { /** diff --git a/Library/Exception/IllegalStateException.php b/Library/Exception/IllegalStateException.php index d0ad8ff935..62de88d15d 100644 --- a/Library/Exception/IllegalStateException.php +++ b/Library/Exception/IllegalStateException.php @@ -11,9 +11,6 @@ namespace Zephir\Exception; -/** - * Zephir\Exception\IllegalStateException. - */ class IllegalStateException extends RuntimeException { } diff --git a/Library/Exception/InvalidArgumentException.php b/Library/Exception/InvalidArgumentException.php index c940e61c23..68002b5bf9 100644 --- a/Library/Exception/InvalidArgumentException.php +++ b/Library/Exception/InvalidArgumentException.php @@ -11,9 +11,6 @@ namespace Zephir\Exception; -/** - * Zephir\Exception\InvalidArgumentException. - */ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { use ExceptionExtraAwareTrait; diff --git a/Library/Exception/InvalidCallException.php b/Library/Exception/InvalidCallException.php index d8b07680f2..6cda337ea1 100644 --- a/Library/Exception/InvalidCallException.php +++ b/Library/Exception/InvalidCallException.php @@ -11,9 +11,6 @@ namespace Zephir\Exception; -/** - * Zephir\Exception\InvalidCallException. - */ class InvalidCallException extends LogicException { } diff --git a/Library/Exception/LogicException.php b/Library/Exception/LogicException.php index 5a961bffef..556edc6acc 100644 --- a/Library/Exception/LogicException.php +++ b/Library/Exception/LogicException.php @@ -15,7 +15,7 @@ * Zephir\Exception\LogicException. * * Exception that represents error in the program logic. - * This kind of exceptions should directly lead to a fix in your code. + * This kind of exception should directly lead to a fix in your code. */ class LogicException extends \LogicException implements ExceptionInterface { diff --git a/Library/Exception/NotImplementedException.php b/Library/Exception/NotImplementedException.php index 69cb57d676..44d3ed252f 100644 --- a/Library/Exception/NotImplementedException.php +++ b/Library/Exception/NotImplementedException.php @@ -12,8 +12,6 @@ namespace Zephir\Exception; /** - * Zephir\Exception\NotImplementedException. - * * Thrown to indicate that a block of code has not been implemented. * Represents the case where the author has yet to implement * the logic at this point in the program. diff --git a/Library/Exception/OutOfBoundsException.php b/Library/Exception/OutOfBoundsException.php deleted file mode 100644 index 29338b14aa..0000000000 --- a/Library/Exception/OutOfBoundsException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\OutOfBoundsException. - */ -class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface -{ - use ExceptionExtraAwareTrait; -} diff --git a/Library/Exception/ParseException.php b/Library/Exception/ParseException.php index aabd21e535..320e0338e5 100644 --- a/Library/Exception/ParseException.php +++ b/Library/Exception/ParseException.php @@ -12,8 +12,6 @@ namespace Zephir\Exception; /** - * Zephir\Exception\ParseException. - * * Exceptions generated by parsing actions */ class ParseException extends RuntimeException diff --git a/Library/Exception/RuntimeException.php b/Library/Exception/RuntimeException.php index 4772baf94d..c98d827b67 100644 --- a/Library/Exception/RuntimeException.php +++ b/Library/Exception/RuntimeException.php @@ -12,8 +12,6 @@ namespace Zephir\Exception; /** - * Zephir\Exception\RuntimeException. - * * Exception thrown if an error which can only be found on runtime occurs. */ class RuntimeException extends \RuntimeException implements ExceptionInterface diff --git a/Library/Exception/UnknownPropertyException.php b/Library/Exception/UnknownPropertyException.php index a6790ce85c..c4a7c117e7 100644 --- a/Library/Exception/UnknownPropertyException.php +++ b/Library/Exception/UnknownPropertyException.php @@ -11,9 +11,6 @@ namespace Zephir\Exception; -/** - * Zephir\Exception\UnknownPropertyException. - */ class UnknownPropertyException extends LogicException { } diff --git a/Library/Exception/ValidationException.php b/Library/Exception/ValidationException.php deleted file mode 100644 index e2b0876685..0000000000 --- a/Library/Exception/ValidationException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\ValidationException. - */ -class ValidationException extends InvalidArgumentException -{ -} diff --git a/Library/Expression/Builder/AbstractBuilder.php b/Library/Expression/Builder/AbstractBuilder.php index 53be021693..af821e05dc 100644 --- a/Library/Expression/Builder/AbstractBuilder.php +++ b/Library/Expression/Builder/AbstractBuilder.php @@ -11,9 +11,6 @@ namespace Zephir\Expression\Builder; -/** - * Class AbstractBuilder. - */ abstract class AbstractBuilder { private $file = null; diff --git a/Library/Expression/Builder/BuilderFactory.php b/Library/Expression/Builder/BuilderFactory.php index 9132a0dd64..3eca0a0bb1 100644 --- a/Library/Expression/Builder/BuilderFactory.php +++ b/Library/Expression/Builder/BuilderFactory.php @@ -14,9 +14,6 @@ use Zephir\Expression\Builder\Factory\OperatorsFactory; use Zephir\Expression\Builder\Factory\StatementsFactory; -/** - * Zephir\Expression\Builder\BuilderFactory. - */ class BuilderFactory { /** @var OperatorsFactory */ diff --git a/Library/Expression/Builder/Factory/OperatorsFactory.php b/Library/Expression/Builder/Factory/OperatorsFactory.php index c5d4ccd9ed..6b84dfaa68 100644 --- a/Library/Expression/Builder/Factory/OperatorsFactory.php +++ b/Library/Expression/Builder/Factory/OperatorsFactory.php @@ -21,9 +21,6 @@ use Zephir\Expression\Builder\Operators\RawOperator; use Zephir\Expression\Builder\Operators\UnaryOperator; -/** - * Class OperatorsFactory. - */ class OperatorsFactory { protected BuilderFactory $factory; @@ -42,7 +39,7 @@ public function __construct(BuilderFactory $factory) * * @return AssignVariableOperator */ - public function assignVariable($variable = null, AbstractBuilder $expression = null) + public function assignVariable($variable = null, AbstractBuilder $expression = null): AssignVariableOperator { return new AssignVariableOperator($variable, $expression); } @@ -54,7 +51,7 @@ public function assignVariable($variable = null, AbstractBuilder $expression = n * * @return AssignPropertyOperator */ - public function assignProperty($variable = null, $property = null, AbstractBuilder $expression = null) + public function assignProperty($variable = null, $property = null, AbstractBuilder $expression = null): AssignPropertyOperator { $assignProperty = new AssignPropertyOperator($variable, $property, $expression); $assignProperty->setType($assignProperty::TYPE_ASSIGN_OBJECT_PROPERTY); @@ -69,7 +66,7 @@ public function assignProperty($variable = null, $property = null, AbstractBuild * * @return AssignPropertyOperator */ - public function assignStaticProperty($variable = null, $property = null, AbstractBuilder $expression = null) + public function assignStaticProperty($variable = null, $property = null, AbstractBuilder $expression = null): AssignPropertyOperator { $assignProperty = $this->assignProperty($variable, $property, $expression); $assignProperty->setType($assignProperty::TYPE_ASSIGN_STATIC_PROPERTY); diff --git a/Library/Expression/Builder/Factory/StatementsFactory.php b/Library/Expression/Builder/Factory/StatementsFactory.php index 99190f963c..e2dd8e4175 100644 --- a/Library/Expression/Builder/Factory/StatementsFactory.php +++ b/Library/Expression/Builder/Factory/StatementsFactory.php @@ -17,8 +17,6 @@ use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\AbstractOperator; use Zephir\Expression\Builder\Statements\CallFunctionStatement; -use Zephir\Expression\Builder\Statements\CallMethodStatement; -use Zephir\Expression\Builder\Statements\CallStaticStatement; use Zephir\Expression\Builder\Statements\IfStatement; use Zephir\Expression\Builder\Statements\LetStatement; use Zephir\Expression\Builder\Statements\RawStatement; @@ -26,14 +24,8 @@ class StatementsFactory { - protected BuilderFactory $factory; - - /** - * @param BuilderFactory $factory - */ - public function __construct(BuilderFactory $factory) + public function __construct(protected BuilderFactory $factory) { - $this->factory = $factory; } /** @@ -48,31 +40,6 @@ public function functionCall($name, $parameters = null, $type = CallFunctionStat return new CallFunctionStatement($name, $parameters, $type); } - /** - * @param $variable - * @param $name - * @param null $parameters - * @param int $type - * - * @return CallMethodStatement - */ - public function methodCall($variable, $name, $parameters = null, $type = CallMethodStatement::TYPE_CALL_DIRECT) - { - return new CallMethodStatement($variable, $name, $parameters, $type); - } - - /** - * @param $class - * @param $method - * @param null $parameters - * - * @return CallStaticStatement - */ - public function staticCall($class, $method, $parameters = null) - { - return new CallStaticStatement($class, $method, $parameters); - } - /** * @param array|null $statements * @@ -118,19 +85,6 @@ public function returnX(AbstractBuilder $expression) ]); } - /** - * @param AbstractBuilder $expression - * - * @return RawStatement - */ - public function throwX(AbstractBuilder $expression) - { - return $this->raw([ - 'type' => 'throw', - 'expr' => $expression, - ]); - } - /** * @param string $value * diff --git a/Library/Expression/Builder/Operators/AbstractOperator.php b/Library/Expression/Builder/Operators/AbstractOperator.php index 67a10a8ee9..8b67ee940a 100644 --- a/Library/Expression/Builder/Operators/AbstractOperator.php +++ b/Library/Expression/Builder/Operators/AbstractOperator.php @@ -13,9 +13,6 @@ use Zephir\Expression\Builder\AbstractBuilder; -/** - * Class AbstractOperator. - */ abstract class AbstractOperator extends AbstractBuilder { } diff --git a/Library/Expression/Builder/Operators/AssignPropertyOperator.php b/Library/Expression/Builder/Operators/AssignPropertyOperator.php index b921870749..20c77bb247 100644 --- a/Library/Expression/Builder/Operators/AssignPropertyOperator.php +++ b/Library/Expression/Builder/Operators/AssignPropertyOperator.php @@ -13,16 +13,13 @@ use Zephir\Expression\Builder\AbstractBuilder; -/** - * Class AssignPropertyOperator. - */ class AssignPropertyOperator extends AssignVariableOperator { // a -> property = expr - const TYPE_ASSIGN_OBJECT_PROPERTY = 'object-property'; + public const TYPE_ASSIGN_OBJECT_PROPERTY = 'object-property'; // a :: property = expr - const TYPE_ASSIGN_STATIC_PROPERTY = 'static-property'; + public const TYPE_ASSIGN_STATIC_PROPERTY = 'static-property'; private $property; private $type = self::TYPE_ASSIGN_OBJECT_PROPERTY; @@ -44,7 +41,7 @@ public function __construct($variable = null, $property = null, AbstractBuilder /** * @return string */ - public function getProperty() + public function getProperty(): string { return $this->property; } @@ -54,7 +51,7 @@ public function getProperty() * * @return $this */ - public function setProperty($property) + public function setProperty(string $property): static { $this->property = $property; @@ -64,7 +61,7 @@ public function setProperty($property) /** * @return string */ - public function getType() + public function getType(): string { return $this->type; } @@ -74,17 +71,14 @@ public function getType() * * @return AssignPropertyOperator */ - public function setType($type) + public function setType(string $type): static { $this->type = $type; return $this; } - /** - * {@inheritdoc} - */ - protected function preBuild() + protected function preBuild(): array { $expression = parent::preBuild(); $expression['assign-type'] = $this->getType(); diff --git a/Library/Expression/Builder/Operators/AssignVariableOperator.php b/Library/Expression/Builder/Operators/AssignVariableOperator.php index 2a9424be5d..a054158c18 100644 --- a/Library/Expression/Builder/Operators/AssignVariableOperator.php +++ b/Library/Expression/Builder/Operators/AssignVariableOperator.php @@ -13,9 +13,6 @@ use Zephir\Expression\Builder\AbstractBuilder; -/** - * Class AssignVariableOperator. - */ class AssignVariableOperator extends AbstractOperator { // = @@ -101,18 +98,6 @@ public function getOperator() return $this->operator; } - /** - * @param $operator - * - * @return $this - */ - public function setOperator($operator) - { - $this->operator = $operator; - - return $this; - } - /** * @return mixed */ diff --git a/Library/Expression/Builder/Operators/BinaryOperator.php b/Library/Expression/Builder/Operators/BinaryOperator.php index 9e934dc100..052de4e484 100644 --- a/Library/Expression/Builder/Operators/BinaryOperator.php +++ b/Library/Expression/Builder/Operators/BinaryOperator.php @@ -14,8 +14,6 @@ use Zephir\Expression\Builder\AbstractBuilder; /** - * BinaryOperator. - * * Allows to manually build a binary operator AST node */ class BinaryOperator extends AbstractOperator diff --git a/Library/Expression/Builder/Operators/RawOperator.php b/Library/Expression/Builder/Operators/RawOperator.php index 17805751d5..8201e97a3c 100644 --- a/Library/Expression/Builder/Operators/RawOperator.php +++ b/Library/Expression/Builder/Operators/RawOperator.php @@ -11,9 +11,6 @@ namespace Zephir\Expression\Builder\Operators; -/** - * Class RawOperator. - */ class RawOperator extends AbstractOperator { /** diff --git a/Library/Expression/Builder/Operators/UnaryOperator.php b/Library/Expression/Builder/Operators/UnaryOperator.php index a0f6168a3f..4cf870eb6a 100644 --- a/Library/Expression/Builder/Operators/UnaryOperator.php +++ b/Library/Expression/Builder/Operators/UnaryOperator.php @@ -14,8 +14,6 @@ use Zephir\Expression\Builder\AbstractBuilder; /** - * UnaryOperator. - * * Allows to manually build a unary operator AST node */ class UnaryOperator extends AbstractOperator diff --git a/Library/Expression/Builder/RawExpression.php b/Library/Expression/Builder/RawExpression.php index a46d5b1067..a5e1c44502 100644 --- a/Library/Expression/Builder/RawExpression.php +++ b/Library/Expression/Builder/RawExpression.php @@ -12,8 +12,6 @@ namespace Zephir\Expression\Builder; /** - * RawExpression. - * * Allows to use a raw expression in a builder */ class RawExpression extends AbstractBuilder diff --git a/Library/Expression/Builder/Statements/AbstractStatement.php b/Library/Expression/Builder/Statements/AbstractStatement.php index 2423dcb04b..1cc60c21d5 100644 --- a/Library/Expression/Builder/Statements/AbstractStatement.php +++ b/Library/Expression/Builder/Statements/AbstractStatement.php @@ -13,9 +13,6 @@ use Zephir\Expression\Builder\AbstractBuilder; -/** - * Class AbstractStatement. - */ abstract class AbstractStatement extends AbstractBuilder { } diff --git a/Library/Expression/Builder/Statements/CallFunctionStatement.php b/Library/Expression/Builder/Statements/CallFunctionStatement.php index 0778dc0b06..b45056202c 100644 --- a/Library/Expression/Builder/Statements/CallFunctionStatement.php +++ b/Library/Expression/Builder/Statements/CallFunctionStatement.php @@ -14,8 +14,6 @@ use Zephir\FunctionCall; /** - * CallFunctionStatement. - * * Allows to manually build a function call AST node */ class CallFunctionStatement extends AbstractStatement @@ -42,9 +40,9 @@ class CallFunctionStatement extends AbstractStatement /** * @param string|null $name * @param array|null $parameters - * @param int $typeCall + * @param int $typeCall */ - public function __construct($name = null, array $parameters = null, $typeCall = self::TYPE_CALL_DIRECT) + public function __construct(string $name = null, array $parameters = null, int $typeCall = self::TYPE_CALL_DIRECT) { if (null !== $name) { $this->setName($name); diff --git a/Library/Expression/Builder/Statements/CallMethodStatement.php b/Library/Expression/Builder/Statements/CallMethodStatement.php index 1dc31db2a4..cc3920262b 100644 --- a/Library/Expression/Builder/Statements/CallMethodStatement.php +++ b/Library/Expression/Builder/Statements/CallMethodStatement.php @@ -12,8 +12,6 @@ namespace Zephir\Expression\Builder\Statements; /** - * CallMethodStatement. - * * Allows to manually build a method call AST node */ class CallMethodStatement extends CallFunctionStatement diff --git a/Library/Expression/Builder/Statements/CallStaticStatement.php b/Library/Expression/Builder/Statements/CallStaticStatement.php index 6ebc3d153d..4133020430 100644 --- a/Library/Expression/Builder/Statements/CallStaticStatement.php +++ b/Library/Expression/Builder/Statements/CallStaticStatement.php @@ -12,8 +12,6 @@ namespace Zephir\Expression\Builder\Statements; /** - * CallStaticStatement. - * * Allows to manually build a static function call AST node */ class CallStaticStatement extends AbstractStatement diff --git a/Library/Expression/Builder/Statements/IfStatement.php b/Library/Expression/Builder/Statements/IfStatement.php index 09b8c50c69..1bb7eafff7 100644 --- a/Library/Expression/Builder/Statements/IfStatement.php +++ b/Library/Expression/Builder/Statements/IfStatement.php @@ -14,8 +14,6 @@ use Zephir\Expression\Builder\Operators\AbstractOperator; /** - * IfStatement. - * * Allows to manually build a 'if' statement AST node */ class IfStatement extends AbstractStatement diff --git a/Library/Expression/Builder/Statements/LetStatement.php b/Library/Expression/Builder/Statements/LetStatement.php index d26952c9aa..2201513a0c 100644 --- a/Library/Expression/Builder/Statements/LetStatement.php +++ b/Library/Expression/Builder/Statements/LetStatement.php @@ -12,8 +12,6 @@ namespace Zephir\Expression\Builder\Statements; /** - * LetStatement. - * * Allows to manually build a 'let' statement AST node */ class LetStatement extends AbstractStatement diff --git a/Library/Expression/Builder/Statements/RawStatement.php b/Library/Expression/Builder/Statements/RawStatement.php index e68dc163d3..a38ece28fb 100644 --- a/Library/Expression/Builder/Statements/RawStatement.php +++ b/Library/Expression/Builder/Statements/RawStatement.php @@ -11,9 +11,6 @@ namespace Zephir\Expression\Builder\Statements; -/** - * Class RawStatement. - */ class RawStatement extends AbstractStatement { /** diff --git a/Library/Expression/Builder/Statements/StatementsBlock.php b/Library/Expression/Builder/Statements/StatementsBlock.php index 013c242dd1..2a30ea4480 100644 --- a/Library/Expression/Builder/Statements/StatementsBlock.php +++ b/Library/Expression/Builder/Statements/StatementsBlock.php @@ -14,8 +14,6 @@ use Zephir\Expression\Builder\AbstractBuilder; /** - * StatementsBlock. - * * Allows to manually build a statements block AST node */ class StatementsBlock extends AbstractBuilder diff --git a/Library/Expression/NativeArray.php b/Library/Expression/NativeArray.php index 72c87e03f7..071a9aeb49 100644 --- a/Library/Expression/NativeArray.php +++ b/Library/Expression/NativeArray.php @@ -45,7 +45,7 @@ class NativeArray * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -61,16 +61,6 @@ public function setReadOnly(bool $readOnly): void $this->readOnly = $readOnly; } - /** - * Sets whether the expression must be resolved in "noisy" mode. - * - * @param bool $noisy - */ - public function setNoisy(bool $noisy): void - { - $this->noisy = $noisy; - } - /** * Resolves an item to be added in an array. * diff --git a/Library/Expression/NativeArrayAccess.php b/Library/Expression/NativeArrayAccess.php index 8fc2d54ded..83cc2a21ab 100644 --- a/Library/Expression/NativeArrayAccess.php +++ b/Library/Expression/NativeArrayAccess.php @@ -24,11 +24,9 @@ */ class NativeArrayAccess { - /** @var bool */ - protected $expecting = true; + protected bool $expecting = true; - /** @var bool */ - protected $readOnly = false; + protected bool $readOnly = false; /** @var Variable|null */ protected $expectingVariable; @@ -278,11 +276,11 @@ protected function accessDimensionArray($expression, Variable $variableVariable, $symbolVariable->observeVariant($compilationContext); $this->readOnly = false; } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext); } } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext); } } diff --git a/Library/Expression/PropertyAccess.php b/Library/Expression/PropertyAccess.php index 35edb3685f..b1603a983f 100644 --- a/Library/Expression/PropertyAccess.php +++ b/Library/Expression/PropertyAccess.php @@ -18,31 +18,26 @@ use Zephir\Variable; /** - * Zephir\Expression\PropertyAccess. - * * Resolves expressions that read properties */ class PropertyAccess { - /** @var bool */ - protected $expecting = true; + protected bool $expecting = true; - /** @var bool */ - protected $readOnly = false; + protected bool $readOnly = false; protected $expectingVariable; - /** @var bool */ - protected $noisy = true; + protected bool $noisy = true; /** * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. * - * @param bool $expecting - * @param Variable $expectingVariable + * @param bool $expecting + * @param Variable|null $expectingVariable */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -140,7 +135,7 @@ public function compile($expression, CompilationContext $compilationContext) } } - /* + /** * Having a proper propertyDefinition we can check if the property is readable * according to its modifiers */ @@ -150,7 +145,7 @@ public function compile($expression, CompilationContext $compilationContext) } if (!$propertyDefinition->isPublic()) { - /* + /** * Protected variables only can be read in the class context * where they were declared */ @@ -184,7 +179,7 @@ public function compile($expression, CompilationContext $compilationContext) if ($this->expectingVariable) { $symbolVariable = $this->expectingVariable; - /* + /** * If a variable is assigned once in the method, we try to promote it * to a read only variable */ @@ -201,13 +196,12 @@ public function compile($expression, CompilationContext $compilationContext) } } - /* - * Variable is not read only or it wasn't promoted + /** + * Variable is not read only, or it wasn't promoted */ if (!$readOnly) { if ('return_value' != $symbolVariable->getName()) { $symbolVariable->observeVariant($compilationContext); - $this->readOnly = false; } else { $makeSymbolVariable = true; } @@ -227,24 +221,22 @@ public function compile($expression, CompilationContext $compilationContext) if ($readOnly) { $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext); } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext); } } - /* + /** * Variable that receives a property value must be polymorphic */ if (!$symbolVariable->isVariable()) { throw new CompilerException('Cannot use variable: '.$symbolVariable->getType().' to assign property value', $expression); } - /* + /** * At this point, we don't know the exact dynamic type fetched from the property */ $symbolVariable->setDynamicTypes('undefined'); - $compilationContext->headersManager->add('kernel/object'); - $compilationContext->backend->fetchProperty($symbolVariable, $variableVariable, $property, $readOnly, $compilationContext); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); diff --git a/Library/Expression/PropertyDynamicAccess.php b/Library/Expression/PropertyDynamicAccess.php index 433e0e7f2b..31218d182d 100644 --- a/Library/Expression/PropertyDynamicAccess.php +++ b/Library/Expression/PropertyDynamicAccess.php @@ -20,20 +20,17 @@ use function Zephir\add_slashes; /** - * Zephir\Expression\PropertyDynamicAccess. - * * Resolves expressions that read properties with a dynamic variable as property */ class PropertyDynamicAccess { - protected $expecting = true; + protected bool $expecting = true; - protected $readOnly = false; + protected bool $readOnly = false; protected $expectingVariable; - /** @var bool */ - protected $noisy = true; + protected bool $noisy = true; /** * Sets if the variable must be resolved into a direct variable symbol @@ -108,7 +105,7 @@ public function compile($expression, CompilationContext $compilationContext) throw new CompilerException('Variable type: '.$propertyAccess['right']['type'].' cannot be used as object', $propertyAccess['left']); } - /* + /** * Resolves the symbol that expects the value */ if ($this->expecting) { @@ -117,14 +114,14 @@ public function compile($expression, CompilationContext $compilationContext) if ('return_value' != $symbolVariable->getName()) { $symbolVariable->observeVariant($compilationContext); } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext); } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserve('variable', $compilationContext); } } - /* + /** * Variable that receives a property value must be polymorphic */ if ($symbolVariable && !$symbolVariable->isVariable()) { diff --git a/Library/Expression/Reference.php b/Library/Expression/Reference.php index cf5a23425e..55803254e4 100644 --- a/Library/Expression/Reference.php +++ b/Library/Expression/Reference.php @@ -13,12 +13,12 @@ namespace Zephir\Expression; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\GlobalConstant; use Zephir\Variable; /** @@ -49,6 +49,14 @@ class Reference */ protected ?Variable $expectingVariable = null; + private array $validTypes = [ + 'variable', + 'string', + 'object', + 'array', + 'callable', + ]; + /** * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. @@ -56,7 +64,7 @@ class Reference * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -72,115 +80,16 @@ public function setReadOnly(bool $readOnly): void $this->readOnly = $readOnly; } - /** - * Resolves an item to be added in an array. - * - * @param CompiledExpression $exprCompiled - * @param CompilationContext $compilationContext - * - * @return GlobalConstant|Variable - * - * @throws Exception - */ - public function getArrayValue(CompiledExpression $exprCompiled, CompilationContext $compilationContext) - { - $codePrinter = $compilationContext->codePrinter; - - switch ($exprCompiled->getType()) { - case 'int': - case 'uint': - case 'long': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_LONG('.$tempVar->getName().', '.$exprCompiled->getCode().');'); - - return $tempVar; - - case 'char': - case 'uchar': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_LONG('.$tempVar->getName().', \''.$exprCompiled->getCode().'\');'); - - return $tempVar; - - case 'double': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_DOUBLE('.$tempVar->getName().', '.$exprCompiled->getCode().');'); - - return $tempVar; - - case 'bool': - if ('true' === $exprCompiled->getCode()) { - return new GlobalConstant('ZEPHIR_GLOBAL(global_true)'); - } - - if ('false' === $exprCompiled->getCode()) { - return new GlobalConstant('ZEPHIR_GLOBAL(global_false)'); - } - - throw new Exception('?'); - break; - - case 'null': - return new GlobalConstant('ZEPHIR_GLOBAL(global_null)'); - - case 'string': - case 'ulong': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_STRING('.$tempVar->getName().', "'.$exprCompiled->getCode().'", 1);'); - - return $tempVar; - - case 'array': - return $compilationContext->symbolTable->getVariableForRead($exprCompiled->getCode(), $compilationContext, $exprCompiled->getOriginal()); - - case 'variable': - $itemVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiled->getCode(), $compilationContext, $exprCompiled->getOriginal()); - switch ($itemVariable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_LONG('.$tempVar->getName().', '.$itemVariable->getName().');'); - - return $tempVar; - - case 'double': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_DOUBLE('.$tempVar->getName().', '.$itemVariable->getName().');'); - - return $tempVar; - - case 'bool': - $tempVar = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext); - $codePrinter->output('ZVAL_BOOL('.$tempVar->getName().', '.$itemVariable->getName().');'); - - return $tempVar; - - case 'string': - case 'variable': - case 'array': - return $itemVariable; - - default: - throw new CompilerException('Unknown '.$itemVariable->getType(), $itemVariable); - } - break; - - default: - throw new CompilerException('Unknown', $exprCompiled); - } - } - /** * Compiles a reference to a value. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -204,20 +113,12 @@ public function compile(array $expression, CompilationContext $compilationContex $leftExpr->setReadOnly($this->readOnly); $left = $leftExpr->compile($compilationContext); - $validTypes = [ - 'variable', - 'string', - 'object', - 'array', - 'callable', - ]; - - if (!in_array($left->getType(), $validTypes)) { + if (!in_array($left->getType(), $this->validTypes)) { throw new CompilerException('Cannot obtain a reference from type: '.$left->getType(), $expression); } $leftVariable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression); - if (!in_array($leftVariable->getType(), $validTypes)) { + if (!in_array($leftVariable->getType(), $this->validTypes)) { throw new CompilerException('Cannot obtain reference from variable type: '.$leftVariable->getType(), $expression); } diff --git a/Library/Expression/StaticConstantAccess.php b/Library/Expression/StaticConstantAccess.php index 4ab9fe5f13..7d8b4c078e 100644 --- a/Library/Expression/StaticConstantAccess.php +++ b/Library/Expression/StaticConstantAccess.php @@ -9,8 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; +use ReflectionException; use Zephir\ClassConstant; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -18,30 +21,28 @@ use Zephir\Exception\CompilerException; use Zephir\Variable; +use function gettype; +use function in_array; + /** - * StaticConstantAccess. - * * Resolves class constants */ class StaticConstantAccess { - /** @var bool */ - protected $expecting = true; + protected bool $expecting = true; - /** @var bool */ - protected $readOnly = false; + protected bool $readOnly = false; - /** @var Variable|null */ - protected $expectingVariable; + protected ?Variable $expectingVariable = null; /** * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. * - * @param bool $expecting + * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -52,32 +53,32 @@ public function setExpectReturn($expecting, Variable $expectingVariable = null) * * @param bool $readOnly */ - public function setReadOnly($readOnly) + public function setReadOnly(bool $readOnly): void { - $this->readOnly = (bool) $readOnly; + $this->readOnly = $readOnly; } /** * Access a static constant class. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException|Exception - * * @return CompiledExpression + * @throws Exception + * @throws ReflectionException */ - public function compile(array $expression, CompilationContext $compilationContext) + public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { $compiler = &$compilationContext->compiler; $className = $expression['left']['value']; $constant = $expression['right']['value']; - /* + /** * Fetch the class definition according to the class where the constant * is supposed to be declared */ - if (!\in_array($className, ['this', 'self', 'static', 'parent'])) { + if (!in_array($className, ['this', 'self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); if ($compiler->isClass($className) || $compiler->isInterface($className)) { $classDefinition = $compiler->getClassDefinition($className); @@ -89,30 +90,28 @@ public function compile(array $expression, CompilationContext $compilationContex } } } else { - if (\in_array($className, ['self', 'static', 'this'])) { + if (in_array($className, ['self', 'static', 'this'])) { $classDefinition = $compilationContext->classDefinition; - } else { - if ('parent' == $className) { - $classDefinition = $compilationContext->classDefinition; - $extendsClass = $classDefinition->getExtendsClass(); - if (!$extendsClass) { - throw new CompilerException( - sprintf( - 'Cannot find constant called "%s" on parent because class %s does not extend any class', - $constant, - $classDefinition->getCompleteName() - ), - $expression - ); - } else { - $classDefinition = $classDefinition->getExtendsClassDefinition(); - } + } elseif ('parent' === $className) { + $classDefinition = $compilationContext->classDefinition; + $extendsClass = $classDefinition->getExtendsClass(); + if (!$extendsClass) { + throw new CompilerException( + sprintf( + 'Cannot find constant called "%s" on parent because class %s does not extend any class', + $constant, + $classDefinition->getCompleteName() + ), + $expression + ); + } else { + $classDefinition = $classDefinition->getExtendsClassDefinition(); } } } - /* - * Constants are resolved to their values at compile time + /** + * Constants are resolved to their values at compile time, * so we need to check that they effectively do exist */ if (!$classDefinition->hasConstant($constant)) { @@ -126,11 +125,11 @@ public function compile(array $expression, CompilationContext $compilationContex ); } - /* + /** * We can optimize the reading of constants by avoiding query their value every time */ if (!$compilationContext->config->get('static-constant-class-folding', 'optimizations')) { - /* + /** * Resolves the symbol that expects the value */ if ($this->expecting) { @@ -152,7 +151,7 @@ public function compile(array $expression, CompilationContext $compilationContex ); } - /* + /** * Variable that receives property accesses must be polymorphic */ if (!$symbolVariable->isVariable()) { @@ -163,9 +162,7 @@ public function compile(array $expression, CompilationContext $compilationContex } $symbolVariable->setDynamicTypes('undefined'); - $compilationContext->headersManager->add('kernel/object'); - $compilationContext->codePrinter->output( sprintf( 'zephir_get_class_constant(%s, %s, SS("%s"));', @@ -186,8 +183,8 @@ public function compile(array $expression, CompilationContext $compilationContex $type = $constantDefinition->getValueType(); } else { $value = $constantDefinition; - $type = \gettype($value); - if ('integer' == $type) { + $type = gettype($value); + if ('integer' === $type) { $type = 'int'; } } @@ -209,9 +206,6 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('null', null, $expression); } - /* - * Return the value as a literal expression - */ return new CompiledExpression($type, $value, $expression); } } diff --git a/Library/Expression/StaticPropertyAccess.php b/Library/Expression/StaticPropertyAccess.php index 56970fee8e..80347e9428 100644 --- a/Library/Expression/StaticPropertyAccess.php +++ b/Library/Expression/StaticPropertyAccess.php @@ -9,36 +9,39 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; +use ReflectionException; use Zephir\ClassProperty; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Variable; +use function in_array; + /** - * Zephir\Expression\StaticPropertyAccess. - * * Resolves class static properties */ class StaticPropertyAccess { - protected $expecting = true; + protected bool $expecting = true; - protected $readOnly = false; + protected bool $readOnly = false; - /** @var Variable|null */ - protected $expectingVariable; + protected ?Variable $expectingVariable = null; /** * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. * - * @param bool $expecting + * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -49,7 +52,7 @@ public function setExpectReturn($expecting, Variable $expectingVariable = null) * * @param bool $readOnly */ - public function setReadOnly($readOnly) + public function setReadOnly(bool $readOnly): void { $this->readOnly = $readOnly; } @@ -57,22 +60,24 @@ public function setReadOnly($readOnly) /** * Access a static property. * - * @param array $expression + * @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): CompiledExpression { $className = $expression['left']['value']; $compiler = $compilationContext->compiler; $property = $expression['right']['value']; - /* + /** * Fetch the class definition according to the class where the constant * is supposed to be declared */ - if (!\in_array($className, ['self', 'static', 'parent'])) { + if (!in_array($className, ['self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); if ($compiler->isClass($className)) { $classDefinition = $compiler->getClassDefinition($className); @@ -84,13 +89,12 @@ public function compile($expression, CompilationContext $compilationContext) } } } else { - if (\in_array($className, ['self', 'static'])) { + if (in_array($className, ['self', 'static'])) { $classDefinition = $compilationContext->classDefinition; } else { - if ('parent' == $className) { + if ('parent' === $className) { $classDefinition = $compilationContext->classDefinition; - $extendsClass = $classDefinition->getExtendsClass(); - if (!$extendsClass) { + if (!$classDefinition->getExtendsClass()) { throw new CompilerException('Cannot access static property "'.$property.'" on parent because class '.$classDefinition->getCompleteName().' does not extend any class', $expression); } else { $classDefinition = $classDefinition->getExtendsClassDefinition(); @@ -121,13 +125,13 @@ public function compile($expression, CompilationContext $compilationContext) } } - /* + /** * Resolves the symbol that expects the value */ if ($this->expecting) { if ($this->expectingVariable) { $symbolVariable = $this->expectingVariable; - if ('return_value' == $symbolVariable->getName()) { + if ('return_value' === $symbolVariable->getName()) { $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext); } } else { @@ -137,7 +141,7 @@ public function compile($expression, CompilationContext $compilationContext) $symbolVariable = $compilationContext->symbolTable->getTempNonTrackedVariable('variable', $compilationContext); } - /* + /** * Variable that receives property accesses must be polymorphic */ if (!$symbolVariable->isVariable()) { @@ -145,15 +149,12 @@ public function compile($expression, CompilationContext $compilationContext) } $symbolVariable->setDynamicTypes('undefined'); - $compilationContext->headersManager->add('kernel/object'); - $readOnly = $this->readOnly; - if (!$readOnly) { - if ('return_value' != $symbolVariable->getName()) { - $symbolVariable->observeVariant($compilationContext); - } + if (!$this->readOnly && 'return_value' != $symbolVariable->getName()) { + $symbolVariable->observeVariant($compilationContext); } + $compilationContext->backend->fetchStaticProperty($symbolVariable, $classDefinition, $property, $this->readOnly, $compilationContext); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); diff --git a/Library/Fcall/FcallAwareInterface.php b/Library/Fcall/FcallAwareInterface.php deleted file mode 100644 index 307a754048..0000000000 --- a/Library/Fcall/FcallAwareInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Fcall; - -/** - * Zephir\Fcall\FcallAwareInterface. - */ -interface FcallAwareInterface -{ - /** - * Sets the FcallManager. - * - * @param FcallManagerInterface $fcallManager - */ - public function setFcallManager(FcallManagerInterface $fcallManager); - - /** - * Returns currently used FcallManager. - * - * @return FcallManagerInterface - */ - public function getFcallManager(); -} diff --git a/Library/Fcall/FcallManagerInterface.php b/Library/Fcall/FcallManagerInterface.php index 1af5aa596a..ab02c599b5 100644 --- a/Library/Fcall/FcallManagerInterface.php +++ b/Library/Fcall/FcallManagerInterface.php @@ -11,13 +11,8 @@ namespace Zephir\Fcall; -/** - * Zephir\Fcall\FcallManagerInterface. - */ interface FcallManagerInterface { - public function macroIsRequired($macro); - /** * Resolve internal fcall attributes to a suitable macro and ensure that it's generated during compilation. * diff --git a/Library/LiteralCompiledExpression.php b/Library/LiteralCompiledExpression.php index f8c20af30a..8c6ea22cab 100644 --- a/Library/LiteralCompiledExpression.php +++ b/Library/LiteralCompiledExpression.php @@ -14,7 +14,7 @@ /** * LiteralCompiledExpression. * - * This represent a compiled expression as CompiledExpression, but the contents of + * This represents a compiled expression as CompiledExpression, but the contents of * the resolved code is potentially a simple literal expression */ class LiteralCompiledExpression extends CompiledExpression diff --git a/Library/MethodCall.php b/Library/MethodCall.php index 47995a1653..cceadf303e 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -11,6 +11,7 @@ namespace Zephir; +use ReflectionException; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; @@ -41,7 +42,7 @@ class MethodCall extends Call * @param CompilationContext $compilationContext * @return mixed|CompiledExpression * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException */ public function compile(Expression $expr, CompilationContext $compilationContext): mixed { @@ -670,7 +671,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext } break; - /* + /** * Passing polymorphic variables to static typed parameters * could lead to potential unexpected type coercions */ @@ -826,12 +827,13 @@ public function compile(Expression $expr, CompilationContext $compilationContext * Examine internal class information and returns the method called. * * @param CompilationContext $compilationContext - * @param Variable $caller - * @param string $methodName + * @param Variable $caller + * @param string $methodName * * @return array + * @throws ReflectionException */ - private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, $methodName) + private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, string $methodName): array { $compiler = $compilationContext->compiler; diff --git a/Library/Operators/AbstractOperator.php b/Library/Operators/AbstractOperator.php index 50e49f3c5b..037f5066ef 100644 --- a/Library/Operators/AbstractOperator.php +++ b/Library/Operators/AbstractOperator.php @@ -35,7 +35,7 @@ abstract class AbstractOperator * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -81,33 +81,24 @@ public function getExpectedNonLiteral(CompilationContext $compilationContext, ar * store the result. * * @param CompilationContext $compilationContext - * @param array $expression - * @param bool $init + * @param array $expression + * @param bool $init * - * @return Variable + * @return Variable|null */ public function getExpected(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable { - $symbolVariable = $this->expectingVariable; + if (!$this->expecting) { + return $this->expectingVariable; + } - if ($this->expecting) { - if (\is_object($symbolVariable)) { - if ('variable' === $symbolVariable->getType()) { - if (!$init) { - return $symbolVariable; - } - $symbolVariable->initVariant($compilationContext); - } else { - if (!$this->readOnly) { - if (!$this->literalOnly) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite('variable', $compilationContext); - } - } else { - $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite('variable', $compilationContext); - } + $symbolVariable = $this->expectingVariable; + if (\is_object($symbolVariable)) { + if ('variable' === $symbolVariable->getType()) { + if (!$init) { + return $symbolVariable; } + $symbolVariable->initVariant($compilationContext); } else { if (!$this->readOnly) { if (!$this->literalOnly) { @@ -119,6 +110,16 @@ public function getExpected(CompilationContext $compilationContext, array $expre $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite('variable', $compilationContext); } } + } else { + if (!$this->readOnly) { + if (!$this->literalOnly) { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + } else { + $symbolVariable = $compilationContext->symbolTable->getTempComplexLiteralVariableForWrite('variable', $compilationContext); + } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempLocalVariableForWrite('variable', $compilationContext); + } } return $symbolVariable; diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index d9c49f3113..a09fbbbbe3 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -152,7 +152,7 @@ public function optimizeTypeOf(array $expr, CompilationContext $compilationConte break; case 'variable': - $condition = $compilationContext->backend->getTypeofCondition($variableVariable, $operator, $value, $compilationContext); + $condition = $compilationContext->backend->getTypeofCondition($variableVariable, $operator, $value); break; default: @@ -231,7 +231,7 @@ public function compile(array $expression, CompilationContext $compilationContex case 'mixed': case 'string': $compilationContext->headersManager->add('kernel/operators'); - $condition = $compilationContext->backend->getTypeofCondition($variableRight, $this->operator, 'null', $compilationContext); + $condition = $compilationContext->backend->getTypeofCondition($variableRight, $this->operator, 'null'); return new CompiledExpression('bool', $condition, $expression); @@ -595,7 +595,7 @@ public function compile(array $expression, CompilationContext $compilationContex switch ($right->getType()) { case 'null': - $condition = $compilationContext->backend->getTypeofCondition($variable, $this->operator, 'null', $compilationContext); + $condition = $compilationContext->backend->getTypeofCondition($variable, $this->operator, 'null'); return new CompiledExpression('bool', $condition, $expression['left']); diff --git a/Library/Operators/Logical/AndOperator.php b/Library/Operators/Logical/AndOperator.php index 29b4e55040..0ce42886df 100644 --- a/Library/Operators/Logical/AndOperator.php +++ b/Library/Operators/Logical/AndOperator.php @@ -14,6 +14,7 @@ namespace Zephir\Operators\Logical; use Exception; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; @@ -32,6 +33,7 @@ class AndOperator extends LogicalBaseOperator * * @return CompiledExpression * + * @throws ReflectionException * @throws \Zephir\Exception */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression diff --git a/Library/Operators/Other/CloneOperator.php b/Library/Operators/Other/CloneOperator.php index 742430d903..56e1a91350 100644 --- a/Library/Operators/Other/CloneOperator.php +++ b/Library/Operators/Other/CloneOperator.php @@ -64,7 +64,6 @@ public function compile(array $expression, CompilationContext $compilationContex } $symbolVariable->setDynamicTypes('object'); - $symbolVariable->setIsInitialized(true, $compilationContext); /* Inherit the dynamic type data from the cloned object */ diff --git a/Library/Operators/Other/IssetOperator.php b/Library/Operators/Other/IssetOperator.php index 061ce042a4..4ed034dd7b 100644 --- a/Library/Operators/Other/IssetOperator.php +++ b/Library/Operators/Other/IssetOperator.php @@ -123,7 +123,7 @@ public function compile(array $expression, CompilationContext $compilationContex $variableCode = $compilationContext->backend->getVariableCode($variable); if ('property-access' === $left['type']) { - return $compilationContext->backend->propertyIsset($variable, $left['right']['value'], $compilationContext); + return $compilationContext->backend->propertyIsset($variable, $left['right']['value']); } $expr = new Expression($left['right']); diff --git a/Library/Statements/ForStatement.php b/Library/Statements/ForStatement.php index e2639a38eb..3354a89d9b 100644 --- a/Library/Statements/ForStatement.php +++ b/Library/Statements/ForStatement.php @@ -485,7 +485,8 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC $codePrinter->increaseLevel(); $codePrinter->output('{'); $codePrinter->increaseLevel(); - $compilationContext->backend->forStatementIterator($iteratorVariable, $variable, $compilationContext); + $compilationContext->symbolTable->mustGrownStack(true); + $compilationContext->codePrinter->output('ZEPHIR_ITERATOR_COPY('.$compilationContext->backend->getVariableCode($variable).', '.$iteratorVariable->getName().');'); $codePrinter->decreaseLevel(); $codePrinter->output('}'); $codePrinter->decreaseLevel(); diff --git a/Library/Statements/IfStatement.php b/Library/Statements/IfStatement.php index f079af883b..df1756947e 100644 --- a/Library/Statements/IfStatement.php +++ b/Library/Statements/IfStatement.php @@ -11,36 +11,37 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\Branch; use Zephir\CompilationContext; use Zephir\Detectors\ReadDetector; +use Zephir\Exception; use Zephir\Optimizers\EvalExpression; use Zephir\Passes\SkipVariantInit; use Zephir\StatementsBlock; /** - * IfStatement. - * * 'If' statement, the same as in PHP/C */ class IfStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext + * @throws ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $exprRaw = $this->statement['expr']; $expr = new EvalExpression(); $condition = $expr->optimize($exprRaw, $compilationContext); - /* + /** * This pass tries to move dynamic variable initialization out of the if/else branch */ if (isset($this->statement['statements']) && (isset($this->statement['else_statements']) || isset($this->statement['elseif_statements']))) { $readDetector = new ReadDetector(); - $skipVariantInit = new SkipVariantInit(); $skipVariantInit->setVariablesToSkip(0, $expr->getUsedVariables()); @@ -73,7 +74,7 @@ public function compile(CompilationContext $compilationContext) foreach ($skipVariantInit->getVariables() as $variable) { if ($symbolTable->hasVariable($variable)) { $symbolVariable = $symbolTable->getVariable($variable); - if ('variable' == $symbolVariable->getType()) { + if ('variable' === $symbolVariable->getType()) { if (!$readDetector->detect($variable, $exprRaw)) { $symbolVariable->initVariant($compilationContext); $symbolVariable->skipInitVariant(2); @@ -96,7 +97,7 @@ public function compile(CompilationContext $compilationContext) } } - /* + /** * Compile statements in the 'if' block */ if (isset($this->statement['statements'])) { @@ -105,11 +106,11 @@ public function compile(CompilationContext $compilationContext) $branch->setRelatedStatement($this); } - /* + /** * Compile statements in the 'elseif' block */ if (isset($this->statement['elseif_statements'])) { - foreach ($this->statement['elseif_statements'] as $key => $statement) { + foreach ($this->statement['elseif_statements'] as $statement) { if (!isset($statement['statements'])) { continue; } @@ -121,7 +122,7 @@ public function compile(CompilationContext $compilationContext) } } - /* + /** * Compile statements in the 'else' block */ if (isset($this->statement['else_statements'])) { diff --git a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php b/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php index cb0f51d753..b7d02416b0 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php +++ b/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php @@ -13,13 +13,12 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Variable as ZephirVariable; /** - * ObjectPropertyArrayIndexAppend. - * * Updates object properties dynamically */ class ObjectPropertyArrayIndexAppend extends ArrayIndex @@ -43,21 +42,21 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres throw new CompilerException('Attempt to use variable type: '.$symbolVariable->getType().' as object', $statement); } - $this->_assignPropertyArrayMultipleIndex($variable, $symbolVariable, $resolvedExpr, $compilationContext, $statement); + $this->_assignPropertyArrayMultipleIndex($symbolVariable, $resolvedExpr, $compilationContext, $statement); } /** * Compiles x->y[a][b][] = {expr} (multiple offset assignment). * - * @param string $variable - * @param ZephirVariable $symbolVariable + * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext - * @param array $statement + * @param array $statement * - * @throws CompilerException + * @throws \ReflectionException + * @throws Exception */ - protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + protected function _assignPropertyArrayMultipleIndex(ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); @@ -94,7 +93,7 @@ protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $ $offsetExprs[] = $resolvedIndex; } - /* + /** * Check if the property to update is defined */ if ('this' == $symbolVariable->getRealName()) { @@ -103,7 +102,7 @@ protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $ throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); } } else { - /* + /** * If we know the class related to a variable we could check if the property * is defined on that class */ diff --git a/Library/Statements/ReturnStatement.php b/Library/Statements/ReturnStatement.php index a411c5816d..c536999c60 100644 --- a/Library/Statements/ReturnStatement.php +++ b/Library/Statements/ReturnStatement.php @@ -22,8 +22,6 @@ use function Zephir\add_slashes; /** - * ReturnStatement. - * * Return statement is used to assign variables */ final class ReturnStatement extends StatementAbstract diff --git a/Library/Statements/StatementAbstract.php b/Library/Statements/StatementAbstract.php index 96f75c5954..56428c4b48 100644 --- a/Library/Statements/StatementAbstract.php +++ b/Library/Statements/StatementAbstract.php @@ -14,48 +14,15 @@ use Zephir\CompilationContext; use Zephir\Optimizers\EvalExpression; -/** - * Zephir\Statements\StatementAbstract. - */ abstract class StatementAbstract { - protected $statement; - - protected $uniqueId; - - /** @var EvalExpression|null */ - protected $evalExpression; - - protected static $uniqueGenerator; + protected ?EvalExpression $evalExpression; - /** - * StatementAbstract construct. - * - * @param array $statement - */ - public function __construct(array $statement) + public function __construct(protected array $statement) { - $this->statement = $statement; } - /** - * Generates a uniqueId for those instructions that need it. - * - * @return int - */ - public function getUniqueId() - { - if (!$this->uniqueId) { - $this->uniqueId = self::$uniqueGenerator++; - } - - return $this->uniqueId; - } - - /** - * @return EvalExpression|null - */ - public function getEvalExpression() + public function getEvalExpression(): ?EvalExpression { return $this->evalExpression; } diff --git a/Library/Statements/SwitchStatement.php b/Library/Statements/SwitchStatement.php index 29cc6fe92b..bff0c62b27 100644 --- a/Library/Statements/SwitchStatement.php +++ b/Library/Statements/SwitchStatement.php @@ -13,21 +13,23 @@ use Zephir\Branch; use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Expression; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; +use function count; /** - * SwitchStatement. - * * Switch statement, the same as in PHP/C */ class SwitchStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext + * @throws \ReflectionException + * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $exprRaw = $this->statement['expr']; @@ -113,14 +115,14 @@ public function compile(CompilationContext $compilationContext) } } - /* + /** * In the second round we generate the conditions with their blocks * grouping 'cases' without a statement block using an 'or' */ foreach ($blocks as $block) { $expressions = $block['expr']; - if (1 == \count($expressions)) { + if (1 == count($expressions)) { $condition = $evalExpr->optimize($expressions[0], $compilationContext); $codePrinter->output('if ('.$condition.') {'); } else { @@ -142,7 +144,7 @@ public function compile(CompilationContext $compilationContext) $compilationContext->codePrinter->decreaseLevel(); - /* + /** * The default block is resolved at the end of the 'switch' */ if ($defaultBlock) { @@ -165,7 +167,7 @@ public function normalizeClauses($clauses) } } - if ($defaultIndex === \count($clauses) - 1) { + if ($defaultIndex === count($clauses) - 1) { return $clauses; } diff --git a/Library/Statements/ThrowStatement.php b/Library/Statements/ThrowStatement.php index 70a7e38322..06bca5ad52 100644 --- a/Library/Statements/ThrowStatement.php +++ b/Library/Statements/ThrowStatement.php @@ -27,8 +27,6 @@ use function Zephir\fqcn; /** - * ThrowStatement. - * * Throws exceptions */ class ThrowStatement extends StatementAbstract @@ -39,7 +37,7 @@ class ThrowStatement extends StatementAbstract * @throws Exception * @throws ReflectionException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $compilationContext->headersManager->add('kernel/exception'); @@ -47,7 +45,7 @@ public function compile(CompilationContext $compilationContext) $statement = $this->statement; $expr = $statement['expr']; - /* + /** * This optimizes throw new Exception("hello") */ if (!$compilationContext->insideTryCatch) { diff --git a/Library/Statements/TryCatchStatement.php b/Library/Statements/TryCatchStatement.php index c2f5cf4f87..197222ce17 100644 --- a/Library/Statements/TryCatchStatement.php +++ b/Library/Statements/TryCatchStatement.php @@ -18,16 +18,11 @@ use Zephir\StatementsBlock; /** - * TryCatchStatement. - * * Try/Catch statement the same as in PHP */ class TryCatchStatement extends StatementAbstract { - /** - * @param CompilationContext $compilationContext - */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $codePrinter = $compilationContext->codePrinter; @@ -46,7 +41,7 @@ public function compile(CompilationContext $compilationContext) $codePrinter->outputBlankLine(); $codePrinter->output('try_end_'.$currentTryCatch.':'); - /* + /** * If 'try' is the latest statement add a 'dummy' statement to avoid compilation errors */ $codePrinter->outputBlankLine(); @@ -54,7 +49,7 @@ public function compile(CompilationContext $compilationContext) --$compilationContext->insideTryCatch; if (isset($this->statement['catches'])) { - /* + /** * Check if there was an exception */ $codePrinter->output('if (EG(exception)) {'); @@ -78,20 +73,16 @@ public function compile(CompilationContext $compilationContext) $assignExceptionVarStmt = $exprBuilder->statements()->rawC('ZEPHIR_CPY_WRT(&'.$variable->getName().', &'.$exc_var->getName().');'); - /* + /** * TODO:, use a builder here */ $variable->setIsInitialized(true, $compilationContext); $variable->setMustInitNull(true); - /* + /** * Check if any of the classes in the catch block match the thrown exception */ foreach ($catch['classes'] as $class) { - $assignExceptVar = $exprBuilder->statements()->let([ - $exprBuilder->operators()->assignVariable($variable->getName(), $exprBuilder->variable($variable->getName())), - ]); - $ifs[] = $exprBuilder->statements()->ifX() ->setCondition( $exprBuilder->operators()->binary( diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 38052a1682..1c28f9cdd0 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -20,8 +20,6 @@ use function is_string; /** - * StaticCall. - * * Call methods in a static context */ class StaticCall extends Call @@ -413,16 +411,17 @@ protected function callParent($methodName, array $expression, $symbolVariable, $ } /** - * Calls static methods on the some class context. + * Calls static methods on some class context. * - * @param string $methodName - * @param array $expression - * @param Variable $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting - * @param ClassDefinition $classDefinition + * @param string $methodName + * @param array $expression + * @param Variable $symbolVariable + * @param bool $mustInit + * @param bool $isExpecting + * @param ClassDefinition $classDefinition * @param CompilationContext $compilationContext - * @param ClassMethod $method + * @param ClassMethod $method + * @throws Exception */ protected function callFromClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, ClassDefinition $classDefinition, CompilationContext $compilationContext, ClassMethod $method) { @@ -446,15 +445,13 @@ protected function callFromClass($methodName, array $expression, $symbolVariable $symbolVariable->trackVariant($compilationContext); } - if ($method) { - $method = $method->getOptimizedMethod(); - } + $method = $method->getOptimizedMethod(); /** * Check if the method call can have an inline cache. */ $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); - $cachePointer = $methodCache->get($compilationContext, isset($method) ? $method : null); + $cachePointer = $methodCache->get($compilationContext, $method); $params = []; if (isset($expression['parameters']) && count($expression['parameters'])) { diff --git a/Library/Variable.php b/Library/Variable.php index 2e2227c8fc..404b61967e 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -15,35 +15,27 @@ use Zephir\Exception\CompilerException; use Zephir\Variable\Globals; +use function in_array; +use function is_string; + /** - * Variable. - * * This represents a variable in a symbol table */ class Variable implements TypeAwareInterface { - const BRANCH_MAGIC = '$$'; - /** - * Variable's type. - */ - protected $type; + public const BRANCH_MAGIC = '$$'; /** * Current dynamic type of the variable. * * @var array */ - protected $dynamicTypes = ['unknown' => true]; - - /** - * Variable's name. - */ - protected $name; + protected array $dynamicTypes = ['unknown' => true]; /** * Branch where the variable was initialized for the first time. */ - protected $initBranch = false; + protected bool $initBranch = false; /** * Compiled variable's name. @@ -53,65 +45,65 @@ class Variable implements TypeAwareInterface /** * Number of times the variable has been read. */ - protected $numberUses = 0; + protected int $numberUses = 0; /** * Whether the variable is temporal or not. */ - protected $temporal = false; + protected bool $temporal = false; /** * Temporal variables are marked as idle. */ - protected $idle = false; + protected bool $idle = false; /** * Reusable temporary variables? */ - protected $reusable = true; + protected bool $reusable = true; /** * Number of mutations to the variable. */ - protected $numberMutates = 0; + protected int $numberMutates = 0; /** * Whether the variable has received any assignment. */ - protected $initialized = false; + protected bool $initialized = false; - protected $initBranches = []; + protected array $initBranches = []; - protected $isExternal = false; + protected bool $isExternal = false; - protected $variantInits = 0; + protected int $variantInits = 0; - protected $mustInitNull = false; + protected bool $mustInitNull = false; - protected $readOnly = false; + protected bool $readOnly = false; - protected $localOnly = false; + protected bool $localOnly = false; - protected $memoryTracked = true; + protected bool $memoryTracked = true; - protected $doublePointer = false; + protected bool $doublePointer = false; protected $defaultInitValue; /** * Class types. */ - protected $classTypes = []; + protected array $classTypes = []; /** * Associated class. */ - protected $associatedClass; + protected ClassDefinition $associatedClass; /** * Initialization skips. */ - protected $numberSkips = 0; + protected int $numberSkips = 0; /** * AST node where the variable was originally declared or created. @@ -131,7 +123,7 @@ class Variable implements TypeAwareInterface /** * Whether the variable was used or not. */ - protected $used = true; + protected bool $used = true; /** * Last AST node where the variable was used. @@ -141,7 +133,7 @@ class Variable implements TypeAwareInterface /** * @var Globals */ - protected $globalsManager; + protected Globals $globalsManager; /** * Complex variable type, they may need special treatment. @@ -157,16 +149,10 @@ class Variable implements TypeAwareInterface 'object' => 1, ]; - public function __construct(string $type, string $name, protected ?Branch $branch = null) + public function __construct(protected string $type, protected string $name, protected ?Branch $branch = null) { $this->globalsManager = new Globals(); - - if (\in_array($type, ['callable', 'object', 'resource'], true)) { - $type = 'variable'; - } - - $this->type = $type; - $this->name = $name; + $this->type = in_array($type, ['callable', 'object', 'resource'], true) ? 'variable' : $type; } /** @@ -184,7 +170,7 @@ public function getInitBranch() * * @return Branch[] */ - public function getInitBranches() + public function getInitBranches(): array { return $this->initBranches; } @@ -194,7 +180,7 @@ public function getInitBranches() * * @param string $type */ - public function setType(string $type) + public function setType(string $type): void { $this->type = $type; } @@ -214,7 +200,7 @@ public function getType(): string * * @param bool $localOnly */ - public function setLocalOnly(bool $localOnly) + public function setLocalOnly(bool $localOnly): void { $this->localOnly = $localOnly; } @@ -224,7 +210,7 @@ public function setLocalOnly(bool $localOnly) * * @return bool */ - public function isLocalOnly() + public function isLocalOnly(): bool { return $this->localOnly; } @@ -234,7 +220,7 @@ public function isLocalOnly() * * @param bool $doublePointer */ - public function setIsDoublePointer(bool $doublePointer) + public function setIsDoublePointer(bool $doublePointer): void { $this->doublePointer = $doublePointer; } @@ -242,7 +228,7 @@ public function setIsDoublePointer(bool $doublePointer) /** * Returns the variable. */ - public function isDoublePointer() + public function isDoublePointer(): bool { return $this->doublePointer; } @@ -306,7 +292,7 @@ public function isReadOnly() * * @param bool $temporal */ - public function setTemporal(bool $temporal) + public function setTemporal(bool $temporal): void { $this->temporal = $temporal; } @@ -316,7 +302,7 @@ public function setTemporal(bool $temporal) * * @return bool */ - public function isTemporal() + public function isTemporal(): bool { return $this->temporal; } @@ -326,7 +312,7 @@ public function isTemporal() * * @param bool $idle */ - public function setIdle(bool $idle) + public function setIdle(bool $idle): void { $this->idle = false; @@ -342,7 +328,7 @@ public function setIdle(bool $idle) * * @return bool */ - public function isIdle() + public function isIdle(): bool { return $this->idle; } @@ -352,7 +338,7 @@ public function isIdle() * * @param bool $reusable */ - public function setReusable(bool $reusable) + public function setReusable(bool $reusable): void { $this->reusable = $reusable; } @@ -362,7 +348,7 @@ public function setReusable(bool $reusable) * * @return bool */ - public function isReusable() + public function isReusable(): bool { return $this->reusable; } @@ -434,7 +420,7 @@ public function getBranch() * * @param array $node */ - public function setOriginal(array $node) + public function setOriginal(array $node): void { $this->node = $node; } @@ -444,15 +430,13 @@ public function setOriginal(array $node) * * @return array */ - public function getOriginal() + public function getOriginal(): array { - $node = $this->node; - - if (!$node) { - $node = ['file' => 'unknown', 'line' => 0, 'char' => 0]; + if ($this->node) { + return $this->node; } - return $node; + return ['file' => 'unknown', 'line' => 0, 'char' => 0]; } /** @@ -460,16 +444,16 @@ public function getOriginal() * * @param array|string $classTypes */ - public function setClassTypes($classTypes) + public function setClassTypes(array|string $classTypes): void { if ($classTypes) { - if (\is_string($classTypes)) { - if (!\in_array($classTypes, $this->classTypes)) { + if (is_string($classTypes)) { + if (!in_array($classTypes, $this->classTypes)) { $this->classTypes[] = $classTypes; } } else { foreach ($classTypes as $classType) { - if (!\in_array($classType, $this->classTypes)) { + if (!in_array($classType, $this->classTypes)) { $this->classTypes[] = $classType; } } @@ -482,7 +466,7 @@ public function setClassTypes($classTypes) * * @return array */ - public function getClassTypes() + public function getClassTypes(): array { return $this->classTypes; } @@ -502,7 +486,7 @@ public function setAssociatedClass($associatedClass) * * @return ClassDefinition */ - public function getAssociatedClass() + public function getAssociatedClass(): ClassDefinition { return $this->associatedClass; } @@ -512,17 +496,17 @@ public function getAssociatedClass() * * @param array|string $types */ - public function setDynamicTypes($types) + public function setDynamicTypes($types): void { if ($types) { unset($this->dynamicTypes['unknown']); - if (\is_string($types)) { + if (is_string($types)) { if (!isset($this->dynamicTypes[$types])) { $this->dynamicTypes[$types] = true; } } else { - foreach ($types as $type => $one) { + foreach ($types as $one) { if (!isset($this->dynamicTypes[$one])) { $this->dynamicTypes[$one] = true; } @@ -536,7 +520,7 @@ public function setDynamicTypes($types) * * @return array */ - public function getDynamicTypes() + public function getDynamicTypes(): array { return $this->dynamicTypes; } @@ -548,9 +532,9 @@ public function getDynamicTypes() * * @return bool */ - public function hasAnyDynamicType($types) + public function hasAnyDynamicType(array|string $types): bool { - if (\is_string($types)) { + if (is_string($types)) { $types = [$types]; } @@ -570,7 +554,7 @@ public function hasAnyDynamicType($types) * * @return bool */ - public function hasDifferentDynamicType(array $types) + public function hasDifferentDynamicType(array $types): bool { $number = 0; foreach ($types as $type) { @@ -585,7 +569,7 @@ public function hasDifferentDynamicType(array $types) /** * Increase the number of uses a variable may have. */ - public function increaseUses() + public function increaseUses(): void { ++$this->numberUses; } @@ -593,7 +577,7 @@ public function increaseUses() /** * Increase the number of mutations a variable may have. */ - public function increaseMutates() + public function increaseMutates(): void { ++$this->numberMutates; } @@ -603,7 +587,7 @@ public function increaseMutates() * * @return int */ - public function getNumberUses() + public function getNumberUses(): int { return $this->numberUses; } @@ -613,7 +597,7 @@ public function getNumberUses() * * @return int */ - public function getNumberMutations() + public function getNumberMutations(): int { return $this->numberMutates; } @@ -625,7 +609,7 @@ public function getNumberMutations() * @param bool $initialized * @param CompilationContext $compilationContext */ - public function setIsInitialized(bool $initialized, CompilationContext $compilationContext) + public function setIsInitialized(bool $initialized, CompilationContext $compilationContext): void { $this->initialized = $initialized; @@ -645,7 +629,7 @@ public function setIsInitialized(bool $initialized, CompilationContext $compilat * * @return bool */ - public function isInitialized() + public function isInitialized(): bool { return $this->initialized; } @@ -655,7 +639,7 @@ public function isInitialized() * * @param bool $isExternal */ - public function setIsExternal(bool $isExternal) + public function setIsExternal(bool $isExternal): void { $this->isExternal = $isExternal; $this->variantInits = 1; @@ -666,7 +650,7 @@ public function setIsExternal(bool $isExternal) * * @return bool */ - public function isExternal() + public function isExternal(): bool { return $this->isExternal; } @@ -676,7 +660,7 @@ public function isExternal() * * @return bool */ - public function mustInitNull() + public function mustInitNull(): bool { return $this->mustInitNull; } @@ -686,7 +670,7 @@ public function mustInitNull() * * @param mixed $mustInitNull */ - public function setMustInitNull($mustInitNull) + public function setMustInitNull($mustInitNull): void { $this->mustInitNull = (bool) $mustInitNull; } @@ -760,7 +744,7 @@ public function separate(CompilationContext $compilationContext) * * @param int $numberSkips */ - public function skipInitVariant($numberSkips) + public function skipInitVariant(int $numberSkips): void { $this->numberSkips += $numberSkips; } @@ -770,17 +754,17 @@ public function skipInitVariant($numberSkips) * * @return int */ - public function getSkipVariant() + public function getSkipVariant(): int { return $this->numberSkips; } - /* + /** * Allocate memory for variable and init it null val * * @param CompilationContext $compilationContext */ - public function initNonReferenced(CompilationContext $compilationContext) + public function initNonReferenced(CompilationContext $compilationContext): void { $compilationContext->headersManager->add('kernel/memory'); $compilationContext->codePrinter->output('ZEPHIR_INIT_ZVAL_NREF('.$this->getName().');'); @@ -791,7 +775,7 @@ public function initNonReferenced(CompilationContext $compilationContext) * * @return int */ - public function getVariantInits() + public function getVariantInits(): int { return $this->variantInits; } @@ -799,7 +783,7 @@ public function getVariantInits() /** * Increase the number of times the variable has been initialized. */ - public function increaseVariantIfNull() + public function increaseVariantIfNull(): void { ++$this->variantInits; } @@ -817,12 +801,12 @@ public function initVariant(CompilationContext $compilationContext) return; } - /* + /** * Variables are allocated for the first time using ZEPHIR_INIT_VAR - * the second, third, etc times are allocated using ZEPHIR_INIT_NVAR + * the second, third, etc. times are allocated using ZEPHIR_INIT_NVAR * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR */ - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { + if ('this_ptr' !== $this->getName() && 'return_value' !== $this->getName()) { if (false === $this->initBranch) { $this->initBranch = $compilationContext->currentBranch; } @@ -1042,7 +1026,7 @@ public function isSuperGlobal() * * @return bool */ - public function isLocalStatic() + public function isLocalStatic(): bool { return $this->isExternal && $this->localOnly; } @@ -1052,9 +1036,9 @@ public function isLocalStatic() * * @return bool */ - public function isVariable() + public function isVariable(): bool { - return 'variable' == $this->type; + return 'variable' === $this->type; } /** @@ -1072,7 +1056,7 @@ public function isMixed(): bool * * @return bool */ - public function isBoolean() + public function isBoolean(): bool { return 'bool' == $this->type; } @@ -1082,7 +1066,7 @@ public function isBoolean() * * @return bool */ - public function isString() + public function isString(): bool { return 'string' == $this->type; } @@ -1112,9 +1096,9 @@ public function isDouble() * * @return bool */ - public function isArray() + public function isArray(): bool { - return 'array' == $this->type; + return 'array' === $this->type; } /** @@ -1122,7 +1106,7 @@ public function isArray() * * @return bool */ - public function isNotVariable() + public function isNotVariable(): bool { return !$this->isVariable(); } @@ -1132,7 +1116,7 @@ public function isNotVariable() * * @return bool */ - public function isNotVariableAndString() + public function isNotVariableAndString(): bool { return !$this->isVariable() && !$this->isString(); } @@ -1142,7 +1126,7 @@ public function isNotVariableAndString() * * @return bool */ - public function isNotVariableAndMixedAndString() + public function isNotVariableAndMixedAndString(): bool { return !$this->isVariable() && !$this->isMixed() && !$this->isString(); } @@ -1152,7 +1136,7 @@ public function isNotVariableAndMixedAndString() * * @return bool */ - public function isNotVariableAndArray() + public function isNotVariableAndArray(): bool { return !$this->isVariable() && !$this->isArray(); } From c618155c2a277587663e2ac6976769e665db30e5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 2 Sep 2023 20:40:21 +0100 Subject: [PATCH 026/375] #2407 - Add return types --- Library/Backend/FcallManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Backend/FcallManager.php b/Library/Backend/FcallManager.php index 5b53197395..0711366c08 100644 --- a/Library/Backend/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -29,7 +29,7 @@ class FcallManager implements FcallManagerInterface * * @return string */ - public function getMacro($static, $doReturn, $paramCount) + public function getMacro($static, $doReturn, $paramCount): string { $scope = $static ? 'STATIC' : ''; $mode = 'CALL_INTERNAL_METHOD_NORETURN_P'; @@ -50,7 +50,7 @@ public function getMacro($static, $doReturn, $paramCount) return $macroName; } - public function genFcallCode() + public function genFcallCode(): void { $codePrinter = new CodePrinter(); From 05527e845c922ba181215e80fa05053a625fed4c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 2 Sep 2023 22:49:56 +0100 Subject: [PATCH 027/375] #2407 - Refactor `Variable` class --- Library/Variable.php | 252 ++++++++++++++-------------------- tests/Zephir/VariableTest.php | 4 - 2 files changed, 105 insertions(+), 151 deletions(-) diff --git a/Library/Variable.php b/Library/Variable.php index 404b61967e..66fc6c86e8 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use ReflectionClass; @@ -23,6 +25,10 @@ */ class Variable implements TypeAwareInterface { + public const VAR_THIS_POINTER = 'this_ptr'; + + public const VAR_RETURN_VALUE = 'return_value'; + public const BRANCH_MAGIC = '$$'; /** @@ -40,7 +46,7 @@ class Variable implements TypeAwareInterface /** * Compiled variable's name. */ - protected $lowName; + protected string $lowName = ''; /** * Number of times the variable has been read. @@ -88,17 +94,11 @@ class Variable implements TypeAwareInterface protected bool $doublePointer = false; - protected $defaultInitValue; + protected mixed $defaultInitValue = null; - /** - * Class types. - */ protected array $classTypes = []; - /** - * Associated class. - */ - protected ClassDefinition $associatedClass; + protected ?ClassDefinition $associatedClass = null; /** * Initialization skips. @@ -108,17 +108,17 @@ class Variable implements TypeAwareInterface /** * AST node where the variable was originally declared or created. */ - protected $node; + protected ?array $node = null; /** * Possible constant value assigned to the variable. */ - protected $possibleValue; + protected mixed $possibleValue = null; /** * Branch where the variable got its last possible value. */ - protected $possibleValueBranch; + protected mixed $possibleValueBranch = null; /** * Whether the variable was used or not. @@ -128,27 +128,13 @@ class Variable implements TypeAwareInterface /** * Last AST node where the variable was used. */ - protected $usedNode; + protected ?array $usedNode = null; /** * @var Globals */ protected Globals $globalsManager; - /** - * Complex variable type, they may need special treatment. - * - * @var array - */ - protected array $complexTypes = [ - 'variable' => 1, - 'string' => 1, - 'array' => 1, - 'resource' => 1, - 'callable' => 1, - 'object' => 1, - ]; - public function __construct(protected string $type, protected string $name, protected ?Branch $branch = null) { $this->globalsManager = new Globals(); @@ -158,9 +144,9 @@ public function __construct(protected string $type, protected string $name, prot /** * Get init branch. * - * @return bool|int + * @return bool */ - public function getInitBranch() + public function getInitBranch(): bool { return $this->initBranch; } @@ -238,7 +224,7 @@ public function isDoublePointer(): bool * * @return string */ - public function getRealName() + public function getRealName(): string { return $this->name; } @@ -248,13 +234,9 @@ public function getRealName() * * @return string */ - public function getName() + public function getName(): string { - if ($this->lowName) { - return $this->lowName; - } - - return $this->name; + return $this->lowName ?: $this->name; } /** @@ -262,7 +244,7 @@ public function getName() * * @param string $lowName */ - public function setLowName(string $lowName) + public function setLowName(string $lowName): void { $this->lowName = $lowName; } @@ -272,7 +254,7 @@ public function setLowName(string $lowName) * * @param bool $readOnly */ - public function setReadOnly(bool $readOnly) + public function setReadOnly(bool $readOnly): void { $this->readOnly = $readOnly; } @@ -282,7 +264,7 @@ public function setReadOnly(bool $readOnly) * * @return bool */ - public function isReadOnly() + public function isReadOnly(): bool { return $this->readOnly; } @@ -359,7 +341,7 @@ public function isReusable(): bool * @param bool $used * @param array|null $node */ - public function setUsed(bool $used, array $node = null) + public function setUsed(bool $used, array $node = null): void { $this->used = $used; $this->usedNode = $node; @@ -370,17 +352,15 @@ public function setUsed(bool $used, array $node = null) * * @return bool */ - public function isUsed() + public function isUsed(): bool { return $this->used; } /** * Returns the last node where the variable was assigned or used. - * - * @return array */ - public function getLastUsedNode() + public function getLastUsedNode(): ?array { return $this->usedNode; } @@ -390,7 +370,7 @@ public function getLastUsedNode() * * @param bool $memoryTracked */ - public function setMemoryTracked(bool $memoryTracked) + public function setMemoryTracked(bool $memoryTracked): void { $this->memoryTracked = $memoryTracked; } @@ -400,7 +380,7 @@ public function setMemoryTracked(bool $memoryTracked) * * @return bool */ - public function isMemoryTracked() + public function isMemoryTracked(): bool { return $this->memoryTracked; } @@ -410,7 +390,7 @@ public function isMemoryTracked() * * @return Branch|null */ - public function getBranch() + public function getBranch(): ?Branch { return $this->branch; } @@ -446,17 +426,17 @@ public function getOriginal(): array */ public function setClassTypes(array|string $classTypes): void { - if ($classTypes) { - if (is_string($classTypes)) { - if (!in_array($classTypes, $this->classTypes)) { - $this->classTypes[] = $classTypes; - } - } else { - foreach ($classTypes as $classType) { - if (!in_array($classType, $this->classTypes)) { - $this->classTypes[] = $classType; - } - } + if (is_string($classTypes)) { + if (!in_array($classTypes, $this->classTypes)) { + $this->classTypes[] = $classTypes; + } + + return; + } + + foreach ($classTypes as $classType) { + if (!in_array($classType, $this->classTypes)) { + $this->classTypes[] = $classType; } } } @@ -474,9 +454,9 @@ public function getClassTypes(): array /** * Sets the PHP class related to variable. * - * @param ClassDefinition|ReflectionClass $associatedClass + * @param ReflectionClass|ClassDefinition $associatedClass */ - public function setAssociatedClass($associatedClass) + public function setAssociatedClass(ReflectionClass|ClassDefinition $associatedClass): void { $this->associatedClass = $associatedClass; } @@ -484,9 +464,9 @@ public function setAssociatedClass($associatedClass) /** * Returns the class related to the variable. * - * @return ClassDefinition + * @return ClassDefinition|null */ - public function getAssociatedClass(): ClassDefinition + public function getAssociatedClass(): ?ClassDefinition { return $this->associatedClass; } @@ -496,21 +476,17 @@ public function getAssociatedClass(): ClassDefinition * * @param array|string $types */ - public function setDynamicTypes($types): void + public function setDynamicTypes(array|string $types): void { - if ($types) { - unset($this->dynamicTypes['unknown']); + unset($this->dynamicTypes['unknown']); - if (is_string($types)) { - if (!isset($this->dynamicTypes[$types])) { - $this->dynamicTypes[$types] = true; - } - } else { - foreach ($types as $one) { - if (!isset($this->dynamicTypes[$one])) { - $this->dynamicTypes[$one] = true; - } - } + if (is_string($types)) { + $types = [$types]; + } + + foreach ($types as $type) { + if (!isset($this->dynamicTypes[$type])) { + $this->dynamicTypes[$type] = true; } } } @@ -563,7 +539,7 @@ public function hasDifferentDynamicType(array $types): bool } } - return 0 == $number; + return 0 === $number; } /** @@ -668,11 +644,11 @@ public function mustInitNull(): bool /** * Set if the variable must be initialized to null. * - * @param mixed $mustInitNull + * @param bool $mustInitNull */ - public function setMustInitNull($mustInitNull): void + public function setMustInitNull(bool $mustInitNull): void { - $this->mustInitNull = (bool) $mustInitNull; + $this->mustInitNull = $mustInitNull; } /** @@ -680,7 +656,7 @@ public function setMustInitNull($mustInitNull): void * * @param mixed $value */ - public function setDefaultInitValue($value) + public function setDefaultInitValue(mixed $value): void { $this->defaultInitValue = $value; } @@ -688,7 +664,7 @@ public function setDefaultInitValue($value) /** * Sets an automatic safe default init value according to its type. */ - public function enableDefaultAutoInitValue() + public function enableDefaultAutoInitValue(): void { switch ($this->type) { case 'char': @@ -722,7 +698,7 @@ public function enableDefaultAutoInitValue() * * @return mixed */ - public function getDefaultInitValue() + public function getDefaultInitValue(): mixed { return $this->defaultInitValue; } @@ -732,9 +708,9 @@ public function getDefaultInitValue() * * @param CompilationContext $compilationContext */ - public function separate(CompilationContext $compilationContext) + public function separate(CompilationContext $compilationContext): void { - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { + if (!in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { $compilationContext->codePrinter->output('ZEPHIR_SEPARATE('.$compilationContext->backend->getVariableCode($this).');'); } } @@ -793,7 +769,7 @@ public function increaseVariantIfNull(): void * * @param CompilationContext $compilationContext */ - public function initVariant(CompilationContext $compilationContext) + public function initVariant(CompilationContext $compilationContext): void { if ($this->numberSkips) { --$this->numberSkips; @@ -806,9 +782,9 @@ public function initVariant(CompilationContext $compilationContext) * the second, third, etc. times are allocated using ZEPHIR_INIT_NVAR * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR */ - if ('this_ptr' !== $this->getName() && 'return_value' !== $this->getName()) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; + if (self::VAR_THIS_POINTER !== $this->getName() && self::VAR_RETURN_VALUE !== $this->getName()) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; } $compilationContext->headersManager->add('kernel/memory'); @@ -820,7 +796,7 @@ public function initVariant(CompilationContext $compilationContext) $compilationContext->backend->initVar($this, $compilationContext, true, true); } else { if ($this->variantInits > 0) { - if (0 === $this->initBranch) { + if (!$this->initBranch) { $compilationContext->codePrinter->output('ZEPHIR_INIT_BNVAR('.$this->getName().');'); } else { $this->mustInitNull = true; @@ -849,7 +825,7 @@ public function initVariant(CompilationContext $compilationContext) * * @param CompilationContext $compilationContext */ - public function trackVariant(CompilationContext $compilationContext) + public function trackVariant(CompilationContext $compilationContext): void { if ($this->numberSkips) { --$this->numberSkips; @@ -857,14 +833,14 @@ public function trackVariant(CompilationContext $compilationContext) return; } - /* + /** * Variables are allocated for the first time using ZEPHIR_INIT_VAR - * the second, third, etc times are allocated using ZEPHIR_INIT_NVAR + * the second, third, etc. times are allocated using ZEPHIR_INIT_NVAR * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR */ - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; + if (self::VAR_THIS_POINTER !== $this->getName() && self::VAR_RETURN_VALUE !== $this->getName()) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; } if (!$this->isLocalOnly()) { @@ -873,7 +849,7 @@ public function trackVariant(CompilationContext $compilationContext) $this->mustInitNull = true; } else { if ($this->variantInits > 0) { - if (1 !== $this->initBranch) { + if (!$this->initBranch) { $this->mustInitNull = true; } } @@ -894,7 +870,7 @@ public function trackVariant(CompilationContext $compilationContext) * * @param CompilationContext $compilationContext */ - public function initComplexLiteralVariant(CompilationContext $compilationContext) + public function initComplexLiteralVariant(CompilationContext $compilationContext): void { if ($this->numberSkips) { --$this->numberSkips; @@ -902,9 +878,9 @@ public function initComplexLiteralVariant(CompilationContext $compilationContext return; } - if ('this_ptr' != $this->getName() && 'return_value' != $this->getName()) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; + if (self::VAR_THIS_POINTER != $this->getName() && self::VAR_RETURN_VALUE != $this->getName()) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; } $compilationContext->headersManager->add('kernel/memory'); @@ -924,6 +900,7 @@ public function initComplexLiteralVariant(CompilationContext $compilationContext $compilationContext->codePrinter->output('ZEPHIR_INIT_VAR(&'.$this->getName().');'); } } + ++$this->variantInits; } } @@ -933,7 +910,7 @@ public function initComplexLiteralVariant(CompilationContext $compilationContext * * @param CompilationContext $compilationContext */ - public function observeVariant(CompilationContext $compilationContext) + public function observeVariant(CompilationContext $compilationContext): void { if ($this->numberSkips) { --$this->numberSkips; @@ -942,9 +919,9 @@ public function observeVariant(CompilationContext $compilationContext) } $name = $this->getName(); - if ('this_ptr' != $name && 'return_value' != $name) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; + if (self::VAR_THIS_POINTER != $name && self::VAR_RETURN_VALUE != $name) { + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; } $compilationContext->headersManager->add('kernel/memory'); @@ -968,7 +945,7 @@ public function observeVariant(CompilationContext $compilationContext) * * @param CompilationContext $compilationContext */ - public function observeOrNullifyVariant(CompilationContext $compilationContext) + public function observeOrNullifyVariant(CompilationContext $compilationContext): void { if ($this->numberSkips) { --$this->numberSkips; @@ -976,47 +953,30 @@ public function observeOrNullifyVariant(CompilationContext $compilationContext) return; } - $name = $this->getName(); - if ('this_ptr' != $name && 'return_value' != $name) { - if (false === $this->initBranch) { - $this->initBranch = $compilationContext->currentBranch; - } - - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->symbolTable->mustGrownStack(true); - /** - * TODO: Do we need this? - * $compilationContext->codePrinter->output('ZEPHIR_OBS_NVAR(' . $this->getName() . ');');. - * - * TODO: What about else? - * $compilationContext->codePrinter->output('ZEPHIR_OBS_VAR(' . $this->getName() . ');'); - */ - if ($this->variantInits > 0 || $compilationContext->insideCycle) { - $this->mustInitNull = true; - } + if (in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { + return; + } - ++$this->variantInits; + if (!$this->initBranch) { + $this->initBranch = $compilationContext->currentBranch === 0; + } - $this->setMustInitNull(true); + $compilationContext->headersManager->add('kernel/memory'); + $compilationContext->symbolTable->mustGrownStack(true); + if ($this->variantInits > 0 || $compilationContext->insideCycle) { + $this->mustInitNull = true; } - } - /** - * Whether the variable is of a complex type. - * - * @return bool - */ - public function isComplex() - { - return isset($this->complexTypes[$this->type]); + ++$this->variantInits; + $this->setMustInitNull(true); } /** - * Checks if a variable is a superglobal. + * Checks if a variable is a super global. * * @return bool */ - public function isSuperGlobal() + public function isSuperGlobal(): bool { return $this->isExternal && $this->globalsManager->isSuperGlobal($this->name); } @@ -1058,7 +1018,7 @@ public function isMixed(): bool */ public function isBoolean(): bool { - return 'bool' == $this->type; + return 'bool' === $this->type; } /** @@ -1068,7 +1028,7 @@ public function isBoolean(): bool */ public function isString(): bool { - return 'string' == $this->type; + return 'string' === $this->type; } /** @@ -1076,9 +1036,9 @@ public function isString(): bool * * @return bool */ - public function isInt() + public function isInt(): bool { - return 'int' == $this->type; + return 'int' === $this->type; } /** @@ -1086,9 +1046,9 @@ public function isInt() * * @return bool */ - public function isDouble() + public function isDouble(): bool { - return 'double' == $this->type; + return 'double' === $this->type; } /** @@ -1147,7 +1107,7 @@ public function isNotVariableAndArray(): bool * @param CompiledExpression $possibleValue * @param CompilationContext $compilationContext */ - public function setPossibleValue(CompiledExpression $possibleValue, CompilationContext $compilationContext) + public function setPossibleValue(CompiledExpression $possibleValue, CompilationContext $compilationContext): void { $this->possibleValue = $possibleValue; $this->possibleValueBranch = $compilationContext->branchManager->getCurrentBranch(); @@ -1158,17 +1118,15 @@ public function setPossibleValue(CompiledExpression $possibleValue, CompilationC * * @return mixed */ - public function getPossibleValue() + public function getPossibleValue(): mixed { return $this->possibleValue; } /** * Returns the branch where the variable was assigned for the last time. - * - * @return Branch */ - public function getPossibleValueBranch() + public function getPossibleValueBranch(): ?Branch { return $this->possibleValueBranch; } diff --git a/tests/Zephir/VariableTest.php b/tests/Zephir/VariableTest.php index 7e2b4ff9f4..58cff493e6 100644 --- a/tests/Zephir/VariableTest.php +++ b/tests/Zephir/VariableTest.php @@ -74,7 +74,6 @@ public function testShouldSetProperties(): void $this->assertTrue($this->zephirVar->isVariable()); $this->assertFalse($this->zephirVar->isLocalStatic()); $this->assertFalse($this->zephirVar->isSuperGlobal()); - $this->assertTrue($this->zephirVar->isComplex()); $this->assertFalse($this->zephirVar->isBoolean()); $this->assertFalse($this->zephirVar->isString()); $this->assertFalse($this->zephirVar->isInt()); @@ -175,9 +174,6 @@ public function testShouldSetProperties(): void $superglobalVar->setIsExternal(true); $this->assertTrue($superglobalVar->isSuperGlobal()); - $this->zephirVar->setType('int'); - $this->assertFalse($this->zephirVar->isComplex()); - $this->zephirVar->setType('bool'); $this->assertTrue($this->zephirVar->isBoolean()); From c2dfc39b0a151ee1125c36a148e341de1d27ec87 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 3 Sep 2023 22:53:02 +0100 Subject: [PATCH 028/375] #2407 - Remove `Plus` class --- .../ReturnType/CompositeSpecification.php | 12 ---- Library/FunctionLike/ReturnType/Plus.php | 55 ------------------- 2 files changed, 67 deletions(-) delete mode 100644 Library/FunctionLike/ReturnType/Plus.php diff --git a/Library/FunctionLike/ReturnType/CompositeSpecification.php b/Library/FunctionLike/ReturnType/CompositeSpecification.php index f25434a76f..69fbec701d 100644 --- a/Library/FunctionLike/ReturnType/CompositeSpecification.php +++ b/Library/FunctionLike/ReturnType/CompositeSpecification.php @@ -27,18 +27,6 @@ public function either(SpecificationInterface $spec) return new Either($this, $spec); } - /** - * Creates a new logical AND specification. - * - * @param SpecificationInterface $spec - * - * @return Plus - */ - public function plus(SpecificationInterface $spec) - { - return new Plus($this, $spec); - } - /** * Creates a new logical NOT specification. * diff --git a/Library/FunctionLike/ReturnType/Plus.php b/Library/FunctionLike/ReturnType/Plus.php deleted file mode 100644 index f3bd0be1d1..0000000000 --- a/Library/FunctionLike/ReturnType/Plus.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -final class Plus extends CompositeSpecification -{ - /** - * Left Specification. - * - * @var SpecificationInterface - */ - protected $left; - - /** - * Right Specification. - * - * @var SpecificationInterface - */ - protected $right; - - /** - * A composite wrapper of two specifications. - * - * @param SpecificationInterface $left - * @param SpecificationInterface $right - */ - public function __construct(SpecificationInterface $left, SpecificationInterface $right) - { - $this->left = $left; - $this->right = $right; - } - - /** - * Checks if the composite AND of specifications passes. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $this->left->isSatisfiedBy($type) && $this->right->isSatisfiedBy($type); - } -} From 1c429d28e3cf9a93e55027897551b1ad735ebaf2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 3 Sep 2023 23:02:54 +0100 Subject: [PATCH 029/375] #2407 - Remove unused `Collection` class --- .../FunctionLike/ReturnType/Collection.php | 322 ---------- .../ReturnType/CollectionTest.php | 567 ------------------ 2 files changed, 889 deletions(-) delete mode 100644 Library/FunctionLike/ReturnType/Collection.php delete mode 100644 tests/Zephir/FunctionLike/ReturnType/CollectionTest.php diff --git a/Library/FunctionLike/ReturnType/Collection.php b/Library/FunctionLike/ReturnType/Collection.php deleted file mode 100644 index b1198d1e6e..0000000000 --- a/Library/FunctionLike/ReturnType/Collection.php +++ /dev/null @@ -1,322 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\FunctionLike\ReturnType; - -use SplObjectStorage; -use Zephir\Exception\InvalidArgumentException; - -use function count; - -final class Collection extends SplObjectStorage -{ - /** - * {@inheritdoc} - * - * @param TypeInterface $returnType - * - * @return string - */ - #[\ReturnTypeWillChange] - public function getHash($returnType) - { - return $returnType->getDataType(); - } - - /** - * {@inheritdoc} - * - * @param TypeInterface $returnType The return type instance - * @param array $definition The definition to associate with the return type instance - * - * @return $this - * - * @throws InvalidArgumentException - */ - #[\ReturnTypeWillChange] - public function attach($returnType, $definition = null) - { - if (!$returnType instanceof TypeInterface) { - $wrong = \is_object($returnType) ? 'instance of '.\get_class($returnType) : \gettype($returnType); - - throw new InvalidArgumentException( - sprintf('Expecting an instance of %s, got %s', TypeInterface::class, $wrong) - ); - } - - parent::attach($returnType, $definition); - - return $this; - } - - /** - * Checks if the collection has return-type or cast hints. - * - * @return bool - */ - public function hasReturnTypes(): bool - { - if (0 === $this->count() || $this->onlyVoid()) { - return false; - } - - return true; - } - - /** - * Gets all return types satisfied by specification. - * - * @param SpecificationInterface $spec - * - * @return TypeInterface[] - */ - public function getTypesBySpecification(SpecificationInterface $spec): array - { - $types = []; - - foreach ($this as $type) { - /** @var TypeInterface $type */ - if ($spec->isSatisfiedBy($type)) { - $types[] = $type; - } - } - - return $types; - } - - /** - * Checks whether at least one return type hint is null compatible. - * - * @return bool - */ - public function areReturnTypesNullCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IsNull()); - } - - /** - * Checks whether at least one return type hint is integer compatible. - * - * @return bool - */ - public function areReturnTypesIntCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IntCompatible()); - } - - /** - * Checks whether at least one return type hint is double compatible. - * - * @return bool - */ - public function areReturnTypesDoubleCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IsDouble()); - } - - /** - * Checks whether at least one return type hint is bool compatible. - * - * @return bool - */ - public function areReturnTypesBoolCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\IsBool()); - } - - /** - * Checks whether at least one return type hint is string compatible. - * - * @return bool - */ - public function areReturnTypesStringCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\StringCompatible()); - } - - /** - * Checks whether at least one return type hint is string compatible. - * - * @return bool - */ - public function areReturnTypesArrayCompatible(): bool - { - return $this->isSatisfiedByTypeSpec(new Specification\ArrayCompatible()); - } - - /** - * Checks whether at least one return type hint is object compatible. - * - * @return bool - */ - public function areReturnTypesObjectCompatible(): bool - { - return count($this->getObjectLikeReturnTypes()) > 0; - } - - /** - * Get object like return types. - * - * @return TypeInterface[] - */ - public function getObjectLikeReturnTypes() - { - return $this->getTypesBySpecification(new Specification\ObjectLike()); - } - - /** - * Checks if the collection has only void. - */ - public function onlyVoid() - { - return $this->isSatisfiedByTypeSpec(new Specification\IsVoid()) && 1 == $this->count(); - } - - /** - * Checks if the collection has only special types. - */ - public function onlySpecial() - { - if (0 == $this->count()) { - return false; - } - - $found = $this->getTypesBySpecification(new Specification\IsSpecial()); - - return count($found) == $this->count(); - } - - /** - * Checks whether all return types hint are well known. - * - * @return bool - */ - public function areReturnTypesWellKnown(): bool - { - if (0 === $this->count() || $this->isSatisfiedByTypeSpec(new Specification\IsSpecial())) { - return false; - } - - $spec = - (new Specification\ObjectLike()) - ->either(new Specification\ArrayCompatible()) - ->either(new Specification\IntCompatible()) - ->either(new Specification\StringCompatible()) - ->either(new Specification\IsBool()) - ->either(new Specification\IsDouble()) - ->either(new Specification\IsNull()) - // TODO: Please double check this - ->either(new Specification\IsVoid()); - - $found = $this->getTypesBySpecification($spec); - - return count($found) == $this->count(); - } - - /** - * Checks if the collection have compatible return types. - * - * @return bool - */ - public function areReturnTypesCompatible(): bool - { - $numberOfReturnTypes = $this->count(); - - if (0 == $numberOfReturnTypes || 1 == $numberOfReturnTypes) { - return true; - } - - // | | ... | - $classes = $this->getObjectLikeReturnTypes(); - - // | | | ... | - $collections = $this->getTypesBySpecification(new Specification\IsCollection()); - if (count($collections) > 0 && $this->areReturnTypesObjectCompatible()) { - return false; - } - - $summ = - // array | | | ... | - (int) $this->areReturnTypesArrayCompatible() + - - // char | uchar | int | uint | long | ulong - (int) $this->areReturnTypesIntCompatible() + - - // bool - (int) $this->areReturnTypesBoolCompatible() + - - // istring | string - (int) $this->areReturnTypesStringCompatible() + - - // double - (int) $this->areReturnTypesDoubleCompatible(); - - // T1 | T2 | ... | Tn - if ($summ > 1) { - return false; - } - - // | - if ($this->areReturnTypesObjectCompatible() && $summ > 0) { - return false; - } - - // null - $null = (int) $this->areReturnTypesNullCompatible(); - - // | null - // | null - // | null - if (1 == $null && 2 == $this->count()) { - return true; - } - - // T1 | T2 | ... | Tn | null - if (1 == $null && $null + $summ != $this->count()) { - return false; - } - - return 1 == $summ; - } - - /** - * Returns an array of cast hinted return types (if any). - * - * @return TypeInterface[] - */ - public function getCastHintedReturnTypes(): array - { - return $this->getTypesBySpecification(new Not(new Specification\IsReal())); - } - - /** - * Returns an array of real return types (if any). - * - * @return TypeInterface[] - */ - public function getRealReturnTypes(): array - { - return $this->getTypesBySpecification(new Specification\IsReal()); - } - - private function isSatisfiedByTypeSpec(SpecificationInterface $spec): bool - { - if (0 === $this->count()) { - return false; - } - - $found = $this->getTypesBySpecification($spec); - - return count($found) > 0; - } -} diff --git a/tests/Zephir/FunctionLike/ReturnType/CollectionTest.php b/tests/Zephir/FunctionLike/ReturnType/CollectionTest.php deleted file mode 100644 index f68247d3a8..0000000000 --- a/tests/Zephir/FunctionLike/ReturnType/CollectionTest.php +++ /dev/null @@ -1,567 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Test\FunctionLike\ReturnType; - -use PHPUnit\Framework\TestCase; -use Zephir\Exception\InvalidArgumentException; -use Zephir\FunctionLike\ReturnType\CastHint; -use Zephir\FunctionLike\ReturnType\Collection; -use Zephir\FunctionLike\ReturnType\RealType; -use Zephir\Types; - -final class CollectionTest extends TestCase -{ - public function testShouldThrowExceptionOnInvalidAttachedObject(): void - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage( - 'Expecting an instance of Zephir\FunctionLike\ReturnType\TypeInterface, got instance of stdClass' - ); - - $collection = new Collection(); - $collection->attach(new \stdClass()); - } - - public function testShouldThrowExceptionOnInvalidAttachedValue(): void - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage( - 'Expecting an instance of Zephir\FunctionLike\ReturnType\TypeInterface, got array' - ); - - $collection = new Collection(); - $collection->attach([]); - } - - public function testShouldAttachTypes(): void - { - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_INT)); - $this->assertCount(1, $collection); - - $collection->attach(new RealType(Types::T_INT)); - $this->assertCount(1, $collection); - - $collection->attach(new RealType(Types::T_STRING)); - $this->assertCount(2, $collection); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertCount(3, $collection); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertCount(4, $collection); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class2')); - $this->assertCount(4, $collection); - } - - public function testShouldDetectOnlyVoid(): void - { - $collection = new Collection(); - - $this->assertFalse($collection->onlyVoid()); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertTrue($collection->onlyVoid()); - - $collection->attach(new RealType(Types::T_INT)); - $this->assertFalse($collection->onlyVoid()); - } - - public function testShouldCheckIfTheCollectionHasRealTypeOrCastHints(): void - { - $collection = new Collection(); - $this->assertFalse($collection->hasReturnTypes()); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertFalse($collection->hasReturnTypes()); - - $collection->attach(new RealType(Types::T_INT)); - $this->assertTrue($collection->hasReturnTypes()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertTrue($collection->hasReturnTypes()); - } - - public function testShouldDetectWhetherReturnTypesAreNullCompatible(): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesNullCompatible()); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertFalse($collection->areReturnTypesNullCompatible()); - - $collection->attach(new RealType(Types::T_NULL)); - $this->assertTrue($collection->areReturnTypesNullCompatible()); - - $collection = new Collection(); - $collection->attach(new RealType(Types::T_NULL)); - $this->assertTrue($collection->areReturnTypesNullCompatible()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertFalse($collection->areReturnTypesNullCompatible()); - } - - public function testShouldDetectWhetherReturnTypesAreSpecial(): void - { - $collection = new Collection(); - $this->assertFalse($collection->onlySpecial()); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertFalse($collection->onlySpecial()); - - $collection->attach(new CastHint(Types::T_NUMBER, null)); - $this->assertFalse($collection->onlySpecial()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_NUMBER, null)); - $this->assertTrue($collection->onlySpecial()); - - $collection->attach(new CastHint(Types::T_RESOURCE, null)); - $collection->attach(new CastHint(Types::T_VARIABLE, null)); - $collection->attach(new CastHint(Types::T_CALLABLE, null)); - $collection->attach(new CastHint(Types::T_ITERABLE, null)); - $this->assertTrue($collection->onlySpecial()); - - $collection->attach(new CastHint(Types::T_OBJECT, null)); - $this->assertFalse($collection->onlySpecial()); - } - - /** - * @dataProvider intCompatibleProvider - * - * @param string $type - * @param bool $expected - */ - public function testShouldDetectWhetherReturnTypesAreIntCompatible(string $type, bool $expected): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesIntCompatible()); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertFalse($collection->areReturnTypesIntCompatible()); - - $collection->attach(new RealType($type)); - $this->assertSame($expected, $collection->areReturnTypesIntCompatible()); - } - - public function testShouldDetectWhetherReturnTypesAreDoubleCompatible(): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesDoubleCompatible()); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertFalse($collection->areReturnTypesDoubleCompatible()); - - $collection->attach(new RealType(Types::T_DOUBLE)); - $this->assertTrue($collection->areReturnTypesDoubleCompatible()); - - $collection = new Collection(); - $collection->attach(new RealType(Types::T_DOUBLE)); - $this->assertTrue($collection->areReturnTypesDoubleCompatible()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertFalse($collection->areReturnTypesDoubleCompatible()); - } - - public function testShouldDetectWhetherReturnTypesAreBoolCompatible(): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesBoolCompatible()); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertFalse($collection->areReturnTypesBoolCompatible()); - - $collection->attach(new RealType(Types::T_BOOL)); - $this->assertTrue($collection->areReturnTypesBoolCompatible()); - - $collection = new Collection(); - $collection->attach(new RealType(Types::T_BOOL)); - $this->assertTrue($collection->areReturnTypesBoolCompatible()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertFalse($collection->areReturnTypesBoolCompatible()); - } - - /** - * @dataProvider stringCompatibleProvider - * - * @param string $type - * @param bool $expected - */ - public function testShouldDetectWhetherReturnTypesAreStringCompatible(string $type, bool $expected): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesStringCompatible()); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertFalse($collection->areReturnTypesStringCompatible()); - - $collection->attach(new RealType($type)); - $this->assertSame($expected, $collection->areReturnTypesStringCompatible()); - } - - public function testShouldDetectWhetherReturnTypesAreArrayCompatible(): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesArrayCompatible()); - - $collection->attach(new RealType(Types::T_VOID)); - $this->assertFalse($collection->areReturnTypesArrayCompatible()); - - $collection->attach(new RealType(Types::T_ARRAY)); - $this->assertTrue($collection->areReturnTypesArrayCompatible()); - - $collection = new Collection(); - $collection->attach(new RealType(Types::T_ARRAY)); - $this->assertTrue($collection->areReturnTypesArrayCompatible()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true)); - $this->assertTrue($collection->areReturnTypesArrayCompatible()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertFalse($collection->areReturnTypesArrayCompatible()); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true)); - $this->assertFalse($collection->areReturnTypesArrayCompatible()); - - $collection->attach(new CastHint(Types::T_UNDEFINED, 'Class2', null, false)); - $this->assertFalse($collection->areReturnTypesArrayCompatible()); - - $collection->attach(new CastHint(Types::T_UNDEFINED, 'Class3', null, true)); - $this->assertFalse($collection->areReturnTypesArrayCompatible()); - } - - public function testShouldDetectWhetherReturnTypesAreObjectCompatible(): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesObjectCompatible()); - - $collection->attach(new CastHint(Types::T_UNDEFINED, 'Class1')); - $this->assertFalse($collection->areReturnTypesObjectCompatible()); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class2')); - $this->assertTrue($collection->areReturnTypesObjectCompatible()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertTrue($collection->areReturnTypesObjectCompatible()); - - $collection = new Collection(); - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true)); - $this->assertFalse($collection->areReturnTypesObjectCompatible()); - - $collection = new Collection(); - $collection->attach(new RealType(Types::T_VOID)); - $this->assertFalse($collection->areReturnTypesObjectCompatible()); - } - - public function testShouldDetectWellKnownTypes(): void - { - $collection = new Collection(); - $this->assertFalse($collection->areReturnTypesWellKnown()); - - $wellKnown = [ - Types::T_INT, - Types::T_UINT, - Types::T_CHAR, - Types::T_UCHAR, - Types::T_LONG, - Types::T_ULONG, - Types::T_DOUBLE, - Types::T_NULL, - Types::T_BOOL, - Types::T_STRING, - Types::T_ISTRING, - Types::T_VOID, - Types::T_ARRAY, - ]; - - foreach ($wellKnown as $type) { - $collection->attach(new RealType($type)); - } - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertTrue($collection->areReturnTypesWellKnown()); - - $collection->attach(new RealType(Types::T_FLOAT)); - $this->assertFalse($collection->areReturnTypesWellKnown()); - - $otherTypes = [ - Types::T_FLOAT, - Types::T_NUMBER, - Types::T_VARIABLE, - Types::T_MIXED, - Types::T_CALLABLE, - Types::T_ITERABLE, - Types::T_RESOURCE, - Types::T_UNDEFINED, - ]; - - $collection = new Collection(); - - foreach ($otherTypes as $type) { - $collection->attach(new RealType($type)); - } - - $this->assertFalse($collection->areReturnTypesWellKnown()); - - foreach ($wellKnown as $type) { - $collection->attach(new RealType($type)); - } - - $this->assertFalse($collection->areReturnTypesWellKnown()); - } - - /** - * @dataProvider compatibleTypesProvider - * - * @param string $type - */ - public function testShouldDetectCompatibleTypesForTrivialCases(string $type): void - { - $collection = new Collection(); - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType($type)); - $this->assertTrue($collection->areReturnTypesCompatible()); - } - - public function intCompatibleProvider(): array - { - $expected = [ - true, true, true, true, true, true, - false, false, false, false, false, - false, false, false, false, false, - false, false, false, false, false, false, - ]; - - return array_map( - function ($type, $expected) { - return [$type[0], $expected]; - }, - $this->compatibleTypesProvider(), - $expected - ); - } - - public function stringCompatibleProvider(): array - { - $expected = [ - false, false, false, false, false, - false, false, false, false, false, false, - true, true, - false, false, false, false, false, - false, false, false, false, - ]; - - return array_map( - function ($type, $expected) { - return [$type[0], $expected]; - }, - $this->compatibleTypesProvider(), - $expected - ); - } - - public function compatibleTypesProvider(): array - { - return [ - 'int' => [Types::T_INT], - 'iunt' => [Types::T_UINT], - 'char' => [Types::T_CHAR], - 'uchar' => [Types::T_UCHAR], - 'long' => [Types::T_LONG], - 'ulong' => [Types::T_ULONG], - 'double' => [Types::T_DOUBLE], - 'float' => [Types::T_FLOAT], - 'null' => [Types::T_NULL], - 'number' => [Types::T_NUMBER], - 'bool' => [Types::T_BOOL], - 'string' => [Types::T_STRING], - 'istring' => [Types::T_ISTRING], - 'void' => [Types::T_VOID], - 'variable' => [Types::T_VARIABLE], - 'mixed' => [Types::T_MIXED], - 'array' => [Types::T_ARRAY], - 'object' => [Types::T_OBJECT], - 'callable' => [Types::T_CALLABLE], - 'iterable' => [Types::T_ITERABLE], - 'resource' => [Types::T_RESOURCE], - 'undefined' => [Types::T_UNDEFINED], - ]; - } - - public function testShouldDetectCompatibleTypesForObjectLike(): void - { - $collection = new Collection(); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new CastHint(Types::T_RESOURCE, null, null, true)); - $this->assertFalse($collection->areReturnTypesCompatible()); - } - - public function testShouldDetectCompatibleTypesForCollections(): void - { - $collection = new Collection(); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1', null, true)); - $collection->attach(new RealType(Types::T_ARRAY)); - - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection = new Collection(); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $collection->attach(new RealType(Types::T_ARRAY)); - - $this->assertFalse($collection->areReturnTypesCompatible()); - } - - public function testShouldDetectCompatibleTypesForIntegers(): void - { - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_CHAR)); - $collection->attach(new RealType(Types::T_UCHAR)); - $collection->attach(new RealType(Types::T_INT)); - $collection->attach(new RealType(Types::T_UINT)); - $collection->attach(new RealType(Types::T_LONG)); - $collection->attach(new RealType(Types::T_ULONG)); - - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType(Types::T_ARRAY)); - $this->assertFalse($collection->areReturnTypesCompatible()); - } - - public function testShouldDetectCompatibleTypesForBool(): void - { - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_BOOL)); - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType(Types::T_CHAR)); - $this->assertFalse($collection->areReturnTypesCompatible()); - } - - public function testShouldDetectCompatibleTypesForString(): void - { - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_STRING)); - $collection->attach(new RealType(Types::T_ISTRING)); - - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType(Types::T_BOOL)); - $this->assertFalse($collection->areReturnTypesCompatible()); - } - - public function testShouldDetectCompatibleTypesForDouble(): void - { - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_DOUBLE)); - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType(Types::T_STRING)); - $this->assertFalse($collection->areReturnTypesCompatible()); - } - - public function testShouldDetectCompatibleTypesForKnownTypes(): void - { - $collection = new Collection(); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType(Types::T_NULL)); - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType(Types::T_ARRAY)); - $this->assertFalse($collection->areReturnTypesCompatible()); - - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_ARRAY)); - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new RealType(Types::T_CHAR)); - $collection->attach(new RealType(Types::T_BOOL)); - $collection->attach(new RealType(Types::T_STRING)); - $collection->attach(new RealType(Types::T_DOUBLE)); - - $this->assertFalse($collection->areReturnTypesCompatible()); - - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_ISTRING)); - $collection->attach(new RealType(Types::T_NULL)); - - $this->assertTrue($collection->areReturnTypesCompatible()); - - $collection->attach(new CastHint(Types::T_RESOURCE, null)); - $this->assertFalse($collection->areReturnTypesCompatible()); - - $collection = new Collection(); - - $collection->attach(new RealType(Types::T_NULL)); - $this->assertTrue($collection->areReturnTypesCompatible()); - } - - public function testShouldGetOnlyRealTypes(): void - { - $collection = new Collection(); - $this->assertCount(0, $collection->getRealReturnTypes()); - - $collection->attach(new RealType(Types::T_ARRAY)); - $this->assertCount(1, $collection->getRealReturnTypes()); - - $collection->attach(new RealType(Types::T_CHAR)); - $collection->attach(new RealType(Types::T_BOOL)); - $collection->attach(new RealType(Types::T_STRING)); - $collection->attach(new RealType(Types::T_DOUBLE)); - $this->assertCount(5, $collection->getRealReturnTypes()); - - $collection->attach(new CastHint(Types::T_RESOURCE, null)); - $this->assertCount(5, $collection->getRealReturnTypes()); - } - - public function testShouldGetOnlyCastHint(): void - { - $collection = new Collection(); - $this->assertCount(0, $collection->getCastHintedReturnTypes()); - - $collection->attach(new CastHint(Types::T_RESOURCE, null)); - $this->assertCount(1, $collection->getCastHintedReturnTypes()); - - $collection->attach(new RealType(Types::T_ARRAY)); - $this->assertCount(1, $collection->getCastHintedReturnTypes()); - - $collection->attach(new CastHint(Types::T_OBJECT, 'Class1')); - $collection->attach(new CastHint(Types::T_CALLABLE, null, null, true)); - $this->assertCount(3, $collection->getCastHintedReturnTypes()); - } -} From cba7ee77c1e248a2465ac8d35484b4439b37a796 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 3 Sep 2023 23:10:17 +0100 Subject: [PATCH 030/375] #2407 - Remove FunctionLike/ directory --- Library/FunctionLike/ReturnType/CastHint.php | 54 -------- .../ReturnType/CompositeSpecification.php | 48 ------- Library/FunctionLike/ReturnType/Either.php | 55 -------- Library/FunctionLike/ReturnType/Factory.php | 78 ----------- Library/FunctionLike/ReturnType/Not.php | 44 ------- Library/FunctionLike/ReturnType/RealType.php | 106 --------------- .../Specification/ArrayCompatible.php | 27 ---- .../Specification/IntCompatible.php | 30 ----- .../ReturnType/Specification/IsBool.php | 30 ----- .../ReturnType/Specification/IsCollection.php | 29 ----- .../ReturnType/Specification/IsDouble.php | 30 ----- .../ReturnType/Specification/IsNull.php | 30 ----- .../ReturnType/Specification/IsReal.php | 29 ----- .../ReturnType/Specification/IsSpecial.php | 44 ------- .../ReturnType/Specification/IsVoid.php | 30 ----- .../ReturnType/Specification/ObjectLike.php | 34 ----- .../Specification/StringCompatible.php | 40 ------ .../ReturnType/SpecificationInterface.php | 26 ---- .../FunctionLike/ReturnType/TypeInterface.php | 63 --------- .../FunctionLike/ReturnType/CastHintTest.php | 82 ------------ .../FunctionLike/ReturnType/FactoryTest.php | 122 ------------------ .../FunctionLike/ReturnType/RealTypeTest.php | 79 ------------ 22 files changed, 1110 deletions(-) delete mode 100644 Library/FunctionLike/ReturnType/CastHint.php delete mode 100644 Library/FunctionLike/ReturnType/CompositeSpecification.php delete mode 100644 Library/FunctionLike/ReturnType/Either.php delete mode 100644 Library/FunctionLike/ReturnType/Factory.php delete mode 100644 Library/FunctionLike/ReturnType/Not.php delete mode 100644 Library/FunctionLike/ReturnType/RealType.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IntCompatible.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsBool.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsCollection.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsDouble.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsNull.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsReal.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsSpecial.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/IsVoid.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/ObjectLike.php delete mode 100644 Library/FunctionLike/ReturnType/Specification/StringCompatible.php delete mode 100644 Library/FunctionLike/ReturnType/SpecificationInterface.php delete mode 100644 Library/FunctionLike/ReturnType/TypeInterface.php delete mode 100644 tests/Zephir/FunctionLike/ReturnType/CastHintTest.php delete mode 100644 tests/Zephir/FunctionLike/ReturnType/FactoryTest.php delete mode 100644 tests/Zephir/FunctionLike/ReturnType/RealTypeTest.php diff --git a/Library/FunctionLike/ReturnType/CastHint.php b/Library/FunctionLike/ReturnType/CastHint.php deleted file mode 100644 index 1f036beb6f..0000000000 --- a/Library/FunctionLike/ReturnType/CastHint.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -final class CastHint implements TypeInterface -{ - public function __construct( - private string $dataType, - private ?string $value = null, - private ?string $type = null, - private bool $collection = false - ) { - $this->type = $type ?: TypeInterface::TYPE_PARAMETER; - } - - public function getType(): string - { - return $this->type; - } - - public function getDataType(): string - { - return $this->dataType; - } - - public function getValue(): ?string - { - return $this->value; - } - - public function isMandatory(): bool - { - return false; - } - - public function isCollection(): bool - { - return $this->collection; - } - - public function isRealType(): bool - { - return false; - } -} diff --git a/Library/FunctionLike/ReturnType/CompositeSpecification.php b/Library/FunctionLike/ReturnType/CompositeSpecification.php deleted file mode 100644 index 69fbec701d..0000000000 --- a/Library/FunctionLike/ReturnType/CompositeSpecification.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -abstract class CompositeSpecification implements SpecificationInterface -{ - /** - * Creates a new logical OR composite specification. - * - * @param SpecificationInterface $spec - * - * @return Either - */ - public function either(SpecificationInterface $spec) - { - return new Either($this, $spec); - } - - /** - * Creates a new logical NOT specification. - * - * @return Not - */ - public function not() - { - return new Not($this); - } - - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - abstract public function isSatisfiedBy(ReturnType\TypeInterface $type); -} diff --git a/Library/FunctionLike/ReturnType/Either.php b/Library/FunctionLike/ReturnType/Either.php deleted file mode 100644 index 6dae122968..0000000000 --- a/Library/FunctionLike/ReturnType/Either.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -final class Either extends CompositeSpecification -{ - /** - * Left Specification. - * - * @var SpecificationInterface - */ - protected $left; - - /** - * Right Specification. - * - * @var SpecificationInterface - */ - protected $right; - - /** - * A composite wrapper of two specifications. - * - * @param SpecificationInterface $left - * @param SpecificationInterface $right - */ - public function __construct(SpecificationInterface $left, SpecificationInterface $right) - { - $this->left = $left; - $this->right = $right; - } - - /** - * Returns the evaluation of both wrapped specifications as a logical OR. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $this->left->isSatisfiedBy($type) || $this->right->isSatisfiedBy($type); - } -} diff --git a/Library/FunctionLike/ReturnType/Factory.php b/Library/FunctionLike/ReturnType/Factory.php deleted file mode 100644 index 951aa7793a..0000000000 --- a/Library/FunctionLike/ReturnType/Factory.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\Types; - -final class Factory -{ - /** - * @param array $ir - * - * @return TypeInterface - */ - public function create(array $ir) - { - if (!isset($ir['cast'])) { - return $this->createRealType( - isset($ir['data-type']) ? $ir['data-type'] : Types::T_UNDEFINED, - $ir - ); - } - - return $this->createCastHint( - isset($ir['cast']['type']) ? $ir['cast']['type'] : Types::T_UNDEFINED, - $ir - ); - } - - /** - * @param array $ir - * - * @return TypeInterface - */ - public function createVoid(array $ir) - { - return $this->createRealType(Types::T_VOID, $ir); - } - - /** - * @param string $dataType - * @param array $ir - * - * @return TypeInterface|RealType - */ - protected function createRealType($dataType, array $ir) - { - return new RealType( - $dataType, - isset($ir['mandatory']) && $ir['mandatory'], - isset($ir['type']) ? $ir['type'] : null - ); - } - - /** - * @param string $dataType - * @param array $ir - * - * @return TypeInterface|CastHint - */ - protected function createCastHint($dataType, array $ir) - { - return new CastHint( - $dataType, - isset($ir['cast']['value']) ? $ir['cast']['value'] : null, - isset($ir['type']) ? $ir['type'] : null, - isset($ir['collection']) && $ir['collection'] - ); - } -} diff --git a/Library/FunctionLike/ReturnType/Not.php b/Library/FunctionLike/ReturnType/Not.php deleted file mode 100644 index da10763237..0000000000 --- a/Library/FunctionLike/ReturnType/Not.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -final class Not extends CompositeSpecification -{ - /** - * @var SpecificationInterface - */ - protected $spec; - - /** - * Creates a new specification wrapping another. - * - * @param SpecificationInterface $spec - */ - public function __construct(SpecificationInterface $spec) - { - $this->spec = $spec; - } - - /** - * Returns the negated result of the wrapped specification. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return false == $this->spec->isSatisfiedBy($type); - } -} diff --git a/Library/FunctionLike/ReturnType/RealType.php b/Library/FunctionLike/ReturnType/RealType.php deleted file mode 100644 index d4337ed164..0000000000 --- a/Library/FunctionLike/ReturnType/RealType.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -final class RealType implements TypeInterface -{ - /** - * @var string - */ - private $dataType; - - /** - * @var bool - */ - private $mandatory; - - /** - * @var string - */ - private $type; - - /** - * Real return type constructor. - * - * @param string $dataType - * @param bool $mandatory - * @param string|null $type - */ - public function __construct($dataType, $mandatory = false, $type = null) - { - $this->dataType = $dataType; - $this->mandatory = (bool) $mandatory; - $this->type = $type ?: TypeInterface::TYPE_PARAMETER; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getDataType() - { - return $this->dataType; - } - - /** - * {@inheritdoc} - * - * Getting values for a real data types is not supported. - */ - public function getValue() - { - return null; - } - - /** - * {@inheritdoc} - * - * @return mixed - */ - public function isMandatory() - { - return $this->mandatory; - } - - /** - * {@inheritdoc} - * - * Checking, whether the return type is the collection for a real data types is not supported. - * - * @return bool - */ - public function isCollection() - { - return false; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function isRealType() - { - return true; - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php b/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php deleted file mode 100644 index 6d6680efd0..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/ArrayCompatible.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class ArrayCompatible extends ReturnType\CompositeSpecification -{ - public function isSatisfiedBy(ReturnType\TypeInterface $type): bool - { - if ($type->isRealType()) { - return Types::T_ARRAY === $type->getDataType(); - } - - return $type->isCollection(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IntCompatible.php b/Library/FunctionLike/ReturnType/Specification/IntCompatible.php deleted file mode 100644 index dff00ba38d..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IntCompatible.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IntCompatible extends ReturnType\CompositeSpecification -{ - public function isSatisfiedBy(ReturnType\TypeInterface $type): bool - { - if (!$type->isRealType()) { - return false; - } - - return match ($type->getDataType()) { - Types::T_INT, Types::T_UINT, Types::T_CHAR, Types::T_UCHAR, Types::T_LONG, Types::T_ULONG => true, - default => false, - }; - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsBool.php b/Library/FunctionLike/ReturnType/Specification/IsBool.php deleted file mode 100644 index a37ff78434..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsBool.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsBool extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_BOOL == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsCollection.php b/Library/FunctionLike/ReturnType/Specification/IsCollection.php deleted file mode 100644 index 270f1f20ea..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsCollection.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; - -final class IsCollection extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return false == $type->isRealType() && true == $type->isCollection(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsDouble.php b/Library/FunctionLike/ReturnType/Specification/IsDouble.php deleted file mode 100644 index 4082a07c58..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsDouble.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsDouble extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_DOUBLE == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsNull.php b/Library/FunctionLike/ReturnType/Specification/IsNull.php deleted file mode 100644 index 03ebd96473..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsNull.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsNull extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_NULL == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsReal.php b/Library/FunctionLike/ReturnType/Specification/IsReal.php deleted file mode 100644 index 61ef53fc41..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsReal.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; - -final class IsReal extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsSpecial.php b/Library/FunctionLike/ReturnType/Specification/IsSpecial.php deleted file mode 100644 index 64e35344d7..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsSpecial.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -/** - * Special types specification. - * - * Used only for type hinting. - */ -final class IsSpecial extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - switch ($type->getDataType()) { - case Types::T_NUMBER: - case Types::T_RESOURCE: - case Types::T_VARIABLE: - case Types::T_CALLABLE: - case Types::T_ITERABLE: - return true; - default: - return false; - } - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/IsVoid.php b/Library/FunctionLike/ReturnType/Specification/IsVoid.php deleted file mode 100644 index 16b9bb1432..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/IsVoid.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class IsVoid extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - return $type->isRealType() && Types::T_VOID == $type->getDataType(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/ObjectLike.php b/Library/FunctionLike/ReturnType/Specification/ObjectLike.php deleted file mode 100644 index c4a9456a22..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/ObjectLike.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class ObjectLike extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - if (true == $type->isRealType()) { - return false; - } - - return Types::T_OBJECT == $type->getDataType() && false === $type->isCollection(); - } -} diff --git a/Library/FunctionLike/ReturnType/Specification/StringCompatible.php b/Library/FunctionLike/ReturnType/Specification/StringCompatible.php deleted file mode 100644 index bdc81dfce5..0000000000 --- a/Library/FunctionLike/ReturnType/Specification/StringCompatible.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType\Specification; - -use Zephir\FunctionLike\ReturnType; -use Zephir\Types; - -final class StringCompatible extends ReturnType\CompositeSpecification -{ - /** - * {@inheritdoc} - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type) - { - if (false == $type->isRealType()) { - return false; - } - - switch ($type->getDataType()) { - case Types::T_STRING: - case Types::T_ISTRING: - return true; - default: - return false; - } - } -} diff --git a/Library/FunctionLike/ReturnType/SpecificationInterface.php b/Library/FunctionLike/ReturnType/SpecificationInterface.php deleted file mode 100644 index cd5eabbc66..0000000000 --- a/Library/FunctionLike/ReturnType/SpecificationInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -use Zephir\FunctionLike\ReturnType; - -interface SpecificationInterface -{ - /** - * Checks if given type meets all criteria. - * - * @param ReturnType\TypeInterface $type - * - * @return bool - */ - public function isSatisfiedBy(ReturnType\TypeInterface $type); -} diff --git a/Library/FunctionLike/ReturnType/TypeInterface.php b/Library/FunctionLike/ReturnType/TypeInterface.php deleted file mode 100644 index d06fbce8c5..0000000000 --- a/Library/FunctionLike/ReturnType/TypeInterface.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\FunctionLike\ReturnType; - -interface TypeInterface -{ - const TYPE_PARAMETER = 'return-type-parameter'; - const TYPE_ANNOTATION = 'return-type-annotation'; - - /** - * Gets the intermediate type. - * - * In most cases this will be a "return-type-parameter" - * string except for some rare cases. - * - * @return string - */ - public function getType(); - - /** - * Gets return data type name. - * - * @return string - */ - public function getDataType(); - - /** - * Gets cast return type. - * - * @return string|null - */ - public function getValue(); - - /** - * Is return type mandatory. - * - * @return mixed - */ - public function isMandatory(); - - /** - * Is the return value a collection. - * - * @return bool - */ - public function isCollection(); - - /** - * Is the return type a real type or it is just a cast hint. - * - * @return bool - */ - public function isRealType(); -} diff --git a/tests/Zephir/FunctionLike/ReturnType/CastHintTest.php b/tests/Zephir/FunctionLike/ReturnType/CastHintTest.php deleted file mode 100644 index 4df7cd526d..0000000000 --- a/tests/Zephir/FunctionLike/ReturnType/CastHintTest.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Test\FunctionLike\ReturnType; - -use PHPUnit\Framework\TestCase; -use Zephir\FunctionLike\ReturnType\CastHint; -use Zephir\FunctionLike\ReturnType\TypeInterface; -use Zephir\Types; - -final class CastHintTest extends TestCase -{ - public function testShouldReturnType(): void - { - $type = new CastHint(Types::T_OBJECT, 'Class1'); - $this->assertEquals(TypeInterface::TYPE_PARAMETER, $type->getType()); - - $type = new CastHint(Types::T_OBJECT, 'Class2', TypeInterface::TYPE_ANNOTATION); - $this->assertEquals(TypeInterface::TYPE_ANNOTATION, $type->getType()); - - $type = new CastHint(Types::T_OBJECT, 'Class3', 'return-type-custom'); - $this->assertEquals('return-type-custom', $type->getType()); - } - - public function testShouldReturnDataType(): void - { - $type = new CastHint(Types::T_OBJECT, 'Class1'); - $this->assertEquals(Types::T_OBJECT, $type->getDataType()); - - $type = new CastHint(Types::T_UNDEFINED, 'Class2'); - $this->assertEquals(Types::T_UNDEFINED, $type->getDataType()); - } - - public function testShouldReturnValue(): void - { - $type = new CastHint(Types::T_OBJECT, 'Class1'); - $this->assertEquals('Class1', $type->getValue()); - - $type = new CastHint(Types::T_OBJECT, '\A\Namespaced\Class\Foo'); - $this->assertEquals('\A\Namespaced\Class\Foo', $type->getValue()); - } - - public function testShouldAlwaysBeNotMandatory(): void - { - $type = new CastHint(Types::T_OBJECT, 'Class1'); - $this->assertFalse($type->isMandatory()); - - $type = new CastHint(Types::T_OBJECT, 'Class2', TypeInterface::TYPE_ANNOTATION); - $this->assertFalse($type->isMandatory()); - } - - public function testShouldDetectCollectionNature(): void - { - $type = new CastHint(Types::T_OBJECT, 'Class1'); - $this->assertFalse($type->isCollection()); - - $type = new CastHint(Types::T_OBJECT, 'Class1', TypeInterface::TYPE_ANNOTATION, true); - $this->assertTrue($type->isCollection()); - - $type = new CastHint(Types::T_OBJECT, 'Class1', TypeInterface::TYPE_PARAMETER, true); - $this->assertTrue($type->isCollection()); - - $type = new CastHint(Types::T_OBJECT, 'Class1', TypeInterface::TYPE_PARAMETER, false); - $this->assertFalse($type->isCollection()); - } - - public function testShouldAlwaysBeRealType(): void - { - $type = new CastHint(Types::T_OBJECT, 'Class1'); - $this->assertFalse($type->isRealType()); - } -} diff --git a/tests/Zephir/FunctionLike/ReturnType/FactoryTest.php b/tests/Zephir/FunctionLike/ReturnType/FactoryTest.php deleted file mode 100644 index 86fe79124d..0000000000 --- a/tests/Zephir/FunctionLike/ReturnType/FactoryTest.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Test\FunctionLike\ReturnType; - -use PHPUnit\Framework\TestCase; -use Zephir\FunctionLike\ReturnType\CastHint; -use Zephir\FunctionLike\ReturnType\Factory; -use Zephir\FunctionLike\ReturnType\RealType; -use Zephir\FunctionLike\ReturnType\TypeInterface; -use Zephir\Types; - -final class FactoryTest extends TestCase -{ - /** - * @dataProvider realTypeDataProvider - * - * @param array $ir - */ - public function testShouldCreateRealType(array $ir): void - { - $factory = new Factory(); - $this->assertInstanceOf(RealType::class, $factory->create($ir)); - } - - public function realTypeDataProvider(): array - { - return [ - [ - [ - 'data-type' => Types::T_STRING, - 'mandatory' => 0, - 'type' => TypeInterface::TYPE_PARAMETER, - ], - ], - [ - [ - 'data-type' => Types::T_DOUBLE, - 'mandatory' => 1, - 'type' => TypeInterface::TYPE_ANNOTATION, - ], - ], - [ - [ - Types::T_INT, - ], - ], - [ - [ - Types::T_UNDEFINED, - ], - ], - ]; - } - - /** - * @dataProvider castHintDataProvider - * - * @param array $ir - */ - public function testShouldCreateCastHint(array $ir): void - { - $factory = new Factory(); - $this->assertInstanceOf(CastHint::class, $factory->create($ir)); - } - - public function castHintDataProvider(): array - { - return [ - [ - [ - 'cast' => [ - 'type' => Types::T_VARIABLE, - 'mandatory' => 0, - ], - 'type' => TypeInterface::TYPE_PARAMETER, - ], - ], - [ - [ - 'cast' => [ - 'type' => Types::T_VARIABLE, - 'value' => 'Class1', - ], - 'type' => TypeInterface::TYPE_ANNOTATION, - 'collection' => 0, - ], - ], - [ - [ - 'cast' => [ - 'value' => 'Class1', - ], - 'collection' => 1, - ], - ], - [ - [ - 'cast' => [ - 'value' => null, - ], - 'type' => Types::T_INT, - ], - ], - [ - [ - 'cast' => [], - ], - ], - ]; - } -} diff --git a/tests/Zephir/FunctionLike/ReturnType/RealTypeTest.php b/tests/Zephir/FunctionLike/ReturnType/RealTypeTest.php deleted file mode 100644 index f2dc8275c6..0000000000 --- a/tests/Zephir/FunctionLike/ReturnType/RealTypeTest.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Test\FunctionLike\ReturnType; - -use PHPUnit\Framework\TestCase; -use Zephir\FunctionLike\ReturnType\RealType; -use Zephir\FunctionLike\ReturnType\TypeInterface; -use Zephir\Types; - -final class RealTypeTest extends TestCase -{ - public function testShouldReturnType(): void - { - $type = new RealType(Types::T_STRING); - $this->assertEquals(TypeInterface::TYPE_PARAMETER, $type->getType()); - - $type = new RealType(Types::T_STRING, false, TypeInterface::TYPE_ANNOTATION); - $this->assertEquals(TypeInterface::TYPE_ANNOTATION, $type->getType()); - - $type = new RealType(Types::T_STRING, false, 'return-type-custom'); - $this->assertEquals('return-type-custom', $type->getType()); - } - - public function testShouldReturnMandatoryStatus(): void - { - $type = new RealType(Types::T_STRING); - $this->assertFalse($type->isMandatory()); - - $type = new RealType(Types::T_STRING, false); - $this->assertFalse($type->isMandatory()); - - $type = new RealType(Types::T_STRING, true); - $this->assertTrue($type->isMandatory()); - } - - public function testShouldAlwaysHaveNullableValue(): void - { - $type = new RealType(Types::T_STRING); - $this->assertNull($type->getValue()); - } - - public function testShouldAlwaysBeNotACollection(): void - { - $type = new RealType(Types::T_STRING); - $this->assertFalse($type->isCollection()); - - $type = new RealType(Types::T_ARRAY); - $this->assertFalse($type->isCollection()); - } - - public function testShouldReturnDataType(): void - { - $type = new RealType(Types::T_STRING); - $this->assertEquals(Types::T_STRING, $type->getDataType()); - - $type = new RealType(Types::T_INT, false, TypeInterface::TYPE_ANNOTATION); - $this->assertEquals(Types::T_INT, $type->getDataType()); - - $type = new RealType(Types::T_VOID, true, 'return-type-custom'); - $this->assertEquals(Types::T_VOID, $type->getDataType()); - } - - public function testShouldAlwaysBeRealType(): void - { - $type = new RealType(Types::T_STRING); - $this->assertTrue($type->isRealType()); - } -} From a0e215f91ffc2680149c89b83fafa441dbced47a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 3 Sep 2023 23:25:45 +0100 Subject: [PATCH 031/375] #2407 - Refactor `Globals` class and add tests --- Library/Variable/Globals.php | 79 +++++---------------------- tests/Zephir/Variable/GlobalsTest.php | 34 ++++++++++++ 2 files changed, 49 insertions(+), 64 deletions(-) create mode 100644 tests/Zephir/Variable/GlobalsTest.php diff --git a/Library/Variable/Globals.php b/Library/Variable/Globals.php index 22b2a4669f..d41b7c64ea 100644 --- a/Library/Variable/Globals.php +++ b/Library/Variable/Globals.php @@ -14,78 +14,29 @@ namespace Zephir\Variable; /** - * Zephir\Variable\Globals. - * * Represents a central knowledge base on global variables. */ -class Globals +final class Globals { /** - * The variables passed to the current script via the URL parameters. - */ - const GET = '_GET'; - - /** - * The variables passed to the current script via the HTTP POST method. - */ - const POST = '_POST'; - - /** - * An array in which the environment variable names are element keys, - * and the environment variable value strings are element values. - */ - const ENV = '_ENV'; - - /** - * The variables passed to the current script via HTTP Cookies. - */ - const COOKIE = '_COOKIE'; - - /** - * Server and execution environment information, such as headers, paths, and script locations. - */ - const SERVER = '_SERVER'; - - /** - * The session variables available to the current script. - */ - const SESSION = '_SESSION'; - - /** - * By default contains the contents of $_COOKIE, $_GET, and $_POST. - */ - const REQUEST = '_REQUEST'; - - /** - * The items uploaded to the current script via the HTTP POST method. - */ - const FILES = '_FILES'; - - /** - * Names of superglobal variables. - * - * @var array - */ - protected $superglobals = [ - self::GET => 1, - self::POST => 1, - self::ENV => 1, - self::COOKIE => 1, - self::SERVER => 1, - self::SESSION => 1, - self::REQUEST => 1, - self::FILES => 1, + * Names of super global variables. + */ + protected array $superGlobals = [ + '_GET', // The variables passed to the current script via the URL parameters. + '_POST', // The variables passed to the current script via the HTTP POST method. + '_ENV', // An array in which the environment variable names are element keys, and the environment variable value strings are element values. + '_COOKIE', // The variables passed to the current script via HTTP Cookies. + '_SERVER', // Server and execution environment information, such as headers, paths, and script locations. + '_SESSION', // The session variables available to the current script. + '_REQUEST', // By default, contains the contents of $_COOKIE, $_GET, and $_POST. + '_FILES', // The items uploaded to the current script via the HTTP POST method. ]; /** - * Checks if a variable is a superglobal. - * - * @param string $name - * - * @return bool + * Checks if a variable is a super global. */ - public function isSuperGlobal($name) + public function isSuperGlobal(string $name): bool { - return isset($this->superglobals[$name]); + return in_array($name, $this->superGlobals, true); } } diff --git a/tests/Zephir/Variable/GlobalsTest.php b/tests/Zephir/Variable/GlobalsTest.php new file mode 100644 index 0000000000..62d5ac1836 --- /dev/null +++ b/tests/Zephir/Variable/GlobalsTest.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Test\Variable; + +use PHPUnit\Framework\TestCase; +use Zephir\Variable\Globals; + +final class GlobalsTest extends TestCase +{ + public function testIsSuperGlobal(): void + { + $globals = new Globals(); + + $this->assertTrue($globals->isSuperGlobal('_GET')); + $this->assertTrue($globals->isSuperGlobal('_POST')); + $this->assertTrue($globals->isSuperGlobal('_COOKIE')); + $this->assertTrue($globals->isSuperGlobal('_SERVER')); + $this->assertTrue($globals->isSuperGlobal('_ENV')); + $this->assertTrue($globals->isSuperGlobal('_FILES')); + $this->assertTrue($globals->isSuperGlobal('_REQUEST')); + $this->assertFalse($globals->isSuperGlobal('foo')); + } +} From 511f790195756688207a036932c29b5c184aa24d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 3 Sep 2023 23:26:27 +0100 Subject: [PATCH 032/375] #2407 - Reformat code with PHP8.0 syntax sugar --- Library/Backend/Backend.php | 19 +- Library/Call.php | 4 +- Library/ClassConstant.php | 23 +- Library/ClassMethod.php | 74 +----- Library/CompiledExpression.php | 17 +- Library/Detectors/ForValueUseDetector.php | 2 + Library/Detectors/WriteDetector.php | 8 +- .../Annotation/ReturnAnnotation.php | 4 +- Library/Documentation/Template.php | 66 ------ Library/Exception/CompilerException.php | 6 +- .../Exception/ExceptionExtraAwareTrait.php | 12 +- Library/Exception/FileSystemException.php | 3 - Library/Exception/LogicException.php | 2 - Library/Expression/NativeArrayAccess.php | 34 +-- Library/Expression/PropertyAccess.php | 6 +- Library/MethodCall.php | 6 +- .../Operators/Logical/LogicalBaseOperator.php | 16 +- Library/Operators/Other/RequireOperator.php | 6 +- Library/Statements/ForStatement.php | 6 +- Library/Statements/Let/StaticProperty.php | 15 +- Library/StaticCall.php | 217 ++++++++---------- Library/SymbolTable.php | 58 +++-- Library/Variable.php | 8 +- tests/Zephir/AliasManagerTest.php | 4 +- 24 files changed, 209 insertions(+), 407 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 1b2687b174..68ed2cae0f 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -316,7 +316,7 @@ public function onPreInitVar(ClassMethod $method): string return ''; } - public function onPreCompile(ClassMethod $method, CompilationContext $context) + public function onPreCompile(ClassMethod $method, CompilationContext $context): void { /** * Initialize the properties within create_object, handler code @@ -331,15 +331,14 @@ public function onPreCompile(ClassMethod $method, CompilationContext $context) } } - public function onPostCompile(ClassMethod $method, CompilationContext $context) + public function onPostCompile(ClassMethod $method, CompilationContext $context): void { - $codePrinter = $context->codePrinter; - if (preg_match('/^zephir_init_properties/', $method->getName())) { - $codePrinter->increaseLevel(); - $codePrinter->output('return Z_OBJ_P(this_ptr);'); - $codePrinter->decreaseLevel(); - $codePrinter->output('}'); - $codePrinter->decreaseLevel(); + if (str_starts_with($method->getName(), 'zephir_init_properties')) { + $context->codePrinter->increaseLevel(); + $context->codePrinter->output('return Z_OBJ_P(this_ptr);'); + $context->codePrinter->decreaseLevel(); + $context->codePrinter->output('}'); + $context->codePrinter->decreaseLevel(); } } @@ -347,7 +346,7 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va { $isComplex = in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); - if ($isComplex && !$variable->isDoublePointer()) { /* && $variable->mustInitNull() */ + if ($isComplex && !$variable->isDoublePointer()) { $groupVariables[] = $variable->getName(); switch ($variable->getRealname()) { case '__$null': diff --git a/Library/Call.php b/Library/Call.php index 5ba45d1349..5644c47023 100644 --- a/Library/Call.php +++ b/Library/Call.php @@ -133,12 +133,12 @@ public function processExpectedObservedReturn(CompilationContext $compilationCon if (\is_object($symbolVariable)) { $readDetector = new ReadDetector(); if ($readDetector->detect($symbolVariable->getName(), $expression)) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext); } else { $mustInit = true; } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext); } } diff --git a/Library/ClassConstant.php b/Library/ClassConstant.php index 6626ff1714..92576fbb9a 100644 --- a/Library/ClassConstant.php +++ b/Library/ClassConstant.php @@ -13,7 +13,7 @@ namespace Zephir; -use Zephir\Exception\CompilerException; +use ReflectionException; use Zephir\Expression\Constants; use Zephir\Expression\StaticConstantAccess; @@ -38,8 +38,6 @@ class ClassConstant protected ?string $docblock = null; /** - * ClassConstant constructor. - * * @param string $name * @param array $value * @param string|null $docBlock @@ -64,8 +62,6 @@ public function getName(): string /** * Returns the constant's value. * - * TODO: Rewrite name - * * @return array */ public function getValue(): array @@ -88,9 +84,9 @@ public function getValueType(): string * * @return mixed */ - public function getValueValue() + public function getValueValue(): mixed { - return $this->value['value'] ?? false; + return $this->value['value'] ?? null; } /** @@ -119,12 +115,12 @@ public function getType(): string * @param CompilationContext $compilationContext * * @throws Exception + * @throws ReflectionException */ - public function processValue(CompilationContext $compilationContext) + public function processValue(CompilationContext $compilationContext): void { if ('constant' === $this->value['type']) { - $constant = new Constants(); - $compiledExpression = $constant->compile($this->value, $compilationContext); + $compiledExpression = (new Constants())->compile($this->value, $compilationContext); $this->value = [ 'type' => $compiledExpression->getType(), @@ -135,8 +131,7 @@ public function processValue(CompilationContext $compilationContext) } if ('static-constant-access' === $this->value['type']) { - $staticConstantAccess = new StaticConstantAccess(); - $compiledExpression = $staticConstantAccess->compile($this->value, $compilationContext); + $compiledExpression = (new StaticConstantAccess())->compile($this->value, $compilationContext); $this->value = [ 'type' => $compiledExpression->getType(), @@ -150,15 +145,13 @@ public function processValue(CompilationContext $compilationContext) * * @param CompilationContext $compilationContext * - * @throws CompilerException * @throws Exception + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): void { $this->processValue($compilationContext); - $constantValue = $this->value['value'] ?? null; - $compilationContext->backend->declareConstant( $this->value['type'], $this->getName(), diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index a7e793a93a..228f1bc38e 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -440,16 +440,6 @@ public function setIsStatic(bool $static): void $this->isStatic = $static; } - /** - * Sets if the method is internal or not. - * - * @param bool $internal - */ - public function setIsInternal(bool $internal): void - { - $this->isInternal = $internal; - } - /** * Sets if the method is bundled or not. * @@ -556,7 +546,7 @@ public function getOptimizedMethod(): self * * @param string $name */ - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } @@ -573,8 +563,6 @@ public function getName(): string /** * Returns the raw docblock. - * - * @return string */ public function getDocBlock(): ?string { @@ -607,21 +595,11 @@ public function getParsedDocBlock(): ?Docblock * * @return mixed */ - public function getLine() + public function getLine(): mixed { return $this->expression['line']; } - /** - * the ending line of the method in the source file. - * - * @return mixed - */ - public function getLastLine() - { - return $this->expression['last-line']; - } - /** * Returns the parameters. * @@ -780,20 +758,6 @@ public function getNumberOfRequiredParameters(): int return $required; } - /** - * Returns the number of required parameters the method has. - * - * @return string - */ - public function getInternalParameters(): string - { - if ($this->parameters === null) { - return ''; - } - - return $this->parameters->count().', ...'; - } - /** * Checks whether the method has a specific modifier. * @@ -900,16 +864,6 @@ public function isMixed(): bool return $this->mixed; } - /** - * Checks if the method is inline. - * - * @return bool - */ - public function isInline(): bool - { - return in_array('inline', $this->visibility); - } - /** * Checks if the method is private. * @@ -1038,26 +992,6 @@ public function getShortcutName() return $this->expression['name']; } - /** - * Returns the local context pass information. - * - * @return LocalContextPass - */ - public function getLocalContextPass(): LocalContextPass - { - return $this->localContext; - } - - /** - * Returns the static type inference pass information. - * - * @return StaticTypeInference - */ - public function getStaticTypeInferencePass(): StaticTypeInference - { - return $this->typeInference; - } - /** * Returns the call gatherer pass information. * @@ -2312,8 +2246,8 @@ public function isReturnTypesHintDetermined(): bool continue; } - /* - * TODO: Probable we should detect return type more more carefully. + /** + * TODO: Probably we should detect return type more more carefully. * It is hard to process return type from the annotations at this time. * Thus we just return false here. */ diff --git a/Library/CompiledExpression.php b/Library/CompiledExpression.php index ebb9431ebc..ebe2d11366 100644 --- a/Library/CompiledExpression.php +++ b/Library/CompiledExpression.php @@ -21,22 +21,13 @@ */ class CompiledExpression implements TypeAwareInterface { - protected string $type; - - protected ?string $code; - - protected ?array $originalExpr; - /** * @param string $type - * @param string|null $code + * @param mixed $code * @param array|null $originalExpr */ - public function __construct(string $type, ?string $code, ?array $originalExpr = null) + public function __construct(protected string $type, protected mixed $code, protected ?array $originalExpr = null) { - $this->type = $type; - $this->code = $code; - $this->originalExpr = $originalExpr; } /** @@ -52,9 +43,9 @@ public function getType(): string /** * Returns the code produced by the compiled expression. * - * @return string|null + * @return mixed */ - public function getCode(): ?string + public function getCode(): mixed { return $this->code; } diff --git a/Library/Detectors/ForValueUseDetector.php b/Library/Detectors/ForValueUseDetector.php index de0cb35bfa..3bb6e40343 100644 --- a/Library/Detectors/ForValueUseDetector.php +++ b/Library/Detectors/ForValueUseDetector.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Detectors; /** diff --git a/Library/Detectors/WriteDetector.php b/Library/Detectors/WriteDetector.php index 2bebfdc0bb..be4400643a 100644 --- a/Library/Detectors/WriteDetector.php +++ b/Library/Detectors/WriteDetector.php @@ -44,7 +44,7 @@ class WriteDetector * * @return bool */ - public function detect(string $variable, array $statements) + public function detect(string $variable, array $statements): bool { $this->passStatementBlock($statements); @@ -123,7 +123,7 @@ public function passLetStatement(array $statement): void * * @param array $expression */ - public function passCall(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -159,7 +159,7 @@ public function passArray(array $expression): void * * @param array $expression */ - public function passNew(array $expression) + public function passNew(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -306,7 +306,7 @@ public function passExpression(array $expression): void * * @param array $statements */ - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { diff --git a/Library/Documentation/Annotation/ReturnAnnotation.php b/Library/Documentation/Annotation/ReturnAnnotation.php index 8c69583da0..6bda8943d0 100644 --- a/Library/Documentation/Annotation/ReturnAnnotation.php +++ b/Library/Documentation/Annotation/ReturnAnnotation.php @@ -18,8 +18,8 @@ */ class ReturnAnnotation extends Annotation { - protected $returnType; - protected $description; + protected string $returnType; + protected string $description; public function getReturnType(): string { diff --git a/Library/Documentation/Template.php b/Library/Documentation/Template.php index 1e95855b79..f20e7679de 100644 --- a/Library/Documentation/Template.php +++ b/Library/Documentation/Template.php @@ -66,53 +66,6 @@ private function getTemplatePath($fileName) return $inputFilename; } - /** - * Set a variable that will be accessible in the template. - * - * @param $name - * @param $value - */ - public function setVar($name, $value) - { - $this->data[$name] = $value; - } - - /** - * get a variable set with setVar(). - * - * @param $name - * - * @return bool - */ - public function getVar($name) - { - return isset($this->data[$name]) ? $this->data[$name] : null; - } - - /** - * find the value in the project configuration (e.g the version). - * - * @param string $name the name of the config to get - */ - public function projectConfig($name) - { - if (isset($this->projectConfig)) { - return $this->projectConfig->get($name); - } else { - return null; - } - } - - /** - * find the value of an option of the theme. - * - * @param string $name the name of the option to get - */ - public function themeOption($name) - { - return isset($this->themeOptions[$name]) ? $this->themeOptions[$name] : null; - } - /** * set the config of the project (it usually wraps the version, the theme config, etc...). * @@ -133,20 +86,6 @@ public function setThemeOptions($themeOptions) $this->themeOptions = $themeOptions; } - /** - * get a value from the theme config (theme.json file placed inside the theme directory). - */ - public function getAssets() - { - $css = $this->theme->getThemeInfoExtendAware('css'); - $js = $this->theme->getThemeInfoExtendAware('javascript'); - - return [ - 'css' => $css, - 'javascript' => $js, - ]; - } - /** * the path to root for the hyperlink in the templates. * @@ -189,11 +128,6 @@ public function getPathToRoot() return $this->pathToRoot; } - public function asset($name) - { - return $this->getPathToRoot().'asset/'.rtrim($name); - } - public function write($outputFile) { $content = $this->parse(); diff --git a/Library/Exception/CompilerException.php b/Library/Exception/CompilerException.php index f2209fda04..d4cb81eb49 100644 --- a/Library/Exception/CompilerException.php +++ b/Library/Exception/CompilerException.php @@ -12,8 +12,6 @@ namespace Zephir\Exception; /** - * Zephir\Exception\CompilerException. - * * Exceptions generated by the compiler */ class CompilerException extends RuntimeException @@ -21,12 +19,12 @@ class CompilerException extends RuntimeException /** * CompilerException constructor. * - * @param string $message the Exception message to throw [optional] + * @param string $message the Exception message to throw [optional] * @param array|null $extra extra info [optional] * @param int $code the Exception code [optional] * @param \Exception|\Throwable $previous the previous throwable used for the exception chaining [optional] */ - public function __construct($message = '', $extra = null, $code = 0, $previous = null) + public function __construct(string $message = '', $extra = null, $code = 0, $previous = null) { if (\is_array($extra) && isset($extra['file'])) { $message .= ' in '.$extra['file'].' on line '.$extra['line']; diff --git a/Library/Exception/ExceptionExtraAwareTrait.php b/Library/Exception/ExceptionExtraAwareTrait.php index 4edf38baef..6b5f3f148f 100644 --- a/Library/Exception/ExceptionExtraAwareTrait.php +++ b/Library/Exception/ExceptionExtraAwareTrait.php @@ -15,27 +15,21 @@ trait ExceptionExtraAwareTrait { /** * Extra info. - * - * @var array */ - protected $extra = []; + protected ?array $extra = []; /** - * {@inheritdoc} - * * @return array */ - public function getExtra() + public function getExtra(): array { return $this->extra; } /** - * {@inheritdoc} - * * @return string */ - public function getErrorRegion() + public function getErrorRegion(): string { $region = ''; $extra = $this->getExtra(); diff --git a/Library/Exception/FileSystemException.php b/Library/Exception/FileSystemException.php index 96977003bc..5b871e2198 100644 --- a/Library/Exception/FileSystemException.php +++ b/Library/Exception/FileSystemException.php @@ -11,9 +11,6 @@ namespace Zephir\Exception; -/** - * Zephir\Exception\FileSystemException. - */ class FileSystemException extends RuntimeException { } diff --git a/Library/Exception/LogicException.php b/Library/Exception/LogicException.php index 556edc6acc..0bc8fa7d21 100644 --- a/Library/Exception/LogicException.php +++ b/Library/Exception/LogicException.php @@ -12,8 +12,6 @@ namespace Zephir\Exception; /** - * Zephir\Exception\LogicException. - * * Exception that represents error in the program logic. * This kind of exception should directly lead to a fix in your code. */ diff --git a/Library/Expression/NativeArrayAccess.php b/Library/Expression/NativeArrayAccess.php index 83cc2a21ab..a4fde9f071 100644 --- a/Library/Expression/NativeArrayAccess.php +++ b/Library/Expression/NativeArrayAccess.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Expression; use ReflectionException; @@ -28,20 +30,18 @@ class NativeArrayAccess protected bool $readOnly = false; - /** @var Variable|null */ - protected $expectingVariable; + protected ?Variable $expectingVariable; - /** @var bool */ - protected $noisy = true; + protected bool $noisy = true; /** * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. * - * @param bool $expecting - * @param Variable $expectingVariable + * @param bool $expecting + * @param Variable|null $expectingVariable */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -52,7 +52,7 @@ public function setExpectReturn($expecting, Variable $expectingVariable = null) * * @param bool $readOnly */ - public function setReadOnly($readOnly) + public function setReadOnly(bool $readOnly): void { $this->readOnly = $readOnly; } @@ -62,7 +62,7 @@ public function setReadOnly($readOnly) * * @param bool $noisy */ - public function setNoisy($noisy) + public function setNoisy(bool $noisy): void { $this->noisy = $noisy; } @@ -73,9 +73,9 @@ public function setNoisy($noisy) * @param $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext) { @@ -130,7 +130,7 @@ public function compile($expression, CompilationContext $compilationContext) * @throws ReflectionException * @throws Exception */ - protected function accessStringOffset(array $expression, Variable $variableVariable, CompilationContext $compilationContext) + protected function accessStringOffset(array $expression, Variable $variableVariable, CompilationContext $compilationContext): CompiledExpression { if ($this->expecting) { if ($this->expectingVariable) { @@ -182,15 +182,15 @@ protected function accessStringOffset(array $expression, Variable $variableVaria } /** - * @param array $expression - * @param Variable $variableVariable + * @param array $expression + * @param Variable $variableVariable * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * @throws Exception + * @throws ReflectionException */ - protected function accessDimensionArray($expression, Variable $variableVariable, CompilationContext $compilationContext) + protected function accessDimensionArray(array $expression, Variable $variableVariable, CompilationContext $compilationContext): CompiledExpression { $arrayAccess = $expression; diff --git a/Library/Expression/PropertyAccess.php b/Library/Expression/PropertyAccess.php index b1603a983f..0165825db4 100644 --- a/Library/Expression/PropertyAccess.php +++ b/Library/Expression/PropertyAccess.php @@ -58,7 +58,7 @@ public function setReadOnly($readOnly) * * @param bool $noisy */ - public function setNoisy($noisy) + public function setNoisy(bool $noisy): void { $this->noisy = $noisy; } @@ -101,7 +101,7 @@ public function compile($expression, CompilationContext $compilationContext) $classDefinition = null; $currentClassDefinition = $compilationContext->classDefinition; - /* + /** * If the property is accessed on 'this', we check if the method does exist */ if ('this' == $variableVariable->getRealName()) { @@ -112,7 +112,7 @@ public function compile($expression, CompilationContext $compilationContext) $propertyDefinition = $classDefinition->getProperty($property); } else { - /* + /** * If we know the class related to a variable we could check if the property * is defined on that class */ diff --git a/Library/MethodCall.php b/Library/MethodCall.php index cceadf303e..a1c905e940 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -99,7 +99,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $type = $expression['call-type']; - /* + /** * In normal method calls and dynamic string method calls we just use the name given by the user */ if (self::CALL_NORMAL == $type || self::CALL_DYNAMIC_STRING == $type) { @@ -136,12 +136,11 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); if (\is_object($symbolVariable)) { - $readDetector = new ReadDetector($expression); + $readDetector = new ReadDetector(); if ($caller == $symbolVariable || $readDetector->detect($symbolVariable->getName(), $expression)) { $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( 'variable', $compilationContext, - $expression ); } else { $mustInit = true; @@ -150,7 +149,6 @@ public function compile(Expression $expr, CompilationContext $compilationContext $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify( 'variable', $compilationContext, - $expression ); } } diff --git a/Library/Operators/Logical/LogicalBaseOperator.php b/Library/Operators/Logical/LogicalBaseOperator.php index b6d91e9879..6fa832e923 100644 --- a/Library/Operators/Logical/LogicalBaseOperator.php +++ b/Library/Operators/Logical/LogicalBaseOperator.php @@ -82,10 +82,10 @@ public function compile($expression, CompilationContext $compilationContext): Co switch ($right->getType()) { case 'int': case 'double': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->bitOperator.' (('.$right->getCode().') ? 1 : 0))', $expression); + return new CompiledExpression('bool', '('.$left->getBooleanCode().' (('.$right->getCode().') ? 1 : 0))', $expression); case 'bool': - return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); + return new CompiledExpression('bool', '('.$left->getBooleanCode().' '.$right->getBooleanCode().')', $expression); case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression); @@ -166,7 +166,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->operator.' '.$right->getCode().')', $expression); case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$right->getBooleanCode().')', $expression); + return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$right->getBooleanCode().')', $expression); case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); @@ -175,7 +175,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$this->bitOperator.' '.$variableRight->getName().')', $expression); + return new CompiledExpression('bool', '('.$variableLeft->getName().' '.$variableRight->getName().')', $expression); case 'variable': $compilationContext->headersManager->add('kernel/operators'); @@ -200,7 +200,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', $variableLeft->getName().' '.$this->operator.' '.$right->getCode(), $expression); case 'bool': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->bitOperator.''.$right->getBooleanCode(), $expression); + return new CompiledExpression('bool', $variableLeft->getName().' '.$right->getBooleanCode(), $expression); case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); @@ -212,7 +212,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', $variableLeft->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); case 'bool': - return new CompiledExpression('bool', $variableLeft->getName().' '.$this->bitOperator.''.$variableRight->getName(), $expression); + return new CompiledExpression('bool', $variableLeft->getName().' '.$variableRight->getName(), $expression); case 'variable': $compilationContext->headersManager->add('kernel/operators'); @@ -237,7 +237,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->operator.' '.$right->getCode(), $expression); case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->bitOperator.''.$right->getBooleanCode(), $expression); + return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$right->getBooleanCode(), $expression); case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['right']); @@ -252,7 +252,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->operator.' ('.$variableRight->getName().' && Z_STRLEN_P('.$variableRight->getName().'))', $expression); case 'bool': - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->bitOperator.' '.$variableRight->getName(), $expression); + return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$variableRight->getName(), $expression); case 'variable': $compilationContext->headersManager->add('kernel/operators'); diff --git a/Library/Operators/Other/RequireOperator.php b/Library/Operators/Other/RequireOperator.php index 3f237536b1..6dd7af44ea 100644 --- a/Library/Operators/Other/RequireOperator.php +++ b/Library/Operators/Other/RequireOperator.php @@ -13,6 +13,7 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -25,12 +26,13 @@ class RequireOperator extends AbstractOperator { /** - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -58,7 +60,7 @@ public function compile(array $expression, CompilationContext $compilationContex $symbolVariable = false; if ($this->isExpecting()) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext); } $compilationContext->headersManager->add('kernel/memory'); diff --git a/Library/Statements/ForStatement.php b/Library/Statements/ForStatement.php index 3354a89d9b..a002d6a624 100644 --- a/Library/Statements/ForStatement.php +++ b/Library/Statements/ForStatement.php @@ -617,12 +617,12 @@ public function compileStringTraverse($expression, CompilationContext $compilati $compilationContext->headersManager->add('kernel/operators'); $codePrinter->output("\t".$variable->getName().' = ZEPHIR_STRING_OFFSET('.$stringVariableCode.', '.$tempVariable->getName().');'); - /* + /** * Variables are initialized in a different way inside cycle */ ++$compilationContext->insideCycle; - /* + /** * Compile statements in the 'for' block */ if (isset($this->statement['statements'])) { @@ -749,7 +749,7 @@ public function compileHashTraverse($expression, CompilationContext $compilation * @throws Exception * @throws ReflectionException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $exprRaw = $this->statement['expr']; diff --git a/Library/Statements/Let/StaticProperty.php b/Library/Statements/Let/StaticProperty.php index 0e0dc83bbe..01258407c7 100644 --- a/Library/Statements/Let/StaticProperty.php +++ b/Library/Statements/Let/StaticProperty.php @@ -9,18 +9,18 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; -use Zephir\Exception\IllegalOperationException; use Zephir\Expression; /** - * StaticProperty. - * * Updates static properties */ class StaticProperty @@ -28,14 +28,13 @@ class StaticProperty /** * Compiles ClassName::foo = {expr}. * - * @param string $className - * @param string $property + * @param string $className + * @param string $property * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext - * @param array $statement + * @param array $statement * - * @throws CompilerException - * @throws IllegalOperationException + * @throws ReflectionException */ public function assignStatic( string $className, diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 1c28f9cdd0..1fda946469 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -27,11 +27,12 @@ class StaticCall extends Call /** * Compiles a static method call. * - * @param Expression $expr + * @param Expression $expr * @param CompilationContext $compilationContext * * @return CompiledExpression * + * @throws Exception * @throws ReflectionException */ public function compile(Expression $expr, CompilationContext $compilationContext): CompiledExpression @@ -51,19 +52,19 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); if (\is_object($symbolVariable)) { - $readDetector = new ReadDetector($expression); + $readDetector = new ReadDetector(); if ($readDetector->detect($symbolVariable->getName(), $expression)) { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext); } else { $mustInit = true; } } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); + $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext); } } /** - * Method calls only return zvals so we need to validate the target variable is also a zval + * Method calls only return zvals, so we need to validate the target variable is also a zval */ if ($isExpecting) { /** @@ -240,14 +241,15 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Calls static methods on the 'self/static' context. * - * @param string $context SELF / STATIC - * @param string $methodName - * @param array $expression - * @param Variable|null $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting + * @param string $context SELF / STATIC + * @param string $methodName + * @param array $expression + * @param bool $mustInit + * @param bool $isExpecting * @param CompilationContext $compilationContext - * @param ClassMethod|null $method + * @param Variable|null $symbolVariable + * @param ClassMethod|null $method + * @throws Exception */ protected function call( string $context, @@ -258,7 +260,7 @@ protected function call( CompilationContext $compilationContext, ?Variable $symbolVariable = null, ?ClassMethod $method = null - ) { + ): void { if (!in_array($context, ['SELF', 'STATIC'])) { $context = 'SELF'; } @@ -293,17 +295,14 @@ protected function call( $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } - $isInternal = false; - if (isset($method)) { - $isInternal = $method->isInternal(); - } - if ($symbolVariable) { $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } $paramCount = count($params); $paramsStr = $paramCount ? ', '.implode(', ', $params) : ''; + + $isInternal = isset($method) && $method->isInternal(); if (!$isInternal) { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { @@ -343,16 +342,17 @@ protected function call( /** * Calls static methods on the 'parent' context. * - * @param string $methodName - * @param array $expression - * @param Variable $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting - * @param ClassDefinition $classDefinition + * @param string $methodName + * @param array $expression + * @param Variable $symbolVariable + * @param bool $mustInit + * @param bool $isExpecting + * @param ClassDefinition $classDefinition * @param CompilationContext $compilationContext - * @param ClassMethod $method + * @param ClassMethod $method + * @throws Exception */ - protected function callParent($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, ClassDefinition $classDefinition, CompilationContext $compilationContext, ClassMethod $method) + protected function callParent(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, ClassDefinition $classDefinition, CompilationContext $compilationContext, ClassMethod $method) { $codePrinter = $compilationContext->codePrinter; $classCe = $classDefinition->getClassEntry($compilationContext); @@ -504,77 +504,42 @@ protected function callFromClass($methodName, array $expression, $symbolVariable /** * Calls static methods on using a dynamic variable as class. * - * @param string $methodName + * @param string $methodName * @param array $expression * @param Variable $symbolVariable * @param bool $mustInit * @param bool $isExpecting * @param CompilationContext $compilationContext */ - protected function callFromDynamicClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, CompilationContext $compilationContext) + protected function callFromDynamicClass(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, CompilationContext $compilationContext): void { - $codePrinter = $compilationContext->codePrinter; - - /** - * Call static methods must grown the stack - */ - $compilationContext->symbolTable->mustGrownStack(true); - - if ($mustInit) { - $symbolVariable->setMustInitNull(true); - $symbolVariable->trackVariant($compilationContext); - } - - $cachePointer = 'NULL, 0'; - - $params = []; - if (isset($expression['parameters']) && count($expression['parameters'])) { - $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); - } - - /** - * Obtain the class entry from the variable. - */ - $classNameVariable = $compilationContext->symbolTable->getVariableForRead($expression['class'], $compilationContext, $expression); - if ($classNameVariable->isNotVariableAndString()) { - throw new CompilerException('Only dynamic/string variables can be used in dynamic classes', $expression); - } - - $compilationContext->headersManager->add('kernel/object'); - - $classEntryVariable = $compilationContext->symbolTable->addTemp('zend_class_entry', $compilationContext); - $codePrinter->output( - sprintf( - '%s = zephir_fetch_class(%s);', - $classEntryVariable->getName(), - $compilationContext->backend->getVariableCode($classNameVariable) - ) - ); - $classEntry = $classEntryVariable->getName(); + list($params, $classEntry) = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); if ($symbolVariable) { $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } + $cachePointer = 'NULL, 0'; + if (!count($params)) { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); + $compilationContext->codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC('.$symbol.', '.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC('.$symbol.', '.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); } } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC(NULL, '.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC(NULL, '.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); } } else { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $compilationContext->codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC('.$symbol.', '.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC('.$symbol.', '.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); } } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC(NULL, '.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC(NULL, '.$classEntry.', "'.$methodName.'", '.$cachePointer.', '.implode(', ', $params).');'); } } @@ -582,7 +547,7 @@ protected function callFromDynamicClass($methodName, array $expression, $symbolV * Temporary variables must be copied if they have more than one reference */ foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $compilationContext->codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); } $this->addCallStatusOrJump($compilationContext); @@ -591,54 +556,15 @@ protected function callFromDynamicClass($methodName, array $expression, $symbolV /** * Calls static methods on using a dynamic variable as class and a dynamic method. * - * @param array $expression - * @param Variable $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting + * @param array $expression + * @param Variable $symbolVariable + * @param bool $mustInit + * @param bool $isExpecting * @param CompilationContext $compilationContext */ - protected function callFromDynamicClassDynamicMethod(array $expression, $symbolVariable, $mustInit, $isExpecting, CompilationContext $compilationContext) + protected function callFromDynamicClassDynamicMethod(array $expression, $symbolVariable, bool $mustInit, bool $isExpecting, CompilationContext $compilationContext): void { - $codePrinter = $compilationContext->codePrinter; - - /** - * Call static methods must grown the stack - */ - $compilationContext->symbolTable->mustGrownStack(true); - - if ($mustInit) { - $symbolVariable->setMustInitNull(true); - $symbolVariable->trackVariant($compilationContext); - } - - $cachePointer = 'NULL, 0'; - - $params = []; - if (isset($expression['parameters']) && count($expression['parameters'])) { - $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); - } - - /** - * Obtain the class entry from the variable. - */ - $classNameVariable = $compilationContext->symbolTable->getVariableForRead($expression['class'], $compilationContext, $expression); - if ($classNameVariable->isNotVariableAndString()) { - throw new CompilerException('Only dynamic/string variables can be used in dynamic classes', $expression); - } - - $compilationContext->headersManager->add('kernel/object'); - - $classEntryVariable = $compilationContext->symbolTable->addTemp('zend_class_entry', $compilationContext); - - $codePrinter->output( - sprintf( - '%s = zephir_fetch_class(%s);', - $classEntryVariable->getName(), - $compilationContext->backend->getVariableCode($classNameVariable) - ) - ); - - $classEntry = $classEntryVariable->getName(); + list($params, $classEntry) = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); /** * Obtain the method name from the variable. @@ -652,25 +578,27 @@ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolV $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } + $cachePointer = 'NULL, 0'; + if (!count($params)) { if ($isExpecting) { if ('return_value' === $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL('.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); + $compilationContext->codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL('.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL('.$symbol.', '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL('.$symbol.', '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); } } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); } } else { if ($isExpecting) { if ('return_value' === $symbolVariable->getName()) { - $codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL('.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); + $compilationContext->codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL('.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL('.$symbol.', '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL('.$symbol.', '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); } } else { - $codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); + $compilationContext->codePrinter->output('ZEPHIR_CALL_CE_STATIC_ZVAL(NULL, '.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.', '.implode(', ', $params).');'); } } @@ -678,9 +606,48 @@ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolV * Temporary variables must be copied if they have more than one reference */ foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { - $codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); + $compilationContext->codePrinter->output('zephir_check_temp_parameter('.$checkVariable.');'); } $this->addCallStatusOrJump($compilationContext); } + + private function fetchClassParams(array $expression, CompilationContext $compilationContext, Variable $symbolVariable, bool $mustInit): array + { + /** + * Call static methods must grow the stack + */ + $compilationContext->symbolTable->mustGrownStack(true); + + if ($mustInit) { + $symbolVariable->setMustInitNull(true); + $symbolVariable->trackVariant($compilationContext); + } + + $params = []; + if (!empty($expression['parameters'])) { + $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); + } + + /** + * Obtain the class entry from the variable. + */ + $classNameVariable = $compilationContext->symbolTable->getVariableForRead($expression['class'], $compilationContext, $expression); + if ($classNameVariable->isNotVariableAndString()) { + throw new CompilerException('Only dynamic/string variables can be used in dynamic classes', $expression); + } + + $compilationContext->headersManager->add('kernel/object'); + $classEntryVariable = $compilationContext->symbolTable->addTemp('zend_class_entry', $compilationContext); + + $compilationContext->codePrinter->output( + sprintf( + '%s = zephir_fetch_class(%s);', + $classEntryVariable->getName(), + $compilationContext->backend->getVariableCode($classNameVariable) + ) + ); + + return [$params, $classEntryVariable->getName()]; + } } diff --git a/Library/SymbolTable.php b/Library/SymbolTable.php index dbd29a72f0..81ba89bb9e 100644 --- a/Library/SymbolTable.php +++ b/Library/SymbolTable.php @@ -20,12 +20,12 @@ */ class SymbolTable { - protected $mustGrownStack = false; + protected bool $mustGrownStack = false; /** @var Variable[][] */ protected $branchVariables = []; - protected $tempVarCount = 0; + protected int $tempVarCount = 0; /** @var Variable[][][][] */ protected $branchTempVariables = []; @@ -67,7 +67,7 @@ public function __construct(protected CompilationContext $compilationContext) $this->branchVariables[1]['return_value_ptr'] = $returnValue; } - public function resolveVariableToBranch($name, CompilationContext $compilationContext) + public function resolveVariableToBranch($name, CompilationContext $compilationContext): ?Branch { $currentBranch = $compilationContext->branchManager->getCurrentBranch(); @@ -87,7 +87,7 @@ public function resolveVariableToBranch($name, CompilationContext $compilationCo * * @param LocalContextPass $localContext */ - public function setLocalContext(LocalContextPass $localContext) + public function setLocalContext(LocalContextPass $localContext): void { $this->localContext = $localContext; } @@ -95,17 +95,17 @@ public function setLocalContext(LocalContextPass $localContext) /** * Check if a variable is declared in the current symbol table. * - * @param string $name - * @param CompilationContext $compilationContext + * @param string $name + * @param CompilationContext|null $compilationContext * * @return bool */ - public function hasVariable($name, CompilationContext $compilationContext = null) + public function hasVariable(string $name, CompilationContext $compilationContext = null): bool { return false !== $this->getVariable($name, $compilationContext ?: $this->compilationContext); } - public function hasVariableInBranch($name, Branch $compareBranch, CompilationContext $compilationContext = null) + public function hasVariableInBranch($name, Branch $compareBranch, CompilationContext $compilationContext = null): bool { $branch = $this->resolveVariableToBranch($name, $compilationContext ?: $this->compilationContext); @@ -139,7 +139,7 @@ public function addVariable( $variable = new Variable($type, $varName, $currentBranch); - /* + /** * Checks whether a variable can be optimized to be static or not */ if ('variable' == $type && $this->localContext && $this->localContext->shouldBeLocal($name)) { @@ -346,7 +346,7 @@ public function getVariableForRead($name, CompilationContext $compilationContext if (!$found) { /** * Check if last assignment - * Variable was initialized in a sub-branch and it's being used in a parent branch. + * Variable was initialized in a sub-branch, and it's being used in a parent branch. */ $possibleBadAssignment = false; @@ -362,7 +362,7 @@ public function getVariableForRead($name, CompilationContext $compilationContext } } else { /* - * Variable is assigned just once and it's assigned in a conditional branch + * Variable is assigned just once, and it's assigned in a conditional branch */ if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); @@ -465,19 +465,17 @@ public function getVariableForWrite($name, CompilationContext $compilationContex /** * Return a variable in the symbol table, it will be used for a mutating operation - * This method implies mutation of one of the members of the variable but no the variables it self. + * This method implies mutation of one of the members of the variable but no the variables itself. * - * @param string $name + * @param string $name * @param CompilationContext $compilationContext - * @param array $statement - * - * @throws CompilerException + * @param array|null $statement * * @return Variable */ - public function getVariableForUpdate($name, CompilationContext $compilationContext, array $statement = null) + public function getVariableForUpdate(string $name, CompilationContext $compilationContext, array $statement = null) { - /* + /** * Create superglobals just in time */ if ($this->globalsManager->isSuperGlobal($name)) { @@ -506,7 +504,7 @@ public function getVariableForUpdate($name, CompilationContext $compilationConte $variable->increaseUses(); $variable->increaseMutates(); - /* + /** * Saves the last place where the variable was mutated * We discard mutations inside loops because iterations could use the value * and Zephir only provides top-down compilation @@ -521,7 +519,7 @@ public function getVariableForUpdate($name, CompilationContext $compilationConte * * @param bool $mustGrownStack */ - public function mustGrownStack($mustGrownStack) + public function mustGrownStack(bool $mustGrownStack): void { $this->mustGrownStack = $mustGrownStack; } @@ -531,7 +529,7 @@ public function mustGrownStack($mustGrownStack) * * @return bool */ - public function getMustGrownStack() + public function getMustGrownStack(): bool { return $this->mustGrownStack; } @@ -539,7 +537,7 @@ public function getMustGrownStack() /** * @return int */ - public function getNextTempVar() + public function getNextTempVar(): int { return $this->tempVarCount++; } @@ -564,13 +562,13 @@ public function getTempVariable(string $type, CompilationContext $compilationCon /** * Creates a temporary variable to be used in a write operation. * - * @param string $type + * @param string $type * @param CompilationContext $context * @param mixed $init * * @return Variable */ - public function getTempVariableForWrite($type, CompilationContext $context, $init = true) + public function getTempVariableForWrite(string $type, CompilationContext $context, $init = true): Variable { $variable = $this->reuseTempVariable($type, 'heap'); if (\is_object($variable)) { @@ -848,8 +846,8 @@ public function markTemporalVariablesIdle(CompilationContext $compilationContext return; } - foreach ($this->branchTempVariables[$branchId] as $location => $typeVariables) { - foreach ($typeVariables as $type => $variables) { + foreach ($this->branchTempVariables[$branchId] as $typeVariables) { + foreach ($typeVariables as $variables) { foreach ($variables as $variable) { $pos = strpos($variable->getName(), Variable::BRANCH_MAGIC); $otherBranchId = 1; @@ -871,7 +869,7 @@ public function markTemporalVariablesIdle(CompilationContext $compilationContext * * @return int */ - public function getExpectedMutations($variable) + public function getExpectedMutations(string $variable): int { if ($this->localContext) { return $this->localContext->getNumberOfMutations($variable); @@ -887,7 +885,7 @@ public function getExpectedMutations($variable) * * @return int */ - public function getLastCallLine() + public function getLastCallLine(): int { if ($this->localContext) { return $this->localContext->getLastCallLine(); @@ -903,7 +901,7 @@ public function getLastCallLine() * * @return int */ - public function getLastUnsetLine() + public function getLastUnsetLine(): int { if ($this->localContext) { return $this->localContext->getLastUnsetLine(); @@ -920,7 +918,7 @@ public function getLastUnsetLine() * @param Variable $variable * @param CompilationContext $compilationContext */ - protected function registerTempVariable($type, $location, Variable $variable, CompilationContext $compilationContext = null) + protected function registerTempVariable($type, $location, Variable $variable, CompilationContext $compilationContext = null): void { $compilationContext = $compilationContext ?: $this->compilationContext; $branchId = $compilationContext->branchManager->getCurrentBranchId(); diff --git a/Library/Variable.php b/Library/Variable.php index 66fc6c86e8..a581d86ed1 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -98,7 +98,7 @@ class Variable implements TypeAwareInterface protected array $classTypes = []; - protected ?ClassDefinition $associatedClass = null; + protected ClassDefinition|ReflectionClass|null $associatedClass = null; /** * Initialization skips. @@ -463,10 +463,8 @@ public function setAssociatedClass(ReflectionClass|ClassDefinition $associatedCl /** * Returns the class related to the variable. - * - * @return ClassDefinition|null */ - public function getAssociatedClass(): ?ClassDefinition + public function getAssociatedClass(): ClassDefinition|ReflectionClass|null { return $this->associatedClass; } @@ -796,7 +794,7 @@ public function initVariant(CompilationContext $compilationContext): void $compilationContext->backend->initVar($this, $compilationContext, true, true); } else { if ($this->variantInits > 0) { - if (!$this->initBranch) { + if ($this->initBranch) { $compilationContext->codePrinter->output('ZEPHIR_INIT_BNVAR('.$this->getName().');'); } else { $this->mustInitNull = true; diff --git a/tests/Zephir/AliasManagerTest.php b/tests/Zephir/AliasManagerTest.php index 70e4c66fcb..65f76767e6 100644 --- a/tests/Zephir/AliasManagerTest.php +++ b/tests/Zephir/AliasManagerTest.php @@ -1,7 +1,5 @@ Date: Sun, 3 Sep 2023 23:31:07 +0100 Subject: [PATCH 033/375] #2407 - Move `ConsoleErrorListener` inside Console/ directory --- Library/Console/Application.php | 5 ++--- .../ConsoleErrorListener.php => Console/ErrorListener.php} | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) rename Library/{EventListener/ConsoleErrorListener.php => Console/ErrorListener.php} (93%) diff --git a/Library/Console/Application.php b/Library/Console/Application.php index de663fa1f4..5232d00547 100644 --- a/Library/Console/Application.php +++ b/Library/Console/Application.php @@ -30,7 +30,6 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Throwable; use Zephir\Console\Command\ListCommand; -use Zephir\EventListener\ConsoleErrorListener; use Zephir\Zephir; final class Application extends BaseApplication @@ -40,7 +39,7 @@ public function __construct() parent::__construct('Zephir', Zephir::VERSION); $dispatcher = new EventDispatcher(); - $dispatcher->addListener(ConsoleEvents::ERROR, [new ConsoleErrorListener(), 'onCommandError']); + $dispatcher->addListener(ConsoleEvents::ERROR, [new ErrorListener(), 'onCommandError']); $this->setDispatcher($dispatcher); } @@ -114,7 +113,7 @@ public function getLongVersion(): string * * @throws Exception|Throwable */ - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { if (true === $input->hasParameterOption(['--dumpversion', '-dumpversion'], true)) { $output->writeln($this->getVersion()); diff --git a/Library/EventListener/ConsoleErrorListener.php b/Library/Console/ErrorListener.php similarity index 93% rename from Library/EventListener/ConsoleErrorListener.php rename to Library/Console/ErrorListener.php index 39a5e7841f..ca9028d8d3 100644 --- a/Library/EventListener/ConsoleErrorListener.php +++ b/Library/Console/ErrorListener.php @@ -11,13 +11,13 @@ declare(strict_types=1); -namespace Zephir\EventListener; +namespace Zephir\Console; use Symfony\Component\Console\Event\ConsoleErrorEvent; use Zephir\Exception\CompilerException; use Zephir\Exception\ExceptionInterface; -class ConsoleErrorListener +class ErrorListener { public function onCommandError(ConsoleErrorEvent $event): void { From 7333687d8eadd4f68e8e1bd905353c77b0d4a09a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 3 Sep 2023 23:45:38 +0100 Subject: [PATCH 034/375] #2407 - Remove `BranchGraph` & `BranchGraphNode` classes --- Library/BranchGraph.php | 52 -------------------- Library/BranchGraphNode.php | 86 ---------------------------------- Library/CompilationContext.php | 2 - Library/SymbolTable.php | 82 ++++++++++++++------------------ 4 files changed, 34 insertions(+), 188 deletions(-) delete mode 100644 Library/BranchGraph.php delete mode 100644 Library/BranchGraphNode.php diff --git a/Library/BranchGraph.php b/Library/BranchGraph.php deleted file mode 100644 index 94be28d76c..0000000000 --- a/Library/BranchGraph.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. - */ - -declare(strict_types=1); - -namespace Zephir; - -/** - * Represents a group of branch nodes - */ -class BranchGraph -{ - protected ?BranchGraphNode $root = null; - - protected array $branchMap = []; - - /** - * Adds a leaf to the branch tree. - * - * @param Branch $branch - */ - public function addLeaf(Branch $branch): void - { - $branchNode = $this->branchMap[$branch->getUniqueId()] ?? new BranchGraphNode($branch); - $branchNode->increase(); - - $tempBranch = $branch->getParentBranch(); - while ($tempBranch) { - if (isset($this->branchMap[$tempBranch->getUniqueId()])) { - $parentBranchNode = $this->branchMap[$tempBranch->getUniqueId()]; - } else { - $parentBranchNode = new BranchGraphNode($tempBranch); - $this->branchMap[$tempBranch->getUniqueId()] = $parentBranchNode; - } - - $parentBranchNode->insert($branchNode); - $branchNode = $parentBranchNode; - $tempBranch = $tempBranch->getParentBranch(); - if (!$tempBranch) { - $this->root = $parentBranchNode; - } - } - } -} diff --git a/Library/BranchGraphNode.php b/Library/BranchGraphNode.php deleted file mode 100644 index f206c8f07c..0000000000 --- a/Library/BranchGraphNode.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir; - -use function count; -use function in_array; - -/** - * Allows visualizing assignments for a specific variable in every branch used. - */ -class BranchGraphNode -{ - /** - * @var int - */ - protected int $increase = 0; - - /** - * @var Branch[] - */ - protected array $branches = []; - - /** - * @var Branch - */ - protected Branch $branch; - - /** - * @param Branch $branch - */ - public function __construct(Branch $branch) - { - $this->branch = $branch; - } - - /** - * Inserts a node in the branch graph. - * - * @param BranchGraphNode $branch - */ - public function insert(self $branch): void - { - if (!in_array($branch, $this->branches)) { - $this->branches[] = $branch; - } - } - - /** - * Increases the branch graph level. - */ - public function increase(): void - { - ++$this->increase; - } - - /** - * Generates an ASCII visualization of the branch. - * - * @param int $padding - */ - public function show(int $padding = 0): void - { - echo str_repeat(' ', $padding), $this->branch->getUniqueId(), ':' , $this->increase; - - if (count($this->branches) > 0) { - echo ':', PHP_EOL; - /** @var BranchGraphNode $node */ - foreach ($this->branches as $node) { - $node->show($padding + 1); - } - } else { - echo PHP_EOL; - } - } -} diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 1b0580cd48..27f807e840 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -146,8 +146,6 @@ class CompilationContext /** * Manages both function and method call caches. - * - * @var CacheManager|null */ public ?CacheManager $cacheManager = null; diff --git a/Library/SymbolTable.php b/Library/SymbolTable.php index 81ba89bb9e..4624fb3e3f 100644 --- a/Library/SymbolTable.php +++ b/Library/SymbolTable.php @@ -9,12 +9,16 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use Zephir\Exception\CompilerException; use Zephir\Passes\LocalContextPass; use Zephir\Variable\Globals; +use function count; + /** * A symbol table stores all the variables defined in a method, their data types and default values. */ @@ -22,23 +26,18 @@ class SymbolTable { protected bool $mustGrownStack = false; - /** @var Variable[][] */ - protected $branchVariables = []; + protected array $branchVariables = []; protected int $tempVarCount = 0; - /** @var Variable[][][][] */ - protected $branchTempVariables = []; + protected array $branchTempVariables = []; /** * @var LocalContextPass */ protected $localContext; - /** - * @var Globals - */ - protected $globalsManager; + protected Globals $globalsManager; public function __construct(protected CompilationContext $compilationContext) { @@ -162,7 +161,7 @@ public function addVariable( * * @return Variable */ - public function addRawVariable(Variable $variable) + public function addRawVariable(Variable $variable): Variable { if (!isset($this->branchVariables[1])) { $this->branchVariables[1] = []; @@ -176,7 +175,7 @@ public function addRawVariable(Variable $variable) * Returns a variable in the symbol table. * * @param $name - * @param CompilationContext $compilationContext + * @param CompilationContext|null $compilationContext * * @return bool|Variable */ @@ -299,7 +298,7 @@ public function getVariableForRead($name, CompilationContext $compilationContext /** @var Branch[] $branches */ $branches = array_reverse($initBranches); - if (1 == \count($branches)) { + if (1 == count($branches)) { if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { if (true === $branches[0]->isUnreachable()) { throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize it at its declaration', $statement); @@ -348,26 +347,28 @@ public function getVariableForRead($name, CompilationContext $compilationContext * Check if last assignment * Variable was initialized in a sub-branch, and it's being used in a parent branch. */ - $possibleBadAssignment = false; - - if ($currentBranch->getLevel() < $branches[0]->getLevel()) { - $possibleBadAssignment = true; - } - - if ($possibleBadAssignment) { - if (\count($branches) > 1) { - $graph = new BranchGraph(); - foreach ($branches as $branch) { - $graph->addLeaf($branch); + $possibleBadAssignment = $currentBranch->getLevel() < $branches[0]->getLevel(); + if ($possibleBadAssignment && count($branches) === 1) { + /** + * Variable is assigned just once, and it's assigned in a conditional branch + */ + if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { + $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); + + if (true === $evalExpression->isUnreachable()) { + throw new CompilerException("Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", $statement); + } else { + $variable->enableDefaultAutoInitValue(); + $compilationContext->logger->warning( + "Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", + ['conditional-initialization', $statement] + ); } } else { - /* - * Variable is assigned just once, and it's assigned in a conditional branch - */ - if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { + if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) { $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); - if (true === $evalExpression->isUnreachable()) { + if (true === $evalExpression->isUnreachableElse()) { throw new CompilerException("Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", $statement); } else { $variable->enableDefaultAutoInitValue(); @@ -376,20 +377,6 @@ public function getVariableForRead($name, CompilationContext $compilationContext ['conditional-initialization', $statement] ); } - } else { - if (Branch::TYPE_CONDITIONAL_FALSE == $branches[0]->getType()) { - $evalExpression = $branches[0]->getRelatedStatement()->getEvalExpression(); - - if (true === $evalExpression->isUnreachableElse()) { - throw new CompilerException("Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", $statement); - } else { - $variable->enableDefaultAutoInitValue(); - $compilationContext->logger->warning( - "Variable '".$name."' was assigned for the first time in conditional branch, consider initialize it at its declaration", - ['conditional-initialization', $statement] - ); - } - } } } } @@ -449,7 +436,7 @@ public function getVariableForWrite($name, CompilationContext $compilationContex $variable->increaseUses(); $variable->increaseMutates(); - /* + /** * Saves the last place where the variable was mutated * We discard mutations inside loops because iterations could use the value * and Zephir only provides top-down compilation @@ -932,13 +919,12 @@ protected function registerTempVariable($type, $location, Variable $variable, Co /** * Reuse variables marked as idle after leave a branch. * - * @param string $type - * @param string $location - * @param CompilationContext $compilationContext - * - * @return Variable + * @param string $type + * @param string $location + * @param CompilationContext|null $compilationContext + * @return Variable|null */ - protected function reuseTempVariable(string $type, $location, CompilationContext $compilationContext = null) + protected function reuseTempVariable(string $type, string $location, CompilationContext $compilationContext = null): ?Variable { $compilationContext = $compilationContext ?: $this->compilationContext; $branchId = $compilationContext->branchManager->getCurrentBranchId(); From 4b58280bfb59a5f845a2339dacecf1921d9db5d3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 3 Sep 2023 23:54:28 +0100 Subject: [PATCH 035/375] #2407 - Refactor `LocalContextPass` class --- Library/Passes/LocalContextPass.php | 135 ++++++++++------------------ 1 file changed, 49 insertions(+), 86 deletions(-) diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index 3817f1e606..f160bbde3e 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -9,19 +9,23 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\StatementsBlock; +use function constant; +use function defined; +use function gettype; + /** - * LocalContextPass. - * * This pass tries to check whether variables only do exist in the local context of the method block - * or if they're used externally which will unallow variables to be placed in the stack + * or if they're used externally which will un allow variables to be placed in the stack * * This pass also tracks the number of initializations a variable may have, this allows * to mark variables as read-only after their last initialization. The number of - * mutations is relative, since assignments inside cycles/loops may perform a n-number of + * mutations is relative, since assignments inside cycles/loops may perform an n-number of * mutations * * @see https://en.wikipedia.org/wiki/Escape_analysis @@ -34,21 +38,21 @@ class LocalContextPass protected array $uses = []; - protected bool $lastCallLine = false; + protected int $lastCallLine = 0; - protected bool $lastUnsetLine = false; + protected int $lastUnsetLine = 0; /** * Do the compilation pass. * * @param StatementsBlock $block */ - public function pass(StatementsBlock $block) + public function pass(StatementsBlock $block): void { $this->passStatementBlock($block->getStatements()); } - public function declareVariables(array $statement) + public function declareVariables(array $statement): void { if (isset($statement['data-type'])) { if ('variable' != $statement['data-type']) { @@ -73,7 +77,7 @@ public function declareVariables(array $statement) * * @param string $variable */ - public function markVariableNoLocal($variable) + public function markVariableNoLocal(string $variable): void { if (isset($this->variables[$variable])) { $this->variables[$variable] = false; @@ -84,9 +88,9 @@ public function markVariableNoLocal($variable) * Marks the latest use/read of a variable. * * @param string $variable - * @param array $node + * @param array $node */ - public function markLastUse($variable, $node) + public function markLastUse(string $variable, array $node): void { if (isset($node['line'])) { $this->uses[$variable] = $node['line']; @@ -100,15 +104,9 @@ public function markLastUse($variable, $node) * * @return bool */ - public function shouldBeLocal($variable) + public function shouldBeLocal(string $variable): bool { - if (isset($this->variables[$variable])) { - if ($this->variables[$variable]) { - return true; - } - } - - return false; + return !empty($this->variables[$variable]); } /** @@ -116,7 +114,7 @@ public function shouldBeLocal($variable) * * @param string $variable */ - public function increaseMutations($variable) + public function increaseMutations(string $variable): void { if (isset($this->mutations[$variable])) { ++$this->mutations[$variable]; @@ -132,29 +130,9 @@ public function increaseMutations($variable) * * @return int */ - public function getNumberOfMutations($variable) - { - if (isset($this->mutations[$variable])) { - return $this->mutations[$variable]; - } - - return 0; - } - - /** - * Returns the latest line where a variable was read. - * - * @param string $variable - * - * @return int - */ - public function getLastVariableUseLine($variable) + public function getNumberOfMutations(string $variable): int { - if (isset($this->uses[$variable])) { - return $this->uses[$variable]; - } - - return 0; + return $this->mutations[$variable] ?? 0; } /** @@ -162,7 +140,7 @@ public function getLastVariableUseLine($variable) * * @return int */ - public function getLastCallLine() + public function getLastCallLine(): int { return $this->lastCallLine; } @@ -172,12 +150,12 @@ public function getLastCallLine() * * @return int */ - public function getLastUnsetLine() + public function getLastUnsetLine(): int { return $this->lastUnsetLine; } - public function passLetStatement(array $statement) + public function passLetStatement(array $statement): void { foreach ($statement['assignments'] as $assignment) { if (isset($assignment['expr'])) { @@ -225,8 +203,8 @@ public function passLetStatement(array $statement) break; case 'constant': - if (\defined($assignment['expr']['value'])) { - if ('string' == \gettype(\constant($assignment['expr']['value']))) { + if (defined($assignment['expr']['value'])) { + if ('string' === gettype(constant($assignment['expr']['value']))) { $this->markVariableNoLocal($assignment['variable']); } } @@ -255,10 +233,8 @@ public function passLetStatement(array $statement) case 'array-index': case 'object-property-array-index': case 'object-property-append': - switch ($assignment['expr']['type']) { - case 'variable': - $this->markVariableNoLocal($assignment['expr']['value']); - break; + if ($assignment['expr']['type'] == 'variable') { + $this->markVariableNoLocal($assignment['expr']['value']); } $this->markVariableNoLocal($assignment['variable']); break; @@ -280,7 +256,7 @@ public function passLetStatement(array $statement) } } - public function passCall(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -293,7 +269,7 @@ public function passCall(array $expression) } } - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { if ('variable' == $item['value']['type']) { @@ -304,7 +280,7 @@ public function passArray(array $expression) } } - public function passNew(array $expression) + public function passNew(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -317,7 +293,7 @@ public function passNew(array $expression) } } - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': @@ -377,6 +353,23 @@ public function passExpression(array $expression) case 'typeof': case 'bitwise_not': + case 'array-access': + case 'static-property-access': + case 'property-string-access': + case 'short-ternary': + case 'property-dynamic-access': + case 'property-access': + case 'ternary': + case 'unlikely': + case 'likely': + case 'clone': + case 'require_once': + case 'list': + case 'minus': + case 'require': + case 'instanceof': + case 'empty': + case 'isset': case 'not': $this->passExpression($expression['left']); break; @@ -404,42 +397,12 @@ public function passExpression(array $expression) $this->passNew($expression); break; - case 'property-access': - case 'property-dynamic-access': - case 'property-string-access': - case 'static-property-access': - case 'array-access': - $this->passExpression($expression['left']); - break; - - case 'isset': - case 'empty': - case 'instanceof': - case 'require': - case 'require_once': - case 'clone': - case 'likely': - case 'unlikely': - /* do special pass later */ - case 'ternary': - case 'short-ternary': - $this->passExpression($expression['left']); - break; - case 'fetch': $this->increaseMutations($expression['left']['value']); $this->markVariableNoLocal($expression['left']['value']); $this->passExpression($expression['right']); break; - case 'minus': - $this->passExpression($expression['left']); - break; - - case 'list': - $this->passExpression($expression['left']); - break; - case 'cast': case 'type-hint': $this->passExpression($expression['right']); @@ -451,7 +414,7 @@ public function passExpression(array $expression) } } - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { From 2c1a0c5f7fb310e0b29ad3aa7d58071dcb0f2edb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 11:18:04 +0100 Subject: [PATCH 036/375] #2407 - Remove unused method `getAllMethodCalls()` --- Library/Passes/CallGathererPass.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/Library/Passes/CallGathererPass.php b/Library/Passes/CallGathererPass.php index 52807cf31e..2ddcfb3b85 100644 --- a/Library/Passes/CallGathererPass.php +++ b/Library/Passes/CallGathererPass.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\CompilationContext; @@ -84,27 +86,17 @@ public function getNumberOfMethodCalls(string $className, string $methodName): i return 0; } - /** - * Returns all the method calls. - * - * @return array - */ - public function getAllMethodCalls(): array - { - return $this->methodCalls; - } - /** * Do the compilation pass. * * @param StatementsBlock $block */ - public function pass(StatementsBlock $block) + public function pass(StatementsBlock $block): void { $this->passStatementBlock($block->getStatements()); } - public function passLetStatement(array $statement) + public function passLetStatement(array $statement): void { foreach ($statement['assignments'] as $assignment) { if (isset($assignment['expr'])) { @@ -113,7 +105,7 @@ public function passLetStatement(array $statement) } } - public function passCall(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -122,14 +114,14 @@ public function passCall(array $expression) } } - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { $this->passExpression($item['value']); } } - public function passNew(array $expression) + public function passNew(array $expression): void { if (!$expression['dynamic']) { $className = $this->compilationContext->getFullName($expression['class']); @@ -147,7 +139,7 @@ public function passNew(array $expression) } } - public function passNewType(array $expression) + public function passNewType(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -156,7 +148,7 @@ public function passNewType(array $expression) } } - public function passExpression(array $expression) + public function passExpression(array $expression): void { switch ($expression['type']) { case 'bool': @@ -285,7 +277,7 @@ public function passExpression(array $expression) } } - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { From 86deafd1506503a10598c2be481613792423e69e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 11:42:27 +0100 Subject: [PATCH 037/375] #2407 - Reformat code with PHP8.0 syntax sugar --- Library/Code/Builder/Struct.php | 40 +++-------------------------- Library/Compiler.php | 8 +++--- Library/Passes/CallGathererPass.php | 22 +++------------- Library/Stubs/Generator.php | 17 ++---------- 4 files changed, 13 insertions(+), 74 deletions(-) diff --git a/Library/Code/Builder/Struct.php b/Library/Code/Builder/Struct.php index 7f62238fbf..c411d5e047 100644 --- a/Library/Code/Builder/Struct.php +++ b/Library/Code/Builder/Struct.php @@ -16,27 +16,11 @@ use Zephir\Exception\InvalidArgumentException; use Zephir\Exception\RuntimeException; -use function is_string; - /** * Represents an internal extension global structure */ class Struct { - /** - * Struct name - * - * @var string - */ - protected string $name; - - /** - * Struct simple name - * - * @var string - */ - protected string $simpleName; - /** * Struct members definition * @@ -50,25 +34,13 @@ class Struct */ protected array $properties = []; - /** - * @param string $name - * @param string $simpleName - * - * @throws InvalidArgumentException - */ - public function __construct(string $name, string $simpleName) + public function __construct(protected string $name, protected string $simpleName) { if (empty($name)) { throw new InvalidArgumentException('Struct name must not be empty'); } - - $this->name = $name; - $this->simpleName = $simpleName; } - /** - * @return string - */ public function __toString(): string { $code = 'typedef struct '.$this->name.' { '.PHP_EOL; @@ -82,21 +54,17 @@ public function __toString(): string /** * @param string $field - * @param array $global + * @param string $type * * @throws InvalidArgumentException */ - public function addProperty(string $field, array $global): void + public function addProperty(string $field, string $type): void { - if (!isset($global['type']) || !is_string($global['type'])) { - throw new InvalidArgumentException('Property type must be string'); - } - if (isset($this->properties[$field])) { throw new InvalidArgumentException('Property was defined more than once'); } - $this->properties[$field] = $this->convertToCType($global['type']); + $this->properties[$field] = $this->convertToCType($type); } /** diff --git a/Library/Compiler.php b/Library/Compiler.php index dfb978150d..36b9ed2ba1 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -1313,17 +1313,17 @@ public function processExtensionGlobals(string $namespace): array * Process compound structures */ foreach ($structures as $structureName => $internalStructure) { - if (preg_match('/^[0-9a-zA-Z\_]$/', $structureName)) { + if (preg_match('/^[0-9a-zA-Z_]$/', $structureName)) { throw new Exception("Struct name: '".$structureName."' contains invalid characters"); } $structBuilder = new Struct('_zephir_struct_'.$structureName, $structureName); foreach ($internalStructure as $field => $global) { - if (preg_match('/^[0-9a-zA-Z\_]$/', $field)) { + if (preg_match('/^[0-9a-zA-Z_]$/', $field)) { throw new Exception("Struct field name: '".$field."' contains invalid characters"); } - $structBuilder->addProperty($field, $global); + $structBuilder->addProperty($field, $global['type']); $isModuleGlobal = (int) !empty($global['module']); $globalsDefault[$isModuleGlobal][] = $structBuilder->getCDefault($field, $global, $namespace); @@ -1342,7 +1342,7 @@ public function processExtensionGlobals(string $namespace): array * Process single variables */ foreach ($variables as $name => $global) { - if (preg_match('/^[0-9a-zA-Z\_]$/', $name)) { + if (preg_match('/^[0-9a-zA-Z_]$/', $name)) { throw new Exception("Extension global variable name: '".$name."' contains invalid characters"); } diff --git a/Library/Passes/CallGathererPass.php b/Library/Passes/CallGathererPass.php index 2ddcfb3b85..5a8af0da8b 100644 --- a/Library/Passes/CallGathererPass.php +++ b/Library/Passes/CallGathererPass.php @@ -31,16 +31,8 @@ class CallGathererPass protected array $methodCalls = []; - protected CompilationContext $compilationContext; - - /** - * CallGathererPass constructor. - * - * @param CompilationContext $compilationContext - */ - public function __construct(CompilationContext $compilationContext) + public function __construct(protected CompilationContext $compilationContext) { - $this->compilationContext = $compilationContext; } /** @@ -62,11 +54,7 @@ public function getCompilationContext(): CompilationContext */ public function getNumberOfFunctionCalls(string $funcName): int { - if (isset($this->functionCalls[$funcName])) { - return $this->functionCalls[$funcName]; - } - - return 0; + return $this->functionCalls[$funcName] ?? 0; } /** @@ -79,11 +67,7 @@ public function getNumberOfFunctionCalls(string $funcName): int */ public function getNumberOfMethodCalls(string $className, string $methodName): int { - if (isset($this->methodCalls[$className][$methodName])) { - return $this->methodCalls[$className][$methodName]; - } - - return 0; + return $this->methodCalls[$className][$methodName] ?? 0; } /** diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index 22b8e41548..5e0ab0fe47 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -25,9 +25,6 @@ use function array_key_exists; use function in_array; -/** - * Stubs Generator. - */ class Generator { /** @@ -41,18 +38,11 @@ class Generator 'scoped', 'deprecated', ]; - - /** - * @var CompilerFile[] - */ - protected array $files; - /** * @param CompilerFile[] $files */ - public function __construct(array $files) + public function __construct(protected array $files) { - $this->files = $files; } /** @@ -454,10 +444,7 @@ protected function wrapPHPValue(array $parameter): string private function fetchDocBlock(?string $docBlock, string $indent): string { $docBlock = (new DocBlock($docBlock, $indent))->__toString(); - if ($docBlock) { - return $docBlock.PHP_EOL; - } - return ''; + return $docBlock ? $docBlock.PHP_EOL : ''; } } From 4db8792191e1678558d69cb9aede68d9e243c1f1 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 11:44:42 +0100 Subject: [PATCH 038/375] #2407 - Remove unused `PropertyAccessor` trait --- Library/Support/PropertyAccessor.php | 52 ---------------------------- 1 file changed, 52 deletions(-) delete mode 100644 Library/Support/PropertyAccessor.php diff --git a/Library/Support/PropertyAccessor.php b/Library/Support/PropertyAccessor.php deleted file mode 100644 index fa4a0c208b..0000000000 --- a/Library/Support/PropertyAccessor.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Support; - -use Zephir\Exception\InvalidCallException; -use Zephir\Exception\UnknownPropertyException; - -/** - * Zephir\Support\PropertyAccessor. - */ -trait PropertyAccessor -{ - /** - * Gets the internal Object's property. - * - * Do not call this method directly as it is a PHP magic method that - * will be implicitly called when executing `$value = $object->property;`. - * - * @param string $name - * - * @throws InvalidCallException - * @throws UnknownPropertyException - * - * @return mixed - */ - public function __get($name) - { - $getter = 'get'.ucfirst($name); - $setter = 'set'.ucfirst($name); - - if (method_exists($this, $getter)) { - return $this->$getter(); - } elseif (method_exists($this, $setter)) { - throw new InvalidCallException( - sprintf('Getting write-only property: %s::%s', static::class, $name) - ); - } - - throw new UnknownPropertyException( - sprintf('Getting unknown property: %s::%s', static::class, $name) - ); - } -} From b67d6d316e05ac5aa5fecd6cb0f42db4ed7ff2da Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 12:13:08 +0100 Subject: [PATCH 039/375] #2407 - Remove unused exception classes --- Library/Exception/BadMethodCallException.php | 20 ------------------ Library/Exception/ContainerException.php | 21 ------------------- Library/Exception/InvalidCallException.php | 16 -------------- .../Exception/UnknownPropertyException.php | 16 -------------- 4 files changed, 73 deletions(-) delete mode 100644 Library/Exception/BadMethodCallException.php delete mode 100644 Library/Exception/ContainerException.php delete mode 100644 Library/Exception/InvalidCallException.php delete mode 100644 Library/Exception/UnknownPropertyException.php diff --git a/Library/Exception/BadMethodCallException.php b/Library/Exception/BadMethodCallException.php deleted file mode 100644 index 0c4d903d2c..0000000000 --- a/Library/Exception/BadMethodCallException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -/** - * Zephir\Exception\BadMethodCallException. - */ -class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface -{ - use ExceptionExtraAwareTrait; -} diff --git a/Library/Exception/ContainerException.php b/Library/Exception/ContainerException.php deleted file mode 100644 index 2f775a3141..0000000000 --- a/Library/Exception/ContainerException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -use Psr\Container\ContainerExceptionInterface; - -/** - * Zephir\Exception\ContainerException. - */ -class ContainerException extends RuntimeException implements ContainerExceptionInterface -{ -} diff --git a/Library/Exception/InvalidCallException.php b/Library/Exception/InvalidCallException.php deleted file mode 100644 index 6cda337ea1..0000000000 --- a/Library/Exception/InvalidCallException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -class InvalidCallException extends LogicException -{ -} diff --git a/Library/Exception/UnknownPropertyException.php b/Library/Exception/UnknownPropertyException.php deleted file mode 100644 index c4a7c117e7..0000000000 --- a/Library/Exception/UnknownPropertyException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Exception; - -class UnknownPropertyException extends LogicException -{ -} From 8bdc6825ee88e823e96e5ed72f59a35f50afee44 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 14:02:15 +0100 Subject: [PATCH 040/375] #2407 - Remove unused method `setStrict()` --- Library/Operators/Other/TypeHintOperator.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Library/Operators/Other/TypeHintOperator.php b/Library/Operators/Other/TypeHintOperator.php index a9ffeb9cd7..1696d30933 100644 --- a/Library/Operators/Other/TypeHintOperator.php +++ b/Library/Operators/Other/TypeHintOperator.php @@ -13,6 +13,7 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -22,27 +23,16 @@ class TypeHintOperator extends AbstractOperator { - private bool $strict = false; - - /** - * Sets if the type hint is strict or not. - * - * @param $strict - */ - public function setStrict($strict) - { - $this->strict = (bool) $strict; - } - /** * Performs type-hint compilation. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -50,7 +40,7 @@ public function compile(array $expression, CompilationContext $compilationContex $expr->setReadOnly(true); $resolved = $expr->compile($compilationContext); - if ('variable' != $resolved->getType()) { + if ('variable' !== $resolved->getType()) { throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression); } From 5578e4c959a60d684ce4e8445d9244f84bd9722f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 14:09:24 +0100 Subject: [PATCH 041/375] #2407 - Remove unused class `PlusOperator` --- Library/Expression/NativeArray.php | 2 - Library/Operators/Unary/PlusOperator.php | 77 ------------------------ 2 files changed, 79 deletions(-) delete mode 100644 Library/Operators/Unary/PlusOperator.php diff --git a/Library/Expression/NativeArray.php b/Library/Expression/NativeArray.php index 071a9aeb49..71e9605a25 100644 --- a/Library/Expression/NativeArray.php +++ b/Library/Expression/NativeArray.php @@ -34,8 +34,6 @@ class NativeArray protected bool $readOnly = false; - protected bool $noisy = true; - protected ?Variable $expectingVariable = null; /** diff --git a/Library/Operators/Unary/PlusOperator.php b/Library/Operators/Unary/PlusOperator.php deleted file mode 100644 index 134d058e9e..0000000000 --- a/Library/Operators/Unary/PlusOperator.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\Operators\Unary; - -use ReflectionException; -use Zephir\CompilationContext; -use Zephir\CompiledExpression; -use Zephir\Exception; -use Zephir\Exception\CompilerException; -use Zephir\Expression; -use Zephir\Operators\AbstractOperator; - -class PlusOperator extends AbstractOperator -{ - /** - * Compile expression. - * - * @param $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * - * @throws Exception - * @throws ReflectionException - */ - public function compile($expression, CompilationContext $compilationContext): CompiledExpression - { - if (!isset($expression['left'])) { - throw new CompilerException('Missing left part of the expression'); - } - - $leftExpr = new Expression($expression['left']); - $leftExpr->setReadOnly($this->readOnly); - $left = $leftExpr->compile($compilationContext); - - switch ($left->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression($left->getType(), '+'.$left->getCode(), $expression); - - case 'variable': - $variable = $compilationContext->symbolTable->getVariable($left->getCode()); - switch ($variable->getType()) { - case 'int': - case 'uint': - case 'long': - case 'ulong': - case 'double': - return new CompiledExpression($variable->getType(), '+'.$variable->getName(), $expression); - - case 'variable': - return new CompiledExpression('variable', $variable->getName(), $expression); - - default: - throw new CompilerException("Cannot operate plus with variable of '".$left->getType()."' type"); - } - break; - - default: - throw new CompilerException("Cannot operate plus with '".$left->getType()."' type"); - } - } -} From 52167042793c989ff114ee9252399cbe3763c105 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 14:09:37 +0100 Subject: [PATCH 042/375] #2407 - Refactor Types classes --- Library/Types/AbstractType.php | 39 +++++++++++++++------------------- Library/Types/ArrayType.php | 34 ++++++++++++----------------- Library/Types/CharType.php | 20 ++++++++++------- Library/Types/DoubleType.php | 12 ++++------- Library/Types/IntType.php | 12 ++++------- Library/Types/IstringType.php | 7 +++--- Library/Types/StringType.php | 12 ++++------- 7 files changed, 57 insertions(+), 79 deletions(-) diff --git a/Library/Types/AbstractType.php b/Library/Types/AbstractType.php index e8c9c81db0..7c52906e15 100644 --- a/Library/Types/AbstractType.php +++ b/Library/Types/AbstractType.php @@ -9,8 +9,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; +use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -23,23 +26,22 @@ abstract class AbstractType { /** * The array of methods in zephir mapped to PHP internal methods. - * - * @var array */ - protected $methodMap = []; + protected array $methodMap = []; /** * Intercepts calls to built-in methods. * - * @param string $methodName - * @param object $caller + * @param string $methodName + * @param object $caller * @param CompilationContext $compilationContext - * @param Call $call - * @param array $expression + * @param Call $call + * @param array $expression * * @return bool|CompiledExpression * - * @throws CompilerException|Exception + * @throws Exception + * @throws ReflectionException */ public function invokeMethod( $methodName, @@ -48,19 +50,19 @@ public function invokeMethod( Call $call, array $expression ) { - /* + /** * Checks first whether the method exist in the array type definition */ if (method_exists($this, $methodName)) { return $this->{$methodName}($caller, $compilationContext, $call, $expression); } - /* + /** * Check the method map */ if (isset($this->methodMap[$methodName])) { $paramNumber = $this->getNumberParam($methodName); - if (0 == $paramNumber) { + if (0 === $paramNumber) { if (isset($expression['parameters'])) { $parameters = $expression['parameters']; array_unshift($parameters, ['parameter' => $caller]); @@ -71,7 +73,7 @@ public function invokeMethod( if (isset($expression['parameters'])) { $parameters = []; foreach ($expression['parameters'] as $number => $parameter) { - if ($number == $paramNumber) { + if ($number === $paramNumber) { $parameters[] = null; } $parameters[] = $parameter; @@ -104,24 +106,17 @@ public function invokeMethod( * * @return string */ - abstract public function getTypeName(); + abstract public function getTypeName(): string; - /** - * @return array - */ - public function getMethodMap() + public function getMethodMap(): array { return $this->methodMap; } /** * Returns the number of the parameter where the object must be bound. - * - * @param $methodName - * - * @return int */ - protected function getNumberParam($methodName) + protected function getNumberParam(string $methodName): int { return 0; } diff --git a/Library/Types/ArrayType.php b/Library/Types/ArrayType.php index 4b2882bff8..f050a0d53d 100644 --- a/Library/Types/ArrayType.php +++ b/Library/Types/ArrayType.php @@ -11,8 +11,11 @@ namespace Zephir\Types; +use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Types; @@ -22,10 +25,7 @@ */ class ArrayType extends AbstractType { - /** - * {@inheritdoc} - */ - public $methodMap = [ + public array $methodMap = [ 'join' => 'join', 'reversed' => 'array_reverse', 'rev' => 'array_reverse', @@ -71,10 +71,7 @@ class ArrayType extends AbstractType 'reduce' => 'array_reduce', ]; - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_ARRAY; } @@ -82,12 +79,14 @@ public function getTypeName() /** * Transforms calls to method "join" to function calls to "join". * - * @param object $caller + * @param object $caller * @param CompilationContext $compilationContext - * @param Call $call - * @param array $expression + * @param Call $call + * @param array $expression * - * @return bool|\Zephir\CompiledExpression + * @return bool|CompiledExpression + * @throws ReflectionException + * @throws Exception */ public function join($caller, CompilationContext $compilationContext, Call $call, array $expression) { @@ -103,15 +102,8 @@ public function join($caller, CompilationContext $compilationContext, Call $call return $expression->compile($compilationContext); } - /** - * {@inheritdoc} - */ - protected function getNumberParam($methodName) + protected function getNumberParam(string $methodName): int { - if ('map' == $methodName) { - return 1; - } - - return 0; + return 'map' === $methodName ? 1 : 0; } } diff --git a/Library/Types/CharType.php b/Library/Types/CharType.php index 385fcd6330..f77a09ae83 100644 --- a/Library/Types/CharType.php +++ b/Library/Types/CharType.php @@ -9,20 +9,22 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; +use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; +use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Types; class CharType extends AbstractType { - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_CHAR; } @@ -30,12 +32,14 @@ public function getTypeName() /** * Transforms calls to method "toHex" to sprintf('%X') call. * - * @param object $caller + * @param object $caller * @param CompilationContext $compilationContext - * @param Call $call - * @param array $expression + * @param Call $call + * @param array $expression * - * @return bool|mixed|\Zephir\CompiledExpression + * @return bool|mixed|CompiledExpression + * @throws ReflectionException + * @throws Exception */ public function toHex($caller, CompilationContext $compilationContext, Call $call, array $expression) { diff --git a/Library/Types/DoubleType.php b/Library/Types/DoubleType.php index b9c0003027..5ad3f5998b 100644 --- a/Library/Types/DoubleType.php +++ b/Library/Types/DoubleType.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; use Zephir\Types; @@ -18,10 +20,7 @@ */ class DoubleType extends AbstractType { - /** - * {@inheritdoc} - */ - public $methodMap = [ + public array $methodMap = [ 'abs' => 'abs', 'tobinary' => 'decbin', 'tohex' => 'dechex', @@ -38,10 +37,7 @@ class DoubleType extends AbstractType 'log' => 'log', ]; - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_DOUBLE; } diff --git a/Library/Types/IntType.php b/Library/Types/IntType.php index 6feb53d059..251de2f54f 100644 --- a/Library/Types/IntType.php +++ b/Library/Types/IntType.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; use Zephir\Types; @@ -18,10 +20,7 @@ */ class IntType extends AbstractType { - /** - * {@inheritdoc} - */ - public $methodMap = [ + public array $methodMap = [ 'abs' => 'abs', 'tobinary' => 'decbin', 'tohex' => 'dechex', @@ -38,10 +37,7 @@ class IntType extends AbstractType 'log' => 'log', ]; - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_INT; } diff --git a/Library/Types/IstringType.php b/Library/Types/IstringType.php index ad4ad03c32..9d7fa0390c 100644 --- a/Library/Types/IstringType.php +++ b/Library/Types/IstringType.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; use Zephir\Types; @@ -18,10 +20,7 @@ */ class IstringType extends StringType { - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_ISTRING; } diff --git a/Library/Types/StringType.php b/Library/Types/StringType.php index b18a7d5539..b365041e7b 100644 --- a/Library/Types/StringType.php +++ b/Library/Types/StringType.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Types; use Zephir\Types; @@ -20,10 +22,7 @@ */ class StringType extends AbstractType { - /** - * {@inheritdoc} - */ - public $methodMap = [ + public array $methodMap = [ 'index' => 'strpos', 'trim' => 'trim', 'trimleft' => 'ltrim', @@ -51,10 +50,7 @@ class StringType extends AbstractType 'uncamelize' => 'uncamelize', ]; - /** - * {@inheritdoc} - */ - public function getTypeName() + public function getTypeName(): string { return Types::T_STRING; } From 748036a55035195f11a3e912a06bdf526f01f539 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 21:19:14 +0100 Subject: [PATCH 043/375] #2407 - Reformat code with PHP8.0 syntax sugar --- Library/CompilationContext.php | 16 +---- Library/Compiler.php | 70 ++++--------------- Library/Compiler/CompilerFileFactory.php | 9 +-- Library/CompilerFileAnonymous.php | 8 +-- Library/Config.php | 2 +- .../Operators/Bitwise/BitwiseBaseOperator.php | 34 ++++----- .../Operators/Bitwise/BitwiseNotOperator.php | 8 ++- .../CompilerFile/CheckDependenciesTest.php | 3 +- 8 files changed, 44 insertions(+), 106 deletions(-) diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 27f807e840..9a5c3c64ae 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -26,11 +26,6 @@ */ class CompilationContext { - /** - * Compiler. - * - * @var Compiler|null - */ public ?Compiler $compiler = null; /** @@ -150,7 +145,7 @@ class CompilationContext public ?CacheManager $cacheManager = null; /** - * Manages class renamings using keyword 'use'. + * Manages class renaming using keyword 'use'. * * @var AliasManager|null */ @@ -201,13 +196,8 @@ public function getFullName(string $className): string /** * Lookup a class from a given class name. - * - * @param string $className - * @param array|null $statement - * - * @return ClassDefinition */ - public function classLookup(string $className, array $statement = null): ClassDefinition + public function classLookup(string $className, array $statement = null): AbstractClassDefinition { if (!in_array($className, ['self', 'static', 'parent'])) { $className = $this->getFullName($className); @@ -215,7 +205,7 @@ public function classLookup(string $className, array $statement = null): ClassDe return $this->compiler->getClassDefinition($className); } - throw new CompilerException("Cannot locate class '{$className}'", $statement); + throw new CompilerException("Cannot locate class '$className'", $statement); } if (in_array($className, ['self', 'static'])) { diff --git a/Library/Compiler.php b/Library/Compiler.php index 36b9ed2ba1..5ee59e604c 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -32,6 +32,7 @@ use Zephir\Exception\RuntimeException; use Zephir\Fcall\FcallManagerInterface; use Zephir\FileSystem\FileSystemInterface; +use Zephir\Parser\Manager; use function count; use function dirname; use function extension_loaded; @@ -43,11 +44,6 @@ final class Compiler { use LoggerAwareTrait; - /** - * @var Backend - */ - public Backend $backend; - /** * @var FunctionDefinition[] */ @@ -102,16 +98,6 @@ final class Compiler */ private array $extraFiles = []; - /** - * @var Config - */ - private Config $config; - - /** - * @var Parser\Manager - */ - private Parser\Manager $parserManager; - /** * @var StringsManager */ @@ -137,41 +123,14 @@ final class Compiler */ private ?string $templatesPath; - /** - * @var FileSystemInterface - */ - private FileSystemInterface $filesystem; - - /** - * @var CompilerFileFactory - */ - private CompilerFileFactory $compilerFileFactory; - - /** - * Compiler constructor. - * - * @param Config $config - * @param Backend $backend - * @param Parser\Manager $manager - * @param FileSystemInterface $filesystem - * @param CompilerFileFactory $compilerFileFactory - * - * @throws RuntimeException - */ public function __construct( - Config $config, - Backend $backend, - Parser\Manager $manager, - FileSystemInterface $filesystem, - CompilerFileFactory $compilerFileFactory + private Config $config, + public Backend $backend, + private Manager $parserManager, + private FileSystemInterface $filesystem, + private CompilerFileFactory $compilerFileFactory, ) { - $this->config = $config; - $this->backend = $backend; - $this->parserManager = $manager; - $this->filesystem = $filesystem; - $this->compilerFileFactory = $compilerFileFactory; $this->logger = new NullLogger(); - $this->stringManager = new StringsManager(); $this->fcallManager = $this->backend->getFcallManager(); @@ -268,11 +227,10 @@ public function getParserManager(): Parser\Manager * Adds a function to the function definitions. * * @param FunctionDefinition $func - * @param array|null $statement + * @param array $statement * - * @throws CompilerException */ - public function addFunction(FunctionDefinition $func, array $statement = []) + public function addFunction(FunctionDefinition $func, array $statement = []): void { $funcName = strtolower($func->getInternalName()); if (isset($this->functionDefinitions[$funcName])) { @@ -431,7 +389,7 @@ public function getClassDefinition(string $className) * @param CompilerFileAnonymous $file * @param ClassDefinition $classDefinition */ - public function addClassDefinition(CompilerFileAnonymous $file, ClassDefinition $classDefinition) + public function addClassDefinition(CompilerFileAnonymous $file, ClassDefinition $classDefinition): void { $this->definitions[$classDefinition->getCompleteName()] = $classDefinition; $this->anonymousFiles[$classDefinition->getCompleteName()] = $file; @@ -485,7 +443,7 @@ public function getConstant(string $name) * * @param array $globals */ - public function setExtensionGlobals(array $globals) + public function setExtensionGlobals(array $globals): void { foreach ($globals as $key => $value) { $this->globals[$key] = $value; @@ -505,7 +463,7 @@ public function isExtensionGlobal(string $name): bool } /** - * Returns a extension global by its name. + * Returns an extension global by its name. * * @param string $name * @@ -563,7 +521,7 @@ public function getPhpIncludeDirs(): string /** * Pre-compile headers to speed up compilation. */ - public function preCompileHeaders() + public function preCompileHeaders(): void { if (is_windows()) { // TODO: Add Windows support @@ -1490,11 +1448,11 @@ public function processCodeInjection(array $entries, string $section = 'request' if (isset($entries[$section])) { foreach ($entries[$section] as $entry) { - if (isset($entry['code']) && !empty($entry['code'])) { + if (!empty($entry['code'])) { $codes[] = $entry['code'].';'; } - if (isset($entry['include']) && !empty($entry['include'])) { + if (!empty($entry['include'])) { $includes[] = '#include "'.$entry['include'].'"'; } } diff --git a/Library/Compiler/CompilerFileFactory.php b/Library/Compiler/CompilerFileFactory.php index 1b2b1659b0..43ba265102 100644 --- a/Library/Compiler/CompilerFileFactory.php +++ b/Library/Compiler/CompilerFileFactory.php @@ -21,15 +21,8 @@ final class CompilerFileFactory { - private Config $config; - private FileSystemInterface $filesystem; - private LoggerInterface $logger; - - public function __construct(Config $config, FileSystemInterface $filesystem, LoggerInterface $logger) + public function __construct(private Config $config, private FileSystemInterface $filesystem, private LoggerInterface $logger) { - $this->config = $config; - $this->filesystem = $filesystem; - $this->logger = $logger; } /** diff --git a/Library/CompilerFileAnonymous.php b/Library/CompilerFileAnonymous.php index 89711ace2a..81c51b7ed1 100644 --- a/Library/CompilerFileAnonymous.php +++ b/Library/CompilerFileAnonymous.php @@ -96,21 +96,21 @@ private function compileClass(CompilationContext $compilationContext) $separators = str_repeat('../', count(explode('\\', $classDefinition->getCompleteName())) - 1); - $code = ''.PHP_EOL; + $code = PHP_EOL; $code .= '#ifdef HAVE_CONFIG_H'.PHP_EOL; $code .= '#include "'.$separators.'ext_config.h"'.PHP_EOL; $code .= '#endif'.PHP_EOL; - $code .= ''.PHP_EOL; + $code .= PHP_EOL; $code .= '#include '.PHP_EOL; $code .= '#include "'.$separators.'php_ext.h"'.PHP_EOL; $code .= '#include "'.$separators.'ext.h"'.PHP_EOL; - $code .= ''.PHP_EOL; + $code .= PHP_EOL; $code .= '#include '.PHP_EOL; $code .= '#include '.PHP_EOL; $code .= '#include '.PHP_EOL; - $code .= ''.PHP_EOL; + $code .= PHP_EOL; $code .= '#include "kernel/main.h"'.PHP_EOL; diff --git a/Library/Config.php b/Library/Config.php index 73aeaf59b0..a678d640b9 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -335,7 +335,7 @@ public function jsonSerialize(): array * * @throws Exception */ - protected function populate() + protected function populate(): void { if (!file_exists('config.json')) { return; diff --git a/Library/Operators/Bitwise/BitwiseBaseOperator.php b/Library/Operators/Bitwise/BitwiseBaseOperator.php index 3d27040aee..e7e82b2a0d 100644 --- a/Library/Operators/Bitwise/BitwiseBaseOperator.php +++ b/Library/Operators/Bitwise/BitwiseBaseOperator.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; use Zephir\CompilationContext; @@ -34,12 +36,12 @@ class BitwiseBaseOperator extends AbstractOperator * @param array $expression * @param CompilationContext $compilationContext * - * @return bool|CompiledExpression + * @return null|CompiledExpression */ - public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext) + public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext): ?CompiledExpression { if (!$compilationContext->config->get('constant-folding', 'optimizations')) { - return false; + return null; } switch ($expression['left']['type']) { @@ -51,7 +53,7 @@ public function optimizeConstantFolding(array $expression, CompilationContext $c //continue to next switch break; default: - return false; + return null; break; } @@ -64,7 +66,7 @@ public function optimizeConstantFolding(array $expression, CompilationContext $c //continue to operator switch break; default: - return false; + return null; break; } @@ -88,12 +90,10 @@ public function optimizeConstantFolding(array $expression, CompilationContext $c return new CompiledExpression('int', $expression['left']['value'] >> $expression['right']['value'], $expression); } - return false; + return null; } /** - * {@inheritdoc} - * * @param array $expression * @param CompilationContext $compilationContext * @@ -113,7 +113,7 @@ public function compile($expression, CompilationContext $compilationContext) * Check for constant folding optimizations. */ $optimized = $this->optimizeConstantFolding($expression, $compilationContext); - if ($optimized) { + if ($optimized !== null) { return $optimized; } @@ -153,10 +153,8 @@ public function compile($expression, CompilationContext $compilationContext) case 'int': case 'uint': case 'long': - case 'ulong': - return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); - case 'bool': + case 'ulong': return new CompiledExpression('int', '('.$left->getCode().' '.$this->operator.' '.$variableRight->getName().')', $expression); case 'double': @@ -196,10 +194,8 @@ public function compile($expression, CompilationContext $compilationContext) case 'int': case 'uint': case 'long': - case 'ulong': - return new CompiledExpression('int', '((int) ('.$left->getBooleanCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); - case 'bool': + case 'ulong': return new CompiledExpression('int', '((int) ('.$left->getBooleanCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); case 'double': @@ -242,10 +238,8 @@ public function compile($expression, CompilationContext $compilationContext) case 'int': case 'uint': case 'long': - case 'ulong': - return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); - case 'bool': + case 'ulong': return new CompiledExpression('int', '((int) ('.$left->getCode().') '.$this->operator.' '.$variableRight->getName().')', $expression); case 'double': @@ -302,10 +296,8 @@ public function compile($expression, CompilationContext $compilationContext) case 'long': case 'ulong': case 'char': - case 'uchar': - return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); - case 'bool': + case 'uchar': return new CompiledExpression('int', '('.$variableLeft->getName().' '.$this->operator.' '.$variableRight->getName().')', $expression); case 'double': diff --git a/Library/Operators/Bitwise/BitwiseNotOperator.php b/Library/Operators/Bitwise/BitwiseNotOperator.php index b40be4dc06..f0666a57d7 100644 --- a/Library/Operators/Bitwise/BitwiseNotOperator.php +++ b/Library/Operators/Bitwise/BitwiseNotOperator.php @@ -9,10 +9,14 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Operators\Bitwise; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Operators\AbstractOperator; @@ -23,9 +27,9 @@ class BitwiseNotOperator extends AbstractOperator * @param $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * @throws ReflectionException + * @throws Exception */ public function compile($expression, CompilationContext $compilationContext) { diff --git a/tests/Zephir/CompilerFile/CheckDependenciesTest.php b/tests/Zephir/CompilerFile/CheckDependenciesTest.php index 14175745f0..cf88d15bda 100644 --- a/tests/Zephir/CompilerFile/CheckDependenciesTest.php +++ b/tests/Zephir/CompilerFile/CheckDependenciesTest.php @@ -19,6 +19,7 @@ use Zephir\AliasManager; use Zephir\Backend\Backend; use Zephir\Compiler; +use Zephir\Compiler\CompilerFileFactory; use Zephir\CompilerFile; use Zephir\Config; use Zephir\FileSystem\HardDisk; @@ -36,7 +37,7 @@ public function testExtendsClassThatDoesNotExist(): void $config = new Config(); $backend = new Backend($config, 'kernel', 'templates'); $disk = new HardDisk(realpath('..').'/tests/output'); - $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); + $compilerFactory = new CompilerFileFactory($config, $disk, $logger); $compiler = new Compiler($config, $backend, new Manager(new Parser()), $disk, $compilerFactory); From e95cc32ad01310e967e95cb748bddb3335f90cca Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 4 Sep 2023 21:28:57 +0100 Subject: [PATCH 044/375] #2407 - Update phpdoc --- Library/Operators/Other/FetchOperator.php | 2 -- Library/Operators/Other/LikelyOperator.php | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Operators/Other/FetchOperator.php b/Library/Operators/Other/FetchOperator.php index b5076c3057..c3fa062454 100644 --- a/Library/Operators/Other/FetchOperator.php +++ b/Library/Operators/Other/FetchOperator.php @@ -21,8 +21,6 @@ use Zephir\Operators\AbstractOperator; /** - * FetchOperator. - * * Fetch is a special operator that checks if an expression 'isset' and then obtain the value * without calculating the hash key twice */ diff --git a/Library/Operators/Other/LikelyOperator.php b/Library/Operators/Other/LikelyOperator.php index 25412ecc13..e6cc5418d2 100644 --- a/Library/Operators/Other/LikelyOperator.php +++ b/Library/Operators/Other/LikelyOperator.php @@ -13,6 +13,7 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -26,12 +27,13 @@ class LikelyOperator extends AbstractOperator { /** - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { From a199684f37e3f24a5058a8616ee6f813c2e9cfa6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 5 Sep 2023 09:20:53 +0100 Subject: [PATCH 045/375] #2407 - Fix variable name --- Library/Backend/Backend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 68ed2cae0f..6d4b5169e3 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -63,7 +63,7 @@ public function getInternalKernelPath(): string public function getTemplateFileContents(string $filename): string { $templatePath = rtrim((string) $this->config->get('templatepath', 'backend'), '\\/'); - if (empty($templatepath)) { + if (empty($templatePath)) { $templatePath = $this->templatesPath; } From d443ac2b6ee8c485424a1d0fa5ecdd7e346d5944 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 5 Sep 2023 09:28:07 +0100 Subject: [PATCH 046/375] #2407 - Remove `invalidDefaultTypeException()` method with its usages --- Library/Backend/VariablesManager.php | 29 ---------------------------- 1 file changed, 29 deletions(-) diff --git a/Library/Backend/VariablesManager.php b/Library/Backend/VariablesManager.php index dd12119955..9294c3b5c2 100644 --- a/Library/Backend/VariablesManager.php +++ b/Library/Backend/VariablesManager.php @@ -110,9 +110,6 @@ private function initDynamicVar(Variable $variable, array $value, Context $conte case 'empty-array': $context->backend->initArray($variable, $context); break; - - default: - throw $this->invalidDefaultTypeException($variable, $value); } } @@ -140,9 +137,6 @@ private function initStringVar(Variable $variable, array $value, Context $contex case Types::T_NULL: $context->backend->assignString($variable, null, $context); break; - - default: - throw $this->invalidDefaultTypeException($variable, $value); } } @@ -170,32 +164,9 @@ private function initArrayVar(Variable $variable, array $value, Context $context case 'empty-array': $context->backend->initArray($variable, $context); break; - - default: - throw $this->invalidDefaultTypeException($variable, $value); } } - /** - * Create a compiler exception with 'Invalid default type' message. - * - * @param Variable $variable - * @param array $value - * - * @return Exception - */ - private function invalidDefaultTypeException(Variable $variable, array $value): Exception - { - new Exception( - sprintf( - 'Invalid default type: %s for data type: %s', - $value['type'], - $variable->getType() - ), - $variable->getOriginal() - ); - } - /** * Validate 'char' value type. * From 4bd015835e0221c98cd2365446594981aa7aab8e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Wed, 6 Sep 2023 21:06:19 +0100 Subject: [PATCH 047/375] #2407 - Move `docker/` directory into `.docker/` --- {docker => .docker}/8.0/.bashrc | 0 {docker => .docker}/8.0/Dockerfile | 2 +- {docker => .docker}/8.1/.bashrc | 0 {docker => .docker}/8.1/Dockerfile | 2 +- {docker => .docker}/8.2/.bashrc | 0 {docker => .docker}/8.2/Dockerfile | 2 +- {docker => .docker}/8.3/.bashrc | 0 {docker => .docker}/8.3/Dockerfile | 2 +- docker-compose.yml | 8 ++++---- 9 files changed, 8 insertions(+), 8 deletions(-) rename {docker => .docker}/8.0/.bashrc (100%) rename {docker => .docker}/8.0/Dockerfile (94%) rename {docker => .docker}/8.1/.bashrc (100%) rename {docker => .docker}/8.1/Dockerfile (94%) rename {docker => .docker}/8.2/.bashrc (100%) rename {docker => .docker}/8.2/Dockerfile (94%) rename {docker => .docker}/8.3/.bashrc (100%) rename {docker => .docker}/8.3/Dockerfile (94%) diff --git a/docker/8.0/.bashrc b/.docker/8.0/.bashrc similarity index 100% rename from docker/8.0/.bashrc rename to .docker/8.0/.bashrc diff --git a/docker/8.0/Dockerfile b/.docker/8.0/Dockerfile similarity index 94% rename from docker/8.0/Dockerfile rename to .docker/8.0/Dockerfile index 847ea05e03..42cff4e91b 100644 --- a/docker/8.0/Dockerfile +++ b/.docker/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:latest AS composer FROM php:8.0-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; diff --git a/docker/8.1/.bashrc b/.docker/8.1/.bashrc similarity index 100% rename from docker/8.1/.bashrc rename to .docker/8.1/.bashrc diff --git a/docker/8.1/Dockerfile b/.docker/8.1/Dockerfile similarity index 94% rename from docker/8.1/Dockerfile rename to .docker/8.1/Dockerfile index 4e001b9f04..08ba38e352 100644 --- a/docker/8.1/Dockerfile +++ b/.docker/8.1/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:latest AS composer FROM php:8.1-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; diff --git a/docker/8.2/.bashrc b/.docker/8.2/.bashrc similarity index 100% rename from docker/8.2/.bashrc rename to .docker/8.2/.bashrc diff --git a/docker/8.2/Dockerfile b/.docker/8.2/Dockerfile similarity index 94% rename from docker/8.2/Dockerfile rename to .docker/8.2/Dockerfile index 69174c95e8..eecd0a7ede 100644 --- a/docker/8.2/Dockerfile +++ b/.docker/8.2/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:latest AS composer FROM php:8.2-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; diff --git a/docker/8.3/.bashrc b/.docker/8.3/.bashrc similarity index 100% rename from docker/8.3/.bashrc rename to .docker/8.3/.bashrc diff --git a/docker/8.3/Dockerfile b/.docker/8.3/Dockerfile similarity index 94% rename from docker/8.3/Dockerfile rename to .docker/8.3/Dockerfile index 3bc4b87b45..1899dd3203 100644 --- a/docker/8.3/Dockerfile +++ b/.docker/8.3/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:latest AS composer FROM php:8.3.0beta3-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; diff --git a/docker-compose.yml b/docker-compose.yml index 449c29c99b..ef4d26b18f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: zephir-8.0: container_name: phalcon-zephir-8.0 hostname: zephir-80 - build: docker/8.0 + build: .docker/8.0 working_dir: /srv environment: - "USER=Zephir" @@ -16,7 +16,7 @@ services: zephir-8.1: container_name: phalcon-zephir-8.1 hostname: zephir-81 - build: docker/8.1 + build: .docker/8.1 working_dir: /srv environment: - "USER=Zephir" @@ -26,7 +26,7 @@ services: zephir-8.2: container_name: phalcon-zephir-8.2 hostname: zephir-82 - build: docker/8.2 + build: .docker/8.2 working_dir: /srv environment: - "USER=Zephir" @@ -36,7 +36,7 @@ services: zephir-8.3: container_name: phalcon-zephir-8.3 hostname: zephir-83 - build: docker/8.3 + build: .docker/8.3 working_dir: /srv environment: - "USER=Zephir" From 3b1fb8197b792b72ed23b376a91ccbb4f3696f01 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Wed, 6 Sep 2023 23:09:23 +0100 Subject: [PATCH 048/375] #2407 - Reformat code with PHP8.0 syntax sugar --- Library/Backend/Backend.php | 14 +++--- Library/Backend/FcallManager.php | 2 + Library/Backend/VariablesManager.php | 2 + Library/Builder/FunctionCallBuilder.php | 28 ++++-------- .../Builder/Operators/CastOperatorBuilder.php | 16 +++---- .../Statements/AbstractStatementBuilder.php | 2 - .../Builder/Statements/IfStatementBuilder.php | 21 +++------ .../Statements/LetStatementBuilder.php | 18 +------- Library/Builder/StatementsBlockBuilder.php | 8 +--- Library/Cache/FunctionCache.php | 10 +---- Library/Cache/MethodCache.php | 8 +--- Library/Classes/Entry.php | 14 +----- Library/CompilationContext.php | 40 ----------------- Library/CompiledExpression.php | 5 --- Library/Compiler/CompilerFileFactory.php | 7 ++- Library/Detectors/WriteDetector.php | 6 +-- Library/Documentation/NamespaceHelper.php | 45 +++++-------------- Library/Documentation/Template.php | 29 ++++++------ Library/HeadersManager.php | 10 ++--- Library/Statements/ForStatement.php | 9 ++-- Library/StatementsBlock.php | 5 --- 21 files changed, 74 insertions(+), 225 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 6d4b5169e3..74107bb5a5 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Backend; use Zephir\ClassDefinition; @@ -33,13 +35,11 @@ class Backend { protected FcallManagerInterface $fcallManager; - /** - * @param Config $config - * @param string $kernelsPath - * @param string $templatesPath - */ - public function __construct(protected Config $config, protected string $kernelsPath, protected string $templatesPath) - { + public function __construct( + protected Config $config, + protected string $kernelsPath, + protected string $templatesPath + ) { $this->fcallManager = new FcallManager(); } diff --git a/Library/Backend/FcallManager.php b/Library/Backend/FcallManager.php index 0711366c08..6401de07cd 100644 --- a/Library/Backend/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Backend; use Zephir\CodePrinter; diff --git a/Library/Backend/VariablesManager.php b/Library/Backend/VariablesManager.php index 9294c3b5c2..9eaf4b6053 100644 --- a/Library/Backend/VariablesManager.php +++ b/Library/Backend/VariablesManager.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Backend; use Zephir\CompilationContext as Context; diff --git a/Library/Builder/FunctionCallBuilder.php b/Library/Builder/FunctionCallBuilder.php index a06def7b3a..395c788610 100644 --- a/Library/Builder/FunctionCallBuilder.php +++ b/Library/Builder/FunctionCallBuilder.php @@ -18,18 +18,6 @@ */ class FunctionCallBuilder { - protected string $name; - - protected array $parameters; - - protected int $type; - - protected ?string $file; - - protected int $line = 0; - - protected int $char = 0; - /** * @param string $name * @param array $parameters @@ -38,14 +26,14 @@ class FunctionCallBuilder * @param int $line * @param int $char */ - public function __construct(string $name, array $parameters, int $type = 1, ?string $file = null, int $line = 0, int $char = 0) - { - $this->name = $name; - $this->parameters = $parameters; - $this->type = $type; - $this->file = $file; - $this->line = $line; - $this->char = $char; + public function __construct( + protected string $name, + protected array $parameters, + protected int $type = 1, + protected ?string $file = null, + protected int $line = 0, + protected int $char = 0, + ) { } /** diff --git a/Library/Builder/Operators/CastOperatorBuilder.php b/Library/Builder/Operators/CastOperatorBuilder.php index 714d089497..a67aa4a32b 100644 --- a/Library/Builder/Operators/CastOperatorBuilder.php +++ b/Library/Builder/Operators/CastOperatorBuilder.php @@ -24,15 +24,13 @@ class CastOperatorBuilder extends AbstractOperatorBuilder protected FunctionCallBuilder $rightOperand; - /** - * @param string $left - * @param FunctionCallBuilder $right - * @param string|null $file - * @param int $line - * @param int $char - */ - public function __construct(string $left, FunctionCallBuilder $right, ?string $file = null, int $line = 0, int $char = 0) - { + public function __construct( + string $left, + FunctionCallBuilder $right, + ?string $file = null, + int $line = 0, + int $char = 0 + ) { $this->leftOperand = $left; $this->rightOperand = $right; $this->file = $file; diff --git a/Library/Builder/Statements/AbstractStatementBuilder.php b/Library/Builder/Statements/AbstractStatementBuilder.php index a788fbc70e..9ec1a69a04 100644 --- a/Library/Builder/Statements/AbstractStatementBuilder.php +++ b/Library/Builder/Statements/AbstractStatementBuilder.php @@ -17,8 +17,6 @@ abstract class AbstractStatementBuilder { /** * Returns a builder definition. - * - * @return array */ abstract public function get(): array; } diff --git a/Library/Builder/Statements/IfStatementBuilder.php b/Library/Builder/Statements/IfStatementBuilder.php index ae469a1291..44c36ea48f 100644 --- a/Library/Builder/Statements/IfStatementBuilder.php +++ b/Library/Builder/Statements/IfStatementBuilder.php @@ -21,22 +21,11 @@ */ class IfStatementBuilder extends AbstractStatementBuilder { - private AbstractOperatorBuilder $evalExpr; - - private StatementsBlockBuilder $ifBlock; - - private ?StatementsBlockBuilder $elseBlock; - - /** - * @param AbstractOperatorBuilder $evalExpr - * @param StatementsBlockBuilder $ifBlock - * @param StatementsBlockBuilder|null $elseBlock - */ - public function __construct(AbstractOperatorBuilder $evalExpr, StatementsBlockBuilder $ifBlock, StatementsBlockBuilder $elseBlock = null) - { - $this->evalExpr = $evalExpr; - $this->ifBlock = $ifBlock; - $this->elseBlock = $elseBlock; + public function __construct( + private AbstractOperatorBuilder $evalExpr, + private StatementsBlockBuilder $ifBlock, + private ?StatementsBlockBuilder $elseBlock = null + ) { } /** diff --git a/Library/Builder/Statements/LetStatementBuilder.php b/Library/Builder/Statements/LetStatementBuilder.php index faf656e47b..721ce2a292 100644 --- a/Library/Builder/Statements/LetStatementBuilder.php +++ b/Library/Builder/Statements/LetStatementBuilder.php @@ -18,24 +18,8 @@ */ class LetStatementBuilder extends AbstractStatementBuilder { - /** - * List of assignments - * - * @var array - */ - private array $assignments; - - /** - * Expression - * - * @var mixed - */ - private $expr; - - public function __construct(array $assignments, $expr) + public function __construct(private array $assignments, private mixed $expr) { - $this->assignments = $assignments; - $this->expr = $expr; } /** diff --git a/Library/Builder/StatementsBlockBuilder.php b/Library/Builder/StatementsBlockBuilder.php index b0a02bfb44..fac1c5233c 100644 --- a/Library/Builder/StatementsBlockBuilder.php +++ b/Library/Builder/StatementsBlockBuilder.php @@ -18,14 +18,8 @@ */ class StatementsBlockBuilder { - protected array $statements; - - protected bool $raw; - - public function __construct(array $statements, bool $raw = false) + public function __construct(protected array $statements, protected bool $raw = false) { - $this->statements = $statements; - $this->raw = $raw; } /** diff --git a/Library/Cache/FunctionCache.php b/Library/Cache/FunctionCache.php index e44fa9c884..d8528ce6e0 100644 --- a/Library/Cache/FunctionCache.php +++ b/Library/Cache/FunctionCache.php @@ -37,16 +37,8 @@ class FunctionCache { protected array $cache = []; - protected ?CallGathererPass $gatherer = null; - - /** - * FunctionCache constructor. - * - * @param CallGathererPass|null $gatherer - */ - public function __construct(CallGathererPass $gatherer = null) + public function __construct(protected ?CallGathererPass $gatherer = null) { - $this->gatherer = $gatherer; } /** diff --git a/Library/Cache/MethodCache.php b/Library/Cache/MethodCache.php index 5b731a1ec3..185a505b5e 100644 --- a/Library/Cache/MethodCache.php +++ b/Library/Cache/MethodCache.php @@ -41,14 +41,8 @@ class MethodCache { protected array $cache = []; - protected ?CallGathererPass $gatherer = null; - - /** - * @param CallGathererPass|null $gatherer - */ - public function __construct(CallGathererPass $gatherer = null) + public function __construct(protected ?CallGathererPass $gatherer = null) { - $this->gatherer = $gatherer; } /** diff --git a/Library/Classes/Entry.php b/Library/Classes/Entry.php index 47ded83a52..2bcd1151f0 100644 --- a/Library/Classes/Entry.php +++ b/Library/Classes/Entry.php @@ -34,11 +34,6 @@ class Entry */ private string $classname; - /** - * @var CompilationContext - */ - private CompilationContext $compilationContext; - /** * @var bool */ @@ -51,15 +46,8 @@ class Entry */ private array $classEntries; - /** - * Entry constructor. - * - * @param string $className - * @param CompilationContext $compilationContext - */ - public function __construct(string $className, CompilationContext $compilationContext) + public function __construct(string $className, private CompilationContext $compilationContext) { - $this->compilationContext = $compilationContext; $this->classname = $this->compilationContext->getFullName($className); $this->classEntries = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 9a5c3c64ae..78edd195f8 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -30,92 +30,66 @@ class CompilationContext /** * Current code printer. - * - * @var CodePrinter|null */ public ?CodePrinter $codePrinter = null; /** * Whether the current method is static or not. - * - * @var bool */ public bool $staticContext = false; /** * Code printer for the header. - * - * @var CodePrinter|null */ public ?CodePrinter $headerPrinter = null; /** * Current symbol table. - * - * @var SymbolTable|null */ public ?SymbolTable $symbolTable = null; /** * Type inference data. - * - * @var StaticTypeInference|null */ public ?StaticTypeInference $typeInference = null; /** * Represents the class currently being compiled. - * - * @var ClassDefinition|null */ public ?ClassDefinition $classDefinition = null; /** * Current method or function that being compiled. - * - * @var ClassMethod|null */ public ?ClassMethod $currentMethod = null; /** * Represents the c-headers added to the file. - * - * @var HeadersManager|null */ public ?HeadersManager $headersManager = null; /** * Represents interned strings and concatenations made in the project. - * - * @var StringsManager|null */ public ?StringsManager $stringsManager = null; /** * Tells if the compilation is being made inside a cycle/loop. - * - * @var int */ public int $insideCycle = 0; /** * Tells if the compilation is being made inside a try/catch block. - * - * @var int */ public int $insideTryCatch = 0; /** * Tells if the compilation is being made inside a switch. - * - * @var int */ public int $insideSwitch = 0; /** * Current cycle/loop block. - * - * @var array */ public array $cycleBlocks = []; @@ -127,15 +101,11 @@ class CompilationContext /** * Global consecutive for try/catch blocks. - * - * @var int */ public int $currentTryCatch = 0; /** * Helps to create graphs of conditional/jump branches in a specific method. - * - * @var BranchManager|null */ public ?BranchManager $branchManager = null; @@ -146,36 +116,26 @@ class CompilationContext /** * Manages class renaming using keyword 'use'. - * - * @var AliasManager|null */ public ?AliasManager $aliasManager = null; /** * Function Cache. - * - * @var FunctionCache|null */ public ?FunctionCache $functionCache = null; /** * Global config. - * - * @var Config|null */ public ?Config $config = null; /** * Global logger. - * - * @var LoggerInterface|null */ public ?LoggerInterface $logger = null; /** * The current backend. - * - * @var Backend|null */ public ?Backend $backend = null; diff --git a/Library/CompiledExpression.php b/Library/CompiledExpression.php index ebe2d11366..dadc5db02c 100644 --- a/Library/CompiledExpression.php +++ b/Library/CompiledExpression.php @@ -21,11 +21,6 @@ */ class CompiledExpression implements TypeAwareInterface { - /** - * @param string $type - * @param mixed $code - * @param array|null $originalExpr - */ public function __construct(protected string $type, protected mixed $code, protected ?array $originalExpr = null) { } diff --git a/Library/Compiler/CompilerFileFactory.php b/Library/Compiler/CompilerFileFactory.php index 43ba265102..6d24349fa0 100644 --- a/Library/Compiler/CompilerFileFactory.php +++ b/Library/Compiler/CompilerFileFactory.php @@ -21,8 +21,11 @@ final class CompilerFileFactory { - public function __construct(private Config $config, private FileSystemInterface $filesystem, private LoggerInterface $logger) - { + public function __construct( + private Config $config, + private FileSystemInterface $filesystem, + private LoggerInterface $logger, + ) { } /** diff --git a/Library/Detectors/WriteDetector.php b/Library/Detectors/WriteDetector.php index be4400643a..f2de68ba01 100644 --- a/Library/Detectors/WriteDetector.php +++ b/Library/Detectors/WriteDetector.php @@ -88,11 +88,7 @@ public function increaseMutations(string $variable): self */ public function getNumberOfMutations(string $variable): int { - if (isset($this->mutations[$variable])) { - return $this->mutations[$variable]; - } - - return 0; + return $this->mutations[$variable] ?? 0; } /** diff --git a/Library/Documentation/NamespaceHelper.php b/Library/Documentation/NamespaceHelper.php index 37544591bd..30b75d1718 100644 --- a/Library/Documentation/NamespaceHelper.php +++ b/Library/Documentation/NamespaceHelper.php @@ -15,18 +15,14 @@ class NamespaceHelper { - protected $fullNamespace; + protected string $endNamespace; + protected string $parentName; - protected $endNamespace; - protected $parentName; + protected array $classes = []; + protected array $namespaces = []; - protected $classes = []; - protected $namespaces = []; - - public function __construct($fullNamespace) + public function __construct(protected string $fullNamespace) { - $this->fullNamespace = $fullNamespace; - $ex = explode('\\', $fullNamespace); $this->endNamespace = $ex[\count($ex) - 1]; @@ -35,51 +31,32 @@ public function __construct($fullNamespace) $this->parentName = implode('\\', $ex); } - public function addClass(CompilerFile $c) + public function addClass(CompilerFile $c): void { $this->classes[] = $c; } - public function addNamespace(self $n) - { - if (!isset($this->namespaces[$n->getFullNamespace()])) { - $this->namespaces[$n->getFullNamespace()] = $n; - } - } - - public function getFullNamespace() + public function getFullNamespace(): string { return $this->fullNamespace; } - /** - * @return string - */ - public function getShortName() + public function getShortName(): string { return $this->endNamespace; } - /** - * @return string - */ - public function getParentName() + public function getParentName(): string { return $this->parentName; } - /** - * @return CompilerFile[] - */ - public function getClasses() + public function getClasses(): array { return $this->classes; } - /** - * @return NamespaceHelper[] - */ - public function getNamespaces() + public function getNamespaces(): array { return $this->namespaces; } diff --git a/Library/Documentation/Template.php b/Library/Documentation/Template.php index f20e7679de..fb8ca61fe0 100644 --- a/Library/Documentation/Template.php +++ b/Library/Documentation/Template.php @@ -19,10 +19,7 @@ class Template { - protected $template; - protected $data; - protected $nestedLevel; - protected $pathToRoot = './'; + protected string $pathToRoot = './'; protected $themeOptions; /** * @var Config @@ -39,16 +36,16 @@ class Template * * @throws Exception */ - public function __construct(protected Theme $theme, array $data, string $template, int $nestedLevel = 0) - { + public function __construct( + protected Theme $theme, + protected array $data, + protected string $template, + protected int $nestedLevel = 0, + ) { // todo clean buffer before exception if ($nestedLevel > 800) { throw new Exception('Recursive inclusion detected in theme creation'); } - - $this->data = $data; - $this->template = $template; - $this->nestedLevel = $nestedLevel; } private function getTemplatePath($fileName) @@ -71,7 +68,7 @@ private function getTemplatePath($fileName) * * @param array $projectConfig */ - public function setProjectConfig($projectConfig) + public function setProjectConfig($projectConfig): void { $this->projectConfig = $projectConfig; } @@ -81,7 +78,7 @@ public function setProjectConfig($projectConfig) * * @param array $themeOptions */ - public function setThemeOptions($themeOptions) + public function setThemeOptions($themeOptions): void { $this->themeOptions = $themeOptions; } @@ -91,7 +88,7 @@ public function setThemeOptions($themeOptions) * * @param string $pathToRoot */ - public function setPathToRoot($pathToRoot) + public function setPathToRoot(string $pathToRoot): void { $this->pathToRoot = $pathToRoot; } @@ -103,7 +100,7 @@ public function setPathToRoot($pathToRoot) * * @return string the relative path to the url */ - public function url($url) + public function url(string $url): string { if (\is_string($url)) { if ('/' == $url[0]) { @@ -123,12 +120,12 @@ public function url($url) /** * @return string */ - public function getPathToRoot() + public function getPathToRoot(): string { return $this->pathToRoot; } - public function write($outputFile) + public function write($outputFile): void { $content = $this->parse(); file_put_contents($outputFile, $content); diff --git a/Library/HeadersManager.php b/Library/HeadersManager.php index c6a7ad9a1d..d83645ffbe 100644 --- a/Library/HeadersManager.php +++ b/Library/HeadersManager.php @@ -31,21 +31,21 @@ class HeadersManager * * @var array */ - protected $headers = []; + protected array $headers = []; /** * List of headers. * * @var array */ - protected $headersFirst = []; + protected array $headersFirst = []; /** * List of headers. * * @var array */ - protected $headersLast = []; + protected array $headersLast = []; /** * Adds a header path to the manager. @@ -79,10 +79,8 @@ public function add($path, $position = 0) /** * Returns a set of headers merged. - * - * @return array */ - public function get() + public function get(): array { return array_merge($this->headersFirst, $this->headers, $this->headersLast); } diff --git a/Library/Statements/ForStatement.php b/Library/Statements/ForStatement.php index a002d6a624..b85dec19aa 100644 --- a/Library/Statements/ForStatement.php +++ b/Library/Statements/ForStatement.php @@ -647,13 +647,12 @@ public function compileStringTraverse($expression, CompilationContext $compilati * - A key must be a zval * - A value must be a zval * - * @param array $expression * @param CompilationContext $compilationContext * @param Variable $exprVariable */ - public function compileHashTraverse($expression, CompilationContext $compilationContext, Variable $exprVariable) + public function compileHashTraverse(CompilationContext $compilationContext, Variable $exprVariable): void { - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { @@ -671,7 +670,7 @@ public function compileHashTraverse($expression, CompilationContext $compilation $keyVariable->setDynamicTypes('undefined'); } - /* + /** * Initialize 'value' variable */ if (isset($this->statement['value'])) { @@ -793,7 +792,7 @@ public function compile(CompilationContext $compilationContext): void switch ($exprVariable->getType()) { case 'variable': case 'array': - $this->compileHashTraverse($expression, $compilationContext, $exprVariable); + $this->compileHashTraverse($compilationContext, $exprVariable); break; case 'string': diff --git a/Library/StatementsBlock.php b/Library/StatementsBlock.php index 9722a40601..c29c9e112a 100644 --- a/Library/StatementsBlock.php +++ b/Library/StatementsBlock.php @@ -62,11 +62,6 @@ public function __construct(protected $statements) $debug = getenv('ZEPHIR_DEBUG'); } - // TODO: Add container support - // elseif ($this->container->has('ZEPHIR_DEBUG')) { - // $debug = $this->container->get('ZEPHIR_DEBUG'); - // } - $this->debug = filter_var($debug, FILTER_VALIDATE_BOOLEAN); } From d61394a10ac8e8d1fd3c9e1879d760ec1cbbb4db Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 11:20:59 +0100 Subject: [PATCH 049/375] #2407 - Reformat code with PHP8.0 syntax sugar --- Library/ClassMethod.php | 345 +++++----------------------------------- 1 file changed, 43 insertions(+), 302 deletions(-) diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 228f1bc38e..92d3bea737 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -13,6 +13,7 @@ namespace Zephir; +use ReflectionException; use Zephir\Classes\Entry as ClassEntry; use Zephir\Detectors\WriteDetector; use Zephir\Documentation\Docblock; @@ -22,9 +23,11 @@ use Zephir\Passes\LocalContextPass; use Zephir\Passes\StaticTypeInference; +use function array_key_exists; use function count; use function in_array; use function is_array; +use function is_object; /** * Represents a class method @@ -33,52 +36,15 @@ class ClassMethod { public bool $optimizable = true; - /** - * @var ClassDefinition|null - */ - protected ?ClassDefinition $classDefinition = null; - - /** - * @var array - */ - protected array $visibility = []; - - /** - * @var string - */ - protected string $name; - - /** - * @var ClassMethodParameters|null - */ - protected ?ClassMethodParameters $parameters = null; - - /** - * @var StatementsBlock|null - */ - protected ?StatementsBlock $statements = null; - - /** - * @var string|null - */ - protected ?string $docblock = null; - - /** - * @var Docblock|null - */ protected ?Docblock $parsedDocblock = null; /** * Types returned by the method. - * - * @var array */ protected array $returnTypes = []; /** * Zend MAY_BE_* types. - * - * @var array|string[] */ protected array $mayBeArgTypes = [ 'int' => 'MAY_BE_LONG', @@ -87,8 +53,6 @@ class ClassMethod /** * Raw-types returned by the method. - * - * @var array|null */ protected ?array $returnTypesRaw = null; @@ -99,8 +63,6 @@ class ClassMethod /** * Whether the variable is void. - * - * @var bool */ protected bool $void = false; @@ -108,126 +70,68 @@ class ClassMethod * Whether the variable is mixed. * * Only for PHP >= 8.0 - * - * @var bool */ protected bool $mixed = false; /** * Whether the method is public or not. - * - * @var bool */ protected bool $isPublic = true; /** * Whether the method is static or not. - * - * @var bool */ protected bool $isStatic = false; /** * Whether the method is final or not. - * - * @var bool */ protected bool $isFinal = false; /** * Whether the method is abstract or not. - * - * @var bool */ protected bool $isAbstract = false; /** * Whether the method is internal or not. - * - * @var bool */ protected bool $isInternal = false; /** * Whether the method is bundled with PHP or not. - * - * @var bool */ protected bool $isBundled = false; /** * Whether the method is an initializer or not. - * - * @var bool */ protected bool $isInitializer = false; - /** - * @var array|null - */ - protected ?array $expression = null; - - /** - * @var array|null - */ - protected ?array $staticVariables = null; - - /** - * LocalContextPass. - * - * @var LocalContextPass|null - */ protected ?LocalContextPass $localContext = null; /** * Static Type Inference Pass. - * - * @var StaticTypeInference|null */ protected ?StaticTypeInference $typeInference = null; /** * Call Gatherer Pass. - * - * @var CallGathererPass|null */ protected ?CallGathererPass $callGathererPass = null; - /** - * ClassMethod constructor. - * - * @param ClassDefinition $classDefinition - * @param array $visibility - * @param string $name - * @param ClassMethodParameters|null $parameters - * @param StatementsBlock|null $statements - * @param string|null $docblock - * @param array|null $returnType - * @param array|null $expression - * @param array|null $staticVariables - */ public function __construct( - ClassDefinition $classDefinition, - array $visibility, - string $name, - ?ClassMethodParameters $parameters = null, - ?StatementsBlock $statements = null, - ?string $docblock = null, + protected ClassDefinition $classDefinition, + protected array $visibility, + protected string $name, + protected ?ClassMethodParameters $parameters = null, + protected ?StatementsBlock $statements = null, + protected ?string $docblock = null, ?array $returnType = null, - ?array $expression = null, - ?array $staticVariables = null + protected ?array $expression = null, + protected array $staticVariables = [] ) { $this->checkVisibility($visibility, $name, $expression); - - $this->classDefinition = $classDefinition; - $this->visibility = $visibility; - $this->name = $name; - $this->parameters = $parameters; - $this->statements = $statements; - $this->docblock = $docblock; - $this->expression = $expression; - $this->staticVariables = $staticVariables; - $this->setReturnTypes($returnType); } @@ -348,8 +252,6 @@ public function hasReturnTypesRaw(): bool /** * Getter for statements block. - * - * @return StatementsBlock $statements Statements block */ public function getStatementsBlock(): StatementsBlock { @@ -358,8 +260,6 @@ public function getStatementsBlock(): StatementsBlock /** * Setter for statements block. - * - * @param StatementsBlock $statementsBlock */ public function setStatementsBlock(StatementsBlock $statementsBlock): void { @@ -368,8 +268,6 @@ public function setStatementsBlock(StatementsBlock $statementsBlock): void /** * Checks whether the method is empty. - * - * @return bool */ public function isEmpty(): bool { @@ -379,10 +277,6 @@ public function isEmpty(): bool /** * Checks for visibility congruence. * - * @param array $visibility - * @param string $name - * @param array $original - * * @throws CompilerException */ public function checkVisibility(array $visibility, string $name, array $original = null): void @@ -432,8 +326,6 @@ public function checkVisibility(array $visibility, string $name, array $original /** * Sets if the method is internal or not. - * - * @param bool $static */ public function setIsStatic(bool $static): void { @@ -442,8 +334,6 @@ public function setIsStatic(bool $static): void /** * Sets if the method is bundled or not. - * - * @param bool $bundled */ public function setIsBundled(bool $bundled): void { @@ -452,8 +342,6 @@ public function setIsBundled(bool $bundled): void /** * Sets if the method is an initializer or not. - * - * @param bool $initializer */ public function setIsInitializer(bool $initializer): void { @@ -462,8 +350,6 @@ public function setIsInitializer(bool $initializer): void /** * Returns the class definition where the method was declared. - * - * @return ClassDefinition|null */ public function getClassDefinition(): ?ClassDefinition { @@ -473,10 +359,6 @@ public function getClassDefinition(): ?ClassDefinition /** * Generate internal method's based on the equivalent PHP methods, * allowing bypassing php userspace for internal method calls. - * - * @param CompilationContext $compilationContext - * - * @return $this */ public function setupOptimized(CompilationContext $compilationContext): self { @@ -543,8 +425,6 @@ public function getOptimizedMethod(): self /** * Sets the method name. - * - * @param string $name */ public function setName(string $name): void { @@ -553,8 +433,6 @@ public function setName(string $name): void /** * Returns the method name. - * - * @return string */ public function getName(): string { @@ -571,8 +449,6 @@ public function getDocBlock(): ?string /** * Returns the parsed docblock. - * - * @return Docblock|null */ public function getParsedDocBlock(): ?Docblock { @@ -592,8 +468,6 @@ public function getParsedDocBlock(): ?Docblock /** * the starting line of the method in the source file. - * - * @return mixed */ public function getLine(): mixed { @@ -602,8 +476,6 @@ public function getLine(): mixed /** * Returns the parameters. - * - * @return ClassMethodParameters|null */ public function getParameters(): ?ClassMethodParameters { @@ -612,8 +484,6 @@ public function getParameters(): ?ClassMethodParameters /** * Checks if the method has return-type or cast hints. - * - * @return bool */ public function hasReturnTypes(): bool { @@ -622,8 +492,6 @@ public function hasReturnTypes(): bool /** * Checks whether at least one return type hint is null compatible. - * - * @return bool */ public function areReturnTypesNullCompatible(): bool { @@ -632,8 +500,6 @@ public function areReturnTypesNullCompatible(): bool /** * Checks whether at least one return type hint is integer compatible. - * - * @return bool */ public function areReturnTypesIntCompatible(): bool { @@ -650,8 +516,6 @@ public function areReturnTypesIntCompatible(): bool /** * Checks whether at least one return type hint is double compatible. - * - * @return bool */ public function areReturnTypesDoubleCompatible(): bool { @@ -660,8 +524,6 @@ public function areReturnTypesDoubleCompatible(): bool /** * Checks whether at least one return type hint is bool compatible. - * - * @return bool */ public function areReturnTypesBoolCompatible(): bool { @@ -670,8 +532,6 @@ public function areReturnTypesBoolCompatible(): bool /** * Checks whether at least one return type hint is false compatible. - * - * @return bool */ public function areReturnTypesFalseCompatible(): bool { @@ -680,8 +540,6 @@ public function areReturnTypesFalseCompatible(): bool /** * Checks whether at least one return type hint is string compatible. - * - * @return bool */ public function areReturnTypesStringCompatible(): bool { @@ -695,8 +553,6 @@ public function areReturnTypesObjectCompatible(): bool /** * Returned type hints by the method. - * - * @return array */ public function getReturnTypes(): array { @@ -705,8 +561,6 @@ public function getReturnTypes(): array /** * Returned class-type hints by the method. - * - * @return array */ public function getReturnClassTypes(): array { @@ -715,8 +569,6 @@ public function getReturnClassTypes(): array /** * Returns the number of parameters the method has. - * - * @return bool */ public function hasParameters(): bool { @@ -725,8 +577,6 @@ public function hasParameters(): bool /** * Returns the number of parameters the method has. - * - * @return int */ public function getNumberOfParameters(): int { @@ -739,8 +589,6 @@ public function getNumberOfParameters(): int /** * Returns the number of required parameters the method has. - * - * @return int */ public function getNumberOfRequiredParameters(): int { @@ -760,10 +608,6 @@ public function getNumberOfRequiredParameters(): int /** * Checks whether the method has a specific modifier. - * - * @param string $modifier - * - * @return bool */ public function hasModifier(string $modifier): bool { @@ -772,8 +616,6 @@ public function hasModifier(string $modifier): bool /** * Returns method visibility modifiers. - * - * @return array */ public function getVisibility(): array { @@ -789,8 +631,6 @@ public function isDeprecated(): bool * Returns the C-modifier flags. * * @throws Exception - * - * @return string */ public function getModifiers(): string { @@ -846,8 +686,6 @@ public function getModifiers(): string /** * Checks if the method must not return any value. - * - * @return bool */ public function isVoid(): bool { @@ -856,8 +694,6 @@ public function isVoid(): bool /** * Checks if the methods return type is `mixed`. - * - * @return bool */ public function isMixed(): bool { @@ -866,8 +702,6 @@ public function isMixed(): bool /** * Checks if the method is private. - * - * @return bool */ public function isPrivate(): bool { @@ -876,8 +710,6 @@ public function isPrivate(): bool /** * Checks if the method is protected. - * - * @return bool */ public function isProtected(): bool { @@ -886,8 +718,6 @@ public function isProtected(): bool /** * Checks if the method is public. - * - * @return bool */ public function isPublic(): bool { @@ -896,8 +726,6 @@ public function isPublic(): bool /** * Checks is abstract method? - * - * @return bool */ public function isAbstract(): bool { @@ -906,8 +734,6 @@ public function isAbstract(): bool /** * Checks whether the method is static. - * - * @return bool */ public function isStatic(): bool { @@ -916,8 +742,6 @@ public function isStatic(): bool /** * Checks whether the method is final. - * - * @return bool */ public function isFinal(): bool { @@ -926,8 +750,6 @@ public function isFinal(): bool /** * Checks whether the method is internal. - * - * @return bool */ public function isInternal(): bool { @@ -936,8 +758,6 @@ public function isInternal(): bool /** * Checks whether the method is bundled. - * - * @return bool */ public function isBundled(): bool { @@ -946,8 +766,6 @@ public function isBundled(): bool /** * Checks whether the method is an initializer. - * - * @return bool */ public function isInitializer(): bool { @@ -956,8 +774,6 @@ public function isInitializer(): bool /** * Check whether the current method is a constructor. - * - * @return bool */ public function isConstructor(): bool { @@ -966,17 +782,12 @@ public function isConstructor(): bool /** * Checks if method is a shortcut. - * - * @return bool */ public function isShortcut(): bool { return $this->expression && 'shortcut' === $this->expression['type']; } - /** - * @return array|string[] - */ public function getMayBeArgTypes(): array { return $this->mayBeArgTypes; @@ -984,18 +795,14 @@ public function getMayBeArgTypes(): array /** * Return shortcut method name. - * - * @return mixed */ - public function getShortcutName() + public function getShortcutName(): mixed { return $this->expression['name']; } /** * Returns the call gatherer pass information. - * - * @return CallGathererPass */ public function getCallGathererPass(): CallGathererPass { @@ -1004,11 +811,6 @@ public function getCallGathererPass(): CallGathererPass /** * Replace macros. - * - * @param SymbolTable $symbolTable - * @param string $containerCode - * - * @return string */ public function removeMemoryStackReferences(SymbolTable $symbolTable, string $containerCode): string { @@ -1036,20 +838,15 @@ public function removeMemoryStackReferences(SymbolTable $symbolTable, string $co $containerCode = str_replace('RETURN_MM_EMPTY_ARRAY', 'RETURN_EMPTY_ARRAY', $containerCode); $containerCode = str_replace('RETURN_MM_MEMBER', 'RETURN_MEMBER', $containerCode); $containerCode = str_replace('RETURN_MM()', 'return', $containerCode); - $containerCode = preg_replace('/[ \t]+ZEPHIR_MM_RESTORE\(\);'.PHP_EOL.'/s', '', $containerCode); - return $containerCode; + return preg_replace('/[ \t]+ZEPHIR_MM_RESTORE\(\);'.PHP_EOL.'/s', '', $containerCode); } /** * Assigns a default value. * - * @param array $parameter - * @param CompilationContext $compilationContext - * - * @return string - * * @throws Exception + * @throws ReflectionException */ public function assignDefaultValue(array $parameter, CompilationContext $compilationContext): string { @@ -1268,7 +1065,7 @@ public function assignDefaultValue(array $parameter, CompilationContext $compila case 'empty-array': case 'array': $compilationContext->backend->initVar($paramVariable, $compilationContext); - $compilationContext->backend->initArray($paramVariable, $compilationContext, null); + $compilationContext->backend->initArray($paramVariable, $compilationContext); break; default: @@ -1358,7 +1155,7 @@ public function assignDefaultValue(array $parameter, CompilationContext $compila $compilationContext->symbolTable->mustGrownStack(true); $compilationContext->headersManager->add('kernel/memory'); $compilationContext->backend->initVar($symbolVariable, $compilationContext); - $compilationContext->backend->initArray($symbolVariable, $compilationContext, null); + $compilationContext->backend->initArray($symbolVariable, $compilationContext); break; default: @@ -1380,12 +1177,7 @@ public function assignDefaultValue(array $parameter, CompilationContext $compila * * TODO: rewrite this to build ifs and throw from builders * - * @param array $parameter - * @param CompilationContext $compilationContext - * * @throws CompilerException - * - * @return string */ public function checkStrictType(array $parameter, CompilationContext $compilationContext): string { @@ -1408,12 +1200,7 @@ public function checkStrictType(array $parameter, CompilationContext $compilatio /** * Assigns a zval value to a static low-level type. * - * @param array $parameter - * @param CompilationContext $compilationContext - * * @throws CompilerException - * - * @return string */ public function assignZvalValue(array $parameter, CompilationContext $compilationContext): string { @@ -1463,8 +1250,6 @@ public function assignZvalValue(array $parameter, CompilationContext $compilatio /** * Pre-compiles the method making compilation pass data (static inference, local-context-pass) available to other methods. * - * @param CompilationContext $compilationContext - * * @throws CompilerException */ public function preCompile(CompilationContext $compilationContext): void @@ -1473,7 +1258,7 @@ public function preCompile(CompilationContext $compilationContext): void $typeInference = null; $callGathererPass = null; - if (\is_object($this->statements)) { + if (is_object($this->statements)) { $compilationContext->currentMethod = $this; /** @@ -1516,9 +1301,8 @@ public function preCompile(CompilationContext $compilationContext): void /** * Compiles the method. * - * @param CompilationContext $compilationContext - * * @throws Exception + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -1555,16 +1339,14 @@ public function compile(CompilationContext $compilationContext): void $symbolTable->setLocalContext($this->localContext); } - if ($this->staticVariables !== null) { - foreach ($this->staticVariables as $var) { - $localVar = clone $var; - $localVar->setIsExternal(true); - $localVar->setLocalOnly(true); - $localVar->setDynamicTypes($localVar->getType()); - $localVar->setType('variable'); - $localVar->setIsDoublePointer(false); - $symbolTable->addRawVariable($localVar); - } + foreach ($this->staticVariables as $var) { + $localVar = clone $var; + $localVar->setIsExternal(true); + $localVar->setLocalOnly(true); + $localVar->setDynamicTypes($localVar->getType()); + $localVar->setType('variable'); + $localVar->setIsDoublePointer(false); + $symbolTable->addRawVariable($localVar); } /** @@ -1610,7 +1392,6 @@ public function compile(CompilationContext $compilationContext): void /** * Round 1. Create variables in parameters in the symbol table. */ - $classCastChecks = []; $substituteVars = []; foreach ($this->parameters->getParameters() as $parameter) { $symbolParam = null; @@ -1656,12 +1437,12 @@ public function compile(CompilationContext $compilationContext): void */ if (!empty($parameter['const'])) { $symbol->setReadOnly(true); - if (\is_object($symbolParam)) { + if (is_object($symbolParam)) { $symbolParam->setReadOnly(true); } } - if (\is_object($symbolParam)) { + if (is_object($symbolParam)) { /** * Parameters are marked as 'external' */ @@ -1731,7 +1512,7 @@ public function compile(CompilationContext $compilationContext): void /** * Compile the block of statements if any */ - if (\is_object($this->statements)) { + if (is_object($this->statements)) { $compilationContext->staticContext = $this->hasModifier('static'); /** @@ -1770,7 +1551,7 @@ public function compile(CompilationContext $compilationContext): void * variable is modified so as do the proper separation. */ $parametersToSeparate = []; - if (\is_object($this->statements)) { + if (is_object($this->statements)) { if (!$this->localContext instanceof LocalContextPass) { $writeDetector = new WriteDetector(); } @@ -1838,19 +1619,10 @@ public function compile(CompilationContext $compilationContext): void $mandatory = $parameter['mandatory'] ?? 0; $dataType = $this->getParamDataType($parameter); - switch ($dataType) { - case 'object': - case 'callable': - case 'resource': - case 'variable': - case 'mixed': - $name = $parameter['name']; - break; - - default: - $name = $parameter['name'].'_param'; - break; - } + $name = match ($dataType) { + 'object', 'callable', 'resource', 'variable', 'mixed' => $parameter['name'], + default => $parameter['name'] . '_param', + }; /** * Assign the default value according to the variable's type. @@ -1871,7 +1643,7 @@ public function compile(CompilationContext $compilationContext): void $initCode .= "\t\t".'ZEPHIR_SEPARATE_PARAM('.$name.');'.PHP_EOL; } else { if ($mandatory) { - $initCode .= $this->checkStrictType($parameter, $compilationContext, $mandatory); + $initCode .= $this->checkStrictType($parameter, $compilationContext); } else { $initCode .= "\t".$this->assignZvalValue($parameter, $compilationContext); } @@ -1954,16 +1726,11 @@ public function compile(CompilationContext $compilationContext): void * Check if there are unused variables. */ $usedVariables = []; - $classDefinition = $this->getClassDefinition(); - if ($classDefinition) { - $completeName = $classDefinition->getCompleteName(); - } else { - $completeName = '[unknown]'; - } + $completeName = $this->getClassDefinition()?->getCompleteName() ?: '[unknown]'; foreach ($symbolTable->getVariables() as $variable) { if ($variable->getNumberUses() <= 0) { - if (false == $variable->isExternal()) { + if (!$variable->isExternal()) { $compilationContext->logger->warning( 'Variable "'.$variable->getName().'" declared but not used in '.$completeName.'::'.$this->getName(), ['unused-variable', $variable->getOriginal()] @@ -2072,7 +1839,7 @@ public function compile(CompilationContext $compilationContext): void /** * Finalize the method compilation */ - if (\is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { + if (is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { /** * If the last statement is not a 'return' or 'throw' we need to * restore the memory stack if needed. @@ -2119,10 +1886,6 @@ public function compile(CompilationContext $compilationContext): void /** * Simple method to check if one of the paths are returning the right expected type. - * - * @param array $statement - * - * @return bool */ public function hasChildReturnStatementType(array $statement): bool { @@ -2164,9 +1927,6 @@ public function hasChildReturnStatementType(array $statement): bool return false; } - /** - * @return string - */ public function getInternalName(): string { $classDefinition = $this->getClassDefinition(); @@ -2176,10 +1936,6 @@ public function getInternalName(): string /** * Returns arginfo name for current method. - * - * @param ClassDefinition|null $classDefinition - * - * @return string */ public function getArgInfoName(?ClassDefinition $classDefinition = null): string { @@ -2207,13 +1963,11 @@ public function getArgInfoName(?ClassDefinition $classDefinition = null): string * * - TRUE: function foo() -> void; * - TRUE: function foo() -> null; - * - TRUE: function foo() -> bool|string|..; + * - TRUE: function foo() -> bool|string|...; * - TRUE: function foo() -> <\stdClass>; * - FALSE: function foo(); * - FALSE: function foo() -> var; * - FALSE: function foo() -> resource|callable; - * - * @return bool */ public function isReturnTypesHintDetermined(): bool { @@ -2241,7 +1995,7 @@ public function isReturnTypesHintDetermined(): bool $this->areReturnTypesStringCompatible() || $this->areReturnTypesFalseCompatible() || $this->areReturnTypesObjectCompatible() || - \array_key_exists('array', $this->getReturnTypes()) + array_key_exists('array', $this->getReturnTypes()) ) { continue; } @@ -2260,18 +2014,16 @@ public function isReturnTypesHintDetermined(): bool /** * Checks if method's return type is nullable object `?object`. - * - * @return bool */ public function isReturnTypeNullableObject(): bool { - return count($this->returnTypes) === 2 && isset($this->returnTypes['object']) && isset($this->returnTypes['null']); + return count($this->returnTypes) === 2 && + isset($this->returnTypes['object']) && + isset($this->returnTypes['null']); } /** * Checks if method's return type is object `object`. - * - * @return bool */ public function isReturnTypeObject(): bool { @@ -2280,8 +2032,6 @@ public function isReturnTypeObject(): bool /** * Checks if the method have compatible return types. - * - * @return bool */ public function areReturnTypesCompatible(): bool { @@ -2316,11 +2066,6 @@ public function areReturnTypesCompatible(): bool /** * Determine Z_PARAM_* * - * @param array $parameter - * @param CompilationContext $compilationContext - * - * @return string - * * @throws Exception */ public function detectParam(array $parameter, CompilationContext $compilationContext): string @@ -2428,10 +2173,6 @@ public function detectParam(array $parameter, CompilationContext $compilationCon /** * Get data type of method's parameter - * - * @param array $parameter - * - * @return string */ private function getParamDataType(array $parameter): string { From 274b98a0aa201dd3e66ddbda3aa69385880c9a59 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 11:54:01 +0100 Subject: [PATCH 050/375] #2407 - Reformat code with PHP8.0 syntax sugar --- Library/Backend/Backend.php | 6 +- Library/Builder/FunctionCallBuilder.php | 11 --- Library/Builder/StatementsBlockBuilder.php | 2 - Library/Cache/ClassEntryCache.php | 6 -- Library/Cache/FunctionCache.php | 6 -- Library/Cache/MethodCache.php | 10 +-- Library/Cache/SlotsCache.php | 12 --- Library/Cache/StaticMethodCache.php | 12 +-- Library/ClassMethod.php | 16 ++-- Library/Classes/Entry.php | 17 +--- Library/Code/Builder/Struct.php | 7 -- Library/Compiler.php | 14 ++-- Library/Compiler/CompilerFileFactory.php | 6 -- Library/Detectors/WriteDetector.php | 29 ------- Library/Expression/Reference.php | 11 --- Library/Expression/StaticPropertyAccess.php | 9 --- Library/FileSystem/HardDisk.php | 86 +++------------------ Library/FunctionDefinition.php | 25 +----- Library/StaticCall.php | 2 +- 19 files changed, 39 insertions(+), 248 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 74107bb5a5..913314fb8a 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -29,6 +29,7 @@ use Zephir\Variable\Globals; use function in_array; +use function strlen; use function Zephir\add_slashes; class Backend @@ -398,8 +399,9 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va break; case 'char': - if (\strlen($defaultValue) > 4) { - if (\strlen($defaultValue) > 10) { + $defaultValue = (string)$defaultValue; + if (strlen($defaultValue) > 4) { + if (strlen($defaultValue) > 10) { throw new CompilerException("Invalid char literal: '".substr($defaultValue, 0, 10)."...'", $variable->getOriginal()); } else { throw new CompilerException("Invalid char literal: '".$defaultValue."'", $variable->getOriginal()); diff --git a/Library/Builder/FunctionCallBuilder.php b/Library/Builder/FunctionCallBuilder.php index 395c788610..3cad886d9b 100644 --- a/Library/Builder/FunctionCallBuilder.php +++ b/Library/Builder/FunctionCallBuilder.php @@ -18,14 +18,6 @@ */ class FunctionCallBuilder { - /** - * @param string $name - * @param array $parameters - * @param int $type - * @param string|null $file - * @param int $line - * @param int $char - */ public function __construct( protected string $name, protected array $parameters, @@ -36,9 +28,6 @@ public function __construct( ) { } - /** - * @return array - */ public function get(): array { return [ diff --git a/Library/Builder/StatementsBlockBuilder.php b/Library/Builder/StatementsBlockBuilder.php index fac1c5233c..5d155c0bf8 100644 --- a/Library/Builder/StatementsBlockBuilder.php +++ b/Library/Builder/StatementsBlockBuilder.php @@ -24,8 +24,6 @@ public function __construct(protected array $statements, protected bool $raw = f /** * Returns a builder definition. - * - * @return array */ public function get(): array { diff --git a/Library/Cache/ClassEntryCache.php b/Library/Cache/ClassEntryCache.php index b652400c4a..d49dcc4560 100644 --- a/Library/Cache/ClassEntryCache.php +++ b/Library/Cache/ClassEntryCache.php @@ -25,12 +25,6 @@ class ClassEntryCache /** * Retrieves/Creates a class entry cache. - * - * @param string $className - * @param bool $dynamic - * @param CompilationContext $compilationContext - * - * @return Variable */ public function get(string $className, bool $dynamic, CompilationContext $compilationContext): Variable { diff --git a/Library/Cache/FunctionCache.php b/Library/Cache/FunctionCache.php index d8528ce6e0..85f9aa16cf 100644 --- a/Library/Cache/FunctionCache.php +++ b/Library/Cache/FunctionCache.php @@ -43,12 +43,6 @@ public function __construct(protected ?CallGathererPass $gatherer = null) /** * Retrieves/Creates a function cache for a function call. - * - * @param string $functionName - * @param CompilationContext $compilationContext - * @param bool $exists - * - * @return string */ public function get(string $functionName, CompilationContext $compilationContext, bool $exists): string { diff --git a/Library/Cache/MethodCache.php b/Library/Cache/MethodCache.php index 185a505b5e..ea9b471a95 100644 --- a/Library/Cache/MethodCache.php +++ b/Library/Cache/MethodCache.php @@ -48,12 +48,6 @@ public function __construct(protected ?CallGathererPass $gatherer = null) /** * Retrieves/Creates a function cache for a method call. * - * @param CompilationContext $compilationContext - * @param string $methodName - * @param Variable $caller - * - * @return string - * * @throws ReflectionException */ public function get(CompilationContext $compilationContext, string $methodName, Variable $caller): string @@ -62,7 +56,7 @@ public function get(CompilationContext $compilationContext, string $methodName, $numberPoly = 0; - if ('this' == $caller->getRealName()) { + if ('this' === $caller->getRealName()) { $classDefinition = $compilationContext->classDefinition; if ($classDefinition->hasMethod($methodName)) { ++$numberPoly; @@ -141,7 +135,7 @@ public function get(CompilationContext $compilationContext, string $methodName, $cacheable = false; } - if ('this_ptr' != $caller->getName()) { + if ('this_ptr' !== $caller->getName()) { $associatedClass = $caller->getAssociatedClass(); if ($this->isClassCacheable($associatedClass)) { $staticCacheable = true; diff --git a/Library/Cache/SlotsCache.php b/Library/Cache/SlotsCache.php index eb211d71d7..c54d5611be 100644 --- a/Library/Cache/SlotsCache.php +++ b/Library/Cache/SlotsCache.php @@ -55,10 +55,6 @@ public static function getFunctionSlot(string $functionName): int /** * Returns or creates a cache slot for a function. - * - * @param string $functionName - * - * @return int */ public static function getExistingFunctionSlot(string $functionName): int { @@ -67,10 +63,6 @@ public static function getExistingFunctionSlot(string $functionName): int /** * Returns or creates a cache slot for a method. - * - * @param ClassMethod $method - * - * @return int */ public static function getMethodSlot(ClassMethod $method): int { @@ -93,10 +85,6 @@ public static function getMethodSlot(ClassMethod $method): int /** * Returns a cache slot for a method. - * - * @param ClassMethod $method - * - * @return int */ public static function getExistingMethodSlot(ClassMethod $method): int { diff --git a/Library/Cache/StaticMethodCache.php b/Library/Cache/StaticMethodCache.php index bedc9de9fc..faf119048f 100644 --- a/Library/Cache/StaticMethodCache.php +++ b/Library/Cache/StaticMethodCache.php @@ -12,7 +12,6 @@ namespace Zephir\Cache; use ReflectionMethod; -use Zephir\ClassMethod; use Zephir\CompilationContext; /** @@ -36,16 +35,7 @@ class StaticMethodCache { protected array $cache = []; - /** - * MethodCache. - * - * @param CompilationContext $compilationContext - * @param ClassMethod|ReflectionMethod|null $method - * @param bool $allowNtsCache - * - * @return string - */ - public function get(CompilationContext $compilationContext, $method, bool $allowNtsCache = true): string + public function get(CompilationContext $compilationContext, $method): string { if ($method === null) { return 'NULL, 0'; diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 92d3bea737..4ef87cb07d 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -120,17 +120,24 @@ class ClassMethod */ protected ?CallGathererPass $callGathererPass = null; + protected array $staticVariables = []; + + protected ?ClassDefinition $classDefinition = null; + public function __construct( - protected ClassDefinition $classDefinition, + ClassDefinition $classDefinition, protected array $visibility, protected string $name, protected ?ClassMethodParameters $parameters = null, protected ?StatementsBlock $statements = null, protected ?string $docblock = null, ?array $returnType = null, - protected ?array $expression = null, - protected array $staticVariables = [] + protected ?array $expression = [], + array $staticVariables = [], ) { + $this->classDefinition = $classDefinition; + $this->staticVariables = $staticVariables; + $this->checkVisibility($visibility, $name, $expression); $this->setReturnTypes($returnType); } @@ -237,9 +244,6 @@ public function setReturnTypes(?array $returnType = null): void } } - /** - * @return array - */ public function getReturnTypesRaw(): array { return $this->returnTypesRaw; diff --git a/Library/Classes/Entry.php b/Library/Classes/Entry.php index 2bcd1151f0..698df3e8f0 100644 --- a/Library/Classes/Entry.php +++ b/Library/Classes/Entry.php @@ -29,27 +29,19 @@ class Entry * Class name * * As it was passed: partially or fully. - * - * @var string */ private string $classname; - /** - * @var bool - */ private bool $isInternal = false; /** * Loaded via config/class-entries.php - * - * @var array */ private array $classEntries; public function __construct(string $className, private CompilationContext $compilationContext) { $this->classname = $this->compilationContext->getFullName($className); - $this->classEntries = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; foreach ($this->classEntries as $key => $val) { @@ -59,8 +51,6 @@ public function __construct(string $className, private CompilationContext $compi } /** - * @return string - * * @throws Exception */ public function get(): string @@ -129,12 +119,7 @@ public function isInternal(): bool } /** - * Detect if start of namespace class - * belongs to project namespace. - * - * @param string $className - * - * @return bool + * Detect if start of namespace class belongs to project namespace. */ private function isInternalClass(string $className): bool { diff --git a/Library/Code/Builder/Struct.php b/Library/Code/Builder/Struct.php index c411d5e047..b9528f64f2 100644 --- a/Library/Code/Builder/Struct.php +++ b/Library/Code/Builder/Struct.php @@ -29,8 +29,6 @@ class Struct * key value; * } * ``` - * - * @var array */ protected array $properties = []; @@ -157,12 +155,7 @@ public function getInitEntry(string $name, array $global, string $namespace): st /** * Generates the internal c-type according to the php's type. - * - * @param string $type - * * @throws InvalidArgumentException - * - * @return string */ protected function convertToCType(string $type): string { diff --git a/Library/Compiler.php b/Library/Compiler.php index 5ee59e604c..8d3f87d757 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -183,8 +183,6 @@ public function setOptimizersPath(string $optimizersPath): void /** * Resolves path to the internal optimizers. * - * @return string - * * @throws IllegalStateException in case of absence internal optimizers directory */ private function resolveOptimizersPath(): ?string @@ -834,16 +832,16 @@ public function compile(bool $development = false, ?int $jobs = null): void } $currentDir = getcwd(); - if (file_exists("{$currentDir}/compile.log")) { - unlink("{$currentDir}/compile.log"); + if (file_exists("$currentDir/compile.log")) { + unlink("$currentDir/compile.log"); } - if (file_exists("{$currentDir}/compile-errors.log")) { - unlink("{$currentDir}/compile-errors.log"); + if (file_exists("$currentDir/compile-errors.log")) { + unlink("$currentDir/compile-errors.log"); } - if (file_exists("{$currentDir}/ext/modules/{$namespace}.so")) { - unlink("{$currentDir}/ext/modules/{$namespace}.so"); + if (file_exists("$currentDir/ext/modules/{$namespace}.so")) { + unlink("$currentDir/ext/modules/{$namespace}.so"); } if (is_windows()) { diff --git a/Library/Compiler/CompilerFileFactory.php b/Library/Compiler/CompilerFileFactory.php index 6d24349fa0..8dbeb42d60 100644 --- a/Library/Compiler/CompilerFileFactory.php +++ b/Library/Compiler/CompilerFileFactory.php @@ -32,16 +32,10 @@ public function __construct( * Creates CompilerFile instance. * * NOTE: Each instance of CompilerFile must have its own AliasManager instance. - * - * @param string $className - * @param string $filePath - * - * @return FileInterface */ public function create(string $className, string $filePath): FileInterface { $compiler = new CompilerFile($this->config, new AliasManager(), $this->filesystem); - $compiler->setClassName($className); $compiler->setFilePath($filePath); $compiler->setLogger($this->logger); diff --git a/Library/Detectors/WriteDetector.php b/Library/Detectors/WriteDetector.php index f2de68ba01..3f18987d03 100644 --- a/Library/Detectors/WriteDetector.php +++ b/Library/Detectors/WriteDetector.php @@ -38,11 +38,6 @@ class WriteDetector /** * Do the detection pass on a single variable. - * - * @param string $variable - * @param array $statements - * - * @return bool */ public function detect(string $variable, array $statements): bool { @@ -53,8 +48,6 @@ public function detect(string $variable, array $statements): bool /** * Sets detection flags. - * - * @param int $flags */ public function setDetectionFlags(int $flags): void { @@ -63,10 +56,6 @@ public function setDetectionFlags(int $flags): void /** * Increase the number of mutations a variable has inside a statement block. - * - * @param string $variable - * - * @return WriteDetector */ public function increaseMutations(string $variable): self { @@ -81,10 +70,6 @@ public function increaseMutations(string $variable): self /** * Returns the number of assignment instructions that mutated a variable. - * - * @param string $variable - * - * @return int */ public function getNumberOfMutations(string $variable): int { @@ -93,8 +78,6 @@ public function getNumberOfMutations(string $variable): int /** * Pass let statements. - * - * @param array $statement */ public function passLetStatement(array $statement): void { @@ -116,8 +99,6 @@ public function passLetStatement(array $statement): void /** * Pass call expressions. - * - * @param array $expression */ public function passCall(array $expression): void { @@ -135,8 +116,6 @@ public function passCall(array $expression): void /** * Pass array expressions. - * - * @param array $expression */ public function passArray(array $expression): void { @@ -152,8 +131,6 @@ public function passArray(array $expression): void /** * Pass "new" expressions. - * - * @param array $expression */ public function passNew(array $expression): void { @@ -171,8 +148,6 @@ public function passNew(array $expression): void /** * Pass "declare" statement. - * - * @param array $statement */ public function declareVariables(array $statement): void { @@ -195,8 +170,6 @@ public function declareVariables(array $statement): void /** * Pass expressions. - * - * @param array $expression */ public function passExpression(array $expression): void { @@ -299,8 +272,6 @@ public function passExpression(array $expression): void /** * Pass statement block. - * - * @param array $statements */ public function passStatementBlock(array $statements): void { diff --git a/Library/Expression/Reference.php b/Library/Expression/Reference.php index 55803254e4..28bd4b122c 100644 --- a/Library/Expression/Reference.php +++ b/Library/Expression/Reference.php @@ -30,22 +30,16 @@ class Reference { /** * Expecting the value - * - * @var bool */ protected bool $expecting = true; /** * Result of the evaluated expression is read only or not - * - * @var bool */ protected bool $readOnly = false; /** * Expecting variable - * - * @var Variable|null */ protected ?Variable $expectingVariable = null; @@ -83,11 +77,6 @@ public function setReadOnly(bool $readOnly): void /** * Compiles a reference to a value. * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression - * * @throws Exception * @throws ReflectionException */ diff --git a/Library/Expression/StaticPropertyAccess.php b/Library/Expression/StaticPropertyAccess.php index 80347e9428..50a95d28e5 100644 --- a/Library/Expression/StaticPropertyAccess.php +++ b/Library/Expression/StaticPropertyAccess.php @@ -37,9 +37,6 @@ class StaticPropertyAccess /** * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable */ public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { @@ -49,8 +46,6 @@ public function setExpectReturn(bool $expecting, Variable $expectingVariable = n /** * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly */ public function setReadOnly(bool $readOnly): void { @@ -60,10 +55,6 @@ public function setReadOnly(bool $readOnly): void /** * Access a static property. * - * @param array $expression - * @param CompilationContext $compilationContext - * - * @return CompiledExpression * @throws ReflectionException * @throws Exception */ diff --git a/Library/FileSystem/HardDisk.php b/Library/FileSystem/HardDisk.php index b046773222..c9f3c04e9f 100644 --- a/Library/FileSystem/HardDisk.php +++ b/Library/FileSystem/HardDisk.php @@ -29,13 +29,8 @@ */ class HardDisk implements FileSystemInterface { - /** @var string */ - private string $localPath; - /** * Initialize checker - * - * @var bool */ private bool $initialized = false; @@ -43,20 +38,13 @@ class HardDisk implements FileSystemInterface * Root or base path * * Path to where all cached files and folders are collected. - * - * @var string */ private string $basePath; /** - * HardDisk constructor. - * - * @param string $basePath - * @param string $localPath - * * @throws InvalidArgumentException */ - public function __construct(string $basePath, string $localPath = Zephir::VERSION) + public function __construct(string $basePath, private string $localPath = Zephir::VERSION) { $this->basePath = $this->rightTrimPath($basePath); $this->localPath = $this->rightTrimPath($localPath); @@ -66,19 +54,11 @@ public function __construct(string $basePath, string $localPath = Zephir::VERSIO } } - /** - * @param string $path - * - * @return string - */ private function rightTrimPath(string $path): string { return rtrim($path, '\\/'); } - /** - * @return bool - */ public function isInitialized(): bool { return $this->initialized; @@ -86,19 +66,12 @@ public function isInitialized(): bool /** * Start File System - * - * @throws RuntimeException */ - public function initialize() + public function initialize(): void { $this->initialized = true; } - /** - * @param string $path - * - * @return bool - */ public function exists(string $path): bool { if ('.' === $path || empty($path)) { @@ -110,11 +83,6 @@ public function exists(string $path): bool return is_file($this->basePath.DIRECTORY_SEPARATOR.$path); } - /** - * @param string $path - * - * @return bool - */ public function makeDirectory(string $path): bool { if ('.' === $path || empty($path)) { @@ -136,11 +104,6 @@ public function makeDirectory(string $path): bool return is_dir($path); } - /** - * @param string $path - * - * @return array - */ public function file(string $path): array { $contents = file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); @@ -148,49 +111,27 @@ public function file(string $path): array return preg_split("/\r\n|\n|\r/", $contents); } - /** - * @param string $path - * - * @return int - */ public function modificationTime(string $path): int { return filemtime($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); } - /** - * @param string $path - * - * @return string - */ public function read(string $path): string { return file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); } - /** - * @param string $path - */ - public function delete(string $path) + public function delete(string $path): void { unlink($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}"); } - /** - * @param string $path - * @param string $data - */ - public function write(string $path, string $data) + public function write(string $path, string $data): void { file_put_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}", $data); } - /** - * @param string $command - * @param string $descriptor - * @param string $destination - */ - public function system(string $command, string $descriptor, string $destination) + public function system(string $command, string $descriptor, string $destination): void { // fallback $redirect = "{$this->localPath}/{$destination}"; @@ -209,12 +150,7 @@ public function system(string $command, string $descriptor, string $destination) } } - /** - * @param string $path - * - * @return mixed - */ - public function requireFile(string $path) + public function requireFile(string $path): mixed { if (!empty($this->basePath)) { return require "{$this->basePath}/{$this->localPath}/{$path}"; @@ -234,7 +170,10 @@ public function clean(): void return; } - $contents = $this->listDirectoryRecursively($this->basePath.DIRECTORY_SEPARATOR.$this->localPath, RecursiveIteratorIterator::CHILD_FIRST); + $contents = $this->listDirectoryRecursively( + $this->basePath.DIRECTORY_SEPARATOR.$this->localPath, + RecursiveIteratorIterator::CHILD_FIRST, + ); /** @var SplFileInfo $file */ foreach ($contents as $file) { @@ -287,11 +226,6 @@ public function getHashFile(string $algorithm, string $sourceFile, bool $useCach return file_get_contents($cacheFile); } - /** - * @param string $path - * - * @return string - */ public function normalizePath(string $path): string { return str_replace(['\\', ':', '/'], '_', $path); diff --git a/Library/FunctionDefinition.php b/Library/FunctionDefinition.php index 814222700e..cea01ef91b 100644 --- a/Library/FunctionDefinition.php +++ b/Library/FunctionDefinition.php @@ -20,34 +20,17 @@ class FunctionDefinition extends ClassMethod { /** * Whether the function is declared in a global or namespaced scope. - * - * @var bool */ private bool $isGlobal = false; - /** - * FunctionDefinition constructor. - * - * @param string $namespace The namespace of the function. - * @param string $name - * @param ClassMethodParameters|null $parameters - * @param StatementsBlock|null $statements - * @param array|null $returnType - * @param array|null $expression - */ public function __construct( private string $namespace, - string $name, - ClassMethodParameters $parameters = null, - StatementsBlock $statements = null, + protected string $name, + protected ?ClassMethodParameters $parameters = null, + protected ?StatementsBlock $statements = null, array $returnType = null, - array $expression = null + protected array $expression = [], ) { - $this->name = $name; - $this->parameters = $parameters; - $this->statements = $statements; - $this->expression = $expression; - $this->setReturnTypes($returnType); } diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 1fda946469..5649508a2f 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -288,7 +288,7 @@ protected function call( * Check if the method call can have an inline cache. */ $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); - $cachePointer = $methodCache->get($compilationContext, $method ?? null, false); + $cachePointer = $methodCache->get($compilationContext, $method ?? null); $params = []; if (isset($expression['parameters']) && count($expression['parameters'])) { From 3e0da01714d3fa485f1be4ec2542787d8c3d4ea2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 11:57:30 +0100 Subject: [PATCH 051/375] #2407 - Adjust type definition --- Library/FunctionDefinition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/FunctionDefinition.php b/Library/FunctionDefinition.php index cea01ef91b..125c5b5491 100644 --- a/Library/FunctionDefinition.php +++ b/Library/FunctionDefinition.php @@ -29,7 +29,7 @@ public function __construct( protected ?ClassMethodParameters $parameters = null, protected ?StatementsBlock $statements = null, array $returnType = null, - protected array $expression = [], + protected ?array $expression = [], ) { $this->setReturnTypes($returnType); } From 4104c0050192b5407f9727f653bca9c77d847772 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 12:57:12 +0100 Subject: [PATCH 052/375] #2407 - Rename namespace to `Zephir\Class\Entry` Since PHP8.0 it is possible to define namespace with `class` name --- Library/{Classes => Class}/Entry.php | 2 +- Library/ClassDefinition.php | 2 +- Library/ClassMethod.php | 2 +- Library/Operators/Other/InstanceOfOperator.php | 2 +- Library/Operators/Other/NewInstanceOperator.php | 2 +- Library/Statements/ThrowStatement.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename Library/{Classes => Class}/Entry.php (99%) diff --git a/Library/Classes/Entry.php b/Library/Class/Entry.php similarity index 99% rename from Library/Classes/Entry.php rename to Library/Class/Entry.php index 698df3e8f0..0ebbf33c1f 100644 --- a/Library/Classes/Entry.php +++ b/Library/Class/Entry.php @@ -11,7 +11,7 @@ declare(strict_types=1); -namespace Zephir\Classes; +namespace Zephir\Class; use ReflectionClass; use Zephir\ClassDefinition; diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 09521adbdf..52a37eeab0 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -15,7 +15,7 @@ use ReflectionClass; use ReflectionException; -use Zephir\Classes\Entry; +use Zephir\Class\Entry; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 4ef87cb07d..982e94810c 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -14,7 +14,7 @@ namespace Zephir; use ReflectionException; -use Zephir\Classes\Entry as ClassEntry; +use Zephir\Class\Entry as ClassEntry; use Zephir\Detectors\WriteDetector; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; diff --git a/Library/Operators/Other/InstanceOfOperator.php b/Library/Operators/Other/InstanceOfOperator.php index c124e1357e..f309ad2035 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/Library/Operators/Other/InstanceOfOperator.php @@ -14,7 +14,7 @@ namespace Zephir\Operators\Other; use ReflectionException; -use Zephir\Classes\Entry; +use Zephir\Class\Entry; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; diff --git a/Library/Operators/Other/NewInstanceOperator.php b/Library/Operators/Other/NewInstanceOperator.php index f459fbab66..b4f1f37bbd 100644 --- a/Library/Operators/Other/NewInstanceOperator.php +++ b/Library/Operators/Other/NewInstanceOperator.php @@ -15,7 +15,7 @@ use ReflectionClass; use ReflectionException; -use Zephir\Classes\Entry; +use Zephir\Class\Entry; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; diff --git a/Library/Statements/ThrowStatement.php b/Library/Statements/ThrowStatement.php index 06bca5ad52..1217c28519 100644 --- a/Library/Statements/ThrowStatement.php +++ b/Library/Statements/ThrowStatement.php @@ -14,7 +14,7 @@ namespace Zephir\Statements; use ReflectionException; -use Zephir\Classes\Entry; +use Zephir\Class\Entry; use Zephir\CodePrinter; use Zephir\CompilationContext; use Zephir\Compiler; From 2cce3aa92f39786f42b0f8830143bdce5844bbef Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 16:32:08 +0100 Subject: [PATCH 053/375] #2407 - Move `ClassConstant` class inside `Class/` directory --- Library/{ => Class}/ClassConstant.php | 4 +++- Library/ClassDefinition.php | 1 + Library/CompilerFile.php | 2 +- Library/Expression/StaticConstantAccess.php | 3 +-- Library/Stubs/Generator.php | 3 +-- tests/Zephir/Stubs/GeneratorTest.php | 3 +-- 6 files changed, 8 insertions(+), 8 deletions(-) rename Library/{ => Class}/ClassConstant.php (97%) diff --git a/Library/ClassConstant.php b/Library/Class/ClassConstant.php similarity index 97% rename from Library/ClassConstant.php rename to Library/Class/ClassConstant.php index 92576fbb9a..6245155b6d 100644 --- a/Library/ClassConstant.php +++ b/Library/Class/ClassConstant.php @@ -11,9 +11,11 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class; use ReflectionException; +use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Expression\Constants; use Zephir\Expression\StaticConstantAccess; diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 52a37eeab0..e9c29e32e9 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -15,6 +15,7 @@ use ReflectionClass; use ReflectionException; +use Zephir\Class\ClassConstant; use Zephir\Class\Entry; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 80afb793d1..365d4a6d0a 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -16,13 +16,13 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use ReflectionException; +use Zephir\Class\ClassConstant; use Zephir\Compiler\FileInterface; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; use Zephir\Exception\IllegalStateException; use Zephir\Exception\ParseException; use Zephir\FileSystem\FileSystemInterface; - use function is_array; /** diff --git a/Library/Expression/StaticConstantAccess.php b/Library/Expression/StaticConstantAccess.php index 7d8b4c078e..600ba37fb9 100644 --- a/Library/Expression/StaticConstantAccess.php +++ b/Library/Expression/StaticConstantAccess.php @@ -14,13 +14,12 @@ namespace Zephir\Expression; use ReflectionException; -use Zephir\ClassConstant; +use Zephir\Class\ClassConstant; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Variable; - use function gettype; use function in_array; diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index 5e0ab0fe47..1fb76d1d24 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -14,14 +14,13 @@ namespace Zephir\Stubs; use Zephir\AliasManager; -use Zephir\ClassConstant; +use Zephir\Class\ClassConstant; use Zephir\ClassDefinition; use Zephir\ClassMethod; use Zephir\ClassMethodParameters; use Zephir\ClassProperty; use Zephir\CompilerFile; use Zephir\Exception; - use function array_key_exists; use function in_array; diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index e8e6326b02..c757f69562 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -16,13 +16,12 @@ use PHPUnit\Framework\TestCase; use ReflectionException; use Zephir\AliasManager; -use Zephir\ClassConstant; +use Zephir\Class\ClassConstant; use Zephir\ClassDefinition; use Zephir\ClassMethod; use Zephir\ClassMethodParameters; use Zephir\ClassProperty; use Zephir\Stubs\Generator; - use function Zephir\is_windows; class GeneratorTest extends TestCase From 6b10b15866e50eb760770e9f73cb31acf107a29c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 16:37:05 +0100 Subject: [PATCH 054/375] #2407 - Move `ClassDefinition` class inside `Class/` directory --- Library/Backend/Backend.php | 3 +-- Library/Cache/MethodCache.php | 2 +- Library/{ => Class}/ClassDefinition.php | 19 ++++++++++++++----- Library/Class/Entry.php | 3 --- Library/ClassMethod.php | 1 + Library/ClassProperty.php | 2 +- Library/CompilationContext.php | 2 +- Library/Compiler.php | 1 + Library/Compiler/FileInterface.php | 2 +- Library/CompilerFile.php | 1 + Library/CompilerFileAnonymous.php | 2 +- Library/Documentation.php | 1 + Library/Documentation/File/ClassFile.php | 2 +- Library/Documentation/File/ClassesFile.php | 2 +- Library/Documentation/File/SourceFile.php | 2 +- Library/Documentation/Template.php | 2 +- Library/Expression/Closure.php | 3 +-- Library/Expression/ClosureArrow.php | 2 +- Library/StaticCall.php | 2 +- Library/Stubs/Generator.php | 2 +- Library/Variable.php | 2 +- .../zephir/partials/class/content.phtml | 6 +++--- .../Api/themes/zephir/partials/source.phtml | 10 +++++----- tests/Zephir/Stubs/GeneratorTest.php | 2 +- tests/Zephir/Stubs/MethodDocBlockTest.php | 2 +- tests/Zephir/TypesTest.php | 2 +- tests/Zephir/VariableTest.php | 2 +- 27 files changed, 45 insertions(+), 37 deletions(-) rename Library/{ => Class}/ClassDefinition.php (99%) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 913314fb8a..0e542099f4 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -13,7 +13,7 @@ namespace Zephir\Backend; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\ClassMethod; use Zephir\CodePrinter; use Zephir\CompilationContext; @@ -27,7 +27,6 @@ use Zephir\GlobalConstant; use Zephir\Variable; use Zephir\Variable\Globals; - use function in_array; use function strlen; use function Zephir\add_slashes; diff --git a/Library/Cache/MethodCache.php b/Library/Cache/MethodCache.php index ea9b471a95..677b06d4e3 100644 --- a/Library/Cache/MethodCache.php +++ b/Library/Cache/MethodCache.php @@ -15,7 +15,7 @@ use ReflectionClass; use ReflectionException; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\CompilationContext; use Zephir\Passes\CallGathererPass; use Zephir\Variable; diff --git a/Library/ClassDefinition.php b/Library/Class/ClassDefinition.php similarity index 99% rename from Library/ClassDefinition.php rename to Library/Class/ClassDefinition.php index e9c29e32e9..f69ed82769 100644 --- a/Library/ClassDefinition.php +++ b/Library/Class/ClassDefinition.php @@ -11,24 +11,33 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class; use ReflectionClass; use ReflectionException; -use Zephir\Class\ClassConstant; -use Zephir\Class\Entry; +use Zephir\AbstractClassDefinition; +use Zephir\AliasManager; +use Zephir\ArgInfoDefinition; +use Zephir\ClassDefinitionRuntime; +use Zephir\ClassMethod; +use Zephir\ClassMethodParameters; +use Zephir\ClassProperty; +use Zephir\CodePrinter; +use Zephir\CompilationContext; +use Zephir\Compiler; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Exception\InvalidArgumentException; +use Zephir\HeadersManager; +use Zephir\StatementsBlock; use function count; use function gettype; use function is_array; use const DIRECTORY_SEPARATOR; /** - * Class Definition - * * Represents a class/interface and their properties and methods. */ final class ClassDefinition extends AbstractClassDefinition diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index 0ebbf33c1f..2aa9280ddc 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -14,7 +14,6 @@ namespace Zephir\Class; use ReflectionClass; -use Zephir\ClassDefinition; use Zephir\CompilationContext; use Zephir\Exception; @@ -26,8 +25,6 @@ class Entry public const NAMESPACE_SEPARATOR = '\\'; /** - * Class name - * * As it was passed: partially or fully. */ private string $classname; diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 982e94810c..aa415d6e54 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -14,6 +14,7 @@ namespace Zephir; use ReflectionException; +use Zephir\Class\ClassDefinition; use Zephir\Class\Entry as ClassEntry; use Zephir\Detectors\WriteDetector; use Zephir\Documentation\Docblock; diff --git a/Library/ClassProperty.php b/Library/ClassProperty.php index 84f7c87dbe..d0a4888a5e 100644 --- a/Library/ClassProperty.php +++ b/Library/ClassProperty.php @@ -12,11 +12,11 @@ namespace Zephir; use ReflectionException; +use Zephir\Class\ClassDefinition; use Zephir\Exception\CompilerException; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\BinaryOperator; use Zephir\Expression\Builder\Statements\LetStatement as ExpressionLetStatement; - use function in_array; use function is_array; diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 78edd195f8..e24b5eea0b 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -16,9 +16,9 @@ use Psr\Log\LoggerInterface; use Zephir\Backend\Backend; use Zephir\Cache\FunctionCache; +use Zephir\Class\ClassDefinition; use Zephir\Exception\CompilerException; use Zephir\Passes\StaticTypeInference; - use function in_array; /** diff --git a/Library/Compiler.php b/Library/Compiler.php index 8d3f87d757..f673caffb9 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -21,6 +21,7 @@ use ReflectionException; use Zephir\Backend\Backend; use Zephir\Backend\StringsManager; +use Zephir\Class\ClassDefinition; use Zephir\Code\Builder\Struct; use Zephir\Compiler\CompilerFileFactory; use Zephir\Compiler\FileInterface; diff --git a/Library/Compiler/FileInterface.php b/Library/Compiler/FileInterface.php index 588e2d19e7..5dd0a61a5a 100644 --- a/Library/Compiler/FileInterface.php +++ b/Library/Compiler/FileInterface.php @@ -11,7 +11,7 @@ namespace Zephir\Compiler; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\Compiler; /** diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 365d4a6d0a..3fa8b1214f 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -17,6 +17,7 @@ use Psr\Log\NullLogger; use ReflectionException; use Zephir\Class\ClassConstant; +use Zephir\Class\ClassDefinition; use Zephir\Compiler\FileInterface; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; diff --git a/Library/CompilerFileAnonymous.php b/Library/CompilerFileAnonymous.php index 81c51b7ed1..1a763d2335 100644 --- a/Library/CompilerFileAnonymous.php +++ b/Library/CompilerFileAnonymous.php @@ -16,8 +16,8 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use ReflectionException; +use Zephir\Class\ClassDefinition; use Zephir\Compiler\FileInterface; - use function count; /** diff --git a/Library/Documentation.php b/Library/Documentation.php index 9d604421db..8a2639feb1 100644 --- a/Library/Documentation.php +++ b/Library/Documentation.php @@ -13,6 +13,7 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; +use Zephir\Class\ClassDefinition; use Zephir\Documentation\File; use Zephir\Documentation\NamespaceAccessor; use Zephir\Documentation\Theme; diff --git a/Library/Documentation/File/ClassFile.php b/Library/Documentation/File/ClassFile.php index 8ec64417d4..260339e2ef 100644 --- a/Library/Documentation/File/ClassFile.php +++ b/Library/Documentation/File/ClassFile.php @@ -11,7 +11,7 @@ namespace Zephir\Documentation\File; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\CompilerFile; use Zephir\Documentation; use Zephir\Documentation\FileInterface; diff --git a/Library/Documentation/File/ClassesFile.php b/Library/Documentation/File/ClassesFile.php index 56ec601f94..cc89dceb52 100644 --- a/Library/Documentation/File/ClassesFile.php +++ b/Library/Documentation/File/ClassesFile.php @@ -11,7 +11,7 @@ namespace Zephir\Documentation\File; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\Documentation\FileInterface; class ClassesFile implements FileInterface diff --git a/Library/Documentation/File/SourceFile.php b/Library/Documentation/File/SourceFile.php index 069ff8c23e..5b252e255f 100644 --- a/Library/Documentation/File/SourceFile.php +++ b/Library/Documentation/File/SourceFile.php @@ -11,7 +11,7 @@ namespace Zephir\Documentation\File; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\Documentation; class SourceFile extends ClassFile diff --git a/Library/Documentation/Template.php b/Library/Documentation/Template.php index fb8ca61fe0..d2ba1a73e3 100644 --- a/Library/Documentation/Template.php +++ b/Library/Documentation/Template.php @@ -11,7 +11,7 @@ namespace Zephir\Documentation; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\CompilerFile; use Zephir\Config; use Zephir\Documentation; diff --git a/Library/Expression/Closure.php b/Library/Expression/Closure.php index 3925339689..fd06114317 100644 --- a/Library/Expression/Closure.php +++ b/Library/Expression/Closure.php @@ -13,7 +13,7 @@ namespace Zephir\Expression; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\ClassMethod; use Zephir\ClassMethodParameters; use Zephir\ClassProperty; @@ -23,7 +23,6 @@ use Zephir\Exception; use Zephir\StatementsBlock; use Zephir\Variable; - use function is_array; /** diff --git a/Library/Expression/ClosureArrow.php b/Library/Expression/ClosureArrow.php index 6c8688c481..b78459a865 100644 --- a/Library/Expression/ClosureArrow.php +++ b/Library/Expression/ClosureArrow.php @@ -13,7 +13,7 @@ namespace Zephir\Expression; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\ClassMethod; use Zephir\ClassMethodParameters; use Zephir\CompilationContext; diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 5649508a2f..aa05503773 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -12,9 +12,9 @@ namespace Zephir; use ReflectionException; +use Zephir\Class\ClassDefinition; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; - use function count; use function in_array; use function is_string; diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index 1fb76d1d24..b53efc279d 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -15,7 +15,7 @@ use Zephir\AliasManager; use Zephir\Class\ClassConstant; -use Zephir\ClassDefinition; +use Zephir\Class\ClassDefinition; use Zephir\ClassMethod; use Zephir\ClassMethodParameters; use Zephir\ClassProperty; diff --git a/Library/Variable.php b/Library/Variable.php index a581d86ed1..2a523afef7 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -14,9 +14,9 @@ namespace Zephir; use ReflectionClass; +use Zephir\Class\ClassDefinition; use Zephir\Exception\CompilerException; use Zephir\Variable\Globals; - use function in_array; use function is_string; diff --git a/templates/Api/themes/zephir/partials/class/content.phtml b/templates/Api/themes/zephir/partials/class/content.phtml index 2dde01a6fd..c5444d4f35 100644 --- a/templates/Api/themes/zephir/partials/class/content.phtml +++ b/templates/Api/themes/zephir/partials/class/content.phtml @@ -4,7 +4,7 @@ * @var string $className * @var array $methods * @var string[] $namespacePieces - * @var Zephir\ClassDefinition $classDefinition + * @var \Zephir\Class\ClassDefinition $classDefinition * @var Zephir\CompilerFile $compilerFile */ @@ -27,10 +27,10 @@ $items = [ - +
Class - + $nspath) { ?> diff --git a/templates/Api/themes/zephir/partials/source.phtml b/templates/Api/themes/zephir/partials/source.phtml index 8010ac6686..7b153f5b59 100644 --- a/templates/Api/themes/zephir/partials/source.phtml +++ b/templates/Api/themes/zephir/partials/source.phtml @@ -3,7 +3,7 @@ * @var string $fullName * @var string $className * @var array $namespacePieces - * @var Zephir\ClassDefinition $classDefinition + * @var \Zephir\Class\ClassDefinition $classDefinition * @var Zephir\CompilerFile $compilerFile */ @@ -17,7 +17,7 @@ $items = [ partial('partials/breadcrumb.phtml', ['items'=> $items]) ?>
- +
Class @@ -28,10 +28,10 @@ $items = [
- +
Class - + $nspath): ?> @@ -40,7 +40,7 @@ $items = [

- +
diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php
index c757f69562..58dcec1995 100644
--- a/tests/Zephir/Stubs/GeneratorTest.php
+++ b/tests/Zephir/Stubs/GeneratorTest.php
@@ -17,7 +17,7 @@
 use ReflectionException;
 use Zephir\AliasManager;
 use Zephir\Class\ClassConstant;
-use Zephir\ClassDefinition;
+use Zephir\Class\ClassDefinition;
 use Zephir\ClassMethod;
 use Zephir\ClassMethodParameters;
 use Zephir\ClassProperty;
diff --git a/tests/Zephir/Stubs/MethodDocBlockTest.php b/tests/Zephir/Stubs/MethodDocBlockTest.php
index 8ae56cb46f..0cc94ff988 100644
--- a/tests/Zephir/Stubs/MethodDocBlockTest.php
+++ b/tests/Zephir/Stubs/MethodDocBlockTest.php
@@ -15,7 +15,7 @@
 
 use PHPUnit\Framework\TestCase;
 use Zephir\AliasManager;
-use Zephir\ClassDefinition;
+use Zephir\Class\ClassDefinition;
 use Zephir\ClassMethod;
 use Zephir\ClassMethodParameters;
 use Zephir\StatementsBlock;
diff --git a/tests/Zephir/TypesTest.php b/tests/Zephir/TypesTest.php
index a2bccd38d1..9867815e57 100644
--- a/tests/Zephir/TypesTest.php
+++ b/tests/Zephir/TypesTest.php
@@ -14,7 +14,7 @@
 namespace Zephir\Test;
 
 use PHPUnit\Framework\TestCase;
-use Zephir\ClassDefinition;
+use Zephir\Class\ClassDefinition;
 use Zephir\ClassMethod;
 use Zephir\Types;
 
diff --git a/tests/Zephir/VariableTest.php b/tests/Zephir/VariableTest.php
index 58cff493e6..409efafe81 100644
--- a/tests/Zephir/VariableTest.php
+++ b/tests/Zephir/VariableTest.php
@@ -16,7 +16,7 @@
 use PHPUnit\Framework\TestCase;
 use Zephir\Branch;
 use Zephir\BranchManager;
-use Zephir\ClassDefinition;
+use Zephir\Class\ClassDefinition;
 use Zephir\CompilationContext;
 use Zephir\CompiledExpression;
 use Zephir\Exception\CompilerException;

From 29c9ab2bbcdfa44554ad869b69314ff5a387b4bc Mon Sep 17 00:00:00 2001
From: Anton Vasiliev <1695147@gmail.com>
Date: Sun, 10 Sep 2023 16:37:36 +0100
Subject: [PATCH 055/375] #2407 - Move `ClassDefinitionRuntime` class inside
 `Class/` directory

---
 Library/Class/ClassDefinition.php              | 1 -
 Library/{ => Class}/ClassDefinitionRuntime.php | 4 +++-
 Library/CompilerFile.php                       | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)
 rename Library/{ => Class}/ClassDefinitionRuntime.php (88%)

diff --git a/Library/Class/ClassDefinition.php b/Library/Class/ClassDefinition.php
index f69ed82769..963c34de66 100644
--- a/Library/Class/ClassDefinition.php
+++ b/Library/Class/ClassDefinition.php
@@ -18,7 +18,6 @@
 use Zephir\AbstractClassDefinition;
 use Zephir\AliasManager;
 use Zephir\ArgInfoDefinition;
-use Zephir\ClassDefinitionRuntime;
 use Zephir\ClassMethod;
 use Zephir\ClassMethodParameters;
 use Zephir\ClassProperty;
diff --git a/Library/ClassDefinitionRuntime.php b/Library/Class/ClassDefinitionRuntime.php
similarity index 88%
rename from Library/ClassDefinitionRuntime.php
rename to Library/Class/ClassDefinitionRuntime.php
index c2679ad3ff..dbd1e26833 100644
--- a/Library/ClassDefinitionRuntime.php
+++ b/Library/Class/ClassDefinitionRuntime.php
@@ -11,7 +11,9 @@
 
 declare(strict_types=1);
 
-namespace Zephir;
+namespace Zephir\Class;
+
+use Zephir\AbstractClassDefinition;
 
 /**
  * Represents a class/interface that only exists in runtime.
diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php
index 3fa8b1214f..ba8975354c 100644
--- a/Library/CompilerFile.php
+++ b/Library/CompilerFile.php
@@ -18,6 +18,7 @@
 use ReflectionException;
 use Zephir\Class\ClassConstant;
 use Zephir\Class\ClassDefinition;
+use Zephir\Class\ClassDefinitionRuntime;
 use Zephir\Compiler\FileInterface;
 use Zephir\Documentation\DocblockParser;
 use Zephir\Exception\CompilerException;

From 7ceffe79b9564b0fe2deb4919fcc830644a41cc0 Mon Sep 17 00:00:00 2001
From: Anton Vasiliev <1695147@gmail.com>
Date: Sun, 10 Sep 2023 16:39:27 +0100
Subject: [PATCH 056/375] #2407 - Move `ClassMethod` class inside `Class/`
 directory

---
 Library/ArgInfoDefinition.php                    |  1 +
 Library/Backend/Backend.php                      |  2 +-
 Library/Cache/SlotsCache.php                     |  2 +-
 Library/Class/ClassDefinition.php                |  1 -
 Library/{ => Class}/ClassMethod.php              | 16 +++++++++++++---
 Library/CompilationContext.php                   |  1 +
 Library/CompilerFile.php                         |  1 +
 Library/Expression/Closure.php                   |  2 +-
 Library/Expression/ClosureArrow.php              |  2 +-
 Library/FunctionDefinition.php                   |  2 ++
 Library/MethodCall.php                           |  1 +
 Library/StaticCall.php                           |  1 +
 Library/Stubs/Generator.php                      |  2 +-
 Library/Stubs/MethodDocBlock.php                 |  2 +-
 Library/Types.php                                |  2 ++
 .../zephir/partials/class/method-details.phtml   |  2 +-
 .../partials/class/method-summary-params.phtml   |  2 +-
 .../zephir/partials/class/method-summary.phtml   |  2 +-
 .../partials/namespace/method-details.phtml      |  4 ++--
 .../namespace/method-summary-params.phtml        |  2 +-
 .../partials/namespace/method-summary.phtml      |  2 +-
 tests/Zephir/Stubs/GeneratorTest.php             |  2 +-
 tests/Zephir/Stubs/MethodDocBlockTest.php        |  2 +-
 tests/Zephir/TypesTest.php                       |  2 +-
 24 files changed, 38 insertions(+), 20 deletions(-)
 rename Library/{ => Class}/ClassMethod.php (99%)

diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php
index 6454d0e674..2d327dc32d 100644
--- a/Library/ArgInfoDefinition.php
+++ b/Library/ArgInfoDefinition.php
@@ -13,6 +13,7 @@
 
 namespace Zephir;
 
+use Zephir\Class\ClassMethod;
 use function array_key_exists;
 use function count;
 
diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php
index 0e542099f4..8886d6b699 100644
--- a/Library/Backend/Backend.php
+++ b/Library/Backend/Backend.php
@@ -14,7 +14,7 @@
 namespace Zephir\Backend;
 
 use Zephir\Class\ClassDefinition;
-use Zephir\ClassMethod;
+use Zephir\Class\ClassMethod;
 use Zephir\CodePrinter;
 use Zephir\CompilationContext;
 use Zephir\CompiledExpression;
diff --git a/Library/Cache/SlotsCache.php b/Library/Cache/SlotsCache.php
index c54d5611be..96ef578dbb 100644
--- a/Library/Cache/SlotsCache.php
+++ b/Library/Cache/SlotsCache.php
@@ -13,7 +13,7 @@
 
 namespace Zephir\Cache;
 
-use Zephir\ClassMethod;
+use Zephir\Class\ClassMethod;
 
 /**
  * In order to reduce memory allocation when calling functions and method_exists
diff --git a/Library/Class/ClassDefinition.php b/Library/Class/ClassDefinition.php
index 963c34de66..704e20ef39 100644
--- a/Library/Class/ClassDefinition.php
+++ b/Library/Class/ClassDefinition.php
@@ -18,7 +18,6 @@
 use Zephir\AbstractClassDefinition;
 use Zephir\AliasManager;
 use Zephir\ArgInfoDefinition;
-use Zephir\ClassMethod;
 use Zephir\ClassMethodParameters;
 use Zephir\ClassProperty;
 use Zephir\CodePrinter;
diff --git a/Library/ClassMethod.php b/Library/Class/ClassMethod.php
similarity index 99%
rename from Library/ClassMethod.php
rename to Library/Class/ClassMethod.php
index aa415d6e54..9ebf45573b 100644
--- a/Library/ClassMethod.php
+++ b/Library/Class/ClassMethod.php
@@ -11,24 +11,34 @@
 
 declare(strict_types=1);
 
-namespace Zephir;
+namespace Zephir\Class;
 
 use ReflectionException;
-use Zephir\Class\ClassDefinition;
+use Zephir\Branch;
+use Zephir\BranchManager;
+use Zephir\CacheManager;
 use Zephir\Class\Entry as ClassEntry;
+use Zephir\ClassMethodParameters;
+use Zephir\CodePrinter;
+use Zephir\CompilationContext;
 use Zephir\Detectors\WriteDetector;
 use Zephir\Documentation\Docblock;
 use Zephir\Documentation\DocblockParser;
+use Zephir\Exception;
 use Zephir\Exception\CompilerException;
+use Zephir\Expression;
 use Zephir\Passes\CallGathererPass;
 use Zephir\Passes\LocalContextPass;
 use Zephir\Passes\StaticTypeInference;
-
+use Zephir\StatementsBlock;
+use Zephir\SymbolTable;
+use Zephir\Variable;
 use function array_key_exists;
 use function count;
 use function in_array;
 use function is_array;
 use function is_object;
+use function Zephir\add_slashes;
 
 /**
  * Represents a class method
diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php
index e24b5eea0b..5d51b83089 100644
--- a/Library/CompilationContext.php
+++ b/Library/CompilationContext.php
@@ -17,6 +17,7 @@
 use Zephir\Backend\Backend;
 use Zephir\Cache\FunctionCache;
 use Zephir\Class\ClassDefinition;
+use Zephir\Class\ClassMethod;
 use Zephir\Exception\CompilerException;
 use Zephir\Passes\StaticTypeInference;
 use function in_array;
diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php
index ba8975354c..9773e7103f 100644
--- a/Library/CompilerFile.php
+++ b/Library/CompilerFile.php
@@ -19,6 +19,7 @@
 use Zephir\Class\ClassConstant;
 use Zephir\Class\ClassDefinition;
 use Zephir\Class\ClassDefinitionRuntime;
+use Zephir\Class\ClassMethod;
 use Zephir\Compiler\FileInterface;
 use Zephir\Documentation\DocblockParser;
 use Zephir\Exception\CompilerException;
diff --git a/Library/Expression/Closure.php b/Library/Expression/Closure.php
index fd06114317..60a68d0cc1 100644
--- a/Library/Expression/Closure.php
+++ b/Library/Expression/Closure.php
@@ -14,7 +14,7 @@
 namespace Zephir\Expression;
 
 use Zephir\Class\ClassDefinition;
-use Zephir\ClassMethod;
+use Zephir\Class\ClassMethod;
 use Zephir\ClassMethodParameters;
 use Zephir\ClassProperty;
 use Zephir\CompilationContext;
diff --git a/Library/Expression/ClosureArrow.php b/Library/Expression/ClosureArrow.php
index b78459a865..3e4a5d0b95 100644
--- a/Library/Expression/ClosureArrow.php
+++ b/Library/Expression/ClosureArrow.php
@@ -14,7 +14,7 @@
 namespace Zephir\Expression;
 
 use Zephir\Class\ClassDefinition;
-use Zephir\ClassMethod;
+use Zephir\Class\ClassMethod;
 use Zephir\ClassMethodParameters;
 use Zephir\CompilationContext;
 use Zephir\CompiledExpression;
diff --git a/Library/FunctionDefinition.php b/Library/FunctionDefinition.php
index 125c5b5491..2eaf8095f3 100644
--- a/Library/FunctionDefinition.php
+++ b/Library/FunctionDefinition.php
@@ -13,6 +13,8 @@
 
 namespace Zephir;
 
+use Zephir\Class\ClassMethod;
+
 /**
  * Represents a function
  */
diff --git a/Library/MethodCall.php b/Library/MethodCall.php
index a1c905e940..3bc46588f0 100644
--- a/Library/MethodCall.php
+++ b/Library/MethodCall.php
@@ -12,6 +12,7 @@
 namespace Zephir;
 
 use ReflectionException;
+use Zephir\Class\ClassMethod;
 use Zephir\Detectors\ReadDetector;
 use Zephir\Exception\CompilerException;
 
diff --git a/Library/StaticCall.php b/Library/StaticCall.php
index aa05503773..94b97e94b3 100644
--- a/Library/StaticCall.php
+++ b/Library/StaticCall.php
@@ -13,6 +13,7 @@
 
 use ReflectionException;
 use Zephir\Class\ClassDefinition;
+use Zephir\Class\ClassMethod;
 use Zephir\Detectors\ReadDetector;
 use Zephir\Exception\CompilerException;
 use function count;
diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php
index b53efc279d..a4128dad81 100644
--- a/Library/Stubs/Generator.php
+++ b/Library/Stubs/Generator.php
@@ -16,7 +16,7 @@
 use Zephir\AliasManager;
 use Zephir\Class\ClassConstant;
 use Zephir\Class\ClassDefinition;
-use Zephir\ClassMethod;
+use Zephir\Class\ClassMethod;
 use Zephir\ClassMethodParameters;
 use Zephir\ClassProperty;
 use Zephir\CompilerFile;
diff --git a/Library/Stubs/MethodDocBlock.php b/Library/Stubs/MethodDocBlock.php
index 86a5e48cbb..134c2fb807 100644
--- a/Library/Stubs/MethodDocBlock.php
+++ b/Library/Stubs/MethodDocBlock.php
@@ -14,7 +14,7 @@
 namespace Zephir\Stubs;
 
 use Zephir\AliasManager;
-use Zephir\ClassMethod;
+use Zephir\Class\ClassMethod;
 use Zephir\Types;
 
 /**
diff --git a/Library/Types.php b/Library/Types.php
index ffb1eff3f7..4055038f1a 100644
--- a/Library/Types.php
+++ b/Library/Types.php
@@ -11,6 +11,8 @@
 
 namespace Zephir;
 
+use Zephir\Class\ClassMethod;
+
 final class Types
 {
     const T_INT = 'int';
diff --git a/templates/Api/themes/zephir/partials/class/method-details.phtml b/templates/Api/themes/zephir/partials/class/method-details.phtml
index 578291f48e..3d6d7bc3cc 100644
--- a/templates/Api/themes/zephir/partials/class/method-details.phtml
+++ b/templates/Api/themes/zephir/partials/class/method-details.phtml
@@ -1,6 +1,6 @@
 
 
diff --git a/templates/Api/themes/zephir/partials/class/method-summary-params.phtml b/templates/Api/themes/zephir/partials/class/method-summary-params.phtml
index f4f36fbf68..d83da6dcdd 100644
--- a/templates/Api/themes/zephir/partials/class/method-summary-params.phtml
+++ b/templates/Api/themes/zephir/partials/class/method-summary-params.phtml
@@ -1,6 +1,6 @@
 getParameters()) {
diff --git a/templates/Api/themes/zephir/partials/class/method-summary.phtml b/templates/Api/themes/zephir/partials/class/method-summary.phtml
index d41a9a47f3..861bc2c392 100644
--- a/templates/Api/themes/zephir/partials/class/method-summary.phtml
+++ b/templates/Api/themes/zephir/partials/class/method-summary.phtml
@@ -1,7 +1,7 @@
 
 
@@ -16,7 +16,7 @@
                 isFinal() ? 'final' : '' ?>
                 getVisibility()) ?>
                 function getName() ?>(partial('partials/class/method-summary-params.phtml' ) ?>)
-                
+
                 
getDocBlock() ?>
diff --git a/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml b/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml index 78be6b6c80..f3349c4763 100644 --- a/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml +++ b/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml @@ -1,6 +1,6 @@ getParameters()){ $i=0; diff --git a/templates/Api/themes/zephir/partials/namespace/method-summary.phtml b/templates/Api/themes/zephir/partials/namespace/method-summary.phtml index 4196e7ae29..5be7c39029 100644 --- a/templates/Api/themes/zephir/partials/namespace/method-summary.phtml +++ b/templates/Api/themes/zephir/partials/namespace/method-summary.phtml @@ -1,6 +1,6 @@ diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index 58dcec1995..eb8a7d97e7 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -18,7 +18,7 @@ use Zephir\AliasManager; use Zephir\Class\ClassConstant; use Zephir\Class\ClassDefinition; -use Zephir\ClassMethod; +use Zephir\Class\ClassMethod; use Zephir\ClassMethodParameters; use Zephir\ClassProperty; use Zephir\Stubs\Generator; diff --git a/tests/Zephir/Stubs/MethodDocBlockTest.php b/tests/Zephir/Stubs/MethodDocBlockTest.php index 0cc94ff988..c2b20b203a 100644 --- a/tests/Zephir/Stubs/MethodDocBlockTest.php +++ b/tests/Zephir/Stubs/MethodDocBlockTest.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\TestCase; use Zephir\AliasManager; use Zephir\Class\ClassDefinition; -use Zephir\ClassMethod; +use Zephir\Class\ClassMethod; use Zephir\ClassMethodParameters; use Zephir\StatementsBlock; use Zephir\Stubs\MethodDocBlock; diff --git a/tests/Zephir/TypesTest.php b/tests/Zephir/TypesTest.php index 9867815e57..b60f1412eb 100644 --- a/tests/Zephir/TypesTest.php +++ b/tests/Zephir/TypesTest.php @@ -15,7 +15,7 @@ use PHPUnit\Framework\TestCase; use Zephir\Class\ClassDefinition; -use Zephir\ClassMethod; +use Zephir\Class\ClassMethod; use Zephir\Types; final class TypesTest extends TestCase From 4b0d2831cc0d2a36cad7d09bf112153423b3ceb2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 16:43:47 +0100 Subject: [PATCH 057/375] #2407 - Move `ClassMethodParameters` class inside `Class/` directory --- Library/{ => Class}/ClassMethodParameters.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename Library/{ => Class}/ClassMethodParameters.php (99%) diff --git a/Library/ClassMethodParameters.php b/Library/Class/ClassMethodParameters.php similarity index 99% rename from Library/ClassMethodParameters.php rename to Library/Class/ClassMethodParameters.php index da36d86acb..9c822ee315 100644 --- a/Library/ClassMethodParameters.php +++ b/Library/Class/ClassMethodParameters.php @@ -11,13 +11,12 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class; use ArrayAccess; use Countable; use Iterator; use Zephir\Exception\CompilerException; - use function count; /** From e36ad0cf92abf2858e68fb91a94e06a7420ab18b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 16:43:53 +0100 Subject: [PATCH 058/375] #2407 - Move `ClassMethodParameters` class inside `Class/` directory --- Library/ArgInfoDefinition.php | 1 + Library/Class/ClassDefinition.php | 1 - Library/Class/ClassMethod.php | 1 - Library/CompilerFile.php | 1 + Library/Expression/Closure.php | 2 +- Library/Expression/ClosureArrow.php | 2 +- Library/FunctionDefinition.php | 1 + Library/Stubs/Generator.php | 2 +- tests/Zephir/Stubs/GeneratorTest.php | 2 +- tests/Zephir/Stubs/MethodDocBlockTest.php | 2 +- 10 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 2d327dc32d..1a2dd2f563 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -14,6 +14,7 @@ namespace Zephir; use Zephir\Class\ClassMethod; +use Zephir\Class\ClassMethodParameters; use function array_key_exists; use function count; diff --git a/Library/Class/ClassDefinition.php b/Library/Class/ClassDefinition.php index 704e20ef39..7287c2983b 100644 --- a/Library/Class/ClassDefinition.php +++ b/Library/Class/ClassDefinition.php @@ -18,7 +18,6 @@ use Zephir\AbstractClassDefinition; use Zephir\AliasManager; use Zephir\ArgInfoDefinition; -use Zephir\ClassMethodParameters; use Zephir\ClassProperty; use Zephir\CodePrinter; use Zephir\CompilationContext; diff --git a/Library/Class/ClassMethod.php b/Library/Class/ClassMethod.php index 9ebf45573b..55f2f1f3b8 100644 --- a/Library/Class/ClassMethod.php +++ b/Library/Class/ClassMethod.php @@ -18,7 +18,6 @@ use Zephir\BranchManager; use Zephir\CacheManager; use Zephir\Class\Entry as ClassEntry; -use Zephir\ClassMethodParameters; use Zephir\CodePrinter; use Zephir\CompilationContext; use Zephir\Detectors\WriteDetector; diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 9773e7103f..17da857d34 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -20,6 +20,7 @@ use Zephir\Class\ClassDefinition; use Zephir\Class\ClassDefinitionRuntime; use Zephir\Class\ClassMethod; +use Zephir\Class\ClassMethodParameters; use Zephir\Compiler\FileInterface; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; diff --git a/Library/Expression/Closure.php b/Library/Expression/Closure.php index 60a68d0cc1..ce742e78e1 100644 --- a/Library/Expression/Closure.php +++ b/Library/Expression/Closure.php @@ -15,7 +15,7 @@ use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; -use Zephir\ClassMethodParameters; +use Zephir\Class\ClassMethodParameters; use Zephir\ClassProperty; use Zephir\CompilationContext; use Zephir\CompiledExpression; diff --git a/Library/Expression/ClosureArrow.php b/Library/Expression/ClosureArrow.php index 3e4a5d0b95..7b264dbb5e 100644 --- a/Library/Expression/ClosureArrow.php +++ b/Library/Expression/ClosureArrow.php @@ -15,7 +15,7 @@ use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; -use Zephir\ClassMethodParameters; +use Zephir\Class\ClassMethodParameters; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; diff --git a/Library/FunctionDefinition.php b/Library/FunctionDefinition.php index 2eaf8095f3..0199866348 100644 --- a/Library/FunctionDefinition.php +++ b/Library/FunctionDefinition.php @@ -14,6 +14,7 @@ namespace Zephir; use Zephir\Class\ClassMethod; +use Zephir\Class\ClassMethodParameters; /** * Represents a function diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index a4128dad81..3a25e55fb5 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -17,7 +17,7 @@ use Zephir\Class\ClassConstant; use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; -use Zephir\ClassMethodParameters; +use Zephir\Class\ClassMethodParameters; use Zephir\ClassProperty; use Zephir\CompilerFile; use Zephir\Exception; diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index eb8a7d97e7..0bb9f7fb17 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -19,7 +19,7 @@ use Zephir\Class\ClassConstant; use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; -use Zephir\ClassMethodParameters; +use Zephir\Class\ClassMethodParameters; use Zephir\ClassProperty; use Zephir\Stubs\Generator; use function Zephir\is_windows; diff --git a/tests/Zephir/Stubs/MethodDocBlockTest.php b/tests/Zephir/Stubs/MethodDocBlockTest.php index c2b20b203a..0b9a704344 100644 --- a/tests/Zephir/Stubs/MethodDocBlockTest.php +++ b/tests/Zephir/Stubs/MethodDocBlockTest.php @@ -17,7 +17,7 @@ use Zephir\AliasManager; use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; -use Zephir\ClassMethodParameters; +use Zephir\Class\ClassMethodParameters; use Zephir\StatementsBlock; use Zephir\Stubs\MethodDocBlock; From ba1c3204a3aa5f7d145be433d01ce8dac70362a8 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 16:56:30 +0100 Subject: [PATCH 059/375] #2407 - Move `ClassProperty` class inside `Class/` directory --- Library/Class/ClassDefinition.php | 1 - Library/{ => Class}/ClassProperty.php | 10 ++++++++-- Library/CompilerFile.php | 1 + Library/Expression/Closure.php | 2 +- Library/Expression/StaticPropertyAccess.php | 3 +-- Library/Statements/Let/StaticPropertyAppend.php | 2 +- Library/Statements/Let/StaticPropertyArrayIndex.php | 2 +- .../Statements/Let/StaticPropertyArrayIndexAppend.php | 2 +- Library/Stubs/Generator.php | 2 +- tests/Zephir/Stubs/GeneratorTest.php | 2 +- 10 files changed, 16 insertions(+), 11 deletions(-) rename Library/{ => Class}/ClassProperty.php (98%) diff --git a/Library/Class/ClassDefinition.php b/Library/Class/ClassDefinition.php index 7287c2983b..777edf5dc4 100644 --- a/Library/Class/ClassDefinition.php +++ b/Library/Class/ClassDefinition.php @@ -18,7 +18,6 @@ use Zephir\AbstractClassDefinition; use Zephir\AliasManager; use Zephir\ArgInfoDefinition; -use Zephir\ClassProperty; use Zephir\CodePrinter; use Zephir\CompilationContext; use Zephir\Compiler; diff --git a/Library/ClassProperty.php b/Library/Class/ClassProperty.php similarity index 98% rename from Library/ClassProperty.php rename to Library/Class/ClassProperty.php index d0a4888a5e..7c2e1a608b 100644 --- a/Library/ClassProperty.php +++ b/Library/Class/ClassProperty.php @@ -9,14 +9,20 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir; +declare(strict_types=1); + +namespace Zephir\Class; use ReflectionException; -use Zephir\Class\ClassDefinition; +use Zephir\CompilationContext; +use Zephir\Exception; use Zephir\Exception\CompilerException; +use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\BinaryOperator; use Zephir\Expression\Builder\Statements\LetStatement as ExpressionLetStatement; +use Zephir\StatementsBlock; +use Zephir\Types; use function in_array; use function is_array; diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 17da857d34..2566e024b1 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -21,6 +21,7 @@ use Zephir\Class\ClassDefinitionRuntime; use Zephir\Class\ClassMethod; use Zephir\Class\ClassMethodParameters; +use Zephir\Class\ClassProperty; use Zephir\Compiler\FileInterface; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; diff --git a/Library/Expression/Closure.php b/Library/Expression/Closure.php index ce742e78e1..65057c9a88 100644 --- a/Library/Expression/Closure.php +++ b/Library/Expression/Closure.php @@ -16,7 +16,7 @@ use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; use Zephir\Class\ClassMethodParameters; -use Zephir\ClassProperty; +use Zephir\Class\ClassProperty; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; diff --git a/Library/Expression/StaticPropertyAccess.php b/Library/Expression/StaticPropertyAccess.php index 50a95d28e5..096c07b0ca 100644 --- a/Library/Expression/StaticPropertyAccess.php +++ b/Library/Expression/StaticPropertyAccess.php @@ -14,13 +14,12 @@ namespace Zephir\Expression; use ReflectionException; -use Zephir\ClassProperty; +use Zephir\Class\ClassProperty; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Variable; - use function in_array; /** diff --git a/Library/Statements/Let/StaticPropertyAppend.php b/Library/Statements/Let/StaticPropertyAppend.php index 8303d5057e..b56620e940 100644 --- a/Library/Statements/Let/StaticPropertyAppend.php +++ b/Library/Statements/Let/StaticPropertyAppend.php @@ -11,7 +11,7 @@ namespace Zephir\Statements\Let; -use Zephir\ClassProperty; +use Zephir\Class\ClassProperty; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; diff --git a/Library/Statements/Let/StaticPropertyArrayIndex.php b/Library/Statements/Let/StaticPropertyArrayIndex.php index 688524cd17..510c71b434 100644 --- a/Library/Statements/Let/StaticPropertyArrayIndex.php +++ b/Library/Statements/Let/StaticPropertyArrayIndex.php @@ -11,7 +11,7 @@ namespace Zephir\Statements\Let; -use Zephir\ClassProperty; +use Zephir\Class\ClassProperty; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; diff --git a/Library/Statements/Let/StaticPropertyArrayIndexAppend.php b/Library/Statements/Let/StaticPropertyArrayIndexAppend.php index 14e76feaec..fa34b28584 100644 --- a/Library/Statements/Let/StaticPropertyArrayIndexAppend.php +++ b/Library/Statements/Let/StaticPropertyArrayIndexAppend.php @@ -11,7 +11,7 @@ namespace Zephir\Statements\Let; -use Zephir\ClassProperty; +use Zephir\Class\ClassProperty; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index 3a25e55fb5..2037ce75dc 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -18,7 +18,7 @@ use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; use Zephir\Class\ClassMethodParameters; -use Zephir\ClassProperty; +use Zephir\Class\ClassProperty; use Zephir\CompilerFile; use Zephir\Exception; use function array_key_exists; diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index 0bb9f7fb17..11618e2a3d 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -20,7 +20,7 @@ use Zephir\Class\ClassDefinition; use Zephir\Class\ClassMethod; use Zephir\Class\ClassMethodParameters; -use Zephir\ClassProperty; +use Zephir\Class\ClassProperty; use Zephir\Stubs\Generator; use function Zephir\is_windows; From 2f563e5a4c0752fcc42b181677f813c0311fef43 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 17:31:43 +0100 Subject: [PATCH 060/375] #2407 - Remove `is_macos()` function --- Library/functions.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Library/functions.php b/Library/functions.php index 98c997c68e..dbb29bf847 100644 --- a/Library/functions.php +++ b/Library/functions.php @@ -182,16 +182,6 @@ function is_windows() return 0 === stripos(PHP_OS, 'WIN'); } -/** - * Checks if currently running under macOs. - * - * @return bool - */ -function is_macos() -{ - return 0 === stripos(PHP_OS, 'DARWIN'); -} - /** * Checks if current PHP is thread safe. * From c0c740db55232c1b21a721dcab20775ee75defd4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 17:36:07 +0100 Subject: [PATCH 061/375] #2407 - Move Class related logic inside `Class/` directory --- Library/ArgInfoDefinition.php | 20 +- Library/Backend/Backend.php | 16 +- Library/Cache/MethodCache.php | 6 +- Library/Cache/SlotsCache.php | 6 +- .../Class/{ClassConstant.php => Constant.php} | 48 +-- .../Definition/AbstractDefinition.php} | 11 +- .../Definition.php} | 290 +++--------------- .../DefinitionRuntime.php} | 6 +- Library/Class/Entry.php | 3 +- .../{ClassMethod.php => Method/Method.php} | 43 +-- .../Parameters.php} | 52 +--- .../Class/{ClassProperty.php => Property.php} | 58 +--- Library/CompilationContext.php | 13 +- Library/Compiler.php | 18 +- Library/Compiler/FileInterface.php | 4 +- Library/CompilerFile.php | 56 ++-- Library/CompilerFileAnonymous.php | 12 +- Library/Documentation.php | 6 +- Library/Documentation/File/ClassFile.php | 4 +- Library/Documentation/File/ClassesFile.php | 4 +- Library/Documentation/File/SourceFile.php | 4 +- Library/Documentation/Template.php | 4 +- Library/Expression/Closure.php | 16 +- Library/Expression/ClosureArrow.php | 12 +- Library/Expression/StaticConstantAccess.php | 4 +- Library/Expression/StaticPropertyAccess.php | 4 +- Library/FunctionDefinition.php | 16 +- Library/MethodCall.php | 8 +- .../Statements/Let/StaticPropertyAppend.php | 4 +- .../Let/StaticPropertyArrayIndex.php | 4 +- .../Let/StaticPropertyArrayIndexAppend.php | 4 +- Library/StaticCall.php | 24 +- Library/Stubs/Generator.php | 32 +- Library/Stubs/MethodDocBlock.php | 16 +- Library/Types.php | 6 +- Library/Variable.php | 10 +- .../zephir/partials/class/content.phtml | 2 +- .../partials/class/method-details.phtml | 2 +- .../class/method-summary-params.phtml | 2 +- .../partials/class/method-summary.phtml | 2 +- .../partials/namespace/method-details.phtml | 2 +- .../namespace/method-summary-params.phtml | 2 +- .../partials/namespace/method-summary.phtml | 2 +- .../Api/themes/zephir/partials/source.phtml | 2 +- tests/Zephir/Stubs/GeneratorTest.php | 34 +- tests/Zephir/Stubs/MethodDocBlockTest.php | 20 +- tests/Zephir/TypesTest.php | 10 +- tests/Zephir/VariableTest.php | 4 +- 48 files changed, 309 insertions(+), 619 deletions(-) rename Library/Class/{ClassConstant.php => Constant.php} (77%) rename Library/{AbstractClassDefinition.php => Class/Definition/AbstractDefinition.php} (71%) rename Library/Class/{ClassDefinition.php => Definition/Definition.php} (87%) rename Library/Class/{ClassDefinitionRuntime.php => Definition/DefinitionRuntime.php} (76%) rename Library/Class/{ClassMethod.php => Method/Method.php} (98%) rename Library/Class/{ClassMethodParameters.php => Method/Parameters.php} (75%) rename Library/Class/{ClassProperty.php => Property.php} (92%) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 1a2dd2f563..4af5842ef7 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -13,8 +13,8 @@ namespace Zephir; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use function array_key_exists; use function count; @@ -26,7 +26,7 @@ class ArgInfoDefinition private bool $returnByRef; /** - * @var ClassMethod|FunctionDefinition + * @var Method|FunctionDefinition */ private $functionLike; @@ -36,9 +36,9 @@ class ArgInfoDefinition private string $name; /** - * @var ClassMethodParameters|null + * @var Parameters|null */ - private ?ClassMethodParameters $parameters; + private ?Parameters $parameters; /** * @var CodePrinter @@ -62,17 +62,17 @@ class ArgInfoDefinition /** * @param string $name - * @param ClassMethod $functionLike + * @param Method $functionLike * @param CodePrinter $codePrinter * @param CompilationContext $compilationContext * @param bool $returnByRef */ public function __construct( - string $name, - ClassMethod $functionLike, - CodePrinter $codePrinter, + string $name, + Method $functionLike, + CodePrinter $codePrinter, CompilationContext $compilationContext, - bool $returnByRef = false + bool $returnByRef = false ) { $this->functionLike = $functionLike; $this->codePrinter = $codePrinter; diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 8886d6b699..a80a930d89 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -13,8 +13,8 @@ namespace Zephir\Backend; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; use Zephir\CodePrinter; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -307,7 +307,7 @@ public function getTypeofCondition( return $condition; } - public function onPreInitVar(ClassMethod $method): string + public function onPreInitVar(Method $method): string { if (!$method instanceof FunctionDefinition && !$method->isInternal()) { return "zval *this_ptr = getThis();\n"; //TODO: think about a better way to solve this. @@ -316,7 +316,7 @@ public function onPreInitVar(ClassMethod $method): string return ''; } - public function onPreCompile(ClassMethod $method, CompilationContext $context): void + public function onPreCompile(Method $method, CompilationContext $context): void { /** * Initialize the properties within create_object, handler code @@ -331,7 +331,7 @@ public function onPreCompile(ClassMethod $method, CompilationContext $context): } } - public function onPostCompile(ClassMethod $method, CompilationContext $context): void + public function onPostCompile(Method $method, CompilationContext $context): void { if (str_starts_with($method->getName(), 'zephir_init_properties')) { $context->codePrinter->increaseLevel(); @@ -505,12 +505,12 @@ public function declareConstant($type, $name, $value, CompilationContext $contex } /** - * @param ClassMethod $method + * @param Method $method * @param CompilationContext $context * * @return string */ - public function getInternalSignature(ClassMethod $method, CompilationContext $context): string + public function getInternalSignature(Method $method, CompilationContext $context): string { if ($method->isInitializer() && !$method->isStatic()) { return 'zend_object *'.$method->getName().'(zend_class_entry *class_type)'; @@ -922,7 +922,7 @@ public function fetchProperty( /** * @param Variable $symbolVariable - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * @param $property * @param bool $readOnly * @param CompilationContext $context diff --git a/Library/Cache/MethodCache.php b/Library/Cache/MethodCache.php index 677b06d4e3..23bb745e3a 100644 --- a/Library/Cache/MethodCache.php +++ b/Library/Cache/MethodCache.php @@ -15,7 +15,7 @@ use ReflectionClass; use ReflectionException; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Passes\CallGathererPass; use Zephir\Variable; @@ -167,13 +167,13 @@ public function get(CompilationContext $compilationContext, string $methodName, /** * Checks if the class is suitable for caching. * - * @param ClassDefinition|ReflectionClass|null $classDefinition + * @param Definition|ReflectionClass|null $classDefinition * * @return bool */ private function isClassCacheable($classDefinition = null): bool { - if ($classDefinition instanceof ClassDefinition) { + if ($classDefinition instanceof Definition) { return true; } diff --git a/Library/Cache/SlotsCache.php b/Library/Cache/SlotsCache.php index 96ef578dbb..094b8baa70 100644 --- a/Library/Cache/SlotsCache.php +++ b/Library/Cache/SlotsCache.php @@ -13,7 +13,7 @@ namespace Zephir\Cache; -use Zephir\Class\ClassMethod; +use Zephir\Class\Method\Method; /** * In order to reduce memory allocation when calling functions and method_exists @@ -64,7 +64,7 @@ public static function getExistingFunctionSlot(string $functionName): int /** * Returns or creates a cache slot for a method. */ - public static function getMethodSlot(ClassMethod $method): int + public static function getMethodSlot(Method $method): int { $className = $method->getClassDefinition()->getCompleteName(); $methodName = $method->getName(); @@ -86,7 +86,7 @@ public static function getMethodSlot(ClassMethod $method): int /** * Returns a cache slot for a method. */ - public static function getExistingMethodSlot(ClassMethod $method): int + public static function getExistingMethodSlot(Method $method): int { $className = $method->getClassDefinition()->getCompleteName(); $methodName = $method->getName(); diff --git a/Library/Class/ClassConstant.php b/Library/Class/Constant.php similarity index 77% rename from Library/Class/ClassConstant.php rename to Library/Class/Constant.php index 6245155b6d..1b96b66132 100644 --- a/Library/Class/ClassConstant.php +++ b/Library/Class/Constant.php @@ -22,39 +22,17 @@ /** * Represents a class constant */ -class ClassConstant +class Constant { - /** - * @var string - */ - protected string $name; - - /** - * @var array - */ - protected array $value = []; - - /** - * @var string|null - */ - protected ?string $docblock = null; - - /** - * @param string $name - * @param array $value - * @param string|null $docBlock - */ - public function __construct(string $name, array $value, ?string $docBlock = null) - { - $this->name = $name; - $this->value = $value; - $this->docblock = $docBlock; + public function __construct( + protected string $name, + protected array $value, + protected ?string $docblock = null, + ) { } /** * Returns the constant's name. - * - * @return string */ public function getName(): string { @@ -63,8 +41,6 @@ public function getName(): string /** * Returns the constant's value. - * - * @return array */ public function getValue(): array { @@ -73,8 +49,6 @@ public function getValue(): array /** * Get the type of the value of the constant. - * - * @return string */ public function getValueType(): string { @@ -83,8 +57,6 @@ public function getValueType(): string /** * Get value of the value of the constant. - * - * @return mixed */ public function getValueValue(): mixed { @@ -93,8 +65,6 @@ public function getValueValue(): mixed /** * Returns the docblock related to the constant. - * - * @return string|null */ public function getDocBlock(): ?string { @@ -103,8 +73,6 @@ public function getDocBlock(): ?string /** * Get type of class constant. - * - * @return string */ public function getType(): string { @@ -114,8 +82,6 @@ public function getType(): string /** * Process the value of the class constant if needed. * - * @param CompilationContext $compilationContext - * * @throws Exception * @throws ReflectionException */ @@ -145,8 +111,6 @@ public function processValue(CompilationContext $compilationContext): void /** * Produce the code to register a class constant. * - * @param CompilationContext $compilationContext - * * @throws Exception * @throws ReflectionException */ diff --git a/Library/AbstractClassDefinition.php b/Library/Class/Definition/AbstractDefinition.php similarity index 71% rename from Library/AbstractClassDefinition.php rename to Library/Class/Definition/AbstractDefinition.php index d6750ccb03..f36fc47dd3 100644 --- a/Library/AbstractClassDefinition.php +++ b/Library/Class/Definition/AbstractDefinition.php @@ -11,22 +11,15 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Class\Definition; -abstract class AbstractClassDefinition +abstract class AbstractDefinition { /** * Class name - * - * @var string */ protected string $name; - /** - * Returns the class name. - * - * @return string - */ public function getName(): string { return $this->name; diff --git a/Library/Class/ClassDefinition.php b/Library/Class/Definition/Definition.php similarity index 87% rename from Library/Class/ClassDefinition.php rename to Library/Class/Definition/Definition.php index 777edf5dc4..ea7735afd5 100644 --- a/Library/Class/ClassDefinition.php +++ b/Library/Class/Definition/Definition.php @@ -11,13 +11,17 @@ declare(strict_types=1); -namespace Zephir\Class; +namespace Zephir\Class\Definition; use ReflectionClass; use ReflectionException; -use Zephir\AbstractClassDefinition; use Zephir\AliasManager; use Zephir\ArgInfoDefinition; +use Zephir\Class\Property; +use Zephir\Class\Constant; +use Zephir\Class\Entry; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use Zephir\CodePrinter; use Zephir\CompilationContext; use Zephir\Compiler; @@ -36,151 +40,94 @@ /** * Represents a class/interface and their properties and methods. */ -final class ClassDefinition extends AbstractClassDefinition +final class Definition extends AbstractDefinition { public const TYPE_CLASS = 'class'; public const TYPE_INTERFACE = 'interface'; - /** - * Class namespace - * - * @var string - */ - protected string $namespace; - /** * Class short name * - * If didn't specified, then equals to $name + * If didn't specify, then equals to $name * - * @var string - * - * @see ClassDefinition::name + * @see Definition::name */ protected string $shortName; /** * Definition type - * - * @var string */ protected string $type = self::TYPE_CLASS; /** * Name of inherited class - * - * @var string|null */ protected ?string $extendsClass = null; /** * List of implemented interfaces of current class - * - * @var array */ protected array $interfaces = []; /** * Contains "final" in the definition - * - * @var bool */ protected bool $final = false; /** * Contains "abstract" in the definition - * - * @var bool */ protected bool $abstract = false; /** * When class is from external dependency - * - * @var bool */ protected bool $external = false; /** * Definition object of inherited class - * - * @var AbstractClassDefinition|null */ - protected ?AbstractClassDefinition $extendsClassDefinition = null; + protected ?AbstractDefinition $extendsClassDefinition = null; - /** - * @var AbstractClassDefinition[] - */ protected array $implementedInterfaceDefinitions = []; /** - * @var ClassProperty[] + * @var Property[] */ protected array $properties = []; /** - * @var ClassConstant[] + * @var Constant[] */ protected array $constants = []; /** - * @var ClassMethod[] + * @var Method[] */ protected array $methods = []; - /** - * @var string - */ protected string $docBlock = ''; - /** - * @var Docblock|null - */ protected ?Docblock $parsedDocblock = null; - /** - * @var int - */ protected int $dependencyRank = 0; - /** - * @var array - */ protected array $originalNode = []; - /** - * @var bool - */ protected bool $isBundled = false; - /** - * @var AliasManager|null - */ protected ?AliasManager $aliasManager = null; - /** - * @var Compiler - */ protected Compiler $compiler; - /** - * ClassDefinition. - * - * @param string $namespace - * @param string $name - * @param string|null $shortName - */ - public function __construct(string $namespace, string $name, ?string $shortName = null) + public function __construct(protected string $namespace, string $name, ?string $shortName = null) { - $this->namespace = $namespace; $this->name = $name; $this->shortName = $shortName ?: $name; } /** * Sets if the class is internal or not. - * - * @param bool $isBundled */ public function setIsBundled(bool $isBundled): void { @@ -189,8 +136,6 @@ public function setIsBundled(bool $isBundled): void /** * Returns whether the class is bundled or not. - * - * @return bool */ public function isBundled(): bool { @@ -199,8 +144,6 @@ public function isBundled(): bool /** * Sets whether the class is external or not. - * - * @param bool $isExternal */ public function setIsExternal(bool $isExternal): void { @@ -209,8 +152,6 @@ public function setIsExternal(bool $isExternal): void /** * Returns whether the class is internal or not. - * - * @return bool */ public function isExternal(): bool { @@ -219,8 +160,6 @@ public function isExternal(): bool /** * Set the class' type (class/interface). - * - * @param string $type */ public function setType(string $type): void { @@ -229,8 +168,6 @@ public function setType(string $type): void /** * Returns the class type. - * - * @return string */ public function getType(): string { @@ -239,8 +176,6 @@ public function getType(): string /** * Returns the class name without namespace. - * - * @return string */ public function getShortName(): string { @@ -249,8 +184,6 @@ public function getShortName(): string /** * Check if the class definition correspond to an interface. - * - * @return bool */ public function isInterface(): bool { @@ -259,8 +192,6 @@ public function isInterface(): bool /** * Sets if the class is final. - * - * @param bool $final */ public function setIsFinal(bool $final): void { @@ -269,8 +200,6 @@ public function setIsFinal(bool $final): void /** * Sets if the class is final. - * - * @param bool $abstract */ public function setIsAbstract(bool $abstract): void { @@ -279,8 +208,6 @@ public function setIsAbstract(bool $abstract): void /** * Checks whether the class is abstract or not. - * - * @return bool */ public function isAbstract(): bool { @@ -289,8 +216,6 @@ public function isAbstract(): bool /** * Checks whether the class is abstract or not. - * - * @return bool */ public function isFinal(): bool { @@ -299,8 +224,6 @@ public function isFinal(): bool /** * Returns the class name including its namespace. - * - * @return string */ public function getCompleteName(): string { @@ -309,8 +232,6 @@ public function getCompleteName(): string /** * Return the class namespace. - * - * @return string */ public function getNamespace(): string { @@ -319,8 +240,6 @@ public function getNamespace(): string /** * Set the original node where the class was declared. - * - * @param array $originalNode */ public function setOriginalNode(array $originalNode): void { @@ -329,8 +248,6 @@ public function setOriginalNode(array $originalNode): void /** * Sets the extended class. - * - * @param string $extendsClass */ public function setExtendsClass(string $extendsClass): void { @@ -339,8 +256,6 @@ public function setExtendsClass(string $extendsClass): void /** * Sets the implemented interfaces. - * - * @param array $implementedInterfaces */ public function setImplementsInterfaces(array $implementedInterfaces): void { @@ -352,8 +267,6 @@ public function setImplementsInterfaces(array $implementedInterfaces): void /** * Returns the extended class. - * - * @return string|null */ public function getExtendsClass(): ?string { @@ -362,8 +275,6 @@ public function getExtendsClass(): ?string /** * Returns the implemented interfaces. - * - * @return array */ public function getImplementedInterfaces(): array { @@ -372,20 +283,16 @@ public function getImplementedInterfaces(): array /** * Sets the class definition for the extended class. - * - * @param AbstractClassDefinition $classDefinition */ - public function setExtendsClassDefinition(AbstractClassDefinition $classDefinition): void + public function setExtendsClassDefinition(AbstractDefinition $classDefinition): void { $this->extendsClassDefinition = $classDefinition; } /** * Returns the class definition related to the extended class. - * - * @return AbstractClassDefinition|null */ - public function getExtendsClassDefinition(): ?AbstractClassDefinition + public function getExtendsClassDefinition(): ?AbstractDefinition { if (!$this->extendsClassDefinition && $this->extendsClass && $this->compiler) { $this->setExtendsClassDefinition($this->compiler->getClassDefinition($this->extendsClass)); @@ -396,18 +303,14 @@ public function getExtendsClassDefinition(): ?AbstractClassDefinition /** * Sets the class definition for the implemented interfaces. - * - * @param AbstractClassDefinition[] $implementedInterfaceDefinitions */ - public function setImplementedInterfaceDefinitions(array $implementedInterfaceDefinitions) + public function setImplementedInterfaceDefinitions(array $implementedInterfaceDefinitions): void { $this->implementedInterfaceDefinitions = $implementedInterfaceDefinitions; } /** * Returns the class definition for the implemented interfaces. - * - * @return AbstractClassDefinition[] */ public function getImplementedInterfaceDefinitions(): array { @@ -416,8 +319,6 @@ public function getImplementedInterfaceDefinitions(): array /** * Calculate the dependency rank of the class based on its dependencies. - * - * @return AbstractClassDefinition[] */ public function getDependencies(): array { @@ -447,8 +348,6 @@ public function increaseDependencyRank(int $rank): void /** * Returns the dependency rank for this class. - * - * @return int */ public function getDependencyRank(): int { @@ -457,8 +356,6 @@ public function getDependencyRank(): int /** * Sets the class/interface docBlock. - * - * @param string $docBlock */ public function setDocBlock(string $docBlock): void { @@ -467,8 +364,6 @@ public function setDocBlock(string $docBlock): void /** * Returns the class/interface docBlock. - * - * @return string */ public function getDocBlock(): string { @@ -477,8 +372,6 @@ public function getDocBlock(): string /** * Returns the parsed docBlock. - * - * @return DocBlock|null */ public function getParsedDocBlock(): ?DocBlock { @@ -498,11 +391,9 @@ public function getParsedDocBlock(): ?DocBlock /** * Adds a property to the definition. * - * @param ClassProperty $property - * * @throws CompilerException */ - public function addProperty(ClassProperty $property): void + public function addProperty(Property $property): void { if (isset($this->properties[$property->getName()])) { throw new CompilerException("Property '".$property->getName()."' was defined more than one time", $property->getOriginal()); @@ -514,11 +405,9 @@ public function addProperty(ClassProperty $property): void /** * Adds a constant to the definition. * - * @param ClassConstant $constant - * * @throws CompilerException */ - public function addConstant(ClassConstant $constant) + public function addConstant(Constant $constant): void { if (isset($this->constants[$constant->getName()])) { throw new CompilerException("Constant '".$constant->getName()."' was defined more than one time"); @@ -529,10 +418,6 @@ public function addConstant(ClassConstant $constant) /** * Checks if a class definition has a property. - * - * @param string $name - * - * @return bool */ public function hasProperty(string $name): bool { @@ -550,9 +435,9 @@ public function hasProperty(string $name): bool * * @param string $propertyName * - * @return ClassProperty|null + * @return Property|null */ - public function getProperty(string $propertyName): ?ClassProperty + public function getProperty(string $propertyName): ?Property { if (isset($this->properties[$propertyName])) { return $this->properties[$propertyName]; @@ -568,10 +453,6 @@ public function getProperty(string $propertyName): ?ClassProperty /** * Checks if class definition has a property. - * - * @param string $name - * - * @return bool */ public function hasConstant(string $name): bool { @@ -593,13 +474,9 @@ public function hasConstant(string $name): bool /** * Returns a constant definition by its name. * - * @param string $constantName - * - * @return ClassConstant|null - * * @throws InvalidArgumentException */ - public function getConstant(string $constantName): ?ClassConstant + public function getConstant(string $constantName): ?Constant { if (isset($this->constants[$constantName])) { return $this->constants[$constantName]; @@ -619,12 +496,9 @@ public function getConstant(string $constantName): ?ClassConstant /** * Adds a method to the class definition. * - * @param ClassMethod $method - * @param array|null $statement - * * @throws CompilerException */ - public function addMethod(ClassMethod $method, ?array $statement = null) + public function addMethod(Method $method, ?array $statement = null): void { $methodName = strtolower($method->getName()); if (isset($this->methods[$methodName])) { @@ -637,12 +511,9 @@ public function addMethod(ClassMethod $method, ?array $statement = null) /** * Updates an existing method definition. * - * @param ClassMethod $method - * @param array|null $statement - * * @throws CompilerException */ - public function updateMethod(ClassMethod $method, ?array $statement = null): void + public function updateMethod(Method $method, ?array $statement = null): void { $methodName = strtolower($method->getName()); if (!isset($this->methods[$methodName])) { @@ -655,7 +526,7 @@ public function updateMethod(ClassMethod $method, ?array $statement = null): voi /** * Returns all properties defined in the class. * - * @return ClassProperty[] + * @return Property[] */ public function getProperties(): array { @@ -665,7 +536,7 @@ public function getProperties(): array /** * Returns all constants defined in the class. * - * @return ClassConstant[] + * @return Constant[] */ public function getConstants(): array { @@ -675,7 +546,7 @@ public function getConstants(): array /** * Returns all methods defined in the class. * - * @return ClassMethod[] + * @return Method[] */ public function getMethods(): array { @@ -683,7 +554,7 @@ public function getMethods(): array } /** - * Checks if the class implements an specific name. + * Checks if the class implements a specific name. * * @param string $methodName * @@ -699,7 +570,7 @@ public function hasMethod(string $methodName): bool } $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof ClassDefinitionRuntime) { + if ($extendsClassDefinition instanceof DefinitionRuntime) { try { $extendsClassDefinition = $this->compiler->getInternalClassDefinition( $extendsClassDefinition->getName() @@ -723,13 +594,8 @@ public function hasMethod(string $methodName): bool /** * Returns a method by its name. - * - * @param string $methodName - * @param bool $checkExtends - * - * @return ClassMethod|null */ - public function getMethod(string $methodName, bool $checkExtends = true): ?ClassMethod + public function getMethod(string $methodName, bool $checkExtends = true): ?Method { $methodNameLower = strtolower($methodName); foreach ($this->methods as $name => $method) { @@ -754,31 +620,14 @@ public function getMethod(string $methodName, bool $checkExtends = true): ?Class /** * Set a method and its body. - * - * @param string $methodName - * @param ClassMethod $method */ - public function setMethod(string $methodName, ClassMethod $method): void + public function setMethod(string $methodName, Method $method): void { $this->methods[$methodName] = $method; } - /** - * Sets class methods externally. - * - * @param array $methods - */ - public function setMethods(array $methods): void - { - $this->methods = $methods; - } - /** * Tries to find the most similar name. - * - * @param string $methodName - * - * @return string|null */ public function getPossibleMethodName(string $methodName): ?string { @@ -800,11 +649,7 @@ public function getPossibleMethodName(string $methodName): ?string /** * Returns the name of the zend_class_entry according to the class name. * - * @param CompilationContext|null $compilationContext - * * @throws Exception - * - * @return string */ public function getClassEntry(?CompilationContext $compilationContext = null): string { @@ -826,8 +671,6 @@ public function getClassEntry(?CompilationContext $compilationContext = null): s /** * Returns a valid namespace to be used in C-sources. - * - * @return string */ public function getCNamespace(): string { @@ -836,8 +679,6 @@ public function getCNamespace(): string /** * Returns a valid namespace to be used in C-sources. - * - * @return string */ public function getNCNamespace(): string { @@ -846,10 +687,6 @@ public function getNCNamespace(): string /** * Class name without namespace prefix for class registration. - * - * @param string $namespace - * - * @return string */ public function getSCName(string $namespace): string { @@ -858,8 +695,6 @@ public function getSCName(string $namespace): string /** * Returns an absolute location to the class header. - * - * @return string */ public function getExternalHeader(): string { @@ -871,12 +706,9 @@ public function getExternalHeader(): string /** * Checks if a class implements an interface. * - * @param ClassDefinition $classDefinition - * @param ClassDefinition $interfaceDefinition - * * @throws CompilerException */ - public function checkInterfaceImplements(self $classDefinition, self $interfaceDefinition) + public function checkInterfaceImplements(self $classDefinition, self $interfaceDefinition): void { foreach ($interfaceDefinition->getMethods() as $method) { if (!$classDefinition->hasMethod($method->getName())) { @@ -913,11 +745,9 @@ public function checkInterfaceImplements(self $classDefinition, self $interfaceD /** * Pre-compiles a class/interface gathering method information required by other methods. * - * @param CompilationContext $compilationContext - * * @throws CompilerException */ - public function preCompile(CompilationContext $compilationContext) + public function preCompile(CompilationContext $compilationContext): void { $this->compiler = $compilationContext->compiler; @@ -933,10 +763,8 @@ public function preCompile(CompilationContext $compilationContext) /** * Returns the initialization method if any does exist. - * - * @return ClassMethod|null */ - public function getInitMethod(): ?ClassMethod + public function getInitMethod(): ?Method { $initClassName = $this->getCNamespace().'_'.$this->getName(); @@ -945,10 +773,8 @@ public function getInitMethod(): ?ClassMethod /** * Returns the initialization method if any does exist. - * - * @return ClassMethod|null */ - public function getStaticInitMethod(): ?ClassMethod + public function getStaticInitMethod(): ?Method { $initClassName = $this->getCNamespace().'_'.$this->getName(); @@ -957,10 +783,8 @@ public function getStaticInitMethod(): ?ClassMethod /** * Returns the initialization method if any does exist. - * - * @return ClassMethod|null */ - public function getLocalOrParentInitMethod(): ?ClassMethod + public function getLocalOrParentInitMethod(): ?Method { $method = $this->getInitMethod(); if ($method === null) { @@ -970,7 +794,7 @@ public function getLocalOrParentInitMethod(): ?ClassMethod $parentClassDefinition = $this->getExtendsClassDefinition(); if ($parentClassDefinition instanceof self) { $method = $parentClassDefinition->getInitMethod(); - if ($method instanceof ClassMethod) { + if ($method instanceof Method) { $this->addInitMethod($method->getStatementsBlock()); } } @@ -980,8 +804,6 @@ public function getLocalOrParentInitMethod(): ?ClassMethod /** * Creates the initialization method. - * - * @param StatementsBlock $statementsBlock */ public function addInitMethod(StatementsBlock $statementsBlock): void { @@ -990,7 +812,7 @@ public function addInitMethod(StatementsBlock $statementsBlock): void } $initClassName = $this->getCNamespace().'_'.$this->getName(); - $classMethod = new ClassMethod( + $classMethod = new Method( $this, ['internal'], 'zephir_init_properties_'.$initClassName, @@ -1004,14 +826,12 @@ public function addInitMethod(StatementsBlock $statementsBlock): void /** * Creates the static initialization method. - * - * @param StatementsBlock $statementsBlock */ public function addStaticInitMethod(StatementsBlock $statementsBlock): void { $initClassName = $this->getCNamespace().'_'.$this->getName(); - $classMethod = new ClassMethod( + $classMethod = new Method( $this, ['internal'], 'zephir_init_static_properties_'.$initClassName, @@ -1027,8 +847,6 @@ public function addStaticInitMethod(StatementsBlock $statementsBlock): void /** * Compiles a class/interface. * - * @param CompilationContext $compilationContext - * * @throws Exception * @throws ReflectionException */ @@ -1413,17 +1231,11 @@ public function compile(CompilationContext $compilationContext): void $compilationContext->headerPrinter = $codePrinter; } - /** - * @return AliasManager|null - */ public function getAliasManager(): ?AliasManager { return $this->aliasManager; } - /** - * @param AliasManager $aliasManager - */ public function setAliasManager(AliasManager $aliasManager): void { $this->aliasManager = $aliasManager; @@ -1431,10 +1243,6 @@ public function setAliasManager(AliasManager $aliasManager): void /** * Builds a class definition from reflection. - * - * @param ReflectionClass $class - * - * @return ClassDefinition */ public static function buildFromReflection(ReflectionClass $class): self { @@ -1464,11 +1272,11 @@ public static function buildFromReflection(ReflectionClass $class): self $parameters[] = $params; } - $classMethod = new ClassMethod( + $classMethod = new Method( $classDefinition, [], $method->getName(), - new ClassMethodParameters($parameters) + new Parameters($parameters) ); $classMethod->setIsStatic($method->isStatic()); $classMethod->setIsBundled(true); @@ -1477,7 +1285,7 @@ public static function buildFromReflection(ReflectionClass $class): self foreach ($class->getConstants() as $constantName => $constantValue) { $type = self::convertPhpConstantType(gettype($constantValue)); - $classConstant = new ClassConstant($constantName, ['value' => $constantValue, 'type' => $type], null); + $classConstant = new Constant($constantName, ['value' => $constantValue, 'type' => $type], null); $classDefinition->addConstant($classConstant); } @@ -1500,7 +1308,7 @@ public static function buildFromReflection(ReflectionClass $class): self $visibility[] = 'static'; } - $classProperty = new ClassProperty( + $classProperty = new Property( $classDefinition, $visibility, $property->getName(), @@ -1516,11 +1324,6 @@ public static function buildFromReflection(ReflectionClass $class): self return $classDefinition; } - /** - * @param string $name - * - * @return bool - */ protected function hasConstantFromInterfaces(string $name): bool { if ($interfaces = $this->getImplementedInterfaceDefinitions()) { @@ -1534,12 +1337,7 @@ protected function hasConstantFromInterfaces(string $name): bool return false; } - /** - * @param string $name - * - * @return ClassConstant|null - */ - protected function getConstantFromInterfaces(string $name): ?ClassConstant + protected function getConstantFromInterfaces(string $name): ?Constant { if ($interfaces = $this->getImplementedInterfaceDefinitions()) { foreach ($interfaces as $interface) { diff --git a/Library/Class/ClassDefinitionRuntime.php b/Library/Class/Definition/DefinitionRuntime.php similarity index 76% rename from Library/Class/ClassDefinitionRuntime.php rename to Library/Class/Definition/DefinitionRuntime.php index dbd1e26833..9ebaab64bd 100644 --- a/Library/Class/ClassDefinitionRuntime.php +++ b/Library/Class/Definition/DefinitionRuntime.php @@ -11,14 +11,12 @@ declare(strict_types=1); -namespace Zephir\Class; - -use Zephir\AbstractClassDefinition; +namespace Zephir\Class\Definition; /** * Represents a class/interface that only exists in runtime. */ -final class ClassDefinitionRuntime extends AbstractClassDefinition +final class DefinitionRuntime extends AbstractDefinition { public function __construct(string $name) { diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index 2aa9280ddc..03a9d56e9c 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -14,6 +14,7 @@ namespace Zephir\Class; use ReflectionClass; +use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Exception; @@ -107,7 +108,7 @@ public function get(): string array_pop($classNamespace); $namespace = implode(self::NAMESPACE_SEPARATOR, $classNamespace); - return (new ClassDefinition($namespace, $className))->getClassEntry(); + return (new Definition($namespace, $className))->getClassEntry(); } public function isInternal(): bool diff --git a/Library/Class/ClassMethod.php b/Library/Class/Method/Method.php similarity index 98% rename from Library/Class/ClassMethod.php rename to Library/Class/Method/Method.php index 55f2f1f3b8..4fad91278d 100644 --- a/Library/Class/ClassMethod.php +++ b/Library/Class/Method/Method.php @@ -11,12 +11,13 @@ declare(strict_types=1); -namespace Zephir\Class; +namespace Zephir\Class\Method; use ReflectionException; use Zephir\Branch; use Zephir\BranchManager; use Zephir\CacheManager; +use Zephir\Class\Definition\Definition; use Zephir\Class\Entry as ClassEntry; use Zephir\CodePrinter; use Zephir\CompilationContext; @@ -42,7 +43,7 @@ /** * Represents a class method */ -class ClassMethod +class Method { public bool $optimizable = true; @@ -132,18 +133,18 @@ class ClassMethod protected array $staticVariables = []; - protected ?ClassDefinition $classDefinition = null; + protected ?Definition $classDefinition = null; public function __construct( - ClassDefinition $classDefinition, - protected array $visibility, - protected string $name, - protected ?ClassMethodParameters $parameters = null, + Definition $classDefinition, + protected array $visibility, + protected string $name, + protected ?Parameters $parameters = null, protected ?StatementsBlock $statements = null, - protected ?string $docblock = null, - ?array $returnType = null, - protected ?array $expression = [], - array $staticVariables = [], + protected ?string $docblock = null, + ?array $returnType = null, + protected ?array $expression = [], + array $staticVariables = [], ) { $this->classDefinition = $classDefinition; $this->staticVariables = $staticVariables; @@ -365,7 +366,7 @@ public function setIsInitializer(bool $initializer): void /** * Returns the class definition where the method was declared. */ - public function getClassDefinition(): ?ClassDefinition + public function getClassDefinition(): ?Definition { return $this->classDefinition; } @@ -491,7 +492,7 @@ public function getLine(): mixed /** * Returns the parameters. */ - public function getParameters(): ?ClassMethodParameters + public function getParameters(): ?Parameters { return $this->parameters; } @@ -586,7 +587,7 @@ public function getReturnClassTypes(): array */ public function hasParameters(): bool { - return $this->parameters instanceof ClassMethodParameters && $this->parameters->count() > 0; + return $this->parameters instanceof Parameters && $this->parameters->count() > 0; } /** @@ -594,7 +595,7 @@ public function hasParameters(): bool */ public function getNumberOfParameters(): int { - if ($this->parameters instanceof ClassMethodParameters) { + if ($this->parameters instanceof Parameters) { return $this->parameters->count(); } @@ -1366,7 +1367,7 @@ public function compile(CompilationContext $compilationContext): void /** * Parameters has an additional extra mutation. */ - if ($this->localContext instanceof LocalContextPass && $this->parameters instanceof ClassMethodParameters) { + if ($this->localContext instanceof LocalContextPass && $this->parameters instanceof Parameters) { foreach ($this->parameters->getParameters() as $parameter) { $this->localContext->increaseMutations($parameter['name']); } @@ -1402,7 +1403,7 @@ public function compile(CompilationContext $compilationContext): void $compilationContext->insideTryCatch = 0; $compilationContext->currentTryCatch = 0; - if ($this->parameters instanceof ClassMethodParameters) { + if ($this->parameters instanceof Parameters) { /** * Round 1. Create variables in parameters in the symbol table. */ @@ -1550,7 +1551,7 @@ public function compile(CompilationContext $compilationContext): void $code = ''; $requiredParams = []; $optionalParams = []; - if ($this->parameters instanceof ClassMethodParameters) { + if ($this->parameters instanceof Parameters) { /** * Round 2. Fetch the parameters in the method. */ @@ -1806,7 +1807,7 @@ public function compile(CompilationContext $compilationContext): void * ZEND_PARSE_PARAMETERS */ $tempCodePrinter = new CodePrinter(); - if ($this->parameters instanceof ClassMethodParameters && $this->parameters->count() > 0) { + if ($this->parameters instanceof Parameters && $this->parameters->count() > 0) { $tempCodePrinter->output('#if PHP_VERSION_ID >= 80000'); $tempCodePrinter->output("\t".'bool is_null_true = 1;'); @@ -1951,9 +1952,9 @@ public function getInternalName(): string /** * Returns arginfo name for current method. */ - public function getArgInfoName(?ClassDefinition $classDefinition = null): string + public function getArgInfoName(?Definition $classDefinition = null): string { - if ($classDefinition instanceof ClassDefinition) { + if ($classDefinition instanceof Definition) { return sprintf( 'arginfo_%s_%s_%s', strtolower($classDefinition->getCNamespace()), diff --git a/Library/Class/ClassMethodParameters.php b/Library/Class/Method/Parameters.php similarity index 75% rename from Library/Class/ClassMethodParameters.php rename to Library/Class/Method/Parameters.php index 9c822ee315..8cc9799363 100644 --- a/Library/Class/ClassMethodParameters.php +++ b/Library/Class/Method/Parameters.php @@ -11,7 +11,7 @@ declare(strict_types=1); -namespace Zephir\Class; +namespace Zephir\Class\Method; use ArrayAccess; use Countable; @@ -22,39 +22,24 @@ /** * Represents the parameters defined in a method. */ -class ClassMethodParameters implements Countable, Iterator, ArrayAccess +class Parameters implements Countable, Iterator, ArrayAccess { - /** - * List of all method's parameters - * - * @var array - */ - private array $parameters = []; - private int $position = 0; /** * List of Required parameters - * - * @var array */ private array $requiredParameters = []; /** * List of Optional parameters (with default value) - * - * @var array */ private array $optionalParameters = []; /** - * ClassMethodParameters constructor. - * - * @param array $parameters - * * @throws CompilerException */ - public function __construct(array $parameters) + public function __construct(private array $parameters) { foreach ($parameters as $parameter) { if (isset($parameter['reference']) && $parameter['reference']) { @@ -65,14 +50,10 @@ public function __construct(array $parameters) ); } } - - $this->parameters = $parameters; } /** * Return internal parameters. - * - * @return array */ public function getParameters(): array { @@ -139,56 +120,47 @@ public function count(): int return count($this->parameters); } - #[\ReturnTypeWillChange] - public function rewind() + public function rewind(): void { $this->position = 0; } - #[\ReturnTypeWillChange] - public function key() + public function key(): int { return $this->position; } - #[\ReturnTypeWillChange] - public function valid() + public function valid(): bool { return isset($this->parameters[$this->position]); } - #[\ReturnTypeWillChange] - public function current() + public function current(): mixed { return $this->parameters[$this->position]; } - #[\ReturnTypeWillChange] - public function next() + public function next(): void { ++$this->position; } - #[\ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists(mixed $offset): bool { return isset($this->parameters[$offset]); } - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { return $this->parameters[$offset]; } - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet(mixed $offset, mixed $value): void { $this->parameters[$offset] = $value; } - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset(mixed $offset): void { unset($this->parameters[$offset]); } diff --git a/Library/Class/ClassProperty.php b/Library/Class/Property.php similarity index 92% rename from Library/Class/ClassProperty.php rename to Library/Class/Property.php index 7c2e1a608b..0dc256d376 100644 --- a/Library/Class/ClassProperty.php +++ b/Library/Class/Property.php @@ -14,13 +14,13 @@ namespace Zephir\Class; use ReflectionException; +use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\BinaryOperator; -use Zephir\Expression\Builder\Statements\LetStatement as ExpressionLetStatement; use Zephir\StatementsBlock; use Zephir\Types; use function in_array; @@ -29,15 +29,15 @@ /** * Represents a property class */ -class ClassProperty +class Property { public function __construct( - protected ClassDefinition $classDefinition, - protected array $visibility, - protected string $name, - protected ?array $defaultValue, - protected ?string $docBlock = null, - protected ?array $original = null, + protected Definition $classDefinition, + protected array $visibility, + protected string $name, + protected ?array $defaultValue, + protected ?string $docBlock = null, + protected ?array $original = null, ) { $this->checkVisibility($visibility, $name, $original); @@ -50,27 +50,20 @@ public function __construct( /** * Returns the class definition where the method was declared. - * - * @return ClassDefinition */ - public function getClassDefinition(): ClassDefinition + public function getClassDefinition(): Definition { return $this->classDefinition; } /** * Returns the property name. - * - * @return string */ public function getName(): string { return $this->name; } - /** - * @return mixed - */ public function getValue(): mixed { if ('array' == $this->defaultValue['type']) { @@ -91,20 +84,13 @@ public function getType() return $this->defaultValue['type']; } - /** - * @return mixed - */ - public function getOriginal(): mixed + public function getOriginal(): ?array { return $this->original; } /** * Checks for visibility congruence. - * - * @param array $visibility - * @param string $name - * @param array|null $original */ public function checkVisibility(array $visibility, string $name, ?array $original = null): void { @@ -123,8 +109,6 @@ public function checkVisibility(array $visibility, string $name, ?array $origina * Returns the C-visibility accessors for the model. * * @throws Exception - * - * @return string */ public function getVisibilityAccessor(): string { @@ -158,8 +142,6 @@ public function getVisibilityAccessor(): string /** * Returns the docblock related to the property. - * - * @return string|null */ public function getDocBlock(): ?string { @@ -168,8 +150,6 @@ public function getDocBlock(): ?string /** * Checks whether the variable is static. - * - * @return bool */ public function isStatic(): bool { @@ -178,8 +158,6 @@ public function isStatic(): bool /** * Checks whether the variable is public. - * - * @return bool */ public function isPublic(): bool { @@ -188,8 +166,6 @@ public function isPublic(): bool /** * Checks whether the variable is protected. - * - * @return bool */ public function isProtected(): bool { @@ -198,8 +174,6 @@ public function isProtected(): bool /** * Checks whether the variable is private. - * - * @return bool */ public function isPrivate(): bool { @@ -209,8 +183,6 @@ public function isPrivate(): bool /** * Produce the code to register a property. * - * @param CompilationContext $compilationContext - * * @throws Exception * @throws ReflectionException */ @@ -247,8 +219,6 @@ public function compile(CompilationContext $compilationContext): void /** * Removes all initialization statements related to this property. - * - * @param array $statements */ protected function removeInitializationStatements(array &$statements): void { @@ -265,9 +235,6 @@ protected function removeInitializationStatements(array &$statements): void } } - /** - * @return $this|ExpressionLetStatement - */ protected function getLetStatement() { $exprBuilder = BuilderFactory::getInstance(); @@ -308,11 +275,6 @@ protected function getLetStatement() ->setStatements($exprBuilder->statements()->block([$lsb])); } - /** - * @param $value - * - * @return bool|string - */ protected function getBooleanCode($value): bool|string { if ('true' == $value || true === $value) { diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 5d51b83089..b6e857c8ab 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -16,8 +16,9 @@ use Psr\Log\LoggerInterface; use Zephir\Backend\Backend; use Zephir\Cache\FunctionCache; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; +use Zephir\Class\Definition\AbstractDefinition; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; use Zephir\Exception\CompilerException; use Zephir\Passes\StaticTypeInference; use function in_array; @@ -57,12 +58,12 @@ class CompilationContext /** * Represents the class currently being compiled. */ - public ?ClassDefinition $classDefinition = null; + public ?Definition $classDefinition = null; /** * Current method or function that being compiled. */ - public ?ClassMethod $currentMethod = null; + public ?Method $currentMethod = null; /** * Represents the c-headers added to the file. @@ -158,7 +159,7 @@ public function getFullName(string $className): string /** * Lookup a class from a given class name. */ - public function classLookup(string $className, array $statement = null): AbstractClassDefinition + public function classLookup(string $className, array $statement = null): AbstractDefinition { if (!in_array($className, ['self', 'static', 'parent'])) { $className = $this->getFullName($className); @@ -174,7 +175,7 @@ public function classLookup(string $className, array $statement = null): Abstrac } $parent = $this->classDefinition->getExtendsClass(); - if (!$parent instanceof ClassDefinition) { + if (!$parent instanceof Definition) { throw new CompilerException( sprintf( 'Cannot access parent:: because class %s does not extend any class', diff --git a/Library/Compiler.php b/Library/Compiler.php index f673caffb9..7b5da332c9 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -21,7 +21,7 @@ use ReflectionException; use Zephir\Backend\Backend; use Zephir\Backend\StringsManager; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Code\Builder\Struct; use Zephir\Compiler\CompilerFileFactory; use Zephir\Compiler\FileInterface; @@ -69,7 +69,7 @@ final class Compiler private array $internalInitializers = []; /** - * @var ClassDefinition[] + * @var Definition[] */ private array $definitions = []; @@ -85,7 +85,7 @@ final class Compiler private array $externalDependencies = []; /** - * @var ClassDefinition[] + * @var Definition[] */ private static array $internalDefinitions = []; @@ -369,7 +369,7 @@ public function isBundledInterface(string $className): bool * * @param string $className * - * @return ClassDefinition|false returns false if no class definition is found + * @return Definition|false returns false if no class definition is found */ public function getClassDefinition(string $className) { @@ -386,9 +386,9 @@ public function getClassDefinition(string $className) * Inserts an anonymous class definition in the compiler. * * @param CompilerFileAnonymous $file - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition */ - public function addClassDefinition(CompilerFileAnonymous $file, ClassDefinition $classDefinition): void + public function addClassDefinition(CompilerFileAnonymous $file, Definition $classDefinition): void { $this->definitions[$classDefinition->getCompleteName()] = $classDefinition; $this->anonymousFiles[$classDefinition->getCompleteName()] = $file; @@ -399,15 +399,15 @@ public function addClassDefinition(CompilerFileAnonymous $file, ClassDefinition * * @param string $className * - * @return ClassDefinition + * @return Definition * * @throws ReflectionException */ - public function getInternalClassDefinition(string $className): ClassDefinition + public function getInternalClassDefinition(string $className): Definition { if (!isset(self::$internalDefinitions[$className])) { $reflection = new \ReflectionClass($className); - self::$internalDefinitions[$className] = ClassDefinition::buildFromReflection($reflection); + self::$internalDefinitions[$className] = Definition::buildFromReflection($reflection); } return self::$internalDefinitions[$className]; diff --git a/Library/Compiler/FileInterface.php b/Library/Compiler/FileInterface.php index 5dd0a61a5a..8d25ea5595 100644 --- a/Library/Compiler/FileInterface.php +++ b/Library/Compiler/FileInterface.php @@ -11,7 +11,7 @@ namespace Zephir\Compiler; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Compiler; /** @@ -29,7 +29,7 @@ public function isExternal(); /** * Returns the class definition related to the compiled file. * - * @return ClassDefinition + * @return Definition */ public function getClassDefinition(); diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 2566e024b1..835948d8a6 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -16,12 +16,12 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use ReflectionException; -use Zephir\Class\ClassConstant; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassDefinitionRuntime; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; +use Zephir\Class\Constant; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Definition\DefinitionRuntime; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use Zephir\Compiler\FileInterface; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; @@ -76,9 +76,9 @@ final class CompilerFile implements FileInterface private ?string $compiledFile = null; /** - * @var ClassDefinition|null + * @var Definition|null */ - private ?ClassDefinition $classDefinition = null; + private ?Definition $classDefinition = null; /** * @var FunctionDefinition[] @@ -142,7 +142,7 @@ public function setClassName(string $className) /** * {@inheritdoc} * - * @return ClassDefinition + * @return Definition */ public function getClassDefinition() { @@ -284,7 +284,7 @@ public function compileComment(CompilationContext $compilationContext, $topState */ public function preCompileInterface($namespace, $topStatement, $docblock) { - $classDefinition = new ClassDefinition($namespace, $topStatement['name']); + $classDefinition = new Definition($namespace, $topStatement['name']); $classDefinition->setIsExternal($this->external); if (isset($topStatement['extends'])) { @@ -308,7 +308,7 @@ public function preCompileInterface($namespace, $topStatement, $docblock) */ if (isset($definition['constants'])) { foreach ($definition['constants'] as $constant) { - $classConstant = new ClassConstant( + $classConstant = new Constant( $constant['name'], $constant['default'] ?? null, $constant['docblock'] ?? null @@ -322,11 +322,11 @@ public function preCompileInterface($namespace, $topStatement, $docblock) */ if (isset($definition['methods'])) { foreach ($definition['methods'] as $method) { - $classMethod = new ClassMethod( + $classMethod = new Method( $classDefinition, $method['visibility'], $method['name'], - isset($method['parameters']) ? new ClassMethodParameters($method['parameters']) : null, + isset($method['parameters']) ? new Parameters($method['parameters']) : null, null, $method['docblock'] ?? null, $method['return-type'] ?? null, @@ -350,7 +350,7 @@ public function preCompileInterface($namespace, $topStatement, $docblock) */ public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock) { - $classDefinition = new ClassDefinition($namespace, $topStatement['name']); + $classDefinition = new Definition($namespace, $topStatement['name']); $classDefinition->setIsExternal($this->external); if (isset($topStatement['extends'])) { @@ -384,7 +384,7 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa /** * Add property to the definition */ - $classDefinition->addProperty(new ClassProperty( + $classDefinition->addProperty(new Property( $classDefinition, $property['visibility'], $property['name'], @@ -407,7 +407,7 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa */ if (isset($definition['constants'])) { foreach ($definition['constants'] as $constant) { - $classDefinition->addConstant(new ClassConstant( + $classDefinition->addConstant(new Constant( $constant['name'], $constant['default'] ?? null, $constant['docblock'] ?? null @@ -420,11 +420,11 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa */ if (isset($definition['methods'])) { foreach ($definition['methods'] as $method) { - $classDefinition->addMethod(new ClassMethod( + $classDefinition->addMethod(new Method( $classDefinition, $method['visibility'], $method['name'], - isset($method['parameters']) ? new ClassMethodParameters($method['parameters']) : null, + isset($method['parameters']) ? new Parameters($method['parameters']) : null, isset($method['statements']) ? new StatementsBlock($method['statements']) : null, $method['docblock'] ?? null, $method['return-type'] ?? null, @@ -512,7 +512,7 @@ public function preCompile(Compiler $compiler) $parameters = null; if (isset($topStatement['parameters'])) { - $parameters = new ClassMethodParameters($topStatement['parameters']); + $parameters = new Parameters($topStatement['parameters']); } $returnType = null; @@ -670,7 +670,7 @@ public function checkDependencies(Compiler $compiler) $extendedDefinition = $compiler->getInternalClassDefinition($extendedClass); $classDefinition->setExtendsClassDefinition($extendedDefinition); } else { - $extendedDefinition = new ClassDefinitionRuntime($extendedClass); + $extendedDefinition = new DefinitionRuntime($extendedClass); $classDefinition->setExtendsClassDefinition($extendedDefinition); $this->logger->warning( @@ -693,7 +693,7 @@ public function checkDependencies(Compiler $compiler) $extendedDefinition = $compiler->getInternalClassDefinition($extendedClass); $classDefinition->setExtendsClassDefinition($extendedDefinition); } else { - $extendedDefinition = new ClassDefinitionRuntime($extendedClass); + $extendedDefinition = new DefinitionRuntime($extendedClass); $classDefinition->setExtendsClassDefinition($extendedDefinition); $this->logger->warning( @@ -718,7 +718,7 @@ public function checkDependencies(Compiler $compiler) $interfaceDefinitions[$interface] = $compiler->getInternalClassDefinition($interface); } else { if ($extendedClass !== null) { - $classDefinition->setExtendsClassDefinition(new ClassDefinitionRuntime($extendedClass)); + $classDefinition->setExtendsClassDefinition(new DefinitionRuntime($extendedClass)); } $this->logger->warning( @@ -951,11 +951,11 @@ public function getFilePath(): string * Creates the property shortcuts. * * @param array $property - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * * @throws CompilerException */ - protected function processShortcuts(array $property, ClassDefinition $classDefinition): void + protected function processShortcuts(array $property, Definition $classDefinition): void { foreach ($property['shortcuts'] as $shortcut) { if (str_starts_with($property['name'], '_')) { @@ -990,7 +990,7 @@ protected function processShortcuts(array $property, ClassDefinition $classDefin switch ($shortcut['name']) { case 'get': - $classDefinition->addMethod(new ClassMethod( + $classDefinition->addMethod(new Method( $classDefinition, ['public'], 'get'.camelize($name), @@ -1018,11 +1018,11 @@ protected function processShortcuts(array $property, ClassDefinition $classDefin break; case 'set': - $classDefinition->addMethod(new ClassMethod( + $classDefinition->addMethod(new Method( $classDefinition, ['public'], 'set'.camelize($name), - new ClassMethodParameters([ + new Parameters([ [ 'type' => 'parameter', 'name' => $name, @@ -1072,7 +1072,7 @@ protected function processShortcuts(array $property, ClassDefinition $classDefin case 'toString': case '__toString': - $classDefinition->addMethod(new ClassMethod( + $classDefinition->addMethod(new Method( $classDefinition, ['public'], '__toString', diff --git a/Library/CompilerFileAnonymous.php b/Library/CompilerFileAnonymous.php index 1a763d2335..0e97c27728 100644 --- a/Library/CompilerFileAnonymous.php +++ b/Library/CompilerFileAnonymous.php @@ -16,7 +16,7 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use ReflectionException; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Compiler\FileInterface; use function count; @@ -33,17 +33,17 @@ final class CompilerFileAnonymous implements FileInterface protected bool $external = false; protected array $headerCBlocks = []; protected ?CompilationContext $context = null; - protected ClassDefinition $classDefinition; + protected Definition $classDefinition; protected Config $config; /** * CompilerFileAnonymous constructor. * - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * @param Config $config * @param CompilationContext|null $context */ - public function __construct(ClassDefinition $classDefinition, Config $config, ?CompilationContext $context = null) + public function __construct(Definition $classDefinition, Config $config, ?CompilationContext $context = null) { $this->classDefinition = $classDefinition; $this->config = $config; @@ -52,9 +52,9 @@ public function __construct(ClassDefinition $classDefinition, Config $config, ?C } /** - * @return ClassDefinition + * @return Definition */ - public function getClassDefinition(): ClassDefinition + public function getClassDefinition(): Definition { return $this->classDefinition; } diff --git a/Library/Documentation.php b/Library/Documentation.php index 8a2639feb1..a3d2081017 100644 --- a/Library/Documentation.php +++ b/Library/Documentation.php @@ -13,7 +13,7 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Documentation\File; use Zephir\Documentation\NamespaceAccessor; use Zephir\Documentation\Theme; @@ -201,7 +201,7 @@ public function build() public static function classUrl($c) { $cname = $c; - if ($c instanceof ClassDefinition) { + if ($c instanceof Definition) { $cname = $c->getCompleteName(); } @@ -213,7 +213,7 @@ public static function namespaceUrl($ns) return '/namespace/'.str_replace('\\', '/', $ns).'.html'; } - public static function sourceUrl(ClassDefinition $c) + public static function sourceUrl(Definition $c) { return '/source/'.str_replace('\\', '/', $c->getCompleteName()).'.html'; } diff --git a/Library/Documentation/File/ClassFile.php b/Library/Documentation/File/ClassFile.php index 260339e2ef..a278b10063 100644 --- a/Library/Documentation/File/ClassFile.php +++ b/Library/Documentation/File/ClassFile.php @@ -11,14 +11,14 @@ namespace Zephir\Documentation\File; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\CompilerFile; use Zephir\Documentation; use Zephir\Documentation\FileInterface; class ClassFile implements FileInterface { - protected ClassDefinition $class; + protected Definition $class; public function __construct(protected CompilerFile $compilerFile) { diff --git a/Library/Documentation/File/ClassesFile.php b/Library/Documentation/File/ClassesFile.php index cc89dceb52..4d5f8ce1b2 100644 --- a/Library/Documentation/File/ClassesFile.php +++ b/Library/Documentation/File/ClassesFile.php @@ -11,12 +11,12 @@ namespace Zephir\Documentation\File; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Documentation\FileInterface; class ClassesFile implements FileInterface { - public function __construct(protected ClassDefinition $classes) + public function __construct(protected Definition $classes) { } diff --git a/Library/Documentation/File/SourceFile.php b/Library/Documentation/File/SourceFile.php index 5b252e255f..1f7ec6dd1a 100644 --- a/Library/Documentation/File/SourceFile.php +++ b/Library/Documentation/File/SourceFile.php @@ -11,12 +11,12 @@ namespace Zephir\Documentation\File; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Documentation; class SourceFile extends ClassFile { - protected ClassDefinition $class; + protected Definition $class; public function getTemplateName(): string { diff --git a/Library/Documentation/Template.php b/Library/Documentation/Template.php index d2ba1a73e3..3755293309 100644 --- a/Library/Documentation/Template.php +++ b/Library/Documentation/Template.php @@ -11,7 +11,7 @@ namespace Zephir\Documentation; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\CompilerFile; use Zephir\Config; use Zephir\Documentation; @@ -108,7 +108,7 @@ public function url(string $url): string } elseif (\is_string($url)) { return $url; } - } elseif ($url instanceof ClassDefinition) { + } elseif ($url instanceof Definition) { return $this->url(Documentation::classUrl($url)); } elseif ($url instanceof CompilerFile) { return $this->url(Documentation::classUrl($url->getClassDefinition())); diff --git a/Library/Expression/Closure.php b/Library/Expression/Closure.php index 65057c9a88..d98aa5a727 100644 --- a/Library/Expression/Closure.php +++ b/Library/Expression/Closure.php @@ -13,10 +13,10 @@ namespace Zephir\Expression; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; @@ -85,7 +85,7 @@ public function setReadOnly(bool $readOnly): void */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - $classDefinition = new ClassDefinition( + $classDefinition = new Definition( $compilationContext->config->get('namespace'), self::$id.'__closure' ); @@ -99,7 +99,7 @@ public function compile(array $expression, CompilationContext $compilationContex $parameters = null; if (isset($expression['left'])) { - $parameters = new ClassMethodParameters($expression['left']); + $parameters = new Parameters($expression['left']); } $block = $expression['right'] ?? []; @@ -112,7 +112,7 @@ public function compile(array $expression, CompilationContext $compilationContex } foreach ($staticVariables as $var) { - $classDefinition->addProperty(new ClassProperty( + $classDefinition->addProperty(new Property( $classDefinition, ['public', 'static'], $var->getName(), @@ -122,7 +122,7 @@ public function compile(array $expression, CompilationContext $compilationContex )); } - $classMethod = new ClassMethod( + $classMethod = new Method( $classDefinition, ['public', 'final'], '__invoke', diff --git a/Library/Expression/ClosureArrow.php b/Library/Expression/ClosureArrow.php index 7b264dbb5e..d420c656e5 100644 --- a/Library/Expression/ClosureArrow.php +++ b/Library/Expression/ClosureArrow.php @@ -13,9 +13,9 @@ namespace Zephir\Expression; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; @@ -40,7 +40,7 @@ class ClosureArrow extends Closure */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - $classDefinition = new ClassDefinition( + $classDefinition = new Definition( $compilationContext->config->get('namespace'), self::$id.'__closure' ); @@ -55,7 +55,7 @@ public function compile(array $expression, CompilationContext $compilationContex /** * Builds parameters using the only parameter available. */ - $parameters = new ClassMethodParameters([ + $parameters = new Parameters([ [ 'type' => 'parameter', 'name' => $expression['left']['value'], @@ -77,7 +77,7 @@ public function compile(array $expression, CompilationContext $compilationContex $block = $statementBlockBuilder->build(); - $classMethod = new ClassMethod( + $classMethod = new Method( $classDefinition, ['public', 'final'], '__invoke', diff --git a/Library/Expression/StaticConstantAccess.php b/Library/Expression/StaticConstantAccess.php index 600ba37fb9..d98337de3c 100644 --- a/Library/Expression/StaticConstantAccess.php +++ b/Library/Expression/StaticConstantAccess.php @@ -14,7 +14,7 @@ namespace Zephir\Expression; use ReflectionException; -use Zephir\Class\ClassConstant; +use Zephir\Class\Constant; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -176,7 +176,7 @@ public function compile(array $expression, CompilationContext $compilationContex $constantDefinition = $classDefinition->getConstant($constant); - if ($constantDefinition instanceof ClassConstant) { + if ($constantDefinition instanceof Constant) { $constantDefinition->processValue($compilationContext); $value = $constantDefinition->getValueValue(); $type = $constantDefinition->getValueType(); diff --git a/Library/Expression/StaticPropertyAccess.php b/Library/Expression/StaticPropertyAccess.php index 096c07b0ca..3fea7d9a04 100644 --- a/Library/Expression/StaticPropertyAccess.php +++ b/Library/Expression/StaticPropertyAccess.php @@ -14,7 +14,7 @@ namespace Zephir\Expression; use ReflectionException; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -97,7 +97,7 @@ public function compile(array $expression, CompilationContext $compilationContex throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $expression); } - /** @var ClassProperty $propertyDefinition */ + /** @var Property $propertyDefinition */ $propertyDefinition = $classDefinition->getProperty($property); if (!$propertyDefinition->isStatic()) { throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $expression); diff --git a/Library/FunctionDefinition.php b/Library/FunctionDefinition.php index 0199866348..1ea93d1067 100644 --- a/Library/FunctionDefinition.php +++ b/Library/FunctionDefinition.php @@ -13,13 +13,13 @@ namespace Zephir; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; /** * Represents a function */ -class FunctionDefinition extends ClassMethod +class FunctionDefinition extends Method { /** * Whether the function is declared in a global or namespaced scope. @@ -27,12 +27,12 @@ class FunctionDefinition extends ClassMethod private bool $isGlobal = false; public function __construct( - private string $namespace, - protected string $name, - protected ?ClassMethodParameters $parameters = null, + private string $namespace, + protected string $name, + protected ?Parameters $parameters = null, protected ?StatementsBlock $statements = null, - array $returnType = null, - protected ?array $expression = [], + array $returnType = null, + protected ?array $expression = [], ) { $this->setReturnTypes($returnType); } diff --git a/Library/MethodCall.php b/Library/MethodCall.php index 3bc46588f0..7074f758d8 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -12,7 +12,7 @@ namespace Zephir; use ReflectionException; -use Zephir\Class\ClassMethod; +use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; @@ -389,7 +389,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext * We only check extension parameters if methods are extension methods * Internal methods may have invalid Reflection information */ - if ($method instanceof ClassMethod && !$method->isBundled()) { + if ($method instanceof Method && !$method->isBundled()) { if (isset($expression['parameters'])) { $callNumberParameters = \count($expression['parameters']); } else { @@ -486,7 +486,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext */ if ($isExpecting) { if (isset($method)) { - if ($method instanceof ClassMethod) { + if ($method instanceof Method) { if ($method->isVoid()) { throw new CompilerException( sprintf( @@ -571,7 +571,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext // We check here if a correct parameter type is passed to the called method if (self::CALL_NORMAL == $type) { - if (isset($method) && $method instanceof ClassMethod && isset($expression['parameters'])) { + if (isset($method) && $method instanceof Method && isset($expression['parameters'])) { $resolvedTypes = $this->getResolvedTypes(); $resolvedDynamicTypes = $this->getResolvedDynamicTypes(); diff --git a/Library/Statements/Let/StaticPropertyAppend.php b/Library/Statements/Let/StaticPropertyAppend.php index b56620e940..9503fc1318 100644 --- a/Library/Statements/Let/StaticPropertyAppend.php +++ b/Library/Statements/Let/StaticPropertyAppend.php @@ -11,7 +11,7 @@ namespace Zephir\Statements\Let; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -75,7 +75,7 @@ public function assignStatic( throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); } - /** @var ClassProperty $propertyDefinition */ + /** @var Property $propertyDefinition */ $propertyDefinition = $classDefinition->getProperty($property); if (!$propertyDefinition->isStatic()) { throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $statement); diff --git a/Library/Statements/Let/StaticPropertyArrayIndex.php b/Library/Statements/Let/StaticPropertyArrayIndex.php index 510c71b434..b3033235e7 100644 --- a/Library/Statements/Let/StaticPropertyArrayIndex.php +++ b/Library/Statements/Let/StaticPropertyArrayIndex.php @@ -11,7 +11,7 @@ namespace Zephir\Statements\Let; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -76,7 +76,7 @@ public function assignStatic( throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); } - /** @var ClassProperty $propertyDefinition */ + /** @var Property $propertyDefinition */ $propertyDefinition = $classDefinition->getProperty($property); if (!$propertyDefinition->isStatic()) { throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $statement); diff --git a/Library/Statements/Let/StaticPropertyArrayIndexAppend.php b/Library/Statements/Let/StaticPropertyArrayIndexAppend.php index fa34b28584..0eb2943c64 100644 --- a/Library/Statements/Let/StaticPropertyArrayIndexAppend.php +++ b/Library/Statements/Let/StaticPropertyArrayIndexAppend.php @@ -11,7 +11,7 @@ namespace Zephir\Statements\Let; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -76,7 +76,7 @@ public function assignStatic( throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); } - /** @var ClassProperty $propertyDefinition */ + /** @var Property $propertyDefinition */ $propertyDefinition = $classDefinition->getProperty($property); if (!$propertyDefinition->isStatic()) { throw new CompilerException("Cannot access non-static property '".$classDefinition->getCompleteName().'::'.$property."'", $statement); diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 94b97e94b3..6d2b227f26 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -12,8 +12,8 @@ namespace Zephir; use ReflectionException; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; use function count; @@ -151,7 +151,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext } if (!$classDefinition->hasMethod('__callStatic')) { - if ($method instanceof ClassMethod && !$method->isBundled()) { + if ($method instanceof Method && !$method->isBundled()) { /** * Try to produce an exception if method is called with a wrong number of parameters */ @@ -214,7 +214,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Transfer the return type-hint to the returned variable */ - if ($isExpecting && isset($method) && $method instanceof ClassMethod) { + if ($isExpecting && isset($method) && $method instanceof Method) { $symbolVariable->setDynamicTypes('object'); foreach ($method->getReturnClassTypes() as $classType) { $symbolVariable->setClassTypes($compilationContext->getFullName($classType)); @@ -249,7 +249,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext * @param bool $isExpecting * @param CompilationContext $compilationContext * @param Variable|null $symbolVariable - * @param ClassMethod|null $method + * @param Method|null $method * @throws Exception */ protected function call( @@ -260,7 +260,7 @@ protected function call( bool $isExpecting, CompilationContext $compilationContext, ?Variable $symbolVariable = null, - ?ClassMethod $method = null + ?Method $method = null ): void { if (!in_array($context, ['SELF', 'STATIC'])) { $context = 'SELF'; @@ -348,12 +348,12 @@ protected function call( * @param Variable $symbolVariable * @param bool $mustInit * @param bool $isExpecting - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * @param CompilationContext $compilationContext - * @param ClassMethod $method + * @param Method $method * @throws Exception */ - protected function callParent(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, ClassDefinition $classDefinition, CompilationContext $compilationContext, ClassMethod $method) + protected function callParent(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method) { $codePrinter = $compilationContext->codePrinter; $classCe = $classDefinition->getClassEntry($compilationContext); @@ -419,12 +419,12 @@ protected function callParent(string $methodName, array $expression, $symbolVari * @param Variable $symbolVariable * @param bool $mustInit * @param bool $isExpecting - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * @param CompilationContext $compilationContext - * @param ClassMethod $method + * @param Method $method * @throws Exception */ - protected function callFromClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, ClassDefinition $classDefinition, CompilationContext $compilationContext, ClassMethod $method) + protected function callFromClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method) { $codePrinter = $compilationContext->codePrinter; diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index 2037ce75dc..f1ec5af964 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -14,11 +14,11 @@ namespace Zephir\Stubs; use Zephir\AliasManager; -use Zephir\Class\ClassConstant; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; +use Zephir\Class\Constant; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use Zephir\CompilerFile; use Zephir\Exception; use function array_key_exists; @@ -89,15 +89,15 @@ public function generate(string $namespace, string $path, string $indent, string /** * Build class. * - * @param ClassDefinition $class + * @param Definition $class * @param string $indent * @param string $banner * - * @throws Exception\RuntimeException - * * @return string + *@throws Exception\RuntimeException + * */ - protected function buildClass(ClassDefinition $class, string $indent, string $banner): string + protected function buildClass(Definition $class, string $indent, string $banner): string { $source = 'getName(); @@ -255,13 +255,13 @@ protected function buildConstant(ClassConstant $constant, string $indent): strin } /** - * @param ClassMethod $method + * @param Method $method * @param bool $isInterface * @param string $indent * * @return string */ - protected function buildMethod(ClassMethod $method, bool $isInterface, string $indent): string + protected function buildMethod(Method $method, bool $isInterface, string $indent): string { $modifier = implode(' ', array_diff($method->getVisibility(), $this->ignoreModifiers)); @@ -271,7 +271,7 @@ protected function buildMethod(ClassMethod $method, bool $isInterface, string $i $parameters = []; - if ($methodParameters instanceof ClassMethodParameters) { + if ($methodParameters instanceof Parameters) { foreach ($methodParameters->getParameters() as $parameter) { $paramStr = ''; if (isset($parameter['cast'])) { diff --git a/Library/Stubs/MethodDocBlock.php b/Library/Stubs/MethodDocBlock.php index 134c2fb807..42c621dd48 100644 --- a/Library/Stubs/MethodDocBlock.php +++ b/Library/Stubs/MethodDocBlock.php @@ -14,7 +14,7 @@ namespace Zephir\Stubs; use Zephir\AliasManager; -use Zephir\Class\ClassMethod; +use Zephir\Class\Method\Method; use Zephir\Types; /** @@ -54,9 +54,9 @@ class MethodDocBlock extends DocBlock private AliasManager $aliasManager; /** - * @var ClassMethod + * @var Method */ - private ClassMethod $classMethod; + private Method $classMethod; /** * @var Types @@ -64,10 +64,10 @@ class MethodDocBlock extends DocBlock private Types $types; public function __construct( - ClassMethod $method, + Method $method, AliasManager $aliasManager, - string $indent = ' ', - ?Types $types = null + string $indent = ' ', + ?Types $types = null ) { parent::__construct($method->getDocBlock(), $indent); @@ -97,7 +97,7 @@ public function processMethodDocBlock(): string return $this->__toString(); } - protected function parseMethodReturnType(ClassMethod $method): void + protected function parseMethodReturnType(Method $method): void { $return = []; foreach ($method->getReturnTypes() as $type) { @@ -247,7 +247,7 @@ private function appendReturnLine(): void } } - private function parseMethodParameters(ClassMethod $method): void + private function parseMethodParameters(Method $method): void { $parameters = $method->getParameters(); $aliasManager = $method->getClassDefinition()->getAliasManager(); diff --git a/Library/Types.php b/Library/Types.php index 4055038f1a..5cf9160705 100644 --- a/Library/Types.php +++ b/Library/Types.php @@ -11,7 +11,7 @@ namespace Zephir; -use Zephir\Class\ClassMethod; +use Zephir\Class\Method\Method; final class Types { @@ -42,12 +42,12 @@ final class Types /** * Gets PHP compatible return type from class method. * - * @param ClassMethod $method + * @param Method $method * @param array|null $returnTypes * * @return string */ - public function getReturnTypeAnnotation(ClassMethod $method, array $returnTypes = null): string + public function getReturnTypeAnnotation(Method $method, array $returnTypes = null): string { if (!$method->hasReturnTypes() && !$method->isVoid()) { return ''; diff --git a/Library/Variable.php b/Library/Variable.php index 2a523afef7..1f1ed10e1c 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -14,7 +14,7 @@ namespace Zephir; use ReflectionClass; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\Exception\CompilerException; use Zephir\Variable\Globals; use function in_array; @@ -98,7 +98,7 @@ class Variable implements TypeAwareInterface protected array $classTypes = []; - protected ClassDefinition|ReflectionClass|null $associatedClass = null; + protected Definition|ReflectionClass|null $associatedClass = null; /** * Initialization skips. @@ -454,9 +454,9 @@ public function getClassTypes(): array /** * Sets the PHP class related to variable. * - * @param ReflectionClass|ClassDefinition $associatedClass + * @param ReflectionClass|Definition $associatedClass */ - public function setAssociatedClass(ReflectionClass|ClassDefinition $associatedClass): void + public function setAssociatedClass(ReflectionClass|Definition $associatedClass): void { $this->associatedClass = $associatedClass; } @@ -464,7 +464,7 @@ public function setAssociatedClass(ReflectionClass|ClassDefinition $associatedCl /** * Returns the class related to the variable. */ - public function getAssociatedClass(): ClassDefinition|ReflectionClass|null + public function getAssociatedClass(): Definition|ReflectionClass|null { return $this->associatedClass; } diff --git a/templates/Api/themes/zephir/partials/class/content.phtml b/templates/Api/themes/zephir/partials/class/content.phtml index c5444d4f35..7b5bc67cb1 100644 --- a/templates/Api/themes/zephir/partials/class/content.phtml +++ b/templates/Api/themes/zephir/partials/class/content.phtml @@ -4,7 +4,7 @@ * @var string $className * @var array $methods * @var string[] $namespacePieces - * @var \Zephir\Class\ClassDefinition $classDefinition + * @var \Zephir\Class\Definition\Definition $classDefinition * @var Zephir\CompilerFile $compilerFile */ diff --git a/templates/Api/themes/zephir/partials/class/method-details.phtml b/templates/Api/themes/zephir/partials/class/method-details.phtml index 3d6d7bc3cc..098cfdef82 100644 --- a/templates/Api/themes/zephir/partials/class/method-details.phtml +++ b/templates/Api/themes/zephir/partials/class/method-details.phtml @@ -1,6 +1,6 @@ diff --git a/templates/Api/themes/zephir/partials/class/method-summary-params.phtml b/templates/Api/themes/zephir/partials/class/method-summary-params.phtml index d83da6dcdd..3e607d0e05 100644 --- a/templates/Api/themes/zephir/partials/class/method-summary-params.phtml +++ b/templates/Api/themes/zephir/partials/class/method-summary-params.phtml @@ -1,6 +1,6 @@ getParameters()) { diff --git a/templates/Api/themes/zephir/partials/class/method-summary.phtml b/templates/Api/themes/zephir/partials/class/method-summary.phtml index 861bc2c392..fa68581e65 100644 --- a/templates/Api/themes/zephir/partials/class/method-summary.phtml +++ b/templates/Api/themes/zephir/partials/class/method-summary.phtml @@ -1,7 +1,7 @@ diff --git a/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml b/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml index f3349c4763..60cbea36f9 100644 --- a/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml +++ b/templates/Api/themes/zephir/partials/namespace/method-summary-params.phtml @@ -1,6 +1,6 @@ getParameters()){ $i=0; diff --git a/templates/Api/themes/zephir/partials/namespace/method-summary.phtml b/templates/Api/themes/zephir/partials/namespace/method-summary.phtml index 5be7c39029..1a3e26028e 100644 --- a/templates/Api/themes/zephir/partials/namespace/method-summary.phtml +++ b/templates/Api/themes/zephir/partials/namespace/method-summary.phtml @@ -1,6 +1,6 @@ diff --git a/templates/Api/themes/zephir/partials/source.phtml b/templates/Api/themes/zephir/partials/source.phtml index 7b153f5b59..2cc090d244 100644 --- a/templates/Api/themes/zephir/partials/source.phtml +++ b/templates/Api/themes/zephir/partials/source.phtml @@ -3,7 +3,7 @@ * @var string $fullName * @var string $className * @var array $namespacePieces - * @var \Zephir\Class\ClassDefinition $classDefinition + * @var \Zephir\Class\Definition\Definition $classDefinition * @var Zephir\CompilerFile $compilerFile */ diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index 11618e2a3d..e607da7317 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -16,11 +16,11 @@ use PHPUnit\Framework\TestCase; use ReflectionException; use Zephir\AliasManager; -use Zephir\Class\ClassConstant; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; -use Zephir\Class\ClassProperty; +use Zephir\Class\Property; +use Zephir\Class\Constant; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use Zephir\Stubs\Generator; use function Zephir\is_windows; @@ -31,13 +31,13 @@ class GeneratorTest extends TestCase */ private $generatorClass; private Generator $testClass; - private ClassDefinition $classDefinition; + private Definition $classDefinition; protected function setUp(): void { $this->generatorClass = new \ReflectionClass(Generator::class); $this->testClass = new Generator([]); - $this->classDefinition = new ClassDefinition('Stub\Stubs', 'StubsBuildClass'); + $this->classDefinition = new Definition('Stub\Stubs', 'StubsBuildClass'); } /** @@ -101,8 +101,8 @@ public static function init(string \$key, int \$priority = 1) $buildClass = $this->getMethod('buildClass'); - $extendsClassDefinition = new ClassDefinition('Stub\Extendable', 'BaseTestClass'); - $implementClassDefinition = new ClassDefinition('Stub\Events', 'EventsManagerInterface'); + $extendsClassDefinition = new Definition('Stub\Extendable', 'BaseTestClass'); + $implementClassDefinition = new Definition('Stub\Events', 'EventsManagerInterface'); $aliasManager = new AliasManager(); // Definitions @@ -128,14 +128,14 @@ public static function init(string \$key, int \$priority = 1) ], ]; - $classMethod = new ClassMethod( + $classMethod = new Method( $this->classDefinition, ['public', 'static'], 'init', - new ClassMethodParameters($methodParamsDefinition) + new Parameters($methodParamsDefinition) ); - $constantsDefinition = new ClassConstant( + $constantsDefinition = new Constant( 'DEFAULT_PATH_DELIMITER', [ 'type' => 'string', @@ -144,7 +144,7 @@ public static function init(string \$key, int \$priority = 1) 'Default path delimiter' ); - $propertyDefinition = new ClassProperty( + $propertyDefinition = new Property( $this->classDefinition, ['public', 'static'], 'defaultPathDelimiter', @@ -263,7 +263,7 @@ public function testShouldBuildProperty(array $visibility, string $type, $value, // Test requirements initialization $buildClass = $this->getMethod('buildProperty'); - $classProperty = new ClassProperty( + $classProperty = new Property( $this->classDefinition, $visibility, 'testProperty', @@ -359,7 +359,7 @@ public function testShouldBuildConstant(string $type, $value, string $expected): $extended = $value; } - $classConstant = new ClassConstant( + $classConstant = new Constant( 'TEST', [ 'type' => $type, @@ -408,7 +408,7 @@ public function testShouldBuildMethod(): void ], ], ]; - $methodParams = new ClassMethodParameters($methodParamsDefinition); + $methodParams = new Parameters($methodParamsDefinition); $returnType = [ 'type' => 'return-type', @@ -424,7 +424,7 @@ public function testShouldBuildMethod(): void $this->classDefinition->setAliasManager(new AliasManager()); - $classMethod = new ClassMethod( + $classMethod = new Method( $this->classDefinition, ['public', 'static'], 'testName', diff --git a/tests/Zephir/Stubs/MethodDocBlockTest.php b/tests/Zephir/Stubs/MethodDocBlockTest.php index 0b9a704344..2a396a7b32 100644 --- a/tests/Zephir/Stubs/MethodDocBlockTest.php +++ b/tests/Zephir/Stubs/MethodDocBlockTest.php @@ -15,9 +15,9 @@ use PHPUnit\Framework\TestCase; use Zephir\AliasManager; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; -use Zephir\Class\ClassMethodParameters; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Method\Method; use Zephir\StatementsBlock; use Zephir\Stubs\MethodDocBlock; @@ -36,7 +36,7 @@ public function prepareMethod(array $params): MethodDocBlock $className = $params['class']['className']; $classShortName = $params['class']['classShortName']; - $classDefinition = new ClassDefinition( + $classDefinition = new Definition( $classNamespace, $className, $classShortName @@ -45,10 +45,10 @@ public function prepareMethod(array $params): MethodDocBlock /** * ClassMethod constructor. * - * @param ClassDefinition $classDefinition + * @param Definition $classDefinition * @param array $visibility * @param string $name - * @param ClassMethodParameters|null $parameters + * @param Parameters|null $parameters * @param StatementsBlock|null $statements * @param string|null $docblock * @param array|null $returnType @@ -62,11 +62,11 @@ public function prepareMethod(array $params): MethodDocBlock $methodReturnType = $params['method']['returnType']; $methodExpression = $params['method']['expression']; - $classMethod = new ClassMethod( + $classMethod = new Method( $classDefinition, $methodVisibility, $methodName, - $methodParams ? new ClassMethodParameters($methodParams) : null, + $methodParams ? new Parameters($methodParams) : null, new StatementsBlock($methodStBlock), $methodDocBlock, $methodReturnType, @@ -250,8 +250,8 @@ public function docBlockProvider(): array */ public function testShouldParseDocBlock(string $zephirDocBlock, string $phpDocBlock): void { - $classMethod = new ClassMethod( - new ClassDefinition('Zephir', 'testMethod'), + $classMethod = new Method( + new Definition('Zephir', 'testMethod'), ['public'], 'exampleMethodName', null, diff --git a/tests/Zephir/TypesTest.php b/tests/Zephir/TypesTest.php index b60f1412eb..157af90ec9 100644 --- a/tests/Zephir/TypesTest.php +++ b/tests/Zephir/TypesTest.php @@ -14,8 +14,8 @@ namespace Zephir\Test; use PHPUnit\Framework\TestCase; -use Zephir\Class\ClassDefinition; -use Zephir\Class\ClassMethod; +use Zephir\Class\Definition\Definition; +use Zephir\Class\Method\Method; use Zephir\Types; final class TypesTest extends TestCase @@ -101,10 +101,10 @@ function ($type) use ($collection) { * @param array $testData - dataProvider data set * @param int $definition - (optional) one of mandatory/collection flag */ - private function buildMethod(array $testData, int $definition = 0): ClassMethod + private function buildMethod(array $testData, int $definition = 0): Method { - return new ClassMethod( - new ClassDefinition('Zephir', 'testMethod'), + return new Method( + new Definition('Zephir', 'testMethod'), ['public'], 'exampleMethodName', null, diff --git a/tests/Zephir/VariableTest.php b/tests/Zephir/VariableTest.php index 409efafe81..84020a92e7 100644 --- a/tests/Zephir/VariableTest.php +++ b/tests/Zephir/VariableTest.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\TestCase; use Zephir\Branch; use Zephir\BranchManager; -use Zephir\Class\ClassDefinition; +use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; @@ -128,7 +128,7 @@ public function testShouldSetProperties(): void $this->zephirVar->setClassTypes('class1'); $this->assertSame(['class1', 'class2', 'class3'], $this->zephirVar->getClassTypes()); - $classDefinition = new ClassDefinition('Zephir\Test', 'VariableTest'); + $classDefinition = new Definition('Zephir\Test', 'VariableTest'); $this->zephirVar->setAssociatedClass($classDefinition); $this->assertSame($classDefinition, $this->zephirVar->getAssociatedClass()); From 37fda6c9d7f95e66edb9ccd2271208a02f751567 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 17:37:50 +0100 Subject: [PATCH 062/375] #2407 - Reformat code with PHP8.0 syntax sugar --- .../Logger/Formatter/CompilerFormatter.php | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/Library/Logger/Formatter/CompilerFormatter.php b/Library/Logger/Formatter/CompilerFormatter.php index f8d5fe3374..99e5320960 100644 --- a/Library/Logger/Formatter/CompilerFormatter.php +++ b/Library/Logger/Formatter/CompilerFormatter.php @@ -27,30 +27,16 @@ final class CompilerFormatter extends LineFormatter { public const SIMPLE_FORMAT = " %level_name%: %message% in %file% on line %line% %type%\n"; - /** - * @var Config - */ - private Config $config; - /** * The contents of the files that are involved in the log message. - * - * @var array */ private array $filesContent = []; - public function __construct(Config $config) + public function __construct(private Config $config) { parent::__construct(); - - $this->config = $config; } - /** - * @param array $record - * - * @return string - */ public function format(array $record): string { if ($this->config->get('silent')) { @@ -141,10 +127,6 @@ private function replacePlaceholders(array $vars, $output) /** * Remove leftover %extra.xxx% and %context.xxx% (if any). - * - * @param string $output - * - * @return string */ private function cleanExtraPlaceholders(string $output): string { @@ -160,10 +142,6 @@ private function cleanExtraPlaceholders(string $output): string /** * Gets the contents of the files that are involved in the log message. - * - * @param string $file File path - * - * @return array */ private function getFileContents(string $file): array { From 2d240e209f4e4b88102d88cdb1836d3226be199a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 17:39:13 +0100 Subject: [PATCH 063/375] #2407 - Move `CacheManager` class inside `Cache/` directory --- Library/{CacheManager.php => Cache/Manager.php} | 8 ++------ Library/Class/Method/Method.php | 4 ++-- Library/CompilationContext.php | 3 ++- 3 files changed, 6 insertions(+), 9 deletions(-) rename Library/{CacheManager.php => Cache/Manager.php} (93%) diff --git a/Library/CacheManager.php b/Library/Cache/Manager.php similarity index 93% rename from Library/CacheManager.php rename to Library/Cache/Manager.php index 02cbb8efe0..da15216156 100644 --- a/Library/CacheManager.php +++ b/Library/Cache/Manager.php @@ -11,18 +11,14 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Cache; -use Zephir\Cache\ClassEntryCache; -use Zephir\Cache\FunctionCache; -use Zephir\Cache\MethodCache; -use Zephir\Cache\StaticMethodCache; use Zephir\Passes\CallGathererPass; /** * Creates and manages function, method and class entries caches */ -class CacheManager +class Manager { /** * @var FunctionCache|null diff --git a/Library/Class/Method/Method.php b/Library/Class/Method/Method.php index 4fad91278d..f6e1692ff7 100644 --- a/Library/Class/Method/Method.php +++ b/Library/Class/Method/Method.php @@ -16,7 +16,7 @@ use ReflectionException; use Zephir\Branch; use Zephir\BranchManager; -use Zephir\CacheManager; +use Zephir\Cache\Manager; use Zephir\Class\Definition\Definition; use Zephir\Class\Entry as ClassEntry; use Zephir\CodePrinter; @@ -1376,7 +1376,7 @@ public function compile(CompilationContext $compilationContext): void /** * Cache Manager manages function calls, method calls and class entries caches. */ - $cacheManager = new CacheManager(); + $cacheManager = new Manager(); $cacheManager->setGatherer($callGathererPass); $compilationContext->cacheManager = $cacheManager; diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index b6e857c8ab..f80831c43a 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface; use Zephir\Backend\Backend; +use Zephir\Cache\Manager; use Zephir\Cache\FunctionCache; use Zephir\Class\Definition\AbstractDefinition; use Zephir\Class\Definition\Definition; @@ -114,7 +115,7 @@ class CompilationContext /** * Manages both function and method call caches. */ - public ?CacheManager $cacheManager = null; + public ?Manager $cacheManager = null; /** * Manages class renaming using keyword 'use'. From d2cb632df174bd3be3ea57a59cef4effda074b07 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 17:41:37 +0100 Subject: [PATCH 064/375] #2407 - Move `Variable` class inside `Variable/` directory --- Library/Backend/Backend.php | 2 +- Library/Backend/VariablesManager.php | 2 +- Library/Cache/ClassEntryCache.php | 2 +- Library/Cache/MethodCache.php | 2 +- Library/Call.php | 1 + Library/Class/Method/Method.php | 2 +- Library/Detectors/ReadDetector.php | 3 +-- Library/Expression.php | 1 + Library/Expression/Closure.php | 6 +++--- Library/Expression/Constants.php | 3 +-- Library/Expression/NativeArray.php | 3 +-- Library/Expression/NativeArrayAccess.php | 2 +- Library/Expression/PropertyAccess.php | 2 +- Library/Expression/PropertyDynamicAccess.php | 3 +-- Library/Expression/Reference.php | 2 +- Library/Expression/StaticConstantAccess.php | 2 +- Library/Expression/StaticPropertyAccess.php | 2 +- Library/MethodCall.php | 1 + Library/Operators/AbstractOperator.php | 2 +- .../Operators/Arithmetical/ArithmeticalBaseOperator.php | 2 +- Library/Optimizers/EvalExpression.php | 2 +- Library/Optimizers/FunctionCall/PregMatchOptimizer.php | 2 +- Library/Statements/ForStatement.php | 3 +-- Library/Statements/Let/ArrayIndex.php | 2 +- Library/Statements/Let/ArrayIndexAppend.php | 2 +- Library/Statements/Let/Decr.php | 2 +- Library/Statements/Let/ExportSymbol.php | 2 +- Library/Statements/Let/ExportSymbolString.php | 2 +- Library/Statements/Let/Incr.php | 2 +- Library/Statements/Let/ObjectDynamicProperty.php | 2 +- Library/Statements/Let/ObjectDynamicStringProperty.php | 2 +- Library/Statements/Let/ObjectProperty.php | 2 +- Library/Statements/Let/ObjectPropertyAppend.php | 2 +- Library/Statements/Let/ObjectPropertyArrayIndex.php | 2 +- Library/Statements/Let/ObjectPropertyArrayIndexAppend.php | 2 +- Library/Statements/Let/ObjectPropertyDecr.php | 2 +- Library/Statements/Let/ObjectPropertyIncr.php | 2 +- Library/Statements/Let/Variable.php | 3 +-- Library/Statements/Let/VariableAppend.php | 2 +- Library/StaticCall.php | 1 + Library/SymbolTable.php | 6 +++--- Library/{ => Variable}/Variable.php | 8 ++++++-- tests/Zephir/Backends/ZendEngine3/BackendTest.php | 2 +- .../Optimizers/FunctionCall/PregMatchOptimizerTest.php | 2 +- tests/Zephir/Statements/Let/VariableTest.php | 2 +- tests/Zephir/{ => Variable}/VariableTest.php | 4 ++-- 46 files changed, 56 insertions(+), 54 deletions(-) rename Library/{ => Variable}/Variable.php (99%) rename tests/Zephir/{ => Variable}/VariableTest.php (99%) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index a80a930d89..a3996ad109 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -25,8 +25,8 @@ use Zephir\Fcall\FcallManagerInterface; use Zephir\FunctionDefinition; use Zephir\GlobalConstant; -use Zephir\Variable; use Zephir\Variable\Globals; +use Zephir\Variable\Variable; use function in_array; use function strlen; use function Zephir\add_slashes; diff --git a/Library/Backend/VariablesManager.php b/Library/Backend/VariablesManager.php index 9eaf4b6053..69a8b89236 100644 --- a/Library/Backend/VariablesManager.php +++ b/Library/Backend/VariablesManager.php @@ -16,7 +16,7 @@ use Zephir\CompilationContext as Context; use Zephir\Exception\CompilerException as Exception; use Zephir\Types; -use Zephir\Variable; +use Zephir\Variable\Variable; use function Zephir\Backend\ZendEngine3\add_slashes; class VariablesManager diff --git a/Library/Cache/ClassEntryCache.php b/Library/Cache/ClassEntryCache.php index d49dcc4560..13f4536370 100644 --- a/Library/Cache/ClassEntryCache.php +++ b/Library/Cache/ClassEntryCache.php @@ -14,7 +14,7 @@ namespace Zephir\Cache; use Zephir\CompilationContext; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Classes located in the PHP userland are cached to avoid further relocates diff --git a/Library/Cache/MethodCache.php b/Library/Cache/MethodCache.php index 23bb745e3a..5a1e497f40 100644 --- a/Library/Cache/MethodCache.php +++ b/Library/Cache/MethodCache.php @@ -18,7 +18,7 @@ use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Passes\CallGathererPass; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Calls in Zephir implement monomorphic and polymorphic caches to diff --git a/Library/Call.php b/Library/Call.php index 5644c47023..0d8720c9e0 100644 --- a/Library/Call.php +++ b/Library/Call.php @@ -15,6 +15,7 @@ use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; +use Zephir\Variable\Variable; /** * Base class for common functionality in functions/calls diff --git a/Library/Class/Method/Method.php b/Library/Class/Method/Method.php index f6e1692ff7..9ddd3538ca 100644 --- a/Library/Class/Method/Method.php +++ b/Library/Class/Method/Method.php @@ -32,7 +32,7 @@ use Zephir\Passes\StaticTypeInference; use Zephir\StatementsBlock; use Zephir\SymbolTable; -use Zephir\Variable; +use Zephir\Variable\Variable; use function array_key_exists; use function count; use function in_array; diff --git a/Library/Detectors/ReadDetector.php b/Library/Detectors/ReadDetector.php index 160f8d0019..d616c8e576 100644 --- a/Library/Detectors/ReadDetector.php +++ b/Library/Detectors/ReadDetector.php @@ -13,8 +13,7 @@ namespace Zephir\Detectors; -use Zephir\Variable; - +use Zephir\Variable\Variable; use function is_array; /** diff --git a/Library/Expression.php b/Library/Expression.php index 6237876872..f002195974 100644 --- a/Library/Expression.php +++ b/Library/Expression.php @@ -67,6 +67,7 @@ use Zephir\Operators\Other\UnlikelyOperator; use Zephir\Operators\Unary\MinusOperator; use Zephir\Operators\Unary\NotOperator; +use Zephir\Variable\Variable; /** * Represents an expression. diff --git a/Library/Expression/Closure.php b/Library/Expression/Closure.php index d98aa5a727..1e80cbd82a 100644 --- a/Library/Expression/Closure.php +++ b/Library/Expression/Closure.php @@ -13,16 +13,16 @@ namespace Zephir\Expression; -use Zephir\Class\Property; use Zephir\Class\Definition\Definition; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; use Zephir\Exception; use Zephir\StatementsBlock; -use Zephir\Variable; +use Zephir\Variable\Variable; use function is_array; /** diff --git a/Library/Expression/Constants.php b/Library/Expression/Constants.php index 587105183b..da8c874d36 100644 --- a/Library/Expression/Constants.php +++ b/Library/Expression/Constants.php @@ -15,8 +15,7 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\LiteralCompiledExpression; -use Zephir\Variable; - +use Zephir\Variable\Variable; use function constant; use function defined; use function gettype; diff --git a/Library/Expression/NativeArray.php b/Library/Expression/NativeArray.php index 71e9605a25..a1d13afa22 100644 --- a/Library/Expression/NativeArray.php +++ b/Library/Expression/NativeArray.php @@ -20,8 +20,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\GlobalConstant; -use Zephir\Variable; - +use Zephir\Variable\Variable; use function count; use function function_exists; diff --git a/Library/Expression/NativeArrayAccess.php b/Library/Expression/NativeArrayAccess.php index a4fde9f071..28e167c1ca 100644 --- a/Library/Expression/NativeArrayAccess.php +++ b/Library/Expression/NativeArrayAccess.php @@ -19,7 +19,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Resolves expressions that read array indexes diff --git a/Library/Expression/PropertyAccess.php b/Library/Expression/PropertyAccess.php index 0165825db4..d1bcf4d192 100644 --- a/Library/Expression/PropertyAccess.php +++ b/Library/Expression/PropertyAccess.php @@ -15,7 +15,7 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Resolves expressions that read properties diff --git a/Library/Expression/PropertyDynamicAccess.php b/Library/Expression/PropertyDynamicAccess.php index 31218d182d..e62992deba 100644 --- a/Library/Expression/PropertyDynamicAccess.php +++ b/Library/Expression/PropertyDynamicAccess.php @@ -15,8 +15,7 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable; - +use Zephir\Variable\Variable; use function Zephir\add_slashes; /** diff --git a/Library/Expression/Reference.php b/Library/Expression/Reference.php index 28bd4b122c..d5e87b53d4 100644 --- a/Library/Expression/Reference.php +++ b/Library/Expression/Reference.php @@ -19,7 +19,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Expression Reference diff --git a/Library/Expression/StaticConstantAccess.php b/Library/Expression/StaticConstantAccess.php index d98337de3c..282062e756 100644 --- a/Library/Expression/StaticConstantAccess.php +++ b/Library/Expression/StaticConstantAccess.php @@ -19,7 +19,7 @@ use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; -use Zephir\Variable; +use Zephir\Variable\Variable; use function gettype; use function in_array; diff --git a/Library/Expression/StaticPropertyAccess.php b/Library/Expression/StaticPropertyAccess.php index 3fea7d9a04..228ba3ae30 100644 --- a/Library/Expression/StaticPropertyAccess.php +++ b/Library/Expression/StaticPropertyAccess.php @@ -19,7 +19,7 @@ use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; -use Zephir\Variable; +use Zephir\Variable\Variable; use function in_array; /** diff --git a/Library/MethodCall.php b/Library/MethodCall.php index 7074f758d8..736e897689 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -15,6 +15,7 @@ use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; +use Zephir\Variable\Variable; /** * Call methods in a non-static context diff --git a/Library/Operators/AbstractOperator.php b/Library/Operators/AbstractOperator.php index 037f5066ef..d35b8aca1b 100644 --- a/Library/Operators/AbstractOperator.php +++ b/Library/Operators/AbstractOperator.php @@ -14,7 +14,7 @@ namespace Zephir\Operators; use Zephir\CompilationContext; -use Zephir\Variable; +use Zephir\Variable\Variable; abstract class AbstractOperator { diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php index c490503d83..a6d992e14b 100644 --- a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php +++ b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php @@ -17,7 +17,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Operators\AbstractOperator; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * This is the base operator for commutative, associative and distributive diff --git a/Library/Optimizers/EvalExpression.php b/Library/Optimizers/EvalExpression.php index f0d19b9faf..94a64a9463 100644 --- a/Library/Optimizers/EvalExpression.php +++ b/Library/Optimizers/EvalExpression.php @@ -19,7 +19,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\LiteralCompiledExpression; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Resolves evaluation of expressions returning a C-int expression that can be used by 'if'/'while'/'do-while' statements diff --git a/Library/Optimizers/FunctionCall/PregMatchOptimizer.php b/Library/Optimizers/FunctionCall/PregMatchOptimizer.php index c5d96ae52d..b1822b8c8a 100644 --- a/Library/Optimizers/FunctionCall/PregMatchOptimizer.php +++ b/Library/Optimizers/FunctionCall/PregMatchOptimizer.php @@ -17,7 +17,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; -use Zephir\Variable; +use Zephir\Variable\Variable; /** * Zephir\Optimizers\FunctionCall\PregMatchOptimizer. diff --git a/Library/Statements/ForStatement.php b/Library/Statements/ForStatement.php index b85dec19aa..5edf1e3a0d 100644 --- a/Library/Statements/ForStatement.php +++ b/Library/Statements/ForStatement.php @@ -21,8 +21,7 @@ use Zephir\FunctionCall; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; -use Zephir\Variable; - +use Zephir\Variable\Variable; use function Zephir\add_slashes; class ForStatement extends StatementAbstract diff --git a/Library/Statements/Let/ArrayIndex.php b/Library/Statements/Let/ArrayIndex.php index c42e9d7e29..9880cbcef0 100644 --- a/Library/Statements/Let/ArrayIndex.php +++ b/Library/Statements/Let/ArrayIndex.php @@ -16,7 +16,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\GlobalConstant; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ArrayIndex. diff --git a/Library/Statements/Let/ArrayIndexAppend.php b/Library/Statements/Let/ArrayIndexAppend.php index 270d8ff754..57b0a79583 100644 --- a/Library/Statements/Let/ArrayIndexAppend.php +++ b/Library/Statements/Let/ArrayIndexAppend.php @@ -15,7 +15,7 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ArrayIndexAppend. diff --git a/Library/Statements/Let/Decr.php b/Library/Statements/Let/Decr.php index 0c7e0bb0bb..15fe91dd18 100644 --- a/Library/Statements/Let/Decr.php +++ b/Library/Statements/Let/Decr.php @@ -13,7 +13,7 @@ use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * Decr. diff --git a/Library/Statements/Let/ExportSymbol.php b/Library/Statements/Let/ExportSymbol.php index a8940d6c71..4b6693cea0 100644 --- a/Library/Statements/Let/ExportSymbol.php +++ b/Library/Statements/Let/ExportSymbol.php @@ -14,7 +14,7 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Statements\LetStatement; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ExportSymbol. diff --git a/Library/Statements/Let/ExportSymbolString.php b/Library/Statements/Let/ExportSymbolString.php index 6097b23922..ae092c1734 100644 --- a/Library/Statements/Let/ExportSymbolString.php +++ b/Library/Statements/Let/ExportSymbolString.php @@ -14,7 +14,7 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Statements\LetStatement; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ExportSymbolString. diff --git a/Library/Statements/Let/Incr.php b/Library/Statements/Let/Incr.php index 974808f70c..3df7523089 100644 --- a/Library/Statements/Let/Incr.php +++ b/Library/Statements/Let/Incr.php @@ -13,7 +13,7 @@ use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * Incr. diff --git a/Library/Statements/Let/ObjectDynamicProperty.php b/Library/Statements/Let/ObjectDynamicProperty.php index b691089380..9c7ade5d1e 100644 --- a/Library/Statements/Let/ObjectDynamicProperty.php +++ b/Library/Statements/Let/ObjectDynamicProperty.php @@ -17,7 +17,7 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * Updates object properties dynamically diff --git a/Library/Statements/Let/ObjectDynamicStringProperty.php b/Library/Statements/Let/ObjectDynamicStringProperty.php index 7d54d71dcb..c20d2251d0 100644 --- a/Library/Statements/Let/ObjectDynamicStringProperty.php +++ b/Library/Statements/Let/ObjectDynamicStringProperty.php @@ -16,7 +16,7 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * Updates object properties dynamically diff --git a/Library/Statements/Let/ObjectProperty.php b/Library/Statements/Let/ObjectProperty.php index e7e8dc9e8c..c277bb8c0a 100644 --- a/Library/Statements/Let/ObjectProperty.php +++ b/Library/Statements/Let/ObjectProperty.php @@ -16,7 +16,7 @@ use Zephir\CompilationContext as Context; use Zephir\CompiledExpression as Expression; use Zephir\Exception\CompilerException as Exception; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * Adds/Updates an array index diff --git a/Library/Statements/Let/ObjectPropertyAppend.php b/Library/Statements/Let/ObjectPropertyAppend.php index 8c11838ee2..0317cf4ee4 100644 --- a/Library/Statements/Let/ObjectPropertyAppend.php +++ b/Library/Statements/Let/ObjectPropertyAppend.php @@ -14,7 +14,7 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ObjectPropertyAppend. diff --git a/Library/Statements/Let/ObjectPropertyArrayIndex.php b/Library/Statements/Let/ObjectPropertyArrayIndex.php index 9c221543b1..7fa1d8b79e 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndex.php +++ b/Library/Statements/Let/ObjectPropertyArrayIndex.php @@ -15,7 +15,7 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ObjectPropertyArrayIndex. diff --git a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php b/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php index b7d02416b0..a27b54ae01 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php +++ b/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php @@ -16,7 +16,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * Updates object properties dynamically diff --git a/Library/Statements/Let/ObjectPropertyDecr.php b/Library/Statements/Let/ObjectPropertyDecr.php index 768963a298..40763179e9 100644 --- a/Library/Statements/Let/ObjectPropertyDecr.php +++ b/Library/Statements/Let/ObjectPropertyDecr.php @@ -13,7 +13,7 @@ use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ObjectPropertyDecr. diff --git a/Library/Statements/Let/ObjectPropertyIncr.php b/Library/Statements/Let/ObjectPropertyIncr.php index 8ac0a698b4..88633e2d5b 100644 --- a/Library/Statements/Let/ObjectPropertyIncr.php +++ b/Library/Statements/Let/ObjectPropertyIncr.php @@ -13,7 +13,7 @@ use Zephir\CompilationContext; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * ObjectPropertyIncr. diff --git a/Library/Statements/Let/Variable.php b/Library/Statements/Let/Variable.php index 479446029f..9debd6dde3 100644 --- a/Library/Statements/Let/Variable.php +++ b/Library/Statements/Let/Variable.php @@ -17,8 +17,7 @@ use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; use Zephir\Exception\IllegalOperationException; -use Zephir\Variable as ZephirVariable; - +use Zephir\Variable\Variable as ZephirVariable; use function Zephir\add_slashes; /** diff --git a/Library/Statements/Let/VariableAppend.php b/Library/Statements/Let/VariableAppend.php index 42595d41c7..caccc18bfa 100644 --- a/Library/Statements/Let/VariableAppend.php +++ b/Library/Statements/Let/VariableAppend.php @@ -14,7 +14,7 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; /** * VariableAppend. diff --git a/Library/StaticCall.php b/Library/StaticCall.php index 6d2b227f26..c1161bbebc 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -16,6 +16,7 @@ use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; +use Zephir\Variable\Variable; use function count; use function in_array; use function is_string; diff --git a/Library/SymbolTable.php b/Library/SymbolTable.php index 4624fb3e3f..818d6f9b26 100644 --- a/Library/SymbolTable.php +++ b/Library/SymbolTable.php @@ -16,7 +16,7 @@ use Zephir\Exception\CompilerException; use Zephir\Passes\LocalContextPass; use Zephir\Variable\Globals; - +use Zephir\Variable\Variable; use function count; /** @@ -401,9 +401,9 @@ public function getVariableForRead($name, CompilationContext $compilationContext * @param CompilationContext $compilationContext * @param array $statement * - * @throws CompilerException + * @return bool|\Zephir\Variable\Variable + *@throws CompilerException * - * @return bool|\Zephir\Variable */ public function getVariableForWrite($name, CompilationContext $compilationContext, array $statement = null) { diff --git a/Library/Variable.php b/Library/Variable/Variable.php similarity index 99% rename from Library/Variable.php rename to Library/Variable/Variable.php index 1f1ed10e1c..fef290049e 100644 --- a/Library/Variable.php +++ b/Library/Variable/Variable.php @@ -11,12 +11,16 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Variable; use ReflectionClass; +use Zephir\Branch; +use Zephir\BranchManager; use Zephir\Class\Definition\Definition; +use Zephir\CompilationContext; +use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Variable\Globals; +use Zephir\TypeAwareInterface; use function in_array; use function is_string; diff --git a/tests/Zephir/Backends/ZendEngine3/BackendTest.php b/tests/Zephir/Backends/ZendEngine3/BackendTest.php index dbe6ce76ca..5a94e16a09 100644 --- a/tests/Zephir/Backends/ZendEngine3/BackendTest.php +++ b/tests/Zephir/Backends/ZendEngine3/BackendTest.php @@ -17,7 +17,7 @@ use Zephir\Backend\Backend; use Zephir\CompilationContext; use Zephir\Config; -use Zephir\Variable; +use Zephir\Variable\Variable; final class BackendTest extends TestCase { diff --git a/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php b/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php index cda80e7caf..7b0cadb0cf 100644 --- a/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php +++ b/tests/Zephir/Optimizers/FunctionCall/PregMatchOptimizerTest.php @@ -20,7 +20,7 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\FunctionCall\PregMatchOptimizer; use Zephir\SymbolTable; -use Zephir\Variable; +use Zephir\Variable\Variable; final class PregMatchOptimizerTest extends TestCase { diff --git a/tests/Zephir/Statements/Let/VariableTest.php b/tests/Zephir/Statements/Let/VariableTest.php index d8b773b796..90af5c5538 100644 --- a/tests/Zephir/Statements/Let/VariableTest.php +++ b/tests/Zephir/Statements/Let/VariableTest.php @@ -20,7 +20,7 @@ use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; use Zephir\Statements\Let\Variable; -use Zephir\Variable as ZephirVariable; +use Zephir\Variable\Variable as ZephirVariable; final class VariableTest extends TestCase { diff --git a/tests/Zephir/VariableTest.php b/tests/Zephir/Variable/VariableTest.php similarity index 99% rename from tests/Zephir/VariableTest.php rename to tests/Zephir/Variable/VariableTest.php index 84020a92e7..a250667937 100644 --- a/tests/Zephir/VariableTest.php +++ b/tests/Zephir/Variable/VariableTest.php @@ -11,7 +11,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Test; +namespace Zephir\Test\Variable; use PHPUnit\Framework\TestCase; use Zephir\Branch; @@ -20,7 +20,7 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; -use Zephir\Variable; +use Zephir\Variable\Variable; final class VariableTest extends TestCase { From 983d9aea0f36c3a5d57025782ec003bd81d13ac7 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 17:52:34 +0100 Subject: [PATCH 065/375] #2407 - Move `CodePrinter` inside `Code/` directory --- Library/Backend/Backend.php | 4 +- Library/Backend/FcallManager.php | 5 +- Library/Class/Definition/Definition.php | 10 +-- Library/Class/Method/Method.php | 12 ++-- Library/{CodePrinter.php => Code/Printer.php} | 20 +----- Library/CompilationContext.php | 7 +- Library/Compiler.php | 6 +- Library/CompilerFile.php | 7 +- Library/CompilerFileAnonymous.php | 3 +- Library/Statements/Let/Variable.php | 71 +++++++------------ Library/Statements/ThrowStatement.php | 7 +- 11 files changed, 60 insertions(+), 92 deletions(-) rename Library/{CodePrinter.php => Code/Printer.php} (92%) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index a3996ad109..ecbe4a85b4 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -15,7 +15,7 @@ use Zephir\Class\Definition\Definition; use Zephir\Class\Method\Method; -use Zephir\CodePrinter; +use Zephir\Code\Printer; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Compiler; @@ -435,7 +435,7 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va */ public function initializeVariableDefaults(array $variables, CompilationContext $context): string { - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $codePrinter->increaseLevel(); $oldCodePrinter = $context->codePrinter; diff --git a/Library/Backend/FcallManager.php b/Library/Backend/FcallManager.php index 6401de07cd..af1855c1db 100644 --- a/Library/Backend/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -13,9 +13,8 @@ namespace Zephir\Backend; -use Zephir\CodePrinter; +use Zephir\Code\Printer; use Zephir\Fcall\FcallManagerInterface; - use function Zephir\file_put_contents_ex; class FcallManager implements FcallManagerInterface @@ -54,7 +53,7 @@ public function getMacro($static, $doReturn, $paramCount): string public function genFcallCode(): void { - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $header = <<outputBlankLine(); $codePrinter->output($exportAPI.' zend_class_entry *'.$this->getClassEntry().';'); diff --git a/Library/Class/Method/Method.php b/Library/Class/Method/Method.php index 9ddd3538ca..6607734448 100644 --- a/Library/Class/Method/Method.php +++ b/Library/Class/Method/Method.php @@ -19,7 +19,7 @@ use Zephir\Cache\Manager; use Zephir\Class\Definition\Definition; use Zephir\Class\Entry as ClassEntry; -use Zephir\CodePrinter; +use Zephir\Code\Printer; use Zephir\CompilationContext; use Zephir\Detectors\WriteDetector; use Zephir\Documentation\Docblock; @@ -875,7 +875,7 @@ public function assignDefaultValue(array $parameter, CompilationContext $compila } $oldCodePrinter = $compilationContext->codePrinter; - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $codePrinter->increaseLevel(); $codePrinter->increaseLevel(); $compilationContext->codePrinter = $codePrinter; @@ -1201,7 +1201,7 @@ public function checkStrictType(array $parameter, CompilationContext $compilatio $compilationContext->headersManager->add('ext/spl/spl_exceptions'); $compilationContext->headersManager->add('kernel/exception'); - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $codePrinter->increaseLevel(); $oldCodePrinter = $compilationContext->codePrinter; $compilationContext->codePrinter = $codePrinter; @@ -1388,7 +1388,7 @@ public function compile(CompilationContext $compilationContext): void /** * Change the code printer to a single method instance. */ - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $compilationContext->codePrinter = $codePrinter; /** @@ -1683,7 +1683,7 @@ public function compile(CompilationContext $compilationContext): void } else { foreach ($params as $param) { /* TODO: Migrate all this code to codeprinter, get rid of temp code printer */ - $tempCodePrinter = new CodePrinter(); + $tempCodePrinter = new Printer(); $realCodePrinter = $compilationContext->codePrinter; $compilationContext->codePrinter = $tempCodePrinter; $paramVar = $compilationContext->symbolTable->getVariableForRead($param, $compilationContext); @@ -1806,7 +1806,7 @@ public function compile(CompilationContext $compilationContext): void /** * ZEND_PARSE_PARAMETERS */ - $tempCodePrinter = new CodePrinter(); + $tempCodePrinter = new Printer(); if ($this->parameters instanceof Parameters && $this->parameters->count() > 0) { $tempCodePrinter->output('#if PHP_VERSION_ID >= 80000'); $tempCodePrinter->output("\t".'bool is_null_true = 1;'); diff --git a/Library/CodePrinter.php b/Library/Code/Printer.php similarity index 92% rename from Library/CodePrinter.php rename to Library/Code/Printer.php index 93910aac00..121273f7b8 100644 --- a/Library/CodePrinter.php +++ b/Library/Code/Printer.php @@ -11,12 +11,12 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Code; /** * Buffers code, making it look pretty */ -class CodePrinter +class Printer { protected string $code = ''; @@ -40,8 +40,6 @@ public function preOutput(string $code): void /** * Add code to the output without indentation. - * - * @param string $code */ public function outputNoIndent(string $code): void { @@ -52,9 +50,6 @@ public function outputNoIndent(string $code): void /** * Add code to the output. - * - * @param string $code - * @param bool $appendEOL */ public function output(string $code, bool $appendEOL = true): void { @@ -65,9 +60,6 @@ public function output(string $code, bool $appendEOL = true): void /** * Adds a comment to the output with indentation level. - * - * @param $docblock - * @param bool $replaceTab */ public function outputDocBlock($docblock, bool $replaceTab = true): void { @@ -91,8 +83,6 @@ public function outputDocBlock($docblock, bool $replaceTab = true): void * Adds a blank line to the output * Optionally controlling if the blank link must be added if the * previous line added isn't one blank line too. - * - * @param bool $ifPrevNotBlank */ public function preOutputBlankLine(bool $ifPrevNotBlank = false): void { @@ -113,8 +103,6 @@ public function preOutputBlankLine(bool $ifPrevNotBlank = false): void * Adds a blank line to the output * Optionally controlling if the blank link must be added if the * previous line added isn't one blank line too. - * - * @param bool $ifPrevNotBlank */ public function outputBlankLine(bool $ifPrevNotBlank = false): void { @@ -149,8 +137,6 @@ public function decreaseLevel(): void /** * Returns the output in the buffer. - * - * @return string */ public function getOutput(): string { @@ -159,8 +145,6 @@ public function getOutput(): string /** * Returns an approximate number of lines printed by the CodePrinter. - * - * @return int */ public function getNumberPrints(): int { diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index f80831c43a..41457c2bad 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -15,11 +15,12 @@ use Psr\Log\LoggerInterface; use Zephir\Backend\Backend; -use Zephir\Cache\Manager; use Zephir\Cache\FunctionCache; +use Zephir\Cache\Manager; use Zephir\Class\Definition\AbstractDefinition; use Zephir\Class\Definition\Definition; use Zephir\Class\Method\Method; +use Zephir\Code\Printer; use Zephir\Exception\CompilerException; use Zephir\Passes\StaticTypeInference; use function in_array; @@ -34,7 +35,7 @@ class CompilationContext /** * Current code printer. */ - public ?CodePrinter $codePrinter = null; + public ?Printer $codePrinter = null; /** * Whether the current method is static or not. @@ -44,7 +45,7 @@ class CompilationContext /** * Code printer for the header. */ - public ?CodePrinter $headerPrinter = null; + public ?Printer $headerPrinter = null; /** * Current symbol table. diff --git a/Library/Compiler.php b/Library/Compiler.php index 7b5da332c9..f1f12e77a9 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -22,7 +22,9 @@ use Zephir\Backend\Backend; use Zephir\Backend\StringsManager; use Zephir\Class\Definition\Definition; +use Zephir\Code\ArgInfoDefinition; use Zephir\Code\Builder\Struct; +use Zephir\Code\Printer; use Zephir\Compiler\CompilerFileFactory; use Zephir\Compiler\FileInterface; use Zephir\Exception\CompilerException; @@ -1822,8 +1824,8 @@ public function createProjectFiles(string $project): bool public function generateFunctionInformation(): array { - $headerPrinter = new CodePrinter(); - $entryPrinter = new CodePrinter(); + $headerPrinter = new Printer(); + $entryPrinter = new Printer(); /** * Specifying Argument Information diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 835948d8a6..490474591e 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -16,12 +16,13 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use ReflectionException; -use Zephir\Class\Property; use Zephir\Class\Constant; use Zephir\Class\Definition\Definition; use Zephir\Class\Definition\DefinitionRuntime; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; +use Zephir\Code\Printer; use Zephir\Compiler\FileInterface; use Zephir\Documentation\DocblockParser; use Zephir\Exception\CompilerException; @@ -794,7 +795,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) /** * Main code-printer for the file. */ - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $compilationContext->codePrinter = $codePrinter; /** diff --git a/Library/CompilerFileAnonymous.php b/Library/CompilerFileAnonymous.php index 0e97c27728..9785152744 100644 --- a/Library/CompilerFileAnonymous.php +++ b/Library/CompilerFileAnonymous.php @@ -17,6 +17,7 @@ use Psr\Log\NullLogger; use ReflectionException; use Zephir\Class\Definition\Definition; +use Zephir\Code\Printer; use Zephir\Compiler\FileInterface; use function count; @@ -166,7 +167,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) /** * Main code-printer for the file. */ - $codePrinter = new CodePrinter(); + $codePrinter = new Printer(); $compilationContext->codePrinter = $codePrinter; $codePrinter->outputBlankLine(); diff --git a/Library/Statements/Let/Variable.php b/Library/Statements/Let/Variable.php index 9debd6dde3..594e806009 100644 --- a/Library/Statements/Let/Variable.php +++ b/Library/Statements/Let/Variable.php @@ -11,7 +11,7 @@ namespace Zephir\Statements\Let; -use Zephir\CodePrinter; +use Zephir\Code\Printer; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Detectors\ReadDetector; @@ -111,20 +111,14 @@ public function assign( /** * Performs numeric assignment. * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * * @throws CompilerException * @throws \Zephir\Exception\IllegalOperationException */ private function doNumericAssignment( - CodePrinter $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - string $variable, - array $statement, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -349,20 +343,14 @@ private function doNumericAssignment( /** * Performs double assignment. * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * * @throws CompilerException * @throws IllegalOperationException */ private function doDoubleAssignment( - CodePrinter $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - string $variable, - array $statement, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -536,22 +524,15 @@ private function doDoubleAssignment( /** * Performs string assignment. * - * @param CodePrinter $codePrinter - * @param CompiledExpression $resolvedExpr - * @param ZephirVariable $symbolVariable - * @param string $variable - * @param array $statement - * @param CompilationContext $compilationContext - * * @throws CompilerException * @throws \Zephir\Exception\IllegalOperationException */ private function doStringAssignment( - CodePrinter $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, + ZephirVariable $symbolVariable, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -724,7 +705,7 @@ private function doStringAssignment( /** * Performs array assignment. * - * @param CodePrinter $codePrinter + * @param Printer $codePrinter * @param CompiledExpression $resolvedExpr * @param ZephirVariable $symbolVariable * @param string $variable @@ -735,11 +716,11 @@ private function doStringAssignment( * @throws IllegalOperationException */ private function doArrayAssignment( - CodePrinter $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, + ZephirVariable $symbolVariable, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -773,7 +754,7 @@ private function doArrayAssignment( /** * Performs boolean assignment. * - * @param CodePrinter $codePrinter + * @param Printer $codePrinter * @param CompiledExpression $resolvedExpr * @param string $variable * @param array $statement @@ -783,10 +764,10 @@ private function doArrayAssignment( * @throws IllegalOperationException */ private function doBoolAssignment( - CodePrinter $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - string $variable, - array $statement, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -908,7 +889,7 @@ private function doBoolAssignment( /** * Performs variable assignment. * - * @param CodePrinter $codePrinter + * @param Printer $codePrinter * @param CompiledExpression $resolvedExpr * @param ZephirVariable $symbolVariable * @param string $variable @@ -920,13 +901,13 @@ private function doBoolAssignment( * @throws IllegalOperationException */ private function doVariableAssignment( - CodePrinter $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, + ZephirVariable $symbolVariable, + string $variable, + array $statement, CompilationContext $compilationContext, - ReadDetector $readDetector + ReadDetector $readDetector ) { switch ($resolvedExpr->getType()) { case 'null': diff --git a/Library/Statements/ThrowStatement.php b/Library/Statements/ThrowStatement.php index 1217c28519..f7394034e1 100644 --- a/Library/Statements/ThrowStatement.php +++ b/Library/Statements/ThrowStatement.php @@ -15,13 +15,12 @@ use ReflectionException; use Zephir\Class\Entry; -use Zephir\CodePrinter; +use Zephir\Code\Printer; use Zephir\CompilationContext; use Zephir\Compiler; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; - use function in_array; use function Zephir\add_slashes; use function Zephir\fqcn; @@ -142,12 +141,12 @@ public function compile(CompilationContext $compilationContext): void /** * Throws an exception escaping the data. * - * @param CodePrinter $printer + * @param Printer $printer * @param string $class * @param string $message * @param array $expression */ - private function throwStringException(CodePrinter $printer, string $class, string $message, array $expression): void + private function throwStringException(Printer $printer, string $class, string $message, array $expression): void { $message = add_slashes($message); $path = Compiler::getShortUserPath($expression['file']); From 93554350bb3834c8ca1a3cfdbeab041ea1f0721c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 17:52:45 +0100 Subject: [PATCH 066/375] #2407 - Move `ArgInfoDefinition` inside `Code/` directory --- Library/{ => Code}/ArgInfoDefinition.php | 65 ++++-------------------- 1 file changed, 10 insertions(+), 55 deletions(-) rename Library/{ => Code}/ArgInfoDefinition.php (94%) diff --git a/Library/ArgInfoDefinition.php b/Library/Code/ArgInfoDefinition.php similarity index 94% rename from Library/ArgInfoDefinition.php rename to Library/Code/ArgInfoDefinition.php index 4af5842ef7..1a8439acef 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/Code/ArgInfoDefinition.php @@ -11,77 +11,32 @@ declare(strict_types=1); -namespace Zephir; +namespace Zephir\Code; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\CompilationContext; +use Zephir\Exception; use function array_key_exists; use function count; +use function Zephir\escape_class; class ArgInfoDefinition { - /** - * @var bool - */ - private bool $returnByRef; - - /** - * @var Method|FunctionDefinition - */ - private $functionLike; - - /** - * @var string - */ - private string $name; - - /** - * @var Parameters|null - */ private ?Parameters $parameters; - /** - * @var CodePrinter - */ - private CodePrinter $codePrinter; - - /** - * @var CompilationContext - */ - private CompilationContext $compilationContext; - - /** - * @var string - */ private string $booleanDefinition = '_IS_BOOL'; - /** - * @var bool - */ private bool $richFormat = true; - /** - * @param string $name - * @param Method $functionLike - * @param CodePrinter $codePrinter - * @param CompilationContext $compilationContext - * @param bool $returnByRef - */ public function __construct( - string $name, - Method $functionLike, - CodePrinter $codePrinter, - CompilationContext $compilationContext, - bool $returnByRef = false + private string $name, + private Method $functionLike, + private Printer $codePrinter, + private CompilationContext $compilationContext, + private bool $returnByRef = false ) { - $this->functionLike = $functionLike; - $this->codePrinter = $codePrinter; - $this->compilationContext = $compilationContext; - - $this->name = $name; $this->parameters = $this->functionLike->getParameters(); - - $this->returnByRef = $returnByRef; } public function setBooleanDefinition(string $definition): void From ae312c9e01c47236b7ed13db9fe35e26d945a25d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 18:02:10 +0100 Subject: [PATCH 067/375] #2407 - Move `FcallManagerInterface` inside `Backend/` directory --- Library/Backend/Backend.php | 1 - Library/Backend/FcallManager.php | 7 +- .../FcallManagerInterface.php | 10 +- Library/Compiler.php | 169 +----------------- Library/CompilerFile.php | 6 - 5 files changed, 14 insertions(+), 179 deletions(-) rename Library/{Fcall => Backend}/FcallManagerInterface.php (60%) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index ecbe4a85b4..13a64161cb 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -22,7 +22,6 @@ use Zephir\Config; use Zephir\Exception; use Zephir\Exception\CompilerException; -use Zephir\Fcall\FcallManagerInterface; use Zephir\FunctionDefinition; use Zephir\GlobalConstant; use Zephir\Variable\Globals; diff --git a/Library/Backend/FcallManager.php b/Library/Backend/FcallManager.php index af1855c1db..1c751f4590 100644 --- a/Library/Backend/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -14,7 +14,6 @@ namespace Zephir\Backend; use Zephir\Code\Printer; -use Zephir\Fcall\FcallManagerInterface; use function Zephir\file_put_contents_ex; class FcallManager implements FcallManagerInterface @@ -25,12 +24,12 @@ class FcallManager implements FcallManagerInterface * {@inheritdoc} * * @param bool $static - * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable - * @param int $paramCount + * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable + * @param int $paramCount * * @return string */ - public function getMacro($static, $doReturn, $paramCount): string + public function getMacro(bool $static, int $doReturn, int $paramCount): string { $scope = $static ? 'STATIC' : ''; $mode = 'CALL_INTERNAL_METHOD_NORETURN_P'; diff --git a/Library/Fcall/FcallManagerInterface.php b/Library/Backend/FcallManagerInterface.php similarity index 60% rename from Library/Fcall/FcallManagerInterface.php rename to Library/Backend/FcallManagerInterface.php index ab02c599b5..4adc7dc851 100644 --- a/Library/Fcall/FcallManagerInterface.php +++ b/Library/Backend/FcallManagerInterface.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir\Fcall; +namespace Zephir\Backend; interface FcallManagerInterface { @@ -17,12 +17,12 @@ interface FcallManagerInterface * Resolve internal fcall attributes to a suitable macro and ensure that it's generated during compilation. * * @param bool $static - * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable - * @param int $paramCount + * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable + * @param int $paramCount * * @return string */ - public function getMacro($static, $doReturn, $paramCount); + public function getMacro(bool $static, int $doReturn, int $paramCount): string; - public function genFcallCode(); + public function genFcallCode(): void; } diff --git a/Library/Compiler.php b/Library/Compiler.php index f1f12e77a9..57f49ca5f1 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -18,8 +18,10 @@ use Psr\Log\NullLogger; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; +use ReflectionClass; use ReflectionException; use Zephir\Backend\Backend; +use Zephir\Backend\FcallManagerInterface; use Zephir\Backend\StringsManager; use Zephir\Class\Definition\Definition; use Zephir\Code\ArgInfoDefinition; @@ -33,7 +35,6 @@ use Zephir\Exception\NotImplementedException; use Zephir\Exception\ParseException; use Zephir\Exception\RuntimeException; -use Zephir\Fcall\FcallManagerInterface; use Zephir\FileSystem\FileSystemInterface; use Zephir\Parser\Manager; use function count; @@ -57,16 +58,11 @@ final class Compiler */ private array $files = []; - /** - * @var string[] - */ private array $anonymousFiles = []; /** * Additional initializer code. * Used for static property initialization. - * - * @var array */ private array $internalInitializers = []; @@ -75,9 +71,6 @@ final class Compiler */ private array $definitions = []; - /** - * @var string[] - */ private array $compiledFiles = []; private array $constants = []; @@ -91,39 +84,18 @@ final class Compiler */ private static array $internalDefinitions = []; - /** - * @var bool - */ private static bool $loadedPrototypes = false; - /** - * @var array - */ private array $extraFiles = []; - /** - * @var StringsManager - */ private StringsManager $stringManager; - /** - * @var FcallManagerInterface - */ private FcallManagerInterface $fcallManager; - /** - * @var string|null - */ private ?string $prototypesPath; - /** - * @var string|null - */ private ?string $optimizersPath; - /** - * @var string|null - */ private ?string $templatesPath; public function __construct( @@ -145,9 +117,6 @@ public function __construct( } } - /** - * @param string $prototypesPath - */ public function setPrototypesPath(string $prototypesPath): void { $this->prototypesPath = $prototypesPath; @@ -155,9 +124,6 @@ public function setPrototypesPath(string $prototypesPath): void /** * Resolves path to the internal prototypes. - * - * @return string|null - * */ private function resolvePrototypesPath(): ?string { @@ -175,9 +141,6 @@ private function resolvePrototypesPath(): ?string return $prototypesPath; } - /** - * @param string $optimizersPath - */ public function setOptimizersPath(string $optimizersPath): void { $this->optimizersPath = $optimizersPath; @@ -204,9 +167,6 @@ private function resolveOptimizersPath(): ?string return $optimizersPath; } - /** - * @param string $templatesPath - */ public function setTemplatesPath(string $templatesPath): void { $this->templatesPath = $templatesPath; @@ -216,8 +176,6 @@ public function setTemplatesPath(string $templatesPath): void * Gets the Zephir Parser Manager. * * @deprecated - * - * @return Parser\Manager */ public function getParserManager(): Parser\Manager { @@ -226,10 +184,6 @@ public function getParserManager(): Parser\Manager /** * Adds a function to the function definitions. - * - * @param FunctionDefinition $func - * @param array $statement - * */ public function addFunction(FunctionDefinition $func, array $statement = []): void { @@ -247,11 +201,6 @@ public function addFunction(FunctionDefinition $func, array $statement = []): vo /** * Loads a class definition in an external dependency. * - * @param string $className - * @param string $location - * - * @return bool - * * @throws CompilerException * @throws IllegalStateException * @throws ParseException @@ -286,10 +235,6 @@ public function loadExternalClass(string $className, string $location): bool /** * Allows to check if a class is part of the compiled extension. - * - * @param string $className - * - * @return bool */ public function isClass(string $className): bool { @@ -314,10 +259,6 @@ public function isClass(string $className): bool /** * Allows checking if an interface is part of the compiled extension. * - * @param string $className - * - * @return bool - * * @throws CompilerException * @throws IllegalStateException * @throws ParseException @@ -344,10 +285,6 @@ public function isInterface(string $className): bool /** * Allows checking if a class is part of PHP. - * - * @param string $className - * - * @return bool */ public function isBundledClass(string $className): bool { @@ -356,10 +293,6 @@ public function isBundledClass(string $className): bool /** * Allows checking if an interface is part of PHP. - * - * @param string $className - * - * @return bool */ public function isBundledInterface(string $className): bool { @@ -368,12 +301,8 @@ public function isBundledInterface(string $className): bool /** * Returns class the class definition from a given class name. - * - * @param string $className - * - * @return Definition|false returns false if no class definition is found */ - public function getClassDefinition(string $className) + public function getClassDefinition(string $className): Definition|bool { foreach ($this->definitions as $key => $value) { if (!strcasecmp($key, $className)) { @@ -386,9 +315,6 @@ public function getClassDefinition(string $className) /** * Inserts an anonymous class definition in the compiler. - * - * @param CompilerFileAnonymous $file - * @param Definition $classDefinition */ public function addClassDefinition(CompilerFileAnonymous $file, Definition $classDefinition): void { @@ -399,16 +325,12 @@ public function addClassDefinition(CompilerFileAnonymous $file, Definition $clas /** * Returns class the class definition from a given class name. * - * @param string $className - * - * @return Definition - * * @throws ReflectionException */ public function getInternalClassDefinition(string $className): Definition { if (!isset(self::$internalDefinitions[$className])) { - $reflection = new \ReflectionClass($className); + $reflection = new ReflectionClass($className); self::$internalDefinitions[$className] = Definition::buildFromReflection($reflection); } @@ -417,10 +339,6 @@ public function getInternalClassDefinition(string $className): Definition /** * Checks if $name is a Zephir constant. - * - * @param string $name - * - * @return bool */ public function isConstant(string $name): bool { @@ -429,20 +347,14 @@ public function isConstant(string $name): bool /** * Returns a Zephir Constant by its name. - * - * @param string $name - * - * @return mixed */ - public function getConstant(string $name) + public function getConstant(string $name): mixed { return $this->constants[$name]; } /** * Sets extensions globals. - * - * @param array $globals */ public function setExtensionGlobals(array $globals): void { @@ -453,10 +365,6 @@ public function setExtensionGlobals(array $globals): void /** * Checks if a specific extension global is defined. - * - * @param string $name - * - * @return bool */ public function isExtensionGlobal(string $name): bool { @@ -465,10 +373,6 @@ public function isExtensionGlobal(string $name): bool /** * Returns an extension global by its name. - * - * @param string $name - * - * @return array */ public function getExtensionGlobal(string $name): array { @@ -477,10 +381,6 @@ public function getExtensionGlobal(string $name): array /** * Returns GCC flags for current compilation. - * - * @param bool $development - * - * @return string */ public function getGccFlags(bool $development = false): string { @@ -509,8 +409,6 @@ public function getGccFlags(bool $development = false): string /** * Returns the php include directories returned by php-config. - * - * @return string */ public function getPhpIncludeDirs(): string { @@ -554,10 +452,6 @@ public function preCompileHeaders(): void /** * Generates the C sources from Zephir without compiling them. * - * @param bool $fromGenerate - * - * @return bool - * * @throws Exception * @throws ReflectionException */ @@ -934,9 +828,6 @@ public function compile(bool $development = false, ?int $jobs = null): void /** * Generate a HTML API. * - * @param array $options - * @param bool $fromGenerate - * * @throws ConfigException * @throws Exception * @throws ReflectionException @@ -959,8 +850,6 @@ public function api(array $options = [], bool $fromGenerate = false): void /** * Generate IDE stubs. * - * @param bool $fromGenerate - * * @throws Exception * @throws ReflectionException */ @@ -995,8 +884,6 @@ public function stubs(bool $fromGenerate = false): void /** * Compiles and installs the extension. * - * @param bool $development - * * @throws Exception * @throws NotImplementedException * @throws CompilerException @@ -1047,10 +934,6 @@ public function install(bool $development = false): void * * TODO: move this to backend? * - * @param string $project - * - * @return bool true if we need to run configure - * * @throws Exception */ public function createConfigFiles(string $project): bool @@ -1239,11 +1122,7 @@ public function createConfigFiles(string $project): bool /** * Process extension globals. * - * @param string $namespace - * * @throws Exception - * - * @return array */ public function processExtensionGlobals(string $namespace): array { @@ -1392,8 +1271,6 @@ public function processExtensionGlobals(string $namespace): array /** * Generates phpinfo() sections showing information about the extension. - * - * @return string */ public function processExtensionInfo(): string { @@ -1436,11 +1313,6 @@ public function processExtensionInfo(): string /** * Process extension code injection. - * - * @param array $entries - * @param string $section - * - * @return array */ public function processCodeInjection(array $entries, string $section = 'request'): array { @@ -1464,19 +1336,12 @@ public function processCodeInjection(array $entries, string $section = 'request' /** * Adds an external dependency to the compiler. - * - * @param string $namespace - * @param string $location */ public function addExternalDependency(string $namespace, string $location): void { $this->externalDependencies[$namespace] = $location; } - /** - * @param CompilerFile[] $files - * @param null $_dependency - */ public function calculateDependencies(array $files, $_dependency = null): void { /** @@ -1518,10 +1383,6 @@ public function calculateDependencies(array $files, $_dependency = null): void * * TODO: Move the part of the logic which depends on templates (backend-specific) to backend? * - * @param string $project - * - * @return bool - * * @throws Exception */ public function createProjectFiles(string $project): bool @@ -1888,10 +1749,6 @@ public function checkIfPhpized(): bool /** * Returns a short user path. - * - * @param string $path - * - * @return string */ public static function getShortUserPath(string $path): string { @@ -1902,10 +1759,6 @@ public static function getShortUserPath(string $path): string * Generate package-dependencies config for m4. * * TODO: Move the template depending part to backend? - * - * @param string $contentM4 - * - * @return string */ public function generatePackageDependenciesM4(string $contentM4): string { @@ -1969,8 +1822,6 @@ public function generatePackageDependenciesM4(string $contentM4): string /** * Pre-compiles classes creating a CompilerFile definition. * - * @param string $filePath - * * @throws IllegalStateException */ private function preCompile(string $filePath): void @@ -1996,12 +1847,10 @@ private function preCompile(string $filePath): void /** * Recursively pre-compiles all sources found in the given path. * - * @param string $path - * * @throws IllegalStateException * @throws InvalidArgumentException */ - private function recursivePreCompile(string $path) + private function recursivePreCompile(string $path): void { if (!is_dir($path)) { throw new InvalidArgumentException( @@ -2219,8 +2068,6 @@ private function checkKernelFile(string $src, string $dst): bool * Checks which files in the base kernel must be copied. * * @throws Exception - * - * @return bool */ private function checkKernelFiles(): bool { @@ -2259,8 +2106,6 @@ private function checkKernelFiles(): bool * Checks if the current directory is a valid Zephir project. * * @throws Exception - * - * @return string */ private function checkDirectory(): string { @@ -2294,8 +2139,6 @@ private function checkDirectory(): string /** * Returns current GCC version. - * - * @return string */ private function getGccVersion(): string { diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 490474591e..6c9fd343ed 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -39,14 +39,8 @@ final class CompilerFile implements FileInterface { use LoggerAwareTrait; - /** - * @var string|null - */ private ?string $namespace = null; - /** - * @var string|null - */ private ?string $className = null; /** From 25bc3b18a76139cc5987ad0cf41eb1e411b9d542 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 18:10:55 +0100 Subject: [PATCH 068/375] #2407 - Move `Types` inside `Types/` directory --- Library/Backend/VariablesManager.php | 2 +- Library/Class/Property.php | 2 +- Library/MethodCall.php | 1 + Library/Operators/Other/CastOperator.php | 2 +- .../Other/RangeInclusiveOperator.php | 2 +- Library/Statements/ReturnStatement.php | 3 +- Library/Stubs/MethodDocBlock.php | 2 +- Library/Types/ArrayType.php | 1 - Library/Types/CharType.php | 1 - Library/Types/DoubleType.php | 2 - Library/Types/IntType.php | 2 - Library/Types/IstringType.php | 2 - Library/Types/StringType.php | 2 - Library/{ => Types}/Types.php | 130 +++++------------- tests/Zephir/TypesTest.php | 2 +- 15 files changed, 44 insertions(+), 112 deletions(-) rename Library/{ => Types}/Types.php (77%) diff --git a/Library/Backend/VariablesManager.php b/Library/Backend/VariablesManager.php index 69a8b89236..55b5d832e4 100644 --- a/Library/Backend/VariablesManager.php +++ b/Library/Backend/VariablesManager.php @@ -15,7 +15,7 @@ use Zephir\CompilationContext as Context; use Zephir\Exception\CompilerException as Exception; -use Zephir\Types; +use Zephir\Types\Types; use Zephir\Variable\Variable; use function Zephir\Backend\ZendEngine3\add_slashes; diff --git a/Library/Class/Property.php b/Library/Class/Property.php index 0dc256d376..2a1afcb05f 100644 --- a/Library/Class/Property.php +++ b/Library/Class/Property.php @@ -22,7 +22,7 @@ use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\BinaryOperator; use Zephir\StatementsBlock; -use Zephir\Types; +use Zephir\Types\Types; use function in_array; use function is_array; diff --git a/Library/MethodCall.php b/Library/MethodCall.php index 736e897689..6d92d4693f 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -15,6 +15,7 @@ use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; +use Zephir\Types\Types; use Zephir\Variable\Variable; /** diff --git a/Library/Operators/Other/CastOperator.php b/Library/Operators/Other/CastOperator.php index 26b8ac9724..0ceb7ccde6 100644 --- a/Library/Operators/Other/CastOperator.php +++ b/Library/Operators/Other/CastOperator.php @@ -22,7 +22,7 @@ use Zephir\Expression; use Zephir\Operators\AbstractOperator; use Zephir\Statements\Let\Variable as LetVariable; -use Zephir\Types; +use Zephir\Types\Types; /** * Converts a value into another of a different type diff --git a/Library/Operators/Other/RangeInclusiveOperator.php b/Library/Operators/Other/RangeInclusiveOperator.php index e8a1815260..44c5a3c8f1 100644 --- a/Library/Operators/Other/RangeInclusiveOperator.php +++ b/Library/Operators/Other/RangeInclusiveOperator.php @@ -19,7 +19,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Operators\AbstractOperator; -use Zephir\Types; +use Zephir\Types\Types; /** * Inclusive range operator diff --git a/Library/Statements/ReturnStatement.php b/Library/Statements/ReturnStatement.php index c536999c60..551236cf33 100644 --- a/Library/Statements/ReturnStatement.php +++ b/Library/Statements/ReturnStatement.php @@ -17,8 +17,7 @@ use Zephir\Exception\CompilerException; use Zephir\Exception\InvalidTypeException; use Zephir\Expression; -use Zephir\Types; - +use Zephir\Types\Types; use function Zephir\add_slashes; /** diff --git a/Library/Stubs/MethodDocBlock.php b/Library/Stubs/MethodDocBlock.php index 42c621dd48..3f29b84e9b 100644 --- a/Library/Stubs/MethodDocBlock.php +++ b/Library/Stubs/MethodDocBlock.php @@ -15,7 +15,7 @@ use Zephir\AliasManager; use Zephir\Class\Method\Method; -use Zephir\Types; +use Zephir\Types\Types; /** * Stubs Generator. diff --git a/Library/Types/ArrayType.php b/Library/Types/ArrayType.php index f050a0d53d..7ecbb04593 100644 --- a/Library/Types/ArrayType.php +++ b/Library/Types/ArrayType.php @@ -18,7 +18,6 @@ use Zephir\Exception; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Types; /** * Defines methods of the built-in array type diff --git a/Library/Types/CharType.php b/Library/Types/CharType.php index f77a09ae83..607a3bceb5 100644 --- a/Library/Types/CharType.php +++ b/Library/Types/CharType.php @@ -20,7 +20,6 @@ use Zephir\Exception; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Types; class CharType extends AbstractType { diff --git a/Library/Types/DoubleType.php b/Library/Types/DoubleType.php index 5ad3f5998b..49dddc27fd 100644 --- a/Library/Types/DoubleType.php +++ b/Library/Types/DoubleType.php @@ -13,8 +13,6 @@ namespace Zephir\Types; -use Zephir\Types; - /** * Defines methods of the built-in double type */ diff --git a/Library/Types/IntType.php b/Library/Types/IntType.php index 251de2f54f..9cd5cc490e 100644 --- a/Library/Types/IntType.php +++ b/Library/Types/IntType.php @@ -13,8 +13,6 @@ namespace Zephir\Types; -use Zephir\Types; - /** * Defines methods of the built-in int type */ diff --git a/Library/Types/IstringType.php b/Library/Types/IstringType.php index 9d7fa0390c..ddf1e6b954 100644 --- a/Library/Types/IstringType.php +++ b/Library/Types/IstringType.php @@ -13,8 +13,6 @@ namespace Zephir\Types; -use Zephir\Types; - /** * Encapsulates built-in methods for the "istring" type */ diff --git a/Library/Types/StringType.php b/Library/Types/StringType.php index b365041e7b..419102c61d 100644 --- a/Library/Types/StringType.php +++ b/Library/Types/StringType.php @@ -13,8 +13,6 @@ namespace Zephir\Types; -use Zephir\Types; - /** * Encapsulates built-in methods for the "string" type * diff --git a/Library/Types.php b/Library/Types/Types.php similarity index 77% rename from Library/Types.php rename to Library/Types/Types.php index 5cf9160705..ecfcdbc7b3 100644 --- a/Library/Types.php +++ b/Library/Types/Types.php @@ -9,43 +9,43 @@ * the LICENSE file that was distributed with this source code. */ -namespace Zephir; +declare(strict_types=1); + +namespace Zephir\Types; use Zephir\Class\Method\Method; +use function array_key_exists; +use function count; +use function in_array; final class Types { - const T_INT = 'int'; - const T_UINT = 'uint'; - const T_CHAR = 'char'; - const T_UCHAR = 'uchar'; - const T_LONG = 'long'; - const T_ULONG = 'ulong'; - const T_DOUBLE = 'double'; - const T_FLOAT = 'float'; - const T_NUMBER = 'number'; - const T_NULL = 'null'; - const T_BOOL = 'bool'; - const T_FALSE = 'false'; - const T_STRING = 'string'; - const T_ISTRING = 'istring'; - const T_VARIABLE = 'variable'; - const T_MIXED = 'mixed'; - const T_ARRAY = 'array'; - const T_VOID = 'void'; - const T_OBJECT = 'object'; - const T_CALLABLE = 'callable'; - const T_RESOURCE = 'resource'; - const T_ITERABLE = 'iterable'; - const T_UNDEFINED = 'undefined'; + public const T_INT = 'int'; + public const T_UINT = 'uint'; + public const T_CHAR = 'char'; + public const T_UCHAR = 'uchar'; + public const T_LONG = 'long'; + public const T_ULONG = 'ulong'; + public const T_DOUBLE = 'double'; + public const T_FLOAT = 'float'; + public const T_NUMBER = 'number'; + public const T_NULL = 'null'; + public const T_BOOL = 'bool'; + public const T_FALSE = 'false'; + public const T_STRING = 'string'; + public const T_ISTRING = 'istring'; + public const T_VARIABLE = 'variable'; + public const T_MIXED = 'mixed'; + public const T_ARRAY = 'array'; + public const T_VOID = 'void'; + public const T_OBJECT = 'object'; + public const T_CALLABLE = 'callable'; + public const T_RESOURCE = 'resource'; + public const T_ITERABLE = 'iterable'; + public const T_UNDEFINED = 'undefined'; /** * Gets PHP compatible return type from class method. - * - * @param Method $method - * @param array|null $returnTypes - * - * @return string */ public function getReturnTypeAnnotation(Method $method, array $returnTypes = null): string { @@ -55,9 +55,9 @@ public function getReturnTypeAnnotation(Method $method, array $returnTypes = nul $isProcessedReturnType = null !== $returnTypes; $returnTypes = $returnTypes ?? $method->getReturnTypes(); - $typesCount = \count($returnTypes); + $typesCount = count($returnTypes); - $isDynamic = \in_array('var', array_keys($returnTypes)); + $isDynamic = in_array('var', array_keys($returnTypes)); $isNullable = $this->isNullable($returnTypes); $isBool = $this->areReturnTypesBoolCompatible($returnTypes); @@ -145,10 +145,6 @@ public function getReturnTypeAnnotation(Method $method, array $returnTypes = nul /** * Match Zephir types with Integer type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesIntegerCompatible(array $types): bool { @@ -167,10 +163,6 @@ private function areReturnTypesIntegerCompatible(array $types): bool /** * Match Zephir types with Float type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesFloatCompatible(array $types): bool { @@ -185,10 +177,6 @@ private function areReturnTypesFloatCompatible(array $types): bool /** * Match Zephir types with Boolean type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesBoolCompatible(array $types): bool { @@ -197,10 +185,6 @@ private function areReturnTypesBoolCompatible(array $types): bool /** * Match Zephir types with String type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesStringCompatible(array $types): bool { @@ -216,10 +200,6 @@ private function areReturnTypesStringCompatible(array $types): bool /** * Match Zephir types with Null type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesNullCompatible(array $types): bool { @@ -228,10 +208,6 @@ private function areReturnTypesNullCompatible(array $types): bool /** * Match Zephir types with Array type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesArrayCompatible(array $types): bool { @@ -240,10 +216,6 @@ private function areReturnTypesArrayCompatible(array $types): bool /** * Match Zephir types with Object type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesObjectCompatible(array $types): bool { @@ -252,10 +224,6 @@ private function areReturnTypesObjectCompatible(array $types): bool /** * Match Zephir types with Iterable type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesIterableCompatible(array $types): bool { @@ -264,10 +232,6 @@ private function areReturnTypesIterableCompatible(array $types): bool /** * Match Zephir types with Resource type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesResourceCompatible(array $types): bool { @@ -276,17 +240,13 @@ private function areReturnTypesResourceCompatible(array $types): bool /** * Match Zephir types with Collections. - * - * @param array $types - * - * @return bool */ private function areReturnTypesCollectionCompatible(array $types): bool { $result = false; foreach ($types as $type => $data) { - if (false !== strpos($type, '[]')) { + if (str_contains($type, '[]')) { $result = true; } } @@ -296,10 +256,6 @@ private function areReturnTypesCollectionCompatible(array $types): bool /** * Match Zephir types with Void type. - * - * @param array $types - * - * @return bool */ private function areReturnTypesVoidCompatible(array $types): bool { @@ -308,10 +264,6 @@ private function areReturnTypesVoidCompatible(array $types): bool /** * Check if Zephir types is a Numeric type compatible. - * - * @param array $types - * - * @return bool */ private function isNumeric(array $types): bool { @@ -320,16 +272,12 @@ private function isNumeric(array $types): bool /** * Check if Zephir types can be Nullable. - * - * @param array $types - * - * @return bool */ private function isNullable(array $types): bool { - return (\array_key_exists(self::T_NULL, $types) - || \in_array(self::T_NULL, $types)) - && 1 !== \count($types); + return (array_key_exists(self::T_NULL, $types) + || in_array(self::T_NULL, $types)) + && 1 !== count($types); } /** @@ -347,12 +295,6 @@ private function isNullable(array $types): bool * 'char' => 48, * ] * ] - * - * @param array $types - Return types from parser - * @param array $allowedTypes - Allowed return types - * @param bool $isNullable - * - * @return bool */ private function areReturnTypesCompatible(array $types, array $allowedTypes, bool $isNullable = false): bool { @@ -363,7 +305,7 @@ private function areReturnTypesCompatible(array $types, array $allowedTypes, boo } foreach ($types as $type => $data) { - $areEquals = \in_array($type, $allowedTypes); + $areEquals = in_array($type, $allowedTypes); $result = isset($result) ? ($areEquals && $result) diff --git a/tests/Zephir/TypesTest.php b/tests/Zephir/TypesTest.php index 157af90ec9..ca9bb7f409 100644 --- a/tests/Zephir/TypesTest.php +++ b/tests/Zephir/TypesTest.php @@ -16,7 +16,7 @@ use PHPUnit\Framework\TestCase; use Zephir\Class\Definition\Definition; use Zephir\Class\Method\Method; -use Zephir\Types; +use Zephir\Types\Types; final class TypesTest extends TestCase { From 9a1e7bf7359deb9d1721879758e728ad4082cf34 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 18:16:38 +0100 Subject: [PATCH 069/375] #2407 - Fix path & import --- Library/Class/Property.php | 1 + Library/Code/ArgInfoDefinition.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Class/Property.php b/Library/Class/Property.php index 2a1afcb05f..0c7852af49 100644 --- a/Library/Class/Property.php +++ b/Library/Class/Property.php @@ -25,6 +25,7 @@ use Zephir\Types\Types; use function in_array; use function is_array; +use function Zephir\add_slashes; /** * Represents a property class diff --git a/Library/Code/ArgInfoDefinition.php b/Library/Code/ArgInfoDefinition.php index 1a8439acef..33116ae4d6 100644 --- a/Library/Code/ArgInfoDefinition.php +++ b/Library/Code/ArgInfoDefinition.php @@ -510,7 +510,7 @@ private function getReturnType(): string */ private function renderPhalconCompatible(): bool { - $compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/phalcon-compatibility-headers.php'; + $compatibilityClasses = require __DIR__.'/../../config/phalcon-compatibility-headers.php'; $classDefinition = $this->functionLike->getClassDefinition(); $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; $extendsClass = $classDefinition !== null ? $classDefinition->getExtendsClass() : null; From 427a94b7fccd4045abba3b0816cd0b6efa2c3a8b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 18:18:11 +0100 Subject: [PATCH 070/375] #2407 - Remove 7.4 Win builds --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5002f44c1..75f3173054 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,7 +61,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.0' , '8.1', '8.2', '8.3' ] + php: [ '8.0', '8.1', '8.2', '8.3' ] ts: [ 'ts', 'nts' ] arch: [ 'x64' ] @@ -77,8 +77,6 @@ jobs: # macOS - { name: macos-clang, os: macos-12, compiler: clang } # Windows - - { php: '7.4', ts: 'ts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' } - - { php: '7.4', ts: 'nts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' } - { php: '8.0', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - { php: '8.0', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } - { php: '8.1', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } From e3a75e723b962bf8705cf9ab71f30ceee4855a50 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 18:26:27 +0100 Subject: [PATCH 071/375] #2407 - Add version check for definition of `zephir_add_function` https://github.com/php/php-src/pull/10161/files#diff-8792658491c2da2691aa3492fee6304154346d593fa1d787ebb897d0467d58efR40 --- kernel/operators.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/operators.h b/kernel/operators.h index 059f0a0fe2..f481d7c3ea 100644 --- a/kernel/operators.h +++ b/kernel/operators.h @@ -146,7 +146,11 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define zephir_get_boolval(z) (Z_TYPE_P(z) == IS_TRUE ? 1 : (Z_TYPE_P(z) == IS_FALSE ? 0 : zephir_get_boolval_ex(z))) #define zephir_get_charval(z) (Z_TYPE_P(z) == IS_LONG ? Z_LVAL_P(z) : zephir_get_charval_ex(z)) +#if PHP_VERSION_ID >= 80300 +#define zephir_add_function(result, left, right) add_function(result, left, right) +#else #define zephir_add_function(result, left, right) fast_add_function(result, left, right) +#endif #define zephir_sub_function(result, left, right) sub_function(result, left, right) #define zephir_pow_function(result, op1, op2) pow_function(result, op1, op2) #define zephir_increment(var) increment_function(var) From 90c9d4c74c3060a4afdea92d0552fa0a7a1f9848 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 18:47:15 +0100 Subject: [PATCH 072/375] #2407 - Adjust tests for PHP8.3 --- .../InterfaceMethodSignatureTest.php | 18 ++++++++++++++---- tests/Extension/NewInstanceOperatorTest.php | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php index ff77315a95..5f89aa88ca 100644 --- a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php +++ b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php @@ -32,7 +32,11 @@ public function testImplementInterfaceInMethodSignature(): void public function testImplementInterfaceInMethodSignatureInt(): void { $this->expectException(\TypeError::class); - $this->expectExceptionMessageMatches('/must be of (the\s)?type int, bool given/'); + if (version_compare(PHP_VERSION, '8.2.0', '<=')) { + $this->expectExceptionMessageMatches('/must be of (the\s)?type int, bool given/'); + } else { + $this->expectExceptionMessageMatches('/must be of type int, true given/'); + } (new ImplementInt())->set(true); } @@ -40,9 +44,15 @@ public function testImplementInterfaceInMethodSignatureInt(): void public function testImplementInterfaceInMethodSignatureInterface(): void { $this->expectException(\TypeError::class); - $this->expectExceptionMessageMatches( - '/(must be of type|implement interface) Stub\\\\Interfaces\\\\InterfaceInt, bool given/' - ); + if (version_compare(PHP_VERSION, '8.2.0', '<=')) { + $this->expectExceptionMessageMatches( + '/(must be of type|implement interface) Stub\\\\Interfaces\\\\InterfaceInt, bool given/' + ); + } else { + $this->expectExceptionMessageMatches( + '/(must be of type) Stub\\\\Interfaces\\\\InterfaceInt, true given/' + ); + } (new ImplementInterface())->getVoid(true); } diff --git a/tests/Extension/NewInstanceOperatorTest.php b/tests/Extension/NewInstanceOperatorTest.php index f35793aa3d..818d44849f 100644 --- a/tests/Extension/NewInstanceOperatorTest.php +++ b/tests/Extension/NewInstanceOperatorTest.php @@ -38,7 +38,8 @@ protected function tearDown(): void public function autoload(string $className): void { - if (version_compare(PHP_VERSION, '8.1.0', '>=')) { + if (version_compare(PHP_VERSION, '8.1.0', '>=') && + version_compare(PHP_VERSION, '8.3.0', '<')) { try { if (isset($this->autoloadMap[$className])) { include $this->autoloadMap[$className]; From 2d95cf0aa0f86f79afa8ce5df362cae4bfc392fb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 19:17:44 +0100 Subject: [PATCH 073/375] #2407 - Adjust tests --- .../Interfaces/InterfaceMethodSignatureTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php index 5f89aa88ca..2d41ad99c1 100644 --- a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php +++ b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php @@ -32,10 +32,10 @@ public function testImplementInterfaceInMethodSignature(): void public function testImplementInterfaceInMethodSignatureInt(): void { $this->expectException(\TypeError::class); - if (version_compare(PHP_VERSION, '8.2.0', '<=')) { - $this->expectExceptionMessageMatches('/must be of (the\s)?type int, bool given/'); - } else { + if (version_compare(PHP_VERSION, '8.3.0beta3', '>=')) { $this->expectExceptionMessageMatches('/must be of type int, true given/'); + } else { + $this->expectExceptionMessageMatches('/must be of (the\s)?type int, bool given/'); } (new ImplementInt())->set(true); @@ -44,13 +44,13 @@ public function testImplementInterfaceInMethodSignatureInt(): void public function testImplementInterfaceInMethodSignatureInterface(): void { $this->expectException(\TypeError::class); - if (version_compare(PHP_VERSION, '8.2.0', '<=')) { + if (version_compare(PHP_VERSION, '8.3.0beta3', '>=')) { $this->expectExceptionMessageMatches( - '/(must be of type|implement interface) Stub\\\\Interfaces\\\\InterfaceInt, bool given/' + '/(must be of type) Stub\\\\Interfaces\\\\InterfaceInt, true given/' ); } else { $this->expectExceptionMessageMatches( - '/(must be of type) Stub\\\\Interfaces\\\\InterfaceInt, true given/' + '/(must be of type|implement interface) Stub\\\\Interfaces\\\\InterfaceInt, bool given/' ); } From 1dfb4d54d11300f5774c7aeaaad3f0b7ee630a86 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 19:23:27 +0100 Subject: [PATCH 074/375] #2407 - Bump version of `PHP_CS_FIXER_VERSION` --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 75f3173054..96e5fcb419 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 env: - PHP_CS_FIXER_VERSION: 3.2.0 + PHP_CS_FIXER_VERSION: 3.26.1 with: php-version: '8.0' coverage: none From bd7c643a0bb58e49c6db10fd41d082fbf610e716 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 19:24:01 +0100 Subject: [PATCH 075/375] #2407 - Fix CS --- Library/AliasManager.php | 4 +- Library/Backend/Backend.php | 79 +++++----- Library/Backend/FcallManager.php | 7 +- Library/Backend/FcallManagerInterface.php | 4 +- Library/Backend/StringsManager.php | 3 +- Library/Backend/VariablesManager.php | 5 +- .../Builder/Operators/CastOperatorBuilder.php | 2 +- .../Operators/UnaryOperatorBuilder.php | 6 +- Library/Cache/Manager.php | 2 +- Library/Cache/MethodCache.php | 14 +- Library/Cache/StaticMethodCache.php | 5 +- Library/Call.php | 4 +- Library/Class/Constant.php | 5 +- Library/Class/Definition/Definition.php | 42 +++--- Library/Class/Entry.php | 3 +- Library/Class/Method/Method.php | 141 +++++++++--------- Library/Class/Method/Parameters.php | 12 +- Library/Class/Property.php | 38 +++-- Library/Code/ArgInfoDefinition.php | 26 ++-- Library/Code/Builder/Struct.php | 7 +- Library/CompilationContext.php | 5 +- Library/CompiledExpression.php | 4 +- Library/Compiler.php | 137 ++++++++--------- Library/CompilerFile.php | 17 +-- Library/CompilerFileAnonymous.php | 12 +- Library/Config.php | 5 +- Library/ConfigException.php | 6 +- Library/Console/Application.php | 6 +- Library/Console/Command/ApiCommand.php | 4 +- Library/Console/Command/CleanCommand.php | 4 +- .../Command/DevelopmentModeAwareTrait.php | 4 +- Library/Console/Command/GenerateCommand.php | 4 +- Library/Console/Command/InitCommand.php | 37 ++--- Library/Console/Command/InstallCommand.php | 4 +- .../Console/Command/RemoveOptionsTrait.php | 7 +- Library/Detectors/ReadDetector.php | 7 +- Library/Documentation.php | 8 +- Library/Documentation/DocblockParser.php | 6 +- Library/Documentation/Template.php | 2 +- Library/Exception/CompilerException.php | 2 +- Library/Expression.php | 6 +- .../Expression/Builder/AbstractBuilder.php | 6 +- Library/Expression/Builder/BuilderFactory.php | 2 +- .../Builder/Factory/OperatorsFactory.php | 4 +- .../Statements/CallFunctionStatement.php | 2 +- Library/Expression/Closure.php | 5 +- Library/Expression/ClosureArrow.php | 6 +- Library/Expression/Constants.php | 24 ++- Library/Expression/NativeArray.php | 9 +- Library/Expression/NativeArrayAccess.php | 17 ++- Library/Expression/PropertyAccess.php | 2 +- Library/Expression/PropertyDynamicAccess.php | 1 + Library/Expression/Reference.php | 5 +- Library/Expression/StaticConstantAccess.php | 16 +- Library/Expression/StaticPropertyAccess.php | 8 +- Library/FileSystem/HardDisk.php | 20 +-- Library/FunctionCall.php | 26 ++-- Library/FunctionDefinition.php | 12 +- .../Logger/Formatter/CompilerFormatter.php | 12 +- Library/MethodCall.php | 44 +++--- Library/Operators/AbstractOperator.php | 6 +- .../Arithmetical/ArithmeticalBaseOperator.php | 10 +- .../Operators/Arithmetical/DivOperator.php | 6 +- .../Operators/Arithmetical/ModOperator.php | 6 +- .../Operators/Bitwise/BitwiseBaseOperator.php | 12 +- .../Operators/Bitwise/BitwiseNotOperator.php | 6 +- .../Comparison/ComparisonBaseOperator.php | 5 +- Library/Operators/Logical/AndOperator.php | 10 +- .../Operators/Logical/LogicalBaseOperator.php | 6 +- Library/Operators/Logical/OrOperator.php | 5 +- Library/Operators/Other/CastOperator.php | 3 +- Library/Operators/Other/ConcatOperator.php | 1 + .../Operators/Other/InstanceOfOperator.php | 5 +- Library/Operators/Other/IssetOperator.php | 3 +- Library/Operators/Other/LikelyOperator.php | 5 +- .../Operators/Other/NewInstanceOperator.php | 6 +- Library/Operators/Other/RequireOperator.php | 5 +- .../Operators/Other/ShortTernaryOperator.php | 2 +- Library/Operators/Other/TernaryOperator.php | 2 +- Library/Operators/Other/TypeHintOperator.php | 5 +- Library/Operators/Other/TypeOfOperator.php | 5 +- Library/Operators/Other/UnlikelyOperator.php | 5 +- Library/Operators/Unary/MinusOperator.php | 5 +- Library/Operators/Unary/NotOperator.php | 5 +- Library/Optimizers/EvalExpression.php | 8 +- .../FunctionCall/AddslashesOptimizer.php | 4 +- .../FunctionCall/ArrayKeyExistsOptimizer.php | 6 +- .../FunctionCall/ArrayKeysOptimizer.php | 4 +- .../FunctionCall/ArrayMergeOptimizer.php | 4 +- .../FunctionCall/BasenameOptimizer.php | 4 +- .../FunctionCall/CamelizeOptimizer.php | 4 +- .../Optimizers/FunctionCall/CeilOptimizer.php | 4 +- .../FunctionCall/ClassExistsOptimizer.php | 4 +- .../FunctionCall/CompareMtimeOptimizer.php | 4 +- .../FunctionCall/Crc32Optimizer.php | 4 +- .../FunctionCall/CreateArrayOptimizer.php | 4 +- .../FunctionCall/CreateInstanceOptimizer.php | 4 +- .../CreateSymbolTableOptimizer.php | 4 +- .../FunctionCall/DoublevalOptimizer.php | 4 +- .../Optimizers/FunctionCall/EvalOptimizer.php | 4 +- .../Optimizers/FunctionCall/ExitOptimizer.php | 6 +- .../FunctionCall/ExplodeOptimizer.php | 4 +- .../FunctionCall/FcloseOptimizer.php | 4 +- .../FunctionCall/FileExistsOptimizer.php | 4 +- .../FunctionCall/FileGetContentsOptimizer.php | 4 +- .../FunctionCall/FilePutContentsOptimizer.php | 4 +- .../FunctionCall/FilemtimeOptimizer.php | 4 +- .../FunctionCall/FloorOptimizer.php | 4 +- .../FunctionCall/FuncGetArgOptimizer.php | 4 +- .../FunctionCall/FuncGetArgsOptimizer.php | 4 +- .../FunctionCall/FunctionExistsOptimizer.php | 3 +- .../FunctionCall/FwriteOptimizer.php | 4 +- .../FunctionCall/GetCalledClassOptimizer.php | 4 +- .../FunctionCall/GetClassLowerOptimizer.php | 4 +- .../FunctionCall/GetClassNsOptimizer.php | 4 +- .../FunctionCall/GetClassOptimizer.php | 4 +- .../FunctionCall/GetNsClassOptimizer.php | 4 +- .../FunctionCall/GettypeOptimizer.php | 4 +- .../FunctionCall/GlobalsGetOptimizer.php | 6 +- .../FunctionCall/GlobalsSetOptimizer.php | 8 +- .../FunctionCall/HashEqualsOptimizer.php | 4 +- .../FunctionCall/ImplodeOptimizer.php | 4 +- .../FunctionCall/InArrayOptimizer.php | 4 +- .../FunctionCall/InterfaceExistsOptimizer.php | 4 +- .../FunctionCall/IntvalOptimizer.php | 4 +- .../IsPrivatePropertyOptimizer.php | 4 +- .../FunctionCall/LdexpOptimizer.php | 4 +- .../Optimizers/FunctionCall/Md5Optimizer.php | 4 +- .../FunctionCall/MergeAppendOptimizer.php | 4 +- .../FunctionCall/MicrotimeOptimizer.php | 4 +- .../Optimizers/FunctionCall/PowOptimizer.php | 4 +- .../FunctionCall/PregMatchOptimizer.php | 8 +- .../PrepareVirtualPathOptimizer.php | 4 +- .../FunctionCall/RoundOptimizer.php | 10 +- .../FunctionCall/StrReplaceOptimizer.php | 4 +- .../FunctionCall/StripcslashesOptimizer.php | 4 +- .../FunctionCall/StripslashesOptimizer.php | 4 +- .../FunctionCall/StrposOptimizer.php | 4 +- .../FunctionCall/StrtokOptimizer.php | 4 +- .../FunctionCall/StrtolowerOptimizer.php | 4 +- .../FunctionCall/StrtoupperOptimizer.php | 4 +- .../FunctionCall/SubstrOptimizer.php | 4 +- .../Optimizers/FunctionCall/TimeOptimizer.php | 4 +- .../Optimizers/FunctionCall/TrimOptimizer.php | 4 +- .../FunctionCall/UcfirstOptimizer.php | 4 +- .../FunctionCall/UncamelizeOptimizer.php | 4 +- .../FunctionCall/UniqueKeyOptimizer.php | 4 +- .../FunctionCall/UniquePathKeyOptimizer.php | 4 +- .../FunctionCall/VarExportOptimizer.php | 4 +- .../ZephirStringToHexOptimizer.php | 4 +- .../Optimizers/IsTypeOptimizerAbstract.php | 4 +- Library/Optimizers/MathOptimizer.php | 4 +- Library/Parser/Manager.php | 4 +- Library/Parser/Parser.php | 4 +- Library/Passes/LocalContextPass.php | 16 +- Library/Passes/SkipVariantInit.php | 10 +- Library/Passes/StaticTypeInference.php | 8 +- Library/Statements/DoWhileStatement.php | 4 +- Library/Statements/EchoStatement.php | 3 +- Library/Statements/ForStatement.php | 21 +-- Library/Statements/IfStatement.php | 4 +- Library/Statements/Let/ArrayIndex.php | 4 +- .../Statements/Let/ObjectDynamicProperty.php | 5 +- Library/Statements/Let/ObjectProperty.php | 2 +- .../Let/ObjectPropertyArrayIndexAppend.php | 4 +- Library/Statements/Let/StaticProperty.php | 9 +- Library/Statements/Let/Variable.php | 51 +++---- Library/Statements/Let/VariableAppend.php | 4 +- Library/Statements/ReturnStatement.php | 4 +- Library/Statements/SwitchStatement.php | 6 +- Library/Statements/ThrowStatement.php | 25 ++-- Library/Statements/UnsetStatement.php | 9 +- Library/StatementsBlock.php | 8 +- Library/StaticCall.php | 95 ++++++------ Library/Stubs/DocBlock.php | 8 +- Library/Stubs/Generator.php | 37 +++-- Library/Stubs/MethodDocBlock.php | 6 +- Library/SymbolTable.php | 32 ++-- Library/Types/AbstractType.php | 11 +- Library/Types/ArrayType.php | 10 +- Library/Types/CharType.php | 10 +- Library/Types/Types.php | 15 +- Library/Variable/Variable.php | 33 ++-- Library/functions.php | 18 +-- prototypes/apc.php | 30 ++-- prototypes/gd.php | 2 +- tests/Extension/ArrayAccessTest.php | 6 +- tests/Extension/ExitDieTest.php | 7 +- tests/Extension/FunctionExistsTest.php | 1 + tests/Extension/Globals/EnvTest.php | 2 +- tests/Extension/Integral/RegexDNATest.php | 5 +- tests/Extension/Issue1134Test.php | 6 +- tests/Extension/MCallTest.php | 10 +- tests/Extension/NewInstanceOperatorTest.php | 3 +- tests/Extension/Oo/ExtendClassTest.php | 7 +- .../Extension/Oo/Scopes/PrivateScopeTest.php | 63 ++++---- .../Extension/Optimizers/IsPhpVersionTest.php | 24 ++- .../Properties/StaticPublicPropertiesTest.php | 6 +- tests/Extension/ReflectionTest.php | 11 +- tests/Extension/RequiresTest.php | 12 +- tests/Extension/TypeHinting/AbstractTest.php | 7 +- tests/Extension/Types/MixedTypeTest.php | 14 +- tests/Extension/Types/ObjTypeTest.php | 5 +- tests/Extension/UnsetTest.php | 2 +- .../CompilerFile/CheckDependenciesTest.php | 3 +- .../CompilerFile/CheckPathSeparatorTest.php | 2 +- tests/Zephir/ConfigTest.php | 1 + tests/Zephir/Stubs/GeneratorTest.php | 17 ++- tests/Zephir/Stubs/MethodDocBlockTest.php | 18 +-- tests/Zephir/TypesTest.php | 2 +- 210 files changed, 959 insertions(+), 1128 deletions(-) diff --git a/Library/AliasManager.php b/Library/AliasManager.php index 4d82afe664..742d5bcaec 100644 --- a/Library/AliasManager.php +++ b/Library/AliasManager.php @@ -13,8 +13,6 @@ namespace Zephir; -use function in_array; - /** * Manage aliases in a file */ @@ -117,7 +115,7 @@ public function isAliasPresentFor(string $className): bool { $extractAlias = $this->implicitAlias($className); - $isClassDeclared = in_array($className, $this->aliases); + $isClassDeclared = \in_array($className, $this->aliases); $classAlias = array_flip($this->aliases)[$className] ?? null; return $isClassDeclared && $classAlias !== $extractAlias; diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 13a64161cb..9a28076e28 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -26,8 +26,7 @@ use Zephir\GlobalConstant; use Zephir\Variable\Globals; use Zephir\Variable\Variable; -use function in_array; -use function strlen; + use function Zephir\add_slashes; class Backend @@ -121,9 +120,9 @@ public function initVar(Variable $variable, CompilationContext $context, $useCod public function getVariableCode(Variable $variable): string { - if ($variable->isDoublePointer() || - in_array($variable->getName(), ['this_ptr', 'return_value']) || - in_array($variable->getType(), ['int', 'long'])) { + if ($variable->isDoublePointer() + || \in_array($variable->getName(), ['this_ptr', 'return_value']) + || \in_array($variable->getType(), ['int', 'long'])) { return $variable->getName(); } @@ -243,13 +242,13 @@ public function getTypeDefinition($type): array } /** - * @param Variable $variableVariable - * @param string $operator - * @param string $value - * - * @throws CompilerException + * @param Variable $variableVariable + * @param string $operator + * @param string $value * * @return string + * + * @throws CompilerException */ public function getTypeofCondition( Variable $variableVariable, @@ -309,7 +308,7 @@ public function getTypeofCondition( public function onPreInitVar(Method $method): string { if (!$method instanceof FunctionDefinition && !$method->isInternal()) { - return "zval *this_ptr = getThis();\n"; //TODO: think about a better way to solve this. + return "zval *this_ptr = getThis();\n"; // TODO: think about a better way to solve this. } return ''; @@ -343,7 +342,7 @@ public function onPostCompile(Method $method, CompilationContext $context): void public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) { - $isComplex = in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); + $isComplex = \in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); if ($isComplex && !$variable->isDoublePointer()) { $groupVariables[] = $variable->getName(); @@ -397,9 +396,9 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va break; case 'char': - $defaultValue = (string)$defaultValue; - if (strlen($defaultValue) > 4) { - if (strlen($defaultValue) > 10) { + $defaultValue = (string) $defaultValue; + if (\strlen($defaultValue) > 4) { + if (\strlen($defaultValue) > 10) { throw new CompilerException("Invalid char literal: '".substr($defaultValue, 0, 10)."...'", $variable->getOriginal()); } else { throw new CompilerException("Invalid char literal: '".$defaultValue."'", $variable->getOriginal()); @@ -428,9 +427,9 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va * @param Variable[] $variables * @param CompilationContext $context * - * @throws CompilerException - * * @return string + * + * @throws CompilerException */ public function initializeVariableDefaults(array $variables, CompilationContext $context): string { @@ -504,7 +503,7 @@ public function declareConstant($type, $name, $value, CompilationContext $contex } /** - * @param Method $method + * @param Method $method * @param CompilationContext $context * * @return string @@ -646,7 +645,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'; } } @@ -771,16 +770,16 @@ public function arrayIssetFetch2(Variable $target, Variable $var, $resolvedExpr, if (!($resolvedExpr instanceof Variable)) { if ('string' === $resolvedExpr->getType()) { return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { + } elseif (\in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression); } else { $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); } } - if (in_array($resolvedExpr->getType(), ['int', 'long'])) { + if (\in_array($resolvedExpr->getType(), ['int', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { + } elseif (\in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); } @@ -920,11 +919,12 @@ public function fetchProperty( } /** - * @param Variable $symbolVariable - * @param Definition $classDefinition - * @param $property - * @param bool $readOnly + * @param Variable $symbolVariable + * @param Definition $classDefinition + * @param $property + * @param bool $readOnly * @param CompilationContext $context + * * @throws Exception */ public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, $property, $readOnly, CompilationContext $context): void @@ -943,14 +943,14 @@ public function fetchStaticProperty(Variable $symbolVariable, $classDefinition, } /** - * @param $value + * @param $value * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|string|Variable + * + * @throws CompilerException */ - public function resolveValue($value, CompilationContext $context): Variable|bool|string + public function resolveValue($value, CompilationContext $context): Variable | bool | string { if ($value instanceof GlobalConstant) { switch ($value->getName()) { @@ -988,7 +988,7 @@ public function resolveValue($value, CompilationContext $context): Variable|bool $value = $this->getVariableCode($tempVariable); } else { if ($value instanceof CompiledExpression) { - if (in_array($value->getType(), ['array', 'variable', 'mixed'])) { + if (\in_array($value->getType(), ['array', 'variable', 'mixed'])) { $value = $context->symbolTable->getVariableForWrite($value->getCode(), $context); } else { return $value->getCode(); @@ -1313,7 +1313,7 @@ public function getScalarTempVariable( * * @return void */ - public function initArray(Variable $variable, CompilationContext $context, ?int $size = null): void + public function initArray(Variable $variable, CompilationContext $context, int $size = null): void { $code = $this->getVariableCode($variable); @@ -1406,7 +1406,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA $type = 'long'; break; - /* Types which map to the same */ + /* Types which map to the same */ case 'variable': case 'mixed': case 'string': @@ -1419,7 +1419,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA $arrayAccess['right'] ); } - if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { + if ($isVariable && \in_array($index->getType(), ['variable', 'string', 'mixed'])) { $output = 'zephir_array_fetch('.$this->getVariableCode($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; } else { if ($isVariable) { @@ -1630,19 +1630,11 @@ public function checkStrictType($type, $var, CompilationContext $context) /** * Assign value to variable helper. - * - * @param string $macro - * @param string $variableName - * @param string|Variable|null $value - * @param CompilationContext $context - * @param bool $useCodePrinter - * - * @return string */ protected function assignHelper( string $macro, string $variableName, - $value, + $value, CompilationContext $context, bool $useCodePrinter ): string { @@ -1696,6 +1688,7 @@ protected function returnHelper(string $macro, $value, CompilationContext $conte * @param CompilationContext $compilationContext * * @return array + * * @throws CompilerException */ private function resolveOffsetExprs(array $offsetExprs, CompilationContext $compilationContext): array diff --git a/Library/Backend/FcallManager.php b/Library/Backend/FcallManager.php index 1c751f4590..ffa27b55c6 100644 --- a/Library/Backend/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -14,6 +14,7 @@ namespace Zephir\Backend; use Zephir\Code\Printer; + use function Zephir\file_put_contents_ex; class FcallManager implements FcallManagerInterface @@ -24,8 +25,8 @@ class FcallManager implements FcallManagerInterface * {@inheritdoc} * * @param bool $static - * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable - * @param int $paramCount + * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable + * @param int $paramCount * * @return string */ @@ -133,7 +134,7 @@ public function genFcallCode(): void sprintf( 'method(0, execute_data, %s, %s%s%s); \\', $retParam, - ($scope ? 'NULL, ' : $objParam), + $scope ? 'NULL, ' : $objParam, $retValueUsed, $i ? ', &'.implode(', &', $zvals) : '' ) diff --git a/Library/Backend/FcallManagerInterface.php b/Library/Backend/FcallManagerInterface.php index 4adc7dc851..8c136055b3 100644 --- a/Library/Backend/FcallManagerInterface.php +++ b/Library/Backend/FcallManagerInterface.php @@ -17,8 +17,8 @@ interface FcallManagerInterface * Resolve internal fcall attributes to a suitable macro and ensure that it's generated during compilation. * * @param bool $static - * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable - * @param int $paramCount + * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable + * @param int $paramCount * * @return string */ diff --git a/Library/Backend/StringsManager.php b/Library/Backend/StringsManager.php index 70ef092ebd..92f964d107 100644 --- a/Library/Backend/StringsManager.php +++ b/Library/Backend/StringsManager.php @@ -15,7 +15,6 @@ use Zephir\StringsManager as BaseStringsManager; -use function strlen; use function Zephir\file_put_contents_ex; /** @@ -61,7 +60,7 @@ public function genConcatCode(): void $macros = []; ksort($this->concatKeys, SORT_STRING); foreach ($this->concatKeys as $key => $one) { - $len = strlen($key); + $len = \strlen($key); $params = []; $zvalCopy = []; $useCopy = []; diff --git a/Library/Backend/VariablesManager.php b/Library/Backend/VariablesManager.php index 55b5d832e4..bd3817be47 100644 --- a/Library/Backend/VariablesManager.php +++ b/Library/Backend/VariablesManager.php @@ -17,6 +17,7 @@ use Zephir\Exception\CompilerException as Exception; use Zephir\Types\Types; use Zephir\Variable\Variable; + use function Zephir\Backend\ZendEngine3\add_slashes; class VariablesManager @@ -174,9 +175,9 @@ private function initArrayVar(Variable $variable, array $value, Context $context * * @param array $value * - * @throws Exception - * * @return void + * + * @throws Exception */ private function validateCharValue(array $value): void { diff --git a/Library/Builder/Operators/CastOperatorBuilder.php b/Library/Builder/Operators/CastOperatorBuilder.php index a67aa4a32b..e57e855e6d 100644 --- a/Library/Builder/Operators/CastOperatorBuilder.php +++ b/Library/Builder/Operators/CastOperatorBuilder.php @@ -27,7 +27,7 @@ class CastOperatorBuilder extends AbstractOperatorBuilder public function __construct( string $left, FunctionCallBuilder $right, - ?string $file = null, + string $file = null, int $line = 0, int $char = 0 ) { diff --git a/Library/Builder/Operators/UnaryOperatorBuilder.php b/Library/Builder/Operators/UnaryOperatorBuilder.php index b893e9904f..e68231881e 100644 --- a/Library/Builder/Operators/UnaryOperatorBuilder.php +++ b/Library/Builder/Operators/UnaryOperatorBuilder.php @@ -13,8 +13,6 @@ namespace Zephir\Builder\Operators; -use function is_object; - /** * Allows to manually build a unary operator AST node */ @@ -34,7 +32,7 @@ class UnaryOperatorBuilder extends AbstractOperatorBuilder */ protected $leftExpression; - public function __construct(string $operator, $leftExpression, ?string $file = null, int $line = 0, int $char = 0) + public function __construct(string $operator, $leftExpression, string $file = null, int $line = 0, int $char = 0) { $this->operator = $operator; $this->leftExpression = $leftExpression; @@ -50,7 +48,7 @@ public function __construct(string $operator, $leftExpression, ?string $file = n */ 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/Cache/Manager.php b/Library/Cache/Manager.php index da15216156..16b6b70824 100644 --- a/Library/Cache/Manager.php +++ b/Library/Cache/Manager.php @@ -50,7 +50,7 @@ class Manager * * @param CallGathererPass|null $gatherer */ - public function setGatherer(?CallGathererPass $gatherer = null): void + public function setGatherer(CallGathererPass $gatherer = null): void { $this->gatherer = $gatherer; } diff --git a/Library/Cache/MethodCache.php b/Library/Cache/MethodCache.php index 5a1e497f40..b5116d7e82 100644 --- a/Library/Cache/MethodCache.php +++ b/Library/Cache/MethodCache.php @@ -13,8 +13,6 @@ namespace Zephir\Cache; -use ReflectionClass; -use ReflectionException; use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Passes\CallGathererPass; @@ -48,7 +46,7 @@ public function __construct(protected ?CallGathererPass $gatherer = null) /** * Retrieves/Creates a function cache for a method call. * - * @throws ReflectionException + * @throws \ReflectionException */ public function get(CompilationContext $compilationContext, string $methodName, Variable $caller): string { @@ -167,7 +165,7 @@ public function get(CompilationContext $compilationContext, string $methodName, /** * Checks if the class is suitable for caching. * - * @param Definition|ReflectionClass|null $classDefinition + * @param Definition|\ReflectionClass|null $classDefinition * * @return bool */ @@ -177,12 +175,12 @@ private function isClassCacheable($classDefinition = null): bool return true; } - if (!($classDefinition instanceof ReflectionClass)) { + if (!($classDefinition instanceof \ReflectionClass)) { return false; } - return $classDefinition->isInternal() && - $classDefinition->isInstantiable() && - in_array($classDefinition->getExtension()->getName(), ['Reflection', 'Core', 'SPL']); + return $classDefinition->isInternal() + && $classDefinition->isInstantiable() + && in_array($classDefinition->getExtension()->getName(), ['Reflection', 'Core', 'SPL']); } } diff --git a/Library/Cache/StaticMethodCache.php b/Library/Cache/StaticMethodCache.php index faf119048f..d22f1c07f5 100644 --- a/Library/Cache/StaticMethodCache.php +++ b/Library/Cache/StaticMethodCache.php @@ -11,7 +11,6 @@ namespace Zephir\Cache; -use ReflectionMethod; use Zephir\CompilationContext; /** @@ -41,7 +40,7 @@ public function get(CompilationContext $compilationContext, $method): string return 'NULL, 0'; } - if (!($method instanceof ReflectionMethod)) { + if (!($method instanceof \ReflectionMethod)) { $completeName = $method->getClassDefinition()->getCompleteName(); /** @@ -71,7 +70,7 @@ public function get(CompilationContext $compilationContext, $method): string $functionCache->setMustInitNull(true); $functionCache->setReusable(false); - if (!($method instanceof ReflectionMethod)) { + if (!($method instanceof \ReflectionMethod)) { $this->cache[$completeName][$method->getName()] = $functionCache; } diff --git a/Library/Call.php b/Library/Call.php index 0d8720c9e0..24aac202cc 100644 --- a/Library/Call.php +++ b/Library/Call.php @@ -52,7 +52,7 @@ class Call /** * @var mixed|null */ - protected $reflection = null; + protected $reflection; /** * @var array @@ -382,7 +382,7 @@ public function getResolvedParams(array $parameters, CompilationContext $compila case 'int': case 'uint': case 'long': - /* ulong must be stored in string */ + /* ulong must be stored in string */ case 'ulong': $parameterTempVariable = $compilationContext->backend->getScalarTempVariable('variable', $compilationContext); $params[] = $compilationContext->backend->getVariableCode($parameterTempVariable); diff --git a/Library/Class/Constant.php b/Library/Class/Constant.php index 1b96b66132..e7dd91a074 100644 --- a/Library/Class/Constant.php +++ b/Library/Class/Constant.php @@ -13,7 +13,6 @@ namespace Zephir\Class; -use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Expression\Constants; @@ -83,7 +82,7 @@ public function getType(): string * Process the value of the class constant if needed. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function processValue(CompilationContext $compilationContext): void { @@ -112,7 +111,7 @@ public function processValue(CompilationContext $compilationContext): void * Produce the code to register a class constant. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { diff --git a/Library/Class/Definition/Definition.php b/Library/Class/Definition/Definition.php index 306573d06f..5fb1eb30b3 100644 --- a/Library/Class/Definition/Definition.php +++ b/Library/Class/Definition/Definition.php @@ -13,8 +13,6 @@ namespace Zephir\Class\Definition; -use ReflectionClass; -use ReflectionException; use Zephir\AliasManager; use Zephir\Class\Constant; use Zephir\Class\Entry; @@ -32,10 +30,6 @@ use Zephir\Exception\InvalidArgumentException; use Zephir\HeadersManager; use Zephir\StatementsBlock; -use function count; -use function gettype; -use function is_array; -use const DIRECTORY_SEPARATOR; /** * Represents a class/interface and their properties and methods. @@ -120,7 +114,7 @@ final class Definition extends AbstractDefinition protected Compiler $compiler; - public function __construct(protected string $namespace, string $name, ?string $shortName = null) + public function __construct(protected string $namespace, string $name, string $shortName = null) { $this->name = $name; $this->shortName = $shortName ?: $name; @@ -498,7 +492,7 @@ public function getConstant(string $constantName): ?Constant * * @throws CompilerException */ - public function addMethod(Method $method, ?array $statement = null): void + public function addMethod(Method $method, array $statement = null): void { $methodName = strtolower($method->getName()); if (isset($this->methods[$methodName])) { @@ -513,7 +507,7 @@ public function addMethod(Method $method, ?array $statement = null): void * * @throws CompilerException */ - public function updateMethod(Method $method, ?array $statement = null): void + public function updateMethod(Method $method, array $statement = null): void { $methodName = strtolower($method->getName()); if (!isset($this->methods[$methodName])) { @@ -575,7 +569,7 @@ public function hasMethod(string $methodName): bool $extendsClassDefinition = $this->compiler->getInternalClassDefinition( $extendsClassDefinition->getName() ); - } catch (ReflectionException $e) { + } catch (\ReflectionException $e) { // Do nothing return false; } @@ -651,7 +645,7 @@ public function getPossibleMethodName(string $methodName): ?string * * @throws Exception */ - public function getClassEntry(?CompilationContext $compilationContext = null): string + public function getClassEntry(CompilationContext $compilationContext = null): string { if ($this->external) { if ($compilationContext === null) { @@ -700,7 +694,7 @@ public function getExternalHeader(): string { $parts = explode('\\', $this->namespace); - return 'ext/'.strtolower($parts[0].DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $this->namespace).DIRECTORY_SEPARATOR.$this->name).'.zep'; + return 'ext/'.strtolower($parts[0].\DIRECTORY_SEPARATOR.str_replace('\\', \DIRECTORY_SEPARATOR, $this->namespace).\DIRECTORY_SEPARATOR.$this->name).'.zep'; } /** @@ -727,8 +721,8 @@ public function checkInterfaceImplements(self $classDefinition, self $interfaceD } $implementedMethod = $classDefinition->getMethod($method->getName()); - if ($implementedMethod->getNumberOfRequiredParameters() > $method->getNumberOfRequiredParameters() || - $implementedMethod->getNumberOfParameters() < $method->getNumberOfParameters() + if ($implementedMethod->getNumberOfRequiredParameters() > $method->getNumberOfRequiredParameters() + || $implementedMethod->getNumberOfParameters() < $method->getNumberOfParameters() ) { throw new CompilerException( sprintf( @@ -848,7 +842,7 @@ public function addStaticInitMethod(StatementsBlock $statementsBlock): void * Compiles a class/interface. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -878,7 +872,7 @@ public function compile(CompilationContext $compilationContext): void $methods = &$this->methods; $initMethod = $this->getLocalOrParentInitMethod(); - if (count($methods) > 0 || $initMethod) { + if (\count($methods) > 0 || $initMethod) { $methodEntry = strtolower($this->getCNamespace()).'_'.strtolower($this->getName()).'_method_entry'; } else { $methodEntry = 'NULL'; @@ -968,7 +962,7 @@ public function compile(CompilationContext $compilationContext): void $interfaces = $this->interfaces; $compiler = $compilationContext->compiler; - if (is_array($interfaces)) { + if (\is_array($interfaces)) { $codePrinter->outputBlankLine(true); foreach ($interfaces as $interface) { @@ -1097,7 +1091,7 @@ public function compile(CompilationContext $compilationContext): void $codePrinter->output('ZEPHIR_INIT_CLASS('.$this->getCNamespace().'_'.$this->getName().');'); $codePrinter->outputBlankLine(); - if (self::TYPE_CLASS === $this->getType() && count($methods) > 0) { + if (self::TYPE_CLASS === $this->getType() && \count($methods) > 0) { foreach ($methods as $method) { if (!$method->isInternal()) { $codePrinter->output('PHP_METHOD('.$this->getCNamespace().'_'.$this->getName().', '.$method->getName().');'); @@ -1126,7 +1120,7 @@ public function compile(CompilationContext $compilationContext): void $argInfo->render(); } - if (count($methods) > 0) { + if (\count($methods) > 0) { $codePrinter->output( sprintf( 'ZEPHIR_INIT_FUNCS(%s_%s_method_entry) {', @@ -1156,7 +1150,7 @@ public function compile(CompilationContext $compilationContext): void $codePrinter->output('#if PHP_VERSION_ID >= 80000'); $codePrinter->output( sprintf( - // TODO: Rename to ZEND_ME + // TODO: Rename to ZEND_ME "\tPHP_ME(%s_%s, %s, %s, %s)", $this->getCNamespace(), $this->getName(), @@ -1168,7 +1162,7 @@ public function compile(CompilationContext $compilationContext): void $codePrinter->output('#else'); $codePrinter->output( sprintf( - // TODO: Rename to ZEND_ME + // TODO: Rename to ZEND_ME "\tPHP_ME(%s_%s, %s, NULL, %s)", $this->getCNamespace(), $this->getName(), @@ -1244,7 +1238,7 @@ public function setAliasManager(AliasManager $aliasManager): void /** * Builds a class definition from reflection. */ - public static function buildFromReflection(ReflectionClass $class): self + public static function buildFromReflection(\ReflectionClass $class): self { $classDefinition = new self($class->getNamespaceName(), $class->getName(), $class->getShortName()); @@ -1263,7 +1257,7 @@ public static function buildFromReflection(ReflectionClass $class): self if (!$params['mandatory']) { try { $params['default'] = $row->getDefaultValue(); - } catch (ReflectionException $e) { + } catch (\ReflectionException $e) { // TODO: dummy default value $params['default'] = true; } @@ -1284,7 +1278,7 @@ public static function buildFromReflection(ReflectionClass $class): self } foreach ($class->getConstants() as $constantName => $constantValue) { - $type = self::convertPhpConstantType(gettype($constantValue)); + $type = self::convertPhpConstantType(\gettype($constantValue)); $classConstant = new Constant($constantName, ['value' => $constantValue, 'type' => $type], null); $classDefinition->addConstant($classConstant); } diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index 03a9d56e9c..9aba0a2e22 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -13,7 +13,6 @@ namespace Zephir\Class; -use ReflectionClass; use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Exception; @@ -73,7 +72,7 @@ public function get(): string } if (class_exists($this->classname) || interface_exists($this->classname)) { - $reflection = new ReflectionClass($this->classname); + $reflection = new \ReflectionClass($this->classname); $className = $reflection->getName(); /** diff --git a/Library/Class/Method/Method.php b/Library/Class/Method/Method.php index 6607734448..00bfe9cd69 100644 --- a/Library/Class/Method/Method.php +++ b/Library/Class/Method/Method.php @@ -13,7 +13,6 @@ namespace Zephir\Class\Method; -use ReflectionException; use Zephir\Branch; use Zephir\BranchManager; use Zephir\Cache\Manager; @@ -33,11 +32,7 @@ use Zephir\StatementsBlock; use Zephir\SymbolTable; use Zephir\Variable\Variable; -use function array_key_exists; -use function count; -use function in_array; -use function is_array; -use function is_object; + use function Zephir\add_slashes; /** @@ -136,15 +131,15 @@ class Method protected ?Definition $classDefinition = null; public function __construct( - Definition $classDefinition, - protected array $visibility, - protected string $name, - protected ?Parameters $parameters = null, + Definition $classDefinition, + protected array $visibility, + protected string $name, + protected ?Parameters $parameters = null, protected ?StatementsBlock $statements = null, - protected ?string $docblock = null, - ?array $returnType = null, - protected ?array $expression = [], - array $staticVariables = [], + protected ?string $docblock = null, + array $returnType = null, + protected ?array $expression = [], + array $staticVariables = [], ) { $this->classDefinition = $classDefinition; $this->staticVariables = $staticVariables; @@ -194,7 +189,7 @@ public function __construct( * * @param array|null $returnType */ - public function setReturnTypes(?array $returnType = null): void + public function setReturnTypes(array $returnType = null): void { $this->returnTypesRaw = $returnType; if (null === $returnType) { @@ -245,12 +240,12 @@ public function setReturnTypes(?array $returnType = null): void } } - if (count($castTypes) > 0) { + if (\count($castTypes) > 0) { $types['object'] = []; $this->returnClassTypes = $castTypes; } - if (count($types) > 0) { + if (\count($types) > 0) { $this->returnTypes = $types; } } @@ -296,47 +291,47 @@ public function isEmpty(): bool */ public function checkVisibility(array $visibility, string $name, array $original = null): void { - if (count($visibility) > 1) { - if (in_array('public', $visibility) && in_array('protected', $visibility)) { + if (\count($visibility) > 1) { + if (\in_array('public', $visibility) && \in_array('protected', $visibility)) { throw new CompilerException("Method '$name' cannot be 'public' and 'protected' at the same time", $original); } - if (in_array('public', $visibility) && in_array('private', $visibility)) { + if (\in_array('public', $visibility) && \in_array('private', $visibility)) { throw new CompilerException("Method '$name' cannot be 'public' and 'private' at the same time", $original); } - if (in_array('private', $visibility) && in_array('protected', $visibility)) { + if (\in_array('private', $visibility) && \in_array('protected', $visibility)) { throw new CompilerException("Method '$name' cannot be 'protected' and 'private' at the same time", $original); } - if (in_array('private', $visibility) && in_array('internal', $visibility)) { + if (\in_array('private', $visibility) && \in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'private' at the same time", $original); } - if (in_array('protected', $visibility) && in_array('internal', $visibility)) { + if (\in_array('protected', $visibility) && \in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'protected' at the same time", $original); } - if (in_array('public', $visibility) && in_array('internal', $visibility)) { + if (\in_array('public', $visibility) && \in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'public' at the same time", $original); } } if ('__construct' === $name) { - if (in_array('static', $visibility)) { + if (\in_array('static', $visibility)) { throw new CompilerException("Constructors cannot be 'static'", $original); } } elseif ('__destruct' === $name) { - if (in_array('static', $visibility)) { + if (\in_array('static', $visibility)) { throw new CompilerException("Destructors cannot be 'static'", $original); } } - $this->isAbstract = in_array('abstract', $visibility); - $this->isStatic = in_array('static', $visibility); - $this->isFinal = in_array('final', $visibility); - $this->isPublic = in_array('public', $visibility); - $this->isInternal = in_array('internal', $visibility); + $this->isAbstract = \in_array('abstract', $visibility); + $this->isStatic = \in_array('static', $visibility); + $this->isFinal = \in_array('final', $visibility); + $this->isPublic = \in_array('public', $visibility); + $this->isInternal = \in_array('internal', $visibility); } /** @@ -502,7 +497,7 @@ public function getParameters(): ?Parameters */ public function hasReturnTypes(): bool { - return count($this->returnTypes) || count($this->returnClassTypes); + return \count($this->returnTypes) || \count($this->returnClassTypes); } /** @@ -521,7 +516,7 @@ public function areReturnTypesIntCompatible(): bool $types = ['int', 'uint', 'char', 'uchar', 'long', 'ulong']; foreach ($this->returnTypes as $returnType => $definition) { - if (in_array($returnType, $types)) { + if (\in_array($returnType, $types)) { return true; } } @@ -626,7 +621,7 @@ public function getNumberOfRequiredParameters(): int */ public function hasModifier(string $modifier): bool { - return in_array($modifier, $this->visibility); + return \in_array($modifier, $this->visibility); } /** @@ -639,7 +634,7 @@ public function getVisibility(): array public function isDeprecated(): bool { - return !empty($this->visibility) && in_array('deprecated', $this->visibility, true); + return !empty($this->visibility) && \in_array('deprecated', $this->visibility, true); } /** @@ -720,7 +715,7 @@ public function isMixed(): bool */ public function isPrivate(): bool { - return in_array('private', $this->visibility); + return \in_array('private', $this->visibility); } /** @@ -728,7 +723,7 @@ public function isPrivate(): bool */ public function isProtected(): bool { - return in_array('protected', $this->visibility); + return \in_array('protected', $this->visibility); } /** @@ -861,7 +856,7 @@ public function removeMemoryStackReferences(SymbolTable $symbolTable, string $co * Assigns a default value. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function assignDefaultValue(array $parameter, CompilationContext $compilationContext): string { @@ -1221,7 +1216,7 @@ public function assignZvalValue(array $parameter, CompilationContext $compilatio { $dataType = $this->getParamDataType($parameter); - if (in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { + if (\in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { return ''; } @@ -1273,7 +1268,7 @@ public function preCompile(CompilationContext $compilationContext): void $typeInference = null; $callGathererPass = null; - if (is_object($this->statements)) { + if (\is_object($this->statements)) { $compilationContext->currentMethod = $this; /** @@ -1317,7 +1312,7 @@ public function preCompile(CompilationContext $compilationContext): void * Compiles the method. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -1452,12 +1447,12 @@ public function compile(CompilationContext $compilationContext): void */ if (!empty($parameter['const'])) { $symbol->setReadOnly(true); - if (is_object($symbolParam)) { + if (\is_object($symbolParam)) { $symbolParam->setReadOnly(true); } } - if (is_object($symbolParam)) { + if (\is_object($symbolParam)) { /** * Parameters are marked as 'external' */ @@ -1527,7 +1522,7 @@ public function compile(CompilationContext $compilationContext): void /** * Compile the block of statements if any */ - if (is_object($this->statements)) { + if (\is_object($this->statements)) { $compilationContext->staticContext = $this->hasModifier('static'); /** @@ -1566,7 +1561,7 @@ public function compile(CompilationContext $compilationContext): void * variable is modified so as do the proper separation. */ $parametersToSeparate = []; - if (is_object($this->statements)) { + if (\is_object($this->statements)) { if (!$this->localContext instanceof LocalContextPass) { $writeDetector = new WriteDetector(); } @@ -1636,7 +1631,7 @@ public function compile(CompilationContext $compilationContext): void $name = match ($dataType) { 'object', 'callable', 'resource', 'variable', 'mixed' => $parameter['name'], - default => $parameter['name'] . '_param', + default => $parameter['name'].'_param', }; /** @@ -1784,7 +1779,7 @@ public function compile(CompilationContext $compilationContext): void if (!$variable->isUsed()) { $node = $variable->getLastUsedNode(); - if (is_array($node)) { + if (\is_array($node)) { $expression = $node['expr'] ?? $node; $compilationContext->logger->warning( 'Variable "'.$variable->getName().'" assigned but not used in '.$completeName.'::'.$this->getName(), @@ -1799,7 +1794,7 @@ public function compile(CompilationContext $compilationContext): void } } - if (count($usedVariables)) { + if (\count($usedVariables)) { $codePrinter->preOutputBlankLine(); } @@ -1818,14 +1813,14 @@ public function compile(CompilationContext $compilationContext): void )); foreach ($requiredParams as $requiredParam) { - $tempCodePrinter->output("\t"."\t".$this->detectParam($requiredParam, $compilationContext)); + $tempCodePrinter->output("\t\t".$this->detectParam($requiredParam, $compilationContext)); } if (!empty($optionalParams)) { - $tempCodePrinter->output("\t"."\t".'Z_PARAM_OPTIONAL'); + $tempCodePrinter->output("\t\t".'Z_PARAM_OPTIONAL'); foreach ($optionalParams as $optionalParam) { - $tempCodePrinter->output("\t"."\t".$this->detectParam($optionalParam, $compilationContext)); + $tempCodePrinter->output("\t\t".$this->detectParam($optionalParam, $compilationContext)); } } @@ -1854,7 +1849,7 @@ public function compile(CompilationContext $compilationContext): void /** * Finalize the method compilation */ - if (is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { + if (\is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { /** * If the last statement is not a 'return' or 'throw' we need to * restore the memory stack if needed. @@ -1904,7 +1899,7 @@ public function compile(CompilationContext $compilationContext): void */ public function hasChildReturnStatementType(array $statement): bool { - if (!isset($statement['statements']) || !is_array($statement['statements'])) { + if (!isset($statement['statements']) || !\is_array($statement['statements'])) { return false; } @@ -1952,7 +1947,7 @@ public function getInternalName(): string /** * Returns arginfo name for current method. */ - public function getArgInfoName(?Definition $classDefinition = null): string + public function getArgInfoName(Definition $classDefinition = null): string { if ($classDefinition instanceof Definition) { return sprintf( @@ -1990,7 +1985,7 @@ public function isReturnTypesHintDetermined(): bool return true; } - if (0 === count($this->returnTypes)) { + if (0 === \count($this->returnTypes)) { return false; } @@ -2003,14 +1998,14 @@ public function isReturnTypesHintDetermined(): bool } if (isset($definition['type']) && 'return-type-annotation' === $definition['type']) { - if ($this->areReturnTypesBoolCompatible() || - $this->areReturnTypesDoubleCompatible() || - $this->areReturnTypesIntCompatible() || - $this->areReturnTypesNullCompatible() || - $this->areReturnTypesStringCompatible() || - $this->areReturnTypesFalseCompatible() || - $this->areReturnTypesObjectCompatible() || - array_key_exists('array', $this->getReturnTypes()) + if ($this->areReturnTypesBoolCompatible() + || $this->areReturnTypesDoubleCompatible() + || $this->areReturnTypesIntCompatible() + || $this->areReturnTypesNullCompatible() + || $this->areReturnTypesStringCompatible() + || $this->areReturnTypesFalseCompatible() + || $this->areReturnTypesObjectCompatible() + || \array_key_exists('array', $this->getReturnTypes()) ) { continue; } @@ -2032,9 +2027,9 @@ public function isReturnTypesHintDetermined(): bool */ public function isReturnTypeNullableObject(): bool { - return count($this->returnTypes) === 2 && - isset($this->returnTypes['object']) && - isset($this->returnTypes['null']); + return \count($this->returnTypes) === 2 + && isset($this->returnTypes['object']) + && isset($this->returnTypes['null']); } /** @@ -2042,7 +2037,7 @@ public function isReturnTypeNullableObject(): bool */ public function isReturnTypeObject(): bool { - return count($this->returnTypes) === 1 && isset($this->returnTypes['object']); + return \count($this->returnTypes) === 1 && isset($this->returnTypes['object']); } /** @@ -2055,12 +2050,12 @@ public function areReturnTypesCompatible(): bool return true; } - $totalTypes = count($this->returnTypes); + $totalTypes = \count($this->returnTypes); // union types if ($totalTypes > 1) { $diff = array_diff(array_keys($this->returnTypes), array_keys($this->mayBeArgTypes)); - if (count($diff) === 0) { + if (\count($diff) === 0) { return true; } } @@ -2167,10 +2162,10 @@ public function detectParam(array $parameter, CompilationContext $compilationCon break; case 'variable': - if (isset($parameter['cast']) && - $parameter['cast']['type'] === 'variable' && - $parameter['cast']['value'] && - $this->classDefinition !== null + if (isset($parameter['cast']) + && $parameter['cast']['type'] === 'variable' + && $parameter['cast']['value'] + && $this->classDefinition !== null ) { $classEntry = (new ClassEntry($parameter['cast']['value'], $compilationContext))->get(); if ($hasDefaultNull) { diff --git a/Library/Class/Method/Parameters.php b/Library/Class/Method/Parameters.php index 8cc9799363..16b24a8037 100644 --- a/Library/Class/Method/Parameters.php +++ b/Library/Class/Method/Parameters.php @@ -13,16 +13,12 @@ namespace Zephir\Class\Method; -use ArrayAccess; -use Countable; -use Iterator; use Zephir\Exception\CompilerException; -use function count; /** * Represents the parameters defined in a method. */ -class Parameters implements Countable, Iterator, ArrayAccess +class Parameters implements \Countable, \Iterator, \ArrayAccess { private int $position = 0; @@ -67,7 +63,7 @@ public function getRequiredParameters(): array public function countRequiredParameters(): int { - return count($this->requiredParameters); + return \count($this->requiredParameters); } public function getOptionalParameters(): array @@ -77,7 +73,7 @@ public function getOptionalParameters(): array public function countOptionalParameters(): int { - return count($this->optionalParameters); + return \count($this->optionalParameters); } public function fetchParameters(bool $isMethodInternal): array @@ -117,7 +113,7 @@ public function fetchParameters(bool $isMethodInternal): array */ public function count(): int { - return count($this->parameters); + return \count($this->parameters); } public function rewind(): void diff --git a/Library/Class/Property.php b/Library/Class/Property.php index 0c7852af49..051f2d9214 100644 --- a/Library/Class/Property.php +++ b/Library/Class/Property.php @@ -13,7 +13,6 @@ namespace Zephir\Class; -use ReflectionException; use Zephir\Class\Definition\Definition; use Zephir\CompilationContext; use Zephir\Exception; @@ -23,8 +22,7 @@ use Zephir\Expression\Builder\Operators\BinaryOperator; use Zephir\StatementsBlock; use Zephir\Types\Types; -use function in_array; -use function is_array; + use function Zephir\add_slashes; /** @@ -34,15 +32,15 @@ class Property { public function __construct( protected Definition $classDefinition, - protected array $visibility, - protected string $name, - protected ?array $defaultValue, - protected ?string $docBlock = null, - protected ?array $original = null, + protected array $visibility, + protected string $name, + protected ?array $defaultValue, + protected ?string $docBlock = null, + protected ?array $original = null, ) { $this->checkVisibility($visibility, $name, $original); - if (!is_array($this->defaultValue)) { + if (!\is_array($this->defaultValue)) { $this->defaultValue = []; $this->defaultValue['type'] = 'null'; $this->defaultValue['value'] = null; @@ -93,15 +91,15 @@ public function getOriginal(): ?array /** * Checks for visibility congruence. */ - public function checkVisibility(array $visibility, string $name, ?array $original = null): void + public function checkVisibility(array $visibility, string $name, array $original = null): void { - if (in_array('public', $visibility) && in_array('protected', $visibility)) { + if (\in_array('public', $visibility) && \in_array('protected', $visibility)) { throw new CompilerException("Property '$name' cannot be 'public' and 'protected' at the same time", $original); } - if (in_array('public', $visibility) && in_array('private', $visibility)) { + if (\in_array('public', $visibility) && \in_array('private', $visibility)) { throw new CompilerException("Property '$name' cannot be 'public' and 'private' at the same time", $original); } - if (in_array('private', $visibility) && in_array('protected', $visibility)) { + if (\in_array('private', $visibility) && \in_array('protected', $visibility)) { throw new CompilerException("Property '$name' cannot be 'protected' and 'private' at the same time", $original); } } @@ -154,7 +152,7 @@ public function getDocBlock(): ?string */ public function isStatic(): bool { - return in_array('static', $this->visibility); + return \in_array('static', $this->visibility); } /** @@ -162,7 +160,7 @@ public function isStatic(): bool */ public function isPublic(): bool { - return in_array('public', $this->visibility); + return \in_array('public', $this->visibility); } /** @@ -170,7 +168,7 @@ public function isPublic(): bool */ public function isProtected(): bool { - return in_array('protected', $this->visibility); + return \in_array('protected', $this->visibility); } /** @@ -178,14 +176,14 @@ public function isProtected(): bool */ public function isPrivate(): bool { - return in_array('private', $this->visibility); + return \in_array('private', $this->visibility); } /** * Produce the code to register a property. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -276,7 +274,7 @@ protected function getLetStatement() ->setStatements($exprBuilder->statements()->block([$lsb])); } - protected function getBooleanCode($value): bool|string + protected function getBooleanCode($value): bool | string { if ('true' == $value || true === $value) { return '1'; @@ -294,7 +292,7 @@ protected function getBooleanCode($value): bool|string * * @param CompilationContext $compilationContext * @param string $type - * @param $value + * @param $value * * @throws Exception * @throws CompilerException diff --git a/Library/Code/ArgInfoDefinition.php b/Library/Code/ArgInfoDefinition.php index 33116ae4d6..de4c4d816c 100644 --- a/Library/Code/ArgInfoDefinition.php +++ b/Library/Code/ArgInfoDefinition.php @@ -17,8 +17,8 @@ use Zephir\Class\Method\Parameters; use Zephir\CompilationContext; use Zephir\Exception; + use function array_key_exists; -use function count; use function Zephir\escape_class; class ArgInfoDefinition @@ -30,11 +30,11 @@ class ArgInfoDefinition private bool $richFormat = true; public function __construct( - private string $name, - private Method $functionLike, - private Printer $codePrinter, + private string $name, + private Method $functionLike, + private Printer $codePrinter, private CompilationContext $compilationContext, - private bool $returnByRef = false + private bool $returnByRef = false ) { $this->parameters = $this->functionLike->getParameters(); } @@ -62,9 +62,9 @@ public function render(): void return; } - if ($this->richFormat && - $this->functionLike->isReturnTypesHintDetermined() && - $this->functionLike->areReturnTypesCompatible() + if ($this->richFormat + && $this->functionLike->isReturnTypesHintDetermined() + && $this->functionLike->areReturnTypesCompatible() ) { $this->richRenderStart(); @@ -124,7 +124,7 @@ public function render(): void private function richRenderStart(): void { - if (array_key_exists('object', $this->functionLike->getReturnTypes()) && 1 === count($this->functionLike->getReturnClassTypes())) { + if (\array_key_exists('object', $this->functionLike->getReturnTypes()) && 1 === \count($this->functionLike->getReturnClassTypes())) { $class = key($this->functionLike->getReturnClassTypes()); $class = escape_class($this->compilationContext->getFullName($class)); @@ -242,7 +242,7 @@ private function richRenderStart(): void return; } - if (count($this->functionLike->getReturnTypes()) > 1) { + if (\count($this->functionLike->getReturnTypes()) > 1) { $types = []; $mayBeTypes = $this->functionLike->getMayBeArgTypes(); foreach ($this->functionLike->getReturnTypes() as $type => $typeInfo) { @@ -253,7 +253,7 @@ private function richRenderStart(): void $types[] = $mayBeTypes[$type]; } - if (count($types) > 1) { + if (\count($types) > 1) { $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( @@ -423,7 +423,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 @@ -490,7 +490,7 @@ 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'; } diff --git a/Library/Code/Builder/Struct.php b/Library/Code/Builder/Struct.php index b9528f64f2..a5e6ff1fc8 100644 --- a/Library/Code/Builder/Struct.php +++ b/Library/Code/Builder/Struct.php @@ -52,7 +52,7 @@ public function __toString(): string /** * @param string $field - * @param string $type + * @param string $type * * @throws InvalidArgumentException */ @@ -72,10 +72,10 @@ public function addProperty(string $field, string $type): void * @param array $global * @param string $namespace * + * @return string + * * @throws RuntimeException * @throws InvalidArgumentException - * - * @return string */ public function getCDefault(string $name, array $global, string $namespace): string { @@ -155,6 +155,7 @@ public function getInitEntry(string $name, array $global, string $namespace): st /** * Generates the internal c-type according to the php's type. + * * @throws InvalidArgumentException */ protected function convertToCType(string $type): string diff --git a/Library/CompilationContext.php b/Library/CompilationContext.php index 41457c2bad..c2522a6db1 100644 --- a/Library/CompilationContext.php +++ b/Library/CompilationContext.php @@ -23,7 +23,6 @@ use Zephir\Code\Printer; use Zephir\Exception\CompilerException; use Zephir\Passes\StaticTypeInference; -use function in_array; /** * This class encapsulates important entities required during compilation @@ -163,7 +162,7 @@ public function getFullName(string $className): string */ public function classLookup(string $className, array $statement = null): AbstractDefinition { - if (!in_array($className, ['self', 'static', 'parent'])) { + if (!\in_array($className, ['self', 'static', 'parent'])) { $className = $this->getFullName($className); if ($this->compiler->isClass($className)) { return $this->compiler->getClassDefinition($className); @@ -172,7 +171,7 @@ public function classLookup(string $className, array $statement = null): Abstrac throw new CompilerException("Cannot locate class '$className'", $statement); } - if (in_array($className, ['self', 'static'])) { + if (\in_array($className, ['self', 'static'])) { return $this->classDefinition; } diff --git a/Library/CompiledExpression.php b/Library/CompiledExpression.php index dadc5db02c..ec5fc2df58 100644 --- a/Library/CompiledExpression.php +++ b/Library/CompiledExpression.php @@ -13,8 +13,6 @@ namespace Zephir; -use Closure; - /** * This represents a compiled expression, the object can be used to check * if the expression type is able to used in certain types of the application. @@ -97,7 +95,7 @@ public function isIntCompatibleType(): bool */ public function resolve(?string $result, CompilationContext $compilationContext): string { - if (!($this->code instanceof Closure)) { + if (!($this->code instanceof \Closure)) { return $this->code; } diff --git a/Library/Compiler.php b/Library/Compiler.php index 57f49ca5f1..a97056c84c 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -13,13 +13,8 @@ namespace Zephir; -use DirectoryIterator; use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; -use RecursiveDirectoryIterator; -use RecursiveIteratorIterator; -use ReflectionClass; -use ReflectionException; use Zephir\Backend\Backend; use Zephir\Backend\FcallManagerInterface; use Zephir\Backend\StringsManager; @@ -37,12 +32,6 @@ use Zephir\Exception\RuntimeException; use Zephir\FileSystem\FileSystemInterface; use Zephir\Parser\Manager; -use function count; -use function dirname; -use function extension_loaded; -use function is_array; -use function is_string; -use const DIRECTORY_SEPARATOR; final class Compiler { @@ -131,7 +120,7 @@ private function resolvePrototypesPath(): ?string // fallback if (empty($prototypesPath)) { - $prototypesPath = dirname(__DIR__).'/prototypes'; + $prototypesPath = \dirname(__DIR__).'/prototypes'; } if (!is_dir($prototypesPath) || !is_readable($prototypesPath)) { @@ -207,7 +196,7 @@ public function addFunction(FunctionDefinition $func, array $statement = []): vo */ public function loadExternalClass(string $className, string $location): bool { - $filePath = $location.DIRECTORY_SEPARATOR.strtolower(str_replace('\\', DIRECTORY_SEPARATOR, $className)).'.zep'; + $filePath = $location.\DIRECTORY_SEPARATOR.strtolower(str_replace('\\', \DIRECTORY_SEPARATOR, $className)).'.zep'; /** * Fix the class name. @@ -302,7 +291,7 @@ public function isBundledInterface(string $className): bool /** * Returns class the class definition from a given class name. */ - public function getClassDefinition(string $className): Definition|bool + public function getClassDefinition(string $className): Definition | bool { foreach ($this->definitions as $key => $value) { if (!strcasecmp($key, $className)) { @@ -325,12 +314,12 @@ public function addClassDefinition(CompilerFileAnonymous $file, Definition $clas /** * Returns class the class definition from a given class name. * - * @throws ReflectionException + * @throws \ReflectionException */ public function getInternalClassDefinition(string $className): Definition { if (!isset(self::$internalDefinitions[$className])) { - $reflection = new ReflectionClass($className); + $reflection = new \ReflectionClass($className); self::$internalDefinitions[$className] = Definition::buildFromReflection($reflection); } @@ -391,7 +380,7 @@ public function getGccFlags(bool $development = false): string $gccFlags = getenv('CFLAGS'); - if (!is_string($gccFlags)) { + if (!\is_string($gccFlags)) { if (false === $development) { $gccVersion = $this->getGccVersion(); if (version_compare($gccVersion, '4.6.0', '>=')) { @@ -429,8 +418,8 @@ public function preCompileHeaders(): void $phpIncludes = $this->getPhpIncludeDirs(); - /** @var DirectoryIterator $file */ - foreach (new DirectoryIterator('ext/kernel') as $file) { + /** @var \DirectoryIterator $file */ + foreach (new \DirectoryIterator('ext/kernel') as $file) { if ($file->isDir() || $file->getExtension() !== 'h') { continue; } @@ -453,7 +442,7 @@ public function preCompileHeaders(): void * Generates the C sources from Zephir without compiling them. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function generate(bool $fromGenerate = false): bool { @@ -466,7 +455,7 @@ public function generate(bool $fromGenerate = false): bool * Check whether there are external dependencies. */ $externalDependencies = $this->config->get('external-dependencies'); - if (is_array($externalDependencies)) { + if (\is_array($externalDependencies)) { foreach ($externalDependencies as $dependencyNs => $location) { if (!file_exists($location)) { throw new CompilerException( @@ -484,8 +473,8 @@ public function generate(bool $fromGenerate = false): bool /** * Round 1. pre-compile all files in memory */ - $this->recursivePreCompile(str_replace('\\', DIRECTORY_SEPARATOR, $namespace)); - if (!count($this->files)) { + $this->recursivePreCompile(str_replace('\\', \DIRECTORY_SEPARATOR, $namespace)); + if (!\count($this->files)) { throw new Exception( "Zephir files to compile couldn't be found. Did you add a first class to the extension?" ); @@ -520,7 +509,7 @@ public function generate(bool $fromGenerate = false): bool * Convert C-constants into PHP constants. */ $constantsSources = $this->config->get('constants-sources'); - if (is_array($constantsSources)) { + if (\is_array($constantsSources)) { $this->loadConstantsSources($constantsSources); } @@ -528,7 +517,7 @@ public function generate(bool $fromGenerate = false): bool * Set extension globals. */ $globals = $this->config->get('globals'); - if (is_array($globals)) { + if (\is_array($globals)) { $this->setExtensionGlobals($globals); } @@ -540,7 +529,7 @@ public function generate(bool $fromGenerate = false): bool FunctionCall::addOptimizerDir("{$optimizersPath}/FunctionCall"); $customOptimizersPaths = $this->config->get('optimizer-dirs'); - if (is_array($customOptimizersPaths)) { + if (\is_array($customOptimizersPaths)) { foreach ($customOptimizersPaths as $directory) { FunctionCall::addOptimizerDir(realpath($directory)); } @@ -550,7 +539,7 @@ public function generate(bool $fromGenerate = false): bool * Load additional extension prototypes. */ $prototypesPath = $this->resolvePrototypesPath(); - foreach (new DirectoryIterator($prototypesPath) as $file) { + foreach (new \DirectoryIterator($prototypesPath) as $file) { if ($file->isDir() || $file->isDot()) { continue; } @@ -559,7 +548,7 @@ public function generate(bool $fromGenerate = false): bool $realPath = "{$file->getPath()}/{$file->getFilename()}"; $extension = $file->getBasename(".{$file->getExtension()}"); - if (!extension_loaded($extension)) { + if (!\extension_loaded($extension)) { require_once $realPath; } } @@ -568,15 +557,15 @@ public function generate(bool $fromGenerate = false): bool * Load customer additional extension prototypes. */ $prototypeDirs = $this->config->get('prototype-dir'); - if (is_array($prototypeDirs)) { + if (\is_array($prototypeDirs)) { foreach ($prototypeDirs as $prototype => $prototypeDir) { /** * Check if the extension is installed */ - if (!extension_loaded($prototype)) { + if (!\extension_loaded($prototype)) { $prototypeRealpath = realpath($prototypeDir); if ($prototypeRealpath) { - foreach (new RecursiveDirectoryIterator($prototypeRealpath) as $file) { + foreach (new \RecursiveDirectoryIterator($prototypeRealpath) as $file) { if ($file->isDir()) { continue; } @@ -645,7 +634,7 @@ public function generate(bool $fromGenerate = false): bool * Round 3.3. Load extra C-sources. */ $extraSources = $this->config->get('extra-sources'); - if (is_array($extraSources)) { + if (\is_array($extraSources)) { $this->extraFiles = $extraSources; } else { $this->extraFiles = []; @@ -655,7 +644,7 @@ public function generate(bool $fromGenerate = false): bool * Round 3.4. Load extra classes sources. */ $extraClasses = $this->config->get('extra-classes'); - if (is_array($extraClasses)) { + if (\is_array($extraClasses)) { foreach ($extraClasses as $value) { if (isset($value['source'])) { $this->extraFiles[] = $value['source']; @@ -668,7 +657,7 @@ public function generate(bool $fromGenerate = false): bool */ $namespace = str_replace('\\', '_', $namespace); $extensionName = $this->config->get('extension-name'); - if (empty($extensionName) || !is_string($extensionName)) { + if (empty($extensionName) || !\is_string($extensionName)) { $extensionName = $namespace; } @@ -715,7 +704,7 @@ public function generate(bool $fromGenerate = false): bool * * @throws Exception */ - public function compile(bool $development = false, ?int $jobs = null): void + public function compile(bool $development = false, int $jobs = null): void { $jobs = $jobs ?: 2; @@ -724,7 +713,7 @@ public function compile(bool $development = false, ?int $jobs = null): void */ $namespace = str_replace('\\', '_', $this->checkDirectory()); $extensionName = $this->config->get('extension-name'); - if (empty($extensionName) || !is_string($extensionName)) { + if (empty($extensionName) || !\is_string($extensionName)) { $extensionName = $namespace; } @@ -765,7 +754,7 @@ public function compile(bool $development = false, ?int $jobs = null): void $configureFix = ["var PHP_ANALYZER = 'disabled';", "var PHP_PGO = 'no';", "var PHP_PGI = 'no';"]; $hasChanged = false; - if (false === strpos($configureFile, $fixMarker)) { + if (!str_contains($configureFile, $fixMarker)) { $configureFile = $fixMarker.PHP_EOL.implode(PHP_EOL, $configureFix).PHP_EOL.$configureFile; $hasChanged = true; } @@ -830,7 +819,7 @@ public function compile(bool $development = false, ?int $jobs = null): void * * @throws ConfigException * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function api(array $options = [], bool $fromGenerate = false): void { @@ -838,7 +827,7 @@ public function api(array $options = [], bool $fromGenerate = false): void $this->generate(); } - $templatesPath = $this->templatesPath ?: dirname(__DIR__).'/templates'; + $templatesPath = $this->templatesPath ?: \dirname(__DIR__).'/templates'; $documentator = new Documentation($this->files, $this->config, $templatesPath, $options); $documentator->setLogger($this->logger); @@ -851,7 +840,7 @@ public function api(array $options = [], bool $fromGenerate = false): void * Generate IDE stubs. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function stubs(bool $fromGenerate = false): void { @@ -976,7 +965,7 @@ public function createConfigFiles(string $project): bool $buildDirs = []; foreach ($compiledFiles as $file) { - $dir = dirname($file); + $dir = \dirname($file); if (!in_array($dir, $buildDirs)) { $buildDirs[] = $dir; @@ -1135,7 +1124,7 @@ public function processExtensionGlobals(string $namespace): array * Generate the extensions globals declaration. */ $globals = $this->config->get('globals'); - if (is_array($globals)) { + if (\is_array($globals)) { $structures = []; $variables = []; foreach ($globals as $name => $global) { @@ -1277,7 +1266,7 @@ public function processExtensionInfo(): string $phpinfo = ''; $info = $this->config->get('info'); - if (!is_array($info)) { + if (!\is_array($info)) { return $phpinfo; } @@ -1289,7 +1278,7 @@ public function processExtensionInfo(): string $headerArray[] = '"'.htmlentities($header).'"'; } - $phpinfo .= "\t".'php_info_print_table_header('.count($headerArray).', '. + $phpinfo .= "\t".'php_info_print_table_header('.\count($headerArray).', '. implode(', ', $headerArray).');'.PHP_EOL; } @@ -1300,7 +1289,7 @@ public function processExtensionInfo(): string $rowArray[] = '"'.htmlentities($field).'"'; } - $phpinfo .= "\t".'php_info_print_table_row('.count($rowArray).', '. + $phpinfo .= "\t".'php_info_print_table_row('.\count($rowArray).', '. implode(', ', $rowArray).');'.PHP_EOL; } } @@ -1495,7 +1484,7 @@ public function createProjectFiles(string $project): bool * Check if there are module/request/global destructors. */ $destructors = $this->config->get('destructors'); - if (is_array($destructors)) { + if (\is_array($destructors)) { $invokeRequestDestructors = $this->processCodeInjection($destructors, 'request'); $includes .= PHP_EOL.$invokeRequestDestructors[0]; $reqDestructors = $invokeRequestDestructors[1]; @@ -1517,7 +1506,7 @@ public function createProjectFiles(string $project): bool * Check if there are module/request/global initializers. */ $initializers = $this->config->get('initializers'); - if (is_array($initializers)) { + if (\is_array($initializers)) { $invokeRequestInitializers = $this->processCodeInjection($initializers, 'request'); $includes .= PHP_EOL.$invokeRequestInitializers[0]; $reqInitializers = $invokeRequestInitializers[1]; @@ -1535,7 +1524,7 @@ public function createProjectFiles(string $project): bool * Append extra details. */ $extraClasses = $this->config->get('extra-classes'); - if (is_array($extraClasses)) { + if (\is_array($extraClasses)) { foreach ($extraClasses as $value) { if (isset($value['init'])) { $completeClassInits[] = 'ZEPHIR_INIT('.$value['init'].')'; @@ -1631,7 +1620,7 @@ public function createProjectFiles(string $project): bool * Append extra headers. */ $extraClasses = $this->config->get('extra-classes'); - if (is_array($extraClasses)) { + if (\is_array($extraClasses)) { foreach ($extraClasses as $value) { if (isset($value['header'])) { $include = '#include "'.$value['header'].'"'; @@ -1752,7 +1741,7 @@ public function checkIfPhpized(): bool */ public static function getShortUserPath(string $path): string { - return str_replace('\\', '/', str_replace(getcwd().DIRECTORY_SEPARATOR, '', $path)); + return str_replace('\\', '/', str_replace(getcwd().\DIRECTORY_SEPARATOR, '', $path)); } /** @@ -1763,7 +1752,7 @@ public static function getShortUserPath(string $path): string public function generatePackageDependenciesM4(string $contentM4): string { $packageDependencies = $this->config->get('package-dependencies'); - if (!is_array($packageDependencies)) { + if (!\is_array($packageDependencies)) { return str_replace('%PROJECT_PACKAGE_DEPENDENCIES%', '', $contentM4); } @@ -1778,7 +1767,7 @@ public function generatePackageDependenciesM4(string $contentM4): string $operatorCmd = '--exact-version'; $ar = explode('=', $version); - if (1 === count($ar)) { + if (1 === \count($ar)) { if ('*' === $version) { $version = '0.0.0'; $operator = '>='; @@ -1831,7 +1820,7 @@ private function preCompile(string $filePath): void } if (preg_match('#\.zep$#', $filePath)) { - $className = str_replace(DIRECTORY_SEPARATOR, '\\', $filePath); + $className = str_replace(\DIRECTORY_SEPARATOR, '\\', $filePath); $className = preg_replace('#.zep$#', '', $className); $className = implode('\\', array_map('ucfirst', explode('\\', $className))); @@ -1857,7 +1846,7 @@ private function recursivePreCompile(string $path): void sprintf( "An invalid path was passed to the compiler. Unable to obtain the '%s%s%s' directory.", getcwd(), - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, $path ) ); @@ -1866,9 +1855,9 @@ private function recursivePreCompile(string $path): void /** * Pre compile all files. */ - $iterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path), - RecursiveIteratorIterator::SELF_FIRST + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($path), + \RecursiveIteratorIterator::SELF_FIRST ); $files = []; @@ -1891,8 +1880,8 @@ private function recursivePreCompile(string $path): void * * @deprecated * - * @param $src - * @param $dest + * @param $src + * @param $dest * @param string $pattern * @param mixed $callback * @@ -1901,7 +1890,7 @@ private function recursivePreCompile(string $path): void private function recursiveProcess($src, $dest, $pattern = null, $callback = 'copy') { $success = true; - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $item) { $pathName = $item->getPathname(); if (!is_readable($pathName)) { @@ -1913,13 +1902,13 @@ private function recursiveProcess($src, $dest, $pattern = null, $callback = 'cop if ($item->isDir()) { if ('.' != $fileName && '..' != $fileName && '.libs' != $fileName) { - if (!is_dir($dest.DIRECTORY_SEPARATOR.$fileName)) { - mkdir($dest.DIRECTORY_SEPARATOR.$fileName, 0755, true); + if (!is_dir($dest.\DIRECTORY_SEPARATOR.$fileName)) { + mkdir($dest.\DIRECTORY_SEPARATOR.$fileName, 0755, true); } - $this->recursiveProcess($pathName, $dest.DIRECTORY_SEPARATOR.$fileName, $pattern, $callback); + $this->recursiveProcess($pathName, $dest.\DIRECTORY_SEPARATOR.$fileName, $pattern, $callback); } } elseif (!$pattern || ($pattern && 1 === preg_match($pattern, $fileName))) { - $path = $dest.DIRECTORY_SEPARATOR.$fileName; + $path = $dest.\DIRECTORY_SEPARATOR.$fileName; $success = $success && \call_user_func($callback, $pathName, $path); } } @@ -1943,9 +1932,9 @@ private function recursiveDeletePath($path, $mask) return; } - $objects = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path), - RecursiveIteratorIterator::SELF_FIRST + $objects = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($path), + \RecursiveIteratorIterator::SELF_FIRST ); foreach ($objects as $name => $object) { @@ -1993,7 +1982,7 @@ private function processAddSources(array $sources, string $project): array { $groupSources = []; foreach ($sources as $source) { - $dirName = str_replace(DIRECTORY_SEPARATOR, '/', dirname($source)); + $dirName = str_replace(\DIRECTORY_SEPARATOR, '/', \dirname($source)); if (!isset($groupSources[$dirName])) { $groupSources[$dirName] = []; } @@ -2024,11 +2013,11 @@ private function assertRequiredExtensionsIsPresent(): void $extensions = []; foreach ($extensionRequires as $value) { // TODO: We'll use this as an object in the future. - if (!is_string($value)) { + if (!\is_string($value)) { continue; } - if (!extension_loaded($value)) { + if (!\extension_loaded($value)) { $extensions[] = $value; } } @@ -2071,7 +2060,7 @@ private function checkKernelFile(string $src, string $dst): bool */ private function checkKernelFiles(): bool { - $kernelPath = 'ext'.DIRECTORY_SEPARATOR.'kernel'; + $kernelPath = 'ext'.\DIRECTORY_SEPARATOR.'kernel'; if (!file_exists($kernelPath)) { if (!mkdir($kernelPath, 0775, true)) { @@ -2116,7 +2105,7 @@ private function checkDirectory(): string throw new Exception('Extension namespace cannot be loaded'); } - if (!is_string($namespace)) { + if (!\is_string($namespace)) { throw new Exception('Extension namespace is invalid'); } @@ -2154,7 +2143,7 @@ private function getGccVersion(): string $lines = $this->filesystem->file('gcc-version'); $lines = array_filter($lines); - $lastLine = $lines[count($lines) - 1]; + $lastLine = $lines[\count($lines) - 1]; if (preg_match('/\d+\.\d+\.\d+/', $lastLine, $matches)) { return $matches[0]; } @@ -2166,7 +2155,7 @@ private function toUnixPaths(array $paths): array { return array_map( static function (string $path): string { - return str_replace(DIRECTORY_SEPARATOR, '/', $path); + return str_replace(\DIRECTORY_SEPARATOR, '/', $path); }, $paths ); diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 6c9fd343ed..01c917e70c 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -15,7 +15,6 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; -use ReflectionException; use Zephir\Class\Constant; use Zephir\Class\Definition\Definition; use Zephir\Class\Definition\DefinitionRuntime; @@ -29,7 +28,6 @@ use Zephir\Exception\IllegalStateException; use Zephir\Exception\ParseException; use Zephir\FileSystem\FileSystemInterface; -use function is_array; /** * This class represents every file compiled in a project. @@ -192,10 +190,10 @@ public function addFunction(Compiler $compiler, FunctionDefinition $func, array * * @param Compiler $compiler * + * @return array + * * @throws ParseException * @throws IllegalStateException if the intermediate representation is not of type 'array' - * - * @return array */ public function genIR(Compiler $compiler): array { @@ -227,7 +225,7 @@ public function genIR(Compiler $compiler): array * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compileClass(CompilationContext $compilationContext): void { @@ -239,6 +237,7 @@ public function compileClass(CompilationContext $compilationContext): void * * @param CompilationContext $compilationContext * @param FunctionDefinition $functionDefinition + * * @throws Exception */ public function compileFunction(CompilationContext $compilationContext, FunctionDefinition $functionDefinition) @@ -291,7 +290,7 @@ public function preCompileInterface($namespace, $topStatement, $docblock) $classDefinition->setType('interface'); - if (is_array($docblock)) { + if (\is_array($docblock)) { $classDefinition->setDocBlock($docblock['value']); } @@ -367,7 +366,7 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa $classDefinition->setIsFinal((bool) $topStatement['final']); } - if (is_array($docblock)) { + if (\is_array($docblock)) { $classDefinition->setDocBlock($docblock['value']); } @@ -648,7 +647,7 @@ public function getCompiledFile(): string * * @param Compiler $compiler * - * @throws ReflectionException + * @throws \ReflectionException */ public function checkDependencies(Compiler $compiler) { @@ -945,7 +944,7 @@ public function getFilePath(): string /** * Creates the property shortcuts. * - * @param array $property + * @param array $property * @param Definition $classDefinition * * @throws CompilerException diff --git a/Library/CompilerFileAnonymous.php b/Library/CompilerFileAnonymous.php index 9785152744..957b48efaf 100644 --- a/Library/CompilerFileAnonymous.php +++ b/Library/CompilerFileAnonymous.php @@ -15,11 +15,9 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; -use ReflectionException; use Zephir\Class\Definition\Definition; use Zephir\Code\Printer; use Zephir\Compiler\FileInterface; -use function count; /** * This class represents an anonymous file created to dump @@ -40,11 +38,11 @@ final class CompilerFileAnonymous implements FileInterface /** * CompilerFileAnonymous constructor. * - * @param Definition $classDefinition + * @param Definition $classDefinition * @param Config $config * @param CompilationContext|null $context */ - public function __construct(Definition $classDefinition, Config $config, ?CompilationContext $context = null) + public function __construct(Definition $classDefinition, Config $config, CompilationContext $context = null) { $this->classDefinition = $classDefinition; $this->config = $config; @@ -84,7 +82,7 @@ public function isExternal(): bool * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ private function compileClass(CompilationContext $compilationContext) { @@ -95,7 +93,7 @@ private function compileClass(CompilationContext $compilationContext) */ $classDefinition->compile($compilationContext); - $separators = str_repeat('../', count(explode('\\', $classDefinition->getCompleteName())) - 1); + $separators = str_repeat('../', \count(explode('\\', $classDefinition->getCompleteName())) - 1); $code = PHP_EOL; $code .= '#ifdef HAVE_CONFIG_H'.PHP_EOL; @@ -121,7 +119,7 @@ private function compileClass(CompilationContext $compilationContext) } } - if (count($this->headerCBlocks) > 0) { + if (\count($this->headerCBlocks) > 0) { $code .= implode(PHP_EOL, $this->headerCBlocks).PHP_EOL; } diff --git a/Library/Config.php b/Library/Config.php index a678d640b9..46ae923e6b 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -13,13 +13,10 @@ namespace Zephir; -use ArrayAccess; -use JsonSerializable; - /** * Manages compiler global configuration. */ -class Config implements ArrayAccess, JsonSerializable +class Config implements \ArrayAccess, \JsonSerializable { /** * Is config changed? diff --git a/Library/ConfigException.php b/Library/ConfigException.php index ab1ad6229a..845c8bf98a 100644 --- a/Library/ConfigException.php +++ b/Library/ConfigException.php @@ -11,11 +11,9 @@ namespace Zephir; -use Exception; - -class ConfigException extends Exception +class ConfigException extends \Exception { - public function __construct($message = '', $code = 0, Exception $previous = null) + public function __construct($message = '', $code = 0, \Exception $previous = null) { $message .= PHP_EOL.'Please see https://docs.zephir-lang.com/0.12/en/config for more information'; diff --git a/Library/Console/Application.php b/Library/Console/Application.php index 5232d00547..09207a46dc 100644 --- a/Library/Console/Application.php +++ b/Library/Console/Application.php @@ -13,7 +13,6 @@ namespace Zephir\Console; -use Exception; use Symfony\Component\Console\Application as BaseApplication; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\HelpCommand; @@ -28,7 +27,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventDispatcher; -use Throwable; use Zephir\Console\Command\ListCommand; use Zephir\Zephir; @@ -111,7 +109,7 @@ public function getLongVersion(): string * * @return int * - * @throws Exception|Throwable + * @throws \Exception|\Throwable */ public function doRun(InputInterface $input, OutputInterface $output): int { @@ -151,7 +149,7 @@ public function doRun(InputInterface $input, OutputInterface $output): int try { return parent::doRun($input, $output); - } catch (CommandNotFoundException|RuntimeException $e) { + } catch (CommandNotFoundException | RuntimeException $e) { fprintf(STDERR, $e->getMessage().PHP_EOL); return 1; diff --git a/Library/Console/Command/ApiCommand.php b/Library/Console/Command/ApiCommand.php index 578ff463dc..c6e5e5533d 100644 --- a/Library/Console/Command/ApiCommand.php +++ b/Library/Console/Command/ApiCommand.php @@ -21,8 +21,6 @@ use Zephir\Compiler; use Zephir\Config; -use function in_array; - /** * Generates an HTML API based on the classes exposed in the extension. */ @@ -80,7 +78,7 @@ protected function sanitizeOptionsFromInput(InputInterface $input): array $options = array_filter($input->getOptions(), function ($v, $k) use ($defaults) { $allowedOpts = array_keys($defaults); - return in_array($k, $allowedOpts, true) && null !== $v; + return \in_array($k, $allowedOpts, true) && null !== $v; }, ARRAY_FILTER_USE_BOTH); foreach ($options as $option => $value) { diff --git a/Library/Console/Command/CleanCommand.php b/Library/Console/Command/CleanCommand.php index 070f601ab5..8a9a4bec26 100644 --- a/Library/Console/Command/CleanCommand.php +++ b/Library/Console/Command/CleanCommand.php @@ -13,12 +13,12 @@ namespace Zephir\Console\Command; -use Exception; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zephir\Exception\FileSystemException; use Zephir\FileSystem\FileSystemInterface; + use function Zephir\is_windows; /** @@ -74,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ); return 1; - } catch (Exception | \Throwable $e) { + } catch (\Exception | \Throwable $e) { $io->getErrorStyle()->error($e->getMessage()); return 1; diff --git a/Library/Console/Command/DevelopmentModeAwareTrait.php b/Library/Console/Command/DevelopmentModeAwareTrait.php index c9054ac077..aba669eb56 100644 --- a/Library/Console/Command/DevelopmentModeAwareTrait.php +++ b/Library/Console/Command/DevelopmentModeAwareTrait.php @@ -15,8 +15,6 @@ use Symfony\Component\Console\Input\InputInterface; -use const PHP_DEBUG; - trait DevelopmentModeAwareTrait { /** @@ -29,7 +27,7 @@ trait DevelopmentModeAwareTrait protected function isDevelopmentModeEnabled(InputInterface $input): bool { if (false === $input->getOption('no-dev')) { - return $input->getOption('dev') || PHP_DEBUG; + return $input->getOption('dev') || \PHP_DEBUG; } return false; diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index a05cd17d86..e5e2871abf 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -22,8 +22,6 @@ use Zephir\Exception\ExceptionInterface; use Zephir\Exception\InvalidArgumentException; -use function extension_loaded; - /** * Generate Command * @@ -57,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $trace = $input->getOption('trace'); - if (extension_loaded('timecop') && 1 == ini_get('timecop.func_override')) { + if (\extension_loaded('timecop') && 1 == ini_get('timecop.func_override')) { $io->getErrorStyle()->warning( <<sanitizeNamespace($input->getArgument('namespace')); // Tell the user the name could be reserved by another extension - if (extension_loaded($namespace)) { + if (\extension_loaded($namespace)) { $this->logger->warning('This extension can have conflicts with an existing loaded extension'); } $this->config->set('namespace', $namespace); $this->config->set('name', $namespace); - if (!is_dir("{$namespace}/{$namespace}")) { - mkdir("{$namespace}/{$namespace}", 0755, true); + if (!\is_dir("{$namespace}/{$namespace}")) { + \mkdir("{$namespace}/{$namespace}", 0755, true); } - chdir($namespace); + \chdir($namespace); // Create 'kernel' - if (!is_dir('ext/kernel')) { - mkdir('ext/kernel', 0755, true); + if (!\is_dir('ext/kernel')) { + \mkdir('ext/kernel', 0755, true); } // Copy the latest kernel files @@ -131,14 +122,14 @@ private function sanitizeNamespace(string $namespace): string * * @return void */ - private function recursiveProcess(string $src, string $dst, ?string $pattern = null, string $callback = 'copy'): void + private function recursiveProcess(string $src, string $dst, string $pattern = null, string $callback = 'copy'): void { $success = true; - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $item) { $pathName = $item->getPathname(); - if (!is_readable($pathName)) { + if (!\is_readable($pathName)) { $this->logger->error('File is not readable :'.$pathName); continue; } @@ -147,13 +138,13 @@ private function recursiveProcess(string $src, string $dst, ?string $pattern = n if ($item->isDir()) { if ('.' != $fileName && '..' != $fileName && '.libs' != $fileName) { - if (!is_dir($dst.DIRECTORY_SEPARATOR.$fileName)) { - mkdir($dst.DIRECTORY_SEPARATOR.$fileName, 0755, true); + if (!\is_dir($dst.\DIRECTORY_SEPARATOR.$fileName)) { + \mkdir($dst.\DIRECTORY_SEPARATOR.$fileName, 0755, true); } - $this->recursiveProcess($pathName, $dst.DIRECTORY_SEPARATOR.$fileName, $pattern, $callback); + $this->recursiveProcess($pathName, $dst.\DIRECTORY_SEPARATOR.$fileName, $pattern, $callback); } - } elseif ($pattern === null || 1 === preg_match($pattern, $fileName)) { - $path = $dst.DIRECTORY_SEPARATOR.$fileName; + } elseif ($pattern === null || 1 === \preg_match($pattern, $fileName)) { + $path = $dst.\DIRECTORY_SEPARATOR.$fileName; $success = $success && $callback($pathName, $path); } } diff --git a/Library/Console/Command/InstallCommand.php b/Library/Console/Command/InstallCommand.php index 0d8b6d0037..2758525463 100644 --- a/Library/Console/Command/InstallCommand.php +++ b/Library/Console/Command/InstallCommand.php @@ -23,8 +23,6 @@ use Zephir\Exception\CompilerException; use Zephir\Exception\NotImplementedException; -use function extension_loaded; - /** * Install Command * @@ -77,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $success = ['Extension installed.']; $namespace = $this->config->get('namespace'); - if (!extension_loaded($namespace)) { + if (!\extension_loaded($namespace)) { $success[] = sprintf('Add "extension=%s.so" to your php.ini', $namespace); } diff --git a/Library/Console/Command/RemoveOptionsTrait.php b/Library/Console/Command/RemoveOptionsTrait.php index c362fe5930..e1c9ee7e3e 100644 --- a/Library/Console/Command/RemoveOptionsTrait.php +++ b/Library/Console/Command/RemoveOptionsTrait.php @@ -16,9 +16,6 @@ use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; -use function array_filter; -use function in_array; - trait RemoveOptionsTrait { protected function removeOptions(array $names): void @@ -26,8 +23,8 @@ protected function removeOptions(array $names): void /** @var InputDefinition $definition */ $definition = $this->getDefinition(); - $filtered = array_filter($definition->getOptions(), function (InputOption $option) use ($names) { - return !in_array($option->getName(), $names, true); + $filtered = \array_filter($definition->getOptions(), function (InputOption $option) use ($names) { + return !\in_array($option->getName(), $names, true); }); $definition->setOptions($filtered); diff --git a/Library/Detectors/ReadDetector.php b/Library/Detectors/ReadDetector.php index d616c8e576..8740ddf172 100644 --- a/Library/Detectors/ReadDetector.php +++ b/Library/Detectors/ReadDetector.php @@ -14,7 +14,6 @@ namespace Zephir\Detectors; use Zephir\Variable\Variable; -use function is_array; /** * Detects if a variable is used in a given expression context @@ -44,13 +43,13 @@ public function detect($variable, array $expression): bool if (in_array($expression['type'], ['fcall', 'mcall', 'scall']) && isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { - if (is_array($parameter['parameter']) && 'variable' === $parameter['parameter']['type'] && $variable == $parameter['parameter']['value']) { + if (\is_array($parameter['parameter']) && 'variable' === $parameter['parameter']['type'] && $variable == $parameter['parameter']['value']) { return true; } } } - return (isset($expression['left']) && is_array($expression['left']) && $this->detect($variable, $expression['left'])) || - (isset($expression['right']) && is_array($expression['right']) && $this->detect($variable, $expression['right'])); + return (isset($expression['left']) && \is_array($expression['left']) && $this->detect($variable, $expression['left'])) + || (isset($expression['right']) && \is_array($expression['right']) && $this->detect($variable, $expression['right'])); } } diff --git a/Library/Documentation.php b/Library/Documentation.php index a3d2081017..ed00e2e120 100644 --- a/Library/Documentation.php +++ b/Library/Documentation.php @@ -236,9 +236,9 @@ public function getOutputDirectory() * @param array $themeConfig * @param string|null $options * - * @throws Exception - * * @return array + * + * @throws Exception */ private function prepareThemeOptions($themeConfig, $options = null) { @@ -307,10 +307,10 @@ private function findOutputDirectory($outputDir) * @param array $themeConfig * @param string|null $path * + * @return string|null + * * @throws InvalidArgumentException * @throws ConfigException - * - * @return string|null */ private function findThemeDirectory($themeConfig, $path = null) { diff --git a/Library/Documentation/DocblockParser.php b/Library/Documentation/DocblockParser.php index d3596fe418..f37f50bed1 100644 --- a/Library/Documentation/DocblockParser.php +++ b/Library/Documentation/DocblockParser.php @@ -19,9 +19,9 @@ class DocblockParser protected $annotation; protected $annotationLen; - protected $currentChar = null; - protected $currentCharIndex = null; - protected $currentLine = null; + protected $currentChar; + protected $currentCharIndex; + protected $currentLine; protected $lines = []; // Parsing helpers diff --git a/Library/Documentation/Template.php b/Library/Documentation/Template.php index 3755293309..c66c2dc15d 100644 --- a/Library/Documentation/Template.php +++ b/Library/Documentation/Template.php @@ -50,7 +50,7 @@ public function __construct( private function getTemplatePath($fileName) { - if ('/' == $fileName[0] || 0 === strpos($fileName, 'phar://')) { + if ('/' == $fileName[0] || str_starts_with($fileName, 'phar://')) { return $fileName; } diff --git a/Library/Exception/CompilerException.php b/Library/Exception/CompilerException.php index d4cb81eb49..8426045ea6 100644 --- a/Library/Exception/CompilerException.php +++ b/Library/Exception/CompilerException.php @@ -19,7 +19,7 @@ class CompilerException extends RuntimeException /** * CompilerException constructor. * - * @param string $message the Exception message to throw [optional] + * @param string $message the Exception message to throw [optional] * @param array|null $extra extra info [optional] * @param int $code the Exception code [optional] * @param \Exception|\Throwable $previous the previous throwable used for the exception chaining [optional] diff --git a/Library/Expression.php b/Library/Expression.php index f002195974..6d6e43bed9 100644 --- a/Library/Expression.php +++ b/Library/Expression.php @@ -13,7 +13,6 @@ namespace Zephir; -use ReflectionException; use Zephir\Exception\CompilerException; use Zephir\Expression\Closure; use Zephir\Expression\ClosureArrow; @@ -225,12 +224,11 @@ public function emptyArray(array $expression, CompilationContext $compilationCon * * @param CompilationContext $compilationContext * - * @throws CompilerException|Exception - * * @return CompiledExpression * + * @throws CompilerException|Exception * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Expression/Builder/AbstractBuilder.php b/Library/Expression/Builder/AbstractBuilder.php index af821e05dc..669d8278a0 100644 --- a/Library/Expression/Builder/AbstractBuilder.php +++ b/Library/Expression/Builder/AbstractBuilder.php @@ -13,9 +13,9 @@ abstract class AbstractBuilder { - private $file = null; - private $line = null; - private $char = null; + private $file; + private $line; + private $char; /** * @param string $file diff --git a/Library/Expression/Builder/BuilderFactory.php b/Library/Expression/Builder/BuilderFactory.php index 3eca0a0bb1..e3e08f9b99 100644 --- a/Library/Expression/Builder/BuilderFactory.php +++ b/Library/Expression/Builder/BuilderFactory.php @@ -75,7 +75,7 @@ public function variable($name) } /** - * @param $type + * @param $type * @param null $value * * @return RawExpression diff --git a/Library/Expression/Builder/Factory/OperatorsFactory.php b/Library/Expression/Builder/Factory/OperatorsFactory.php index 6b84dfaa68..946126eff4 100644 --- a/Library/Expression/Builder/Factory/OperatorsFactory.php +++ b/Library/Expression/Builder/Factory/OperatorsFactory.php @@ -98,7 +98,7 @@ public function unary($operator = null, AbstractBuilder $expression = null) } /** - * @param $type + * @param $type * @param AbstractBuilder $expression * * @return RawOperator @@ -113,7 +113,7 @@ public function cast($type, AbstractBuilder $expression) } /** - * @param $type + * @param $type * @param AbstractBuilder $expression * * @return RawOperator diff --git a/Library/Expression/Builder/Statements/CallFunctionStatement.php b/Library/Expression/Builder/Statements/CallFunctionStatement.php index b45056202c..b0f460cf98 100644 --- a/Library/Expression/Builder/Statements/CallFunctionStatement.php +++ b/Library/Expression/Builder/Statements/CallFunctionStatement.php @@ -40,7 +40,7 @@ class CallFunctionStatement extends AbstractStatement /** * @param string|null $name * @param array|null $parameters - * @param int $typeCall + * @param int $typeCall */ public function __construct(string $name = null, array $parameters = null, int $typeCall = self::TYPE_CALL_DIRECT) { diff --git a/Library/Expression/Closure.php b/Library/Expression/Closure.php index 1e80cbd82a..b7b90f8972 100644 --- a/Library/Expression/Closure.php +++ b/Library/Expression/Closure.php @@ -23,7 +23,6 @@ use Zephir\Exception; use Zephir\StatementsBlock; use Zephir\Variable\Variable; -use function is_array; /** * Creates an anonymous function within the extension simulating a closure @@ -57,7 +56,7 @@ class Closure * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null): void + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -105,7 +104,7 @@ public function compile(array $expression, CompilationContext $compilationContex $block = $expression['right'] ?? []; $staticVariables = []; - if (isset($expression['use']) && is_array($expression['use'])) { + if (isset($expression['use']) && \is_array($expression['use'])) { foreach ($expression['use'] as $parameter) { $staticVariables[$parameter['name']] = $compilationContext->symbolTable->getVariable($parameter['name']); } diff --git a/Library/Expression/ClosureArrow.php b/Library/Expression/ClosureArrow.php index d420c656e5..75ba6eff5e 100644 --- a/Library/Expression/ClosureArrow.php +++ b/Library/Expression/ClosureArrow.php @@ -14,8 +14,8 @@ namespace Zephir\Expression; use Zephir\Class\Definition\Definition; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\CompilerFileAnonymous; @@ -34,9 +34,9 @@ class ClosureArrow extends Closure * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Expression/Constants.php b/Library/Expression/Constants.php index da8c874d36..079c525851 100644 --- a/Library/Expression/Constants.php +++ b/Library/Expression/Constants.php @@ -16,10 +16,8 @@ use Zephir\Exception\CompilerException; use Zephir\LiteralCompiledExpression; use Zephir\Variable\Variable; + use function constant; -use function defined; -use function gettype; -use function in_array; use function Zephir\add_slashes; /** @@ -101,7 +99,7 @@ class Constants * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null) { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -123,9 +121,9 @@ public function setReadOnly(bool $readOnly): void * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function compile(array $expression, CompilationContext $compilationContext) { @@ -135,7 +133,7 @@ public function compile(array $expression, CompilationContext $compilationContex $constantName = $expression['value']; $mergedConstants = array_merge($this->envConstants, $this->magicConstants, $this->resources); - if (!defined($expression['value']) && !in_array($constantName, $mergedConstants)) { + if (!\defined($expression['value']) && !\in_array($constantName, $mergedConstants)) { if (!$compilationContext->compiler->isConstant($constantName)) { $compilationContext->logger->warning( "Constant '".$constantName."' does not exist at compile time", @@ -145,18 +143,18 @@ public function compile(array $expression, CompilationContext $compilationContex $isZephirConstant = true; } } else { - $isPhpConstant = false === strpos($constantName, 'VERSION'); + $isPhpConstant = !str_contains($constantName, 'VERSION'); } - if ($isZephirConstant && !in_array($constantName, $this->resources)) { + if ($isZephirConstant && !\in_array($constantName, $this->resources)) { $constant = $compilationContext->compiler->getConstant($constantName); return new LiteralCompiledExpression($constant[0], $constant[1], $expression); } - if ($isPhpConstant && !in_array($constantName, $mergedConstants)) { - $constantName = constant($constantName); - $type = strtolower(gettype($constantName)); + if ($isPhpConstant && !\in_array($constantName, $mergedConstants)) { + $constantName = \constant($constantName); + $type = strtolower(\gettype($constantName)); switch ($type) { case 'integer': @@ -175,7 +173,7 @@ public function compile(array $expression, CompilationContext $compilationContex } } - if (in_array($constantName, $this->magicConstants)) { + if (\in_array($constantName, $this->magicConstants)) { switch ($constantName) { case '__CLASS__': return new CompiledExpression( diff --git a/Library/Expression/NativeArray.php b/Library/Expression/NativeArray.php index a1d13afa22..32ba85bde0 100644 --- a/Library/Expression/NativeArray.php +++ b/Library/Expression/NativeArray.php @@ -13,7 +13,6 @@ namespace Zephir\Expression; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -21,8 +20,6 @@ use Zephir\Expression; use Zephir\GlobalConstant; use Zephir\Variable\Variable; -use function count; -use function function_exists; /** * Resolves expressions that create arrays @@ -165,7 +162,7 @@ public function getArrayValue(CompiledExpression $exprCompiled, CompilationConte * * @return CompiledExpression * - * @throws ReflectionException + * @throws \ReflectionException * @throws Exception */ public function compile(array $expression, CompilationContext $compilationContext) @@ -206,8 +203,8 @@ public function compile(array $expression, CompilationContext $compilationContex * This calculates a prime number bigger than the current array size to possibly * reduce hash collisions when adding new members to the array. */ - $arrayLength = count($expression['left']); - if ($arrayLength >= 33 && function_exists('gmp_nextprime')) { + $arrayLength = \count($expression['left']); + if ($arrayLength >= 33 && \function_exists('gmp_nextprime')) { $arrayLength = (int) gmp_strval(gmp_nextprime($arrayLength - 1)); } diff --git a/Library/Expression/NativeArrayAccess.php b/Library/Expression/NativeArrayAccess.php index 28e167c1ca..84f0f273cf 100644 --- a/Library/Expression/NativeArrayAccess.php +++ b/Library/Expression/NativeArrayAccess.php @@ -13,7 +13,6 @@ namespace Zephir\Expression; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -38,7 +37,7 @@ class NativeArrayAccess * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. * - * @param bool $expecting + * @param bool $expecting * @param Variable|null $expectingVariable */ public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void @@ -70,12 +69,13 @@ public function setNoisy(bool $noisy): void /** * Compiles foo[x] = {expr}. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression + * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile($expression, CompilationContext $compilationContext) { @@ -127,7 +127,7 @@ public function compile($expression, CompilationContext $compilationContext) * * @return CompiledExpression * - * @throws ReflectionException + * @throws \ReflectionException * @throws Exception */ protected function accessStringOffset(array $expression, Variable $variableVariable, CompilationContext $compilationContext): CompiledExpression @@ -182,13 +182,14 @@ protected function accessStringOffset(array $expression, Variable $variableVaria } /** - * @param array $expression - * @param Variable $variableVariable + * @param array $expression + * @param Variable $variableVariable * @param CompilationContext $compilationContext * * @return CompiledExpression + * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ protected function accessDimensionArray(array $expression, Variable $variableVariable, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Expression/PropertyAccess.php b/Library/Expression/PropertyAccess.php index d1bcf4d192..e294e1f1ab 100644 --- a/Library/Expression/PropertyAccess.php +++ b/Library/Expression/PropertyAccess.php @@ -34,7 +34,7 @@ class PropertyAccess * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. * - * @param bool $expecting + * @param bool $expecting * @param Variable|null $expectingVariable */ public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void diff --git a/Library/Expression/PropertyDynamicAccess.php b/Library/Expression/PropertyDynamicAccess.php index e62992deba..eac8b2f048 100644 --- a/Library/Expression/PropertyDynamicAccess.php +++ b/Library/Expression/PropertyDynamicAccess.php @@ -16,6 +16,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Variable\Variable; + use function Zephir\add_slashes; /** diff --git a/Library/Expression/Reference.php b/Library/Expression/Reference.php index d5e87b53d4..ebad811eb3 100644 --- a/Library/Expression/Reference.php +++ b/Library/Expression/Reference.php @@ -13,7 +13,6 @@ namespace Zephir\Expression; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -58,7 +57,7 @@ class Reference * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null): void + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -78,7 +77,7 @@ public function setReadOnly(bool $readOnly): void * Compiles a reference to a value. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Expression/StaticConstantAccess.php b/Library/Expression/StaticConstantAccess.php index 282062e756..16638d7d1f 100644 --- a/Library/Expression/StaticConstantAccess.php +++ b/Library/Expression/StaticConstantAccess.php @@ -13,15 +13,12 @@ namespace Zephir\Expression; -use ReflectionException; use Zephir\Class\Constant; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Variable\Variable; -use function gettype; -use function in_array; /** * Resolves class constants @@ -38,7 +35,7 @@ class StaticConstantAccess * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. * - * @param bool $expecting + * @param bool $expecting * @param Variable|null $expectingVariable */ public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void @@ -60,12 +57,13 @@ public function setReadOnly(bool $readOnly): void /** * Access a static constant class. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression + * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -77,7 +75,7 @@ public function compile(array $expression, CompilationContext $compilationContex * Fetch the class definition according to the class where the constant * is supposed to be declared */ - if (!in_array($className, ['this', 'self', 'static', 'parent'])) { + if (!\in_array($className, ['this', 'self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); if ($compiler->isClass($className) || $compiler->isInterface($className)) { $classDefinition = $compiler->getClassDefinition($className); @@ -89,7 +87,7 @@ public function compile(array $expression, CompilationContext $compilationContex } } } else { - if (in_array($className, ['self', 'static', 'this'])) { + if (\in_array($className, ['self', 'static', 'this'])) { $classDefinition = $compilationContext->classDefinition; } elseif ('parent' === $className) { $classDefinition = $compilationContext->classDefinition; @@ -182,7 +180,7 @@ public function compile(array $expression, CompilationContext $compilationContex $type = $constantDefinition->getValueType(); } else { $value = $constantDefinition; - $type = gettype($value); + $type = \gettype($value); if ('integer' === $type) { $type = 'int'; } diff --git a/Library/Expression/StaticPropertyAccess.php b/Library/Expression/StaticPropertyAccess.php index 228ba3ae30..6f48f7b5a7 100644 --- a/Library/Expression/StaticPropertyAccess.php +++ b/Library/Expression/StaticPropertyAccess.php @@ -13,14 +13,12 @@ namespace Zephir\Expression; -use ReflectionException; use Zephir\Class\Property; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Variable\Variable; -use function in_array; /** * Resolves class static properties @@ -54,7 +52,7 @@ public function setReadOnly(bool $readOnly): void /** * Access a static property. * - * @throws ReflectionException + * @throws \ReflectionException * @throws Exception */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression @@ -67,7 +65,7 @@ public function compile(array $expression, CompilationContext $compilationContex * Fetch the class definition according to the class where the constant * is supposed to be declared */ - if (!in_array($className, ['self', 'static', 'parent'])) { + if (!\in_array($className, ['self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); if ($compiler->isClass($className)) { $classDefinition = $compiler->getClassDefinition($className); @@ -79,7 +77,7 @@ public function compile(array $expression, CompilationContext $compilationContex } } } else { - if (in_array($className, ['self', 'static'])) { + if (\in_array($className, ['self', 'static'])) { $classDefinition = $compilationContext->classDefinition; } else { if ('parent' === $className) { diff --git a/Library/FileSystem/HardDisk.php b/Library/FileSystem/HardDisk.php index c9f3c04e9f..9a5010b0b6 100644 --- a/Library/FileSystem/HardDisk.php +++ b/Library/FileSystem/HardDisk.php @@ -13,13 +13,7 @@ namespace Zephir\FileSystem; -use FilesystemIterator; -use Generator; -use RecursiveDirectoryIterator; -use RecursiveIteratorIterator; -use SplFileInfo; use Zephir\Exception\InvalidArgumentException; -use Zephir\Exception\RuntimeException; use Zephir\Zephir; /** @@ -172,10 +166,10 @@ public function clean(): void $contents = $this->listDirectoryRecursively( $this->basePath.DIRECTORY_SEPARATOR.$this->localPath, - RecursiveIteratorIterator::CHILD_FIRST, + \RecursiveIteratorIterator::CHILD_FIRST, ); - /** @var SplFileInfo $file */ + /** @var \SplFileInfo $file */ foreach ($contents as $file) { $this->deleteFileInfoObject($file); } @@ -231,7 +225,7 @@ public function normalizePath(string $path): string return str_replace(['\\', ':', '/'], '_', $path); } - protected function deleteFileInfoObject(SplFileInfo $file): bool + protected function deleteFileInfoObject(\SplFileInfo $file): bool { switch ($file->getType()) { case 'dir': @@ -245,10 +239,10 @@ protected function deleteFileInfoObject(SplFileInfo $file): bool private function listDirectoryRecursively( string $path, - int $mode = RecursiveIteratorIterator::SELF_FIRST - ): Generator { - yield from new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), + int $mode = \RecursiveIteratorIterator::SELF_FIRST + ): \Generator { + yield from new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), $mode ); } diff --git a/Library/FunctionCall.php b/Library/FunctionCall.php index f6ea9c2887..5047b87258 100644 --- a/Library/FunctionCall.php +++ b/Library/FunctionCall.php @@ -141,9 +141,9 @@ public function functionExists($functionName, CompilationContext $context) * @param Expression $expr * @param CompilationContext $compilationContext * - * @throws CompilerException|Exception - * * @return CompiledExpression + * + * @throws CompilerException|Exception */ public function compile(Expression $expr, CompilationContext $compilationContext) { @@ -178,9 +178,9 @@ public static function addOptimizerDir($directory) * @param string $funcName * @param array $expression * - * @throws CompilerException - * * @return bool + * + * @throws CompilerException */ protected function isReadOnly($funcName, array $expression) { @@ -213,9 +213,9 @@ protected function isReadOnly($funcName, array $expression) * Check if the number of parameters. */ $numberParameters = \count($expression['parameters']); - if ('unpack' == $funcName && - (0 == version_compare(PHP_VERSION, '7.1.0') || - 0 == version_compare(PHP_VERSION, '7.1.1')) + if ('unpack' == $funcName + && (0 == version_compare(PHP_VERSION, '7.1.0') + || 0 == version_compare(PHP_VERSION, '7.1.1')) ) { if ($numberParameters < 2) { throw new CompilerException(sprintf($messageFormat, $funcName), $expression); @@ -308,9 +308,9 @@ protected function markReferences( * @param Call $call * @param CompilationContext $compilationContext * - * @throws Exception - * * @return bool|mixed + * + * @throws Exception */ protected function optimize($funcName, array $expression, Call $call, CompilationContext $compilationContext) { @@ -364,9 +364,9 @@ protected function optimize($funcName, array $expression, Call $call, Compilatio * @param array $expression * @param CompilationContext $compilationContext * - * @throws Exception|\Zephir\Exception\CompilerException - * * @return CompiledExpression + * + * @throws Exception|\Zephir\Exception\CompilerException */ protected function _callNormal(array $expression, CompilationContext $compilationContext) { @@ -557,9 +557,9 @@ protected function _callNormal(array $expression, CompilationContext $compilatio * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ protected function _callDynamic(array $expression, CompilationContext $compilationContext) { diff --git a/Library/FunctionDefinition.php b/Library/FunctionDefinition.php index 1ea93d1067..0775857f51 100644 --- a/Library/FunctionDefinition.php +++ b/Library/FunctionDefinition.php @@ -13,8 +13,8 @@ namespace Zephir; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; /** * Represents a function @@ -27,12 +27,12 @@ class FunctionDefinition extends Method private bool $isGlobal = false; public function __construct( - private string $namespace, - protected string $name, - protected ?Parameters $parameters = null, + private string $namespace, + protected string $name, + protected ?Parameters $parameters = null, protected ?StatementsBlock $statements = null, - array $returnType = null, - protected ?array $expression = [], + array $returnType = null, + protected ?array $expression = [], ) { $this->setReturnTypes($returnType); } diff --git a/Library/Logger/Formatter/CompilerFormatter.php b/Library/Logger/Formatter/CompilerFormatter.php index 99e5320960..cf6c7b9c19 100644 --- a/Library/Logger/Formatter/CompilerFormatter.php +++ b/Library/Logger/Formatter/CompilerFormatter.php @@ -16,10 +16,6 @@ use Monolog\Formatter\LineFormatter; use Zephir\Config; -use function array_key_exists; -use function count; -use function is_array; - /** * Formatter for warnings/notices/errors generated in compilation. */ @@ -53,9 +49,9 @@ public function format(array $record): string $output = str_replace('%context%', '', $output); // ignore empty context or invalid format - if (!empty($vars['context']) && - is_array($vars['context']) && - 2 == count($vars['context']) + if (!empty($vars['context']) + && \is_array($vars['context']) + && 2 == \count($vars['context']) ) { $type = $vars['context'][0]; $node = $vars['context'][1]; @@ -97,7 +93,7 @@ public function format(array $record): string private function replacePlaceholders(array $vars, $output) { // WARNING -> Warning - if (array_key_exists('level_name', $vars)) { + if (\array_key_exists('level_name', $vars)) { $vars['level_name'] = ucfirst(strtolower($vars['level_name'])); } diff --git a/Library/MethodCall.php b/Library/MethodCall.php index 6d92d4693f..a6aac43fff 100644 --- a/Library/MethodCall.php +++ b/Library/MethodCall.php @@ -11,7 +11,6 @@ namespace Zephir; -use ReflectionException; use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; @@ -41,11 +40,13 @@ class MethodCall extends Call /** * Compiles a method call. * - * @param Expression $expr + * @param Expression $expr * @param CompilationContext $compilationContext + * * @return mixed|CompiledExpression + * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(Expression $expr, CompilationContext $compilationContext): mixed { @@ -319,10 +320,10 @@ public function compile(Expression $expr, CompilationContext $compilationContext $numberImplemented = 0; $compiler = $compilationContext->compiler; foreach ($classTypes as $classType) { - if ($compiler->isClass($classType) || - $compiler->isInterface($classType) || - $compiler->isBundledClass($classType) || - $compiler->isBundledInterface($classType) + if ($compiler->isClass($classType) + || $compiler->isInterface($classType) + || $compiler->isBundledClass($classType) + || $compiler->isBundledInterface($classType) ) { if ($compiler->isClass($classType) || $compiler->isInterface($classType)) { $classDefinition = $compiler->getClassDefinition($classType); @@ -373,9 +374,9 @@ public function compile(Expression $expr, CompilationContext $compilationContext /* * Check visibility for protected methods */ - if ($method->isProtected() && - $method->getClassDefinition() != $classDefinition && - $method->getClassDefinition() != $classDefinition->getExtendsClass() + if ($method->isProtected() + && $method->getClassDefinition() != $classDefinition + && $method->getClassDefinition() != $classDefinition->getExtendsClass() ) { throw new CompilerException( sprintf( @@ -672,10 +673,10 @@ public function compile(Expression $expr, CompilationContext $compilationContext } break; - /** - * Passing polymorphic variables to static typed parameters - * could lead to potential unexpected type coercions - */ + /** + * Passing polymorphic variables to static typed parameters + * could lead to potential unexpected type coercions + */ case 'variable': if ($resolvedDynamicTypes[$n] != $parameter['data-type']) { if ('undefined' == $resolvedDynamicTypes[$n]) { @@ -746,7 +747,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $compilationContext ); } else { - //TODO: also move to backend + // TODO: also move to backend if ($isExpecting) { $symbolCode = $compilationContext->backend->getVariableCode($symbolVariable); } @@ -828,11 +829,12 @@ public function compile(Expression $expr, CompilationContext $compilationContext * Examine internal class information and returns the method called. * * @param CompilationContext $compilationContext - * @param Variable $caller - * @param string $methodName + * @param Variable $caller + * @param string $methodName * * @return array - * @throws ReflectionException + * + * @throws \ReflectionException */ private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, string $methodName): array { @@ -854,9 +856,9 @@ private function getRealCalledMethod(CompilationContext $compilationContext, Var continue; } - if ($compiler->isClass($classType) || - $compiler->isBundledClass($classType) || - $compiler->isBundledInterface($classType) + if ($compiler->isClass($classType) + || $compiler->isBundledClass($classType) + || $compiler->isBundledInterface($classType) ) { if ($compiler->isClass($classType)) { $classDefinition = $compiler->getClassDefinition($classType); diff --git a/Library/Operators/AbstractOperator.php b/Library/Operators/AbstractOperator.php index d35b8aca1b..330435ef0d 100644 --- a/Library/Operators/AbstractOperator.php +++ b/Library/Operators/AbstractOperator.php @@ -35,7 +35,7 @@ abstract class AbstractOperator * @param bool $expecting * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = null): void + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -81,8 +81,8 @@ public function getExpectedNonLiteral(CompilationContext $compilationContext, ar * store the result. * * @param CompilationContext $compilationContext - * @param array $expression - * @param bool $init + * @param array $expression + * @param bool $init * * @return Variable|null */ diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php index a6d992e14b..ac6b94bcae 100644 --- a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php +++ b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php @@ -82,10 +82,10 @@ public function optimizeConstantFolding(array $expression, CompilationContext $c * @param array $expression * @param CompilationContext $compilationContext * + * @return CompiledExpression + * * @throws Exception * @throws CompilerException - * - * @return CompiledExpression */ public function compile($expression, CompilationContext $compilationContext) { @@ -443,7 +443,7 @@ public function compile($expression, CompilationContext $compilationContext) } break; - /* a(var) + a(x) */ + /* a(var) + a(x) */ case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); switch ($variableRight->getType()) { @@ -468,7 +468,7 @@ public function compile($expression, CompilationContext $compilationContext) ); break; - /* a(var) + a(bool) */ + /* a(var) + a(bool) */ case 'bool': $compilationContext->headersManager->add('kernel/operators'); $variableLeft = $compilationContext->backend->getVariableCode($variableLeft); @@ -476,7 +476,7 @@ public function compile($expression, CompilationContext $compilationContext) return new CompiledExpression('int', '(zephir_get_numberval('.$variableLeft.') '.$this->operator.' '.$variableRight->getName().')', $expression); break; - /* a(var) + a(var) */ + /* a(var) + a(var) */ case 'variable': case 'array': $compilationContext->headersManager->add('kernel/operators'); diff --git a/Library/Operators/Arithmetical/DivOperator.php b/Library/Operators/Arithmetical/DivOperator.php index bdb56058f6..5e66647eb0 100644 --- a/Library/Operators/Arithmetical/DivOperator.php +++ b/Library/Operators/Arithmetical/DivOperator.php @@ -329,7 +329,7 @@ public function compile($expression, CompilationContext $compilationContext) return new CompiledExpression('double', 'zephir_safe_div_zval_double('.$op1.', '.$op2.')', $expression); - /* a(var) + a(x) */ + /* a(var) + a(x) */ case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); switch ($variableRight->getType()) { @@ -343,11 +343,11 @@ public function compile($expression, CompilationContext $compilationContext) case 'double': return new CompiledExpression('double', 'zephir_safe_div_zval_double('.$op1.', '.$variableRight->getName().')', $expression); - /* a(var) + a(bool) */ + /* a(var) + a(bool) */ case 'bool': return new CompiledExpression('int', 'zephir_safe_div_zval_long('.$op1.', '.$variableRight->getName().')', $expression); - /* a(var) + a(var) */ + /* a(var) + a(var) */ case 'variable': $op2 = $compilationContext->backend->getVariableCode($variableRight); diff --git a/Library/Operators/Arithmetical/ModOperator.php b/Library/Operators/Arithmetical/ModOperator.php index a82bb4718a..d6aaddc7af 100644 --- a/Library/Operators/Arithmetical/ModOperator.php +++ b/Library/Operators/Arithmetical/ModOperator.php @@ -333,7 +333,7 @@ public function compile($expression, CompilationContext $compilationContext) return new CompiledExpression('double', 'zephir_safe_mod_zval_double('.$op1.', '.$op2.')', $expression); break; - /* a(var) + a(x) */ + /* a(var) + a(x) */ case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); switch ($variableRight->getType()) { @@ -345,12 +345,12 @@ public function compile($expression, CompilationContext $compilationContext) return new CompiledExpression('double', 'zephir_safe_mod_zval_long('.$op1.', '.$variableRight->getName().')', $expression); break; - /* a(var) + a(bool) */ + /* a(var) + a(bool) */ case 'bool': return new CompiledExpression('int', 'zephir_safe_mod_zval_long('.$op1.', '.$variableRight->getName().')', $expression); break; - /* a(var) + a(var) */ + /* a(var) + a(var) */ case 'variable': $compilationContext->headersManager->add('kernel/operators'); $op2 = $compilationContext->backend->getVariableCode($variableRight); diff --git a/Library/Operators/Bitwise/BitwiseBaseOperator.php b/Library/Operators/Bitwise/BitwiseBaseOperator.php index e7e82b2a0d..a0f896cacb 100644 --- a/Library/Operators/Bitwise/BitwiseBaseOperator.php +++ b/Library/Operators/Bitwise/BitwiseBaseOperator.php @@ -36,7 +36,7 @@ class BitwiseBaseOperator extends AbstractOperator * @param array $expression * @param CompilationContext $compilationContext * - * @return null|CompiledExpression + * @return CompiledExpression|null */ public function optimizeConstantFolding(array $expression, CompilationContext $compilationContext): ?CompiledExpression { @@ -50,7 +50,7 @@ public function optimizeConstantFolding(array $expression, CompilationContext $c case 'long': case 'ulong': case 'double': - //continue to next switch + // continue to next switch break; default: return null; @@ -63,7 +63,7 @@ public function optimizeConstantFolding(array $expression, CompilationContext $c case 'long': case 'ulong': case 'double': - //continue to operator switch + // continue to operator switch break; default: return null; @@ -430,7 +430,7 @@ public function compile($expression, CompilationContext $compilationContext) } break; - /* a(var) + a(x) */ + /* a(var) + a(x) */ case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); $symbol = $compilationContext->backend->getVariableCode($variableLeft); @@ -445,14 +445,14 @@ public function compile($expression, CompilationContext $compilationContext) return new CompiledExpression('int', '((int) (zephir_get_numberval('.$symbol.')) '.$this->operator.' '.$variableRight->getName().')', $expression); break; - /* a(var) + a(bool) */ + /* a(var) + a(bool) */ case 'bool': $compilationContext->headersManager->add('kernel/operators'); return new CompiledExpression('int', '((int) (zephir_get_numberval('.$symbol.')) '.$this->operator.' '.$variableRight->getName().')', $expression); break; - /* a(var) + a(var) */ + /* a(var) + a(var) */ case 'variable': $compilationContext->headersManager->add('kernel/operators'); $op1 = $symbol; diff --git a/Library/Operators/Bitwise/BitwiseNotOperator.php b/Library/Operators/Bitwise/BitwiseNotOperator.php index f0666a57d7..e7a7b2dd07 100644 --- a/Library/Operators/Bitwise/BitwiseNotOperator.php +++ b/Library/Operators/Bitwise/BitwiseNotOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Bitwise; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -24,11 +23,12 @@ class BitwiseNotOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression - * @throws ReflectionException + * + * @throws \ReflectionException * @throws Exception */ public function compile($expression, CompilationContext $compilationContext) diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index a09fbbbbe3..887c24f8ec 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Comparison; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -35,7 +34,7 @@ class ComparisonBaseOperator extends AbstractOperator * @return CompiledExpression|null * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function optimizeTypeOf(array $expr, CompilationContext $compilationContext): ?CompiledExpression { @@ -170,7 +169,7 @@ public function optimizeTypeOf(array $expr, CompilationContext $compilationConte * * @return CompiledExpression * - * @throws ReflectionException + * @throws \ReflectionException * @throws Exception */ public function compile(array $expression, CompilationContext $compilationContext) diff --git a/Library/Operators/Logical/AndOperator.php b/Library/Operators/Logical/AndOperator.php index 0ce42886df..4869779d1f 100644 --- a/Library/Operators/Logical/AndOperator.php +++ b/Library/Operators/Logical/AndOperator.php @@ -13,8 +13,6 @@ namespace Zephir\Operators\Logical; -use Exception; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; @@ -28,22 +26,22 @@ class AndOperator extends LogicalBaseOperator protected string $bitOperator = '&&'; /** - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * - * @throws ReflectionException + * @throws \ReflectionException * @throws \Zephir\Exception */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { if (!isset($expression['left'])) { - throw new Exception('Missing left part of the expression'); + throw new \Exception('Missing left part of the expression'); } if (!isset($expression['right'])) { - throw new Exception('Missing right part of the expression'); + throw new \Exception('Missing right part of the expression'); } $leftExpr = new Expression($expression['left']); diff --git a/Library/Operators/Logical/LogicalBaseOperator.php b/Library/Operators/Logical/LogicalBaseOperator.php index 6fa832e923..6131252824 100644 --- a/Library/Operators/Logical/LogicalBaseOperator.php +++ b/Library/Operators/Logical/LogicalBaseOperator.php @@ -258,7 +258,7 @@ public function compile($expression, CompilationContext $compilationContext): Co $compilationContext->headersManager->add('kernel/operators'); $variableCode = $compilationContext->backend->getVariableCode($variableRight); - return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.' '.$this->operator.' zephir_is_true('.$variableCode.')', $expression); + return new CompiledExpression('bool', '('.$variableLeft->getName().' && Z_STRLEN_P('.$variableLeft->getName().')) '.$this->operator.' zephir_is_true('.$variableCode.')', $expression); default: throw new CompilerException("Cannot compare variable('double') with variable('".$variableRight->getType()."')", $expression); @@ -285,7 +285,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', 'zephir_is_true('.$op1.') '.$op.' '.$op2, $expression); - /* a(var) && a(x) */ + /* a(var) && a(x) */ case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->resolve(null, $compilationContext), $compilationContext, $expression); $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); @@ -298,7 +298,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', 'zephir_is_true('.$variableLeftCode.') '.$this->operator.' '.$variableRightCode, $expression); - /* a(var) && a(var) */ + /* a(var) && a(var) */ case 'variable': $compilationContext->headersManager->add('kernel/operators'); $op1 = $variableLeftCode; diff --git a/Library/Operators/Logical/OrOperator.php b/Library/Operators/Logical/OrOperator.php index 6e8588e8f1..54be169b90 100644 --- a/Library/Operators/Logical/OrOperator.php +++ b/Library/Operators/Logical/OrOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Logical; -use Exception; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; @@ -29,11 +28,11 @@ class OrOperator extends LogicalBaseOperator public function compile($expression, CompilationContext $compilationContext): CompiledExpression { if (!isset($expression['left'])) { - throw new Exception('Missing left part of the expression'); + throw new \Exception('Missing left part of the expression'); } if (!isset($expression['right'])) { - throw new Exception('Missing right part of the expression'); + throw new \Exception('Missing right part of the expression'); } $leftExpr = new Expression($expression['left']); diff --git a/Library/Operators/Other/CastOperator.php b/Library/Operators/Other/CastOperator.php index 0ceb7ccde6..4fcaa8a344 100644 --- a/Library/Operators/Other/CastOperator.php +++ b/Library/Operators/Other/CastOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Detectors\ReadDetector; @@ -37,7 +36,7 @@ class CastOperator extends AbstractOperator * * @return CompiledExpression * - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/ConcatOperator.php b/Library/Operators/Other/ConcatOperator.php index 3f5ab4b7b5..5701ea8521 100644 --- a/Library/Operators/Other/ConcatOperator.php +++ b/Library/Operators/Other/ConcatOperator.php @@ -19,6 +19,7 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Operators\AbstractOperator; + use function Zephir\add_slashes; /** diff --git a/Library/Operators/Other/InstanceOfOperator.php b/Library/Operators/Other/InstanceOfOperator.php index f309ad2035..a1b9bedfee 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/Library/Operators/Other/InstanceOfOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\Class\Entry; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -30,13 +29,13 @@ class InstanceOfOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $context * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile($expression, CompilationContext $context): CompiledExpression { diff --git a/Library/Operators/Other/IssetOperator.php b/Library/Operators/Other/IssetOperator.php index 4ed034dd7b..0666448753 100644 --- a/Library/Operators/Other/IssetOperator.php +++ b/Library/Operators/Other/IssetOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -35,7 +34,7 @@ class IssetOperator extends AbstractOperator * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/LikelyOperator.php b/Library/Operators/Other/LikelyOperator.php index e6cc5418d2..ef2bc03a72 100644 --- a/Library/Operators/Other/LikelyOperator.php +++ b/Library/Operators/Other/LikelyOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -27,13 +26,13 @@ class LikelyOperator extends AbstractOperator { /** - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/NewInstanceOperator.php b/Library/Operators/Other/NewInstanceOperator.php index b4f1f37bbd..6787949683 100644 --- a/Library/Operators/Other/NewInstanceOperator.php +++ b/Library/Operators/Other/NewInstanceOperator.php @@ -13,8 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionClass; -use ReflectionException; use Zephir\Class\Entry; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -41,7 +39,7 @@ class NewInstanceOperator extends AbstractOperator * * @return CompiledExpression * - * @throws ReflectionException + * @throws \ReflectionException * @throws Exception */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression @@ -158,7 +156,7 @@ public function compile(array $expression, CompilationContext $compilationContex $zendClassEntry = $compilationContext->cacheManager->getClassEntryCache()->get($classNameToFetch, false, $compilationContext); $classEntry = $zendClassEntry->getName(); } else { - $reflectionClass = new ReflectionClass($className); + $reflectionClass = new \ReflectionClass($className); if ($reflectionClass->isInterface()) { throw new CompilerException('Interfaces cannot be instantiated', $expression); } diff --git a/Library/Operators/Other/RequireOperator.php b/Library/Operators/Other/RequireOperator.php index 6dd7af44ea..04001afe7c 100644 --- a/Library/Operators/Other/RequireOperator.php +++ b/Library/Operators/Other/RequireOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -26,13 +25,13 @@ class RequireOperator extends AbstractOperator { /** - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/ShortTernaryOperator.php b/Library/Operators/Other/ShortTernaryOperator.php index 2efa139671..029cfc5912 100644 --- a/Library/Operators/Other/ShortTernaryOperator.php +++ b/Library/Operators/Other/ShortTernaryOperator.php @@ -32,7 +32,7 @@ class ShortTernaryOperator extends AbstractOperator /** * Compile ternary operator. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression diff --git a/Library/Operators/Other/TernaryOperator.php b/Library/Operators/Other/TernaryOperator.php index e3d0054aae..9ed0f29464 100644 --- a/Library/Operators/Other/TernaryOperator.php +++ b/Library/Operators/Other/TernaryOperator.php @@ -27,7 +27,7 @@ class TernaryOperator extends AbstractOperator /** * Compile ternary operator. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression diff --git a/Library/Operators/Other/TypeHintOperator.php b/Library/Operators/Other/TypeHintOperator.php index 1696d30933..6baf09c6e6 100644 --- a/Library/Operators/Other/TypeHintOperator.php +++ b/Library/Operators/Other/TypeHintOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -26,13 +25,13 @@ class TypeHintOperator extends AbstractOperator /** * Performs type-hint compilation. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/TypeOfOperator.php b/Library/Operators/Other/TypeOfOperator.php index 6ac240678e..cb1fac6c31 100644 --- a/Library/Operators/Other/TypeOfOperator.php +++ b/Library/Operators/Other/TypeOfOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -28,13 +27,13 @@ class TypeOfOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/UnlikelyOperator.php b/Library/Operators/Other/UnlikelyOperator.php index 587d0b060f..8c4e33af3e 100644 --- a/Library/Operators/Other/UnlikelyOperator.php +++ b/Library/Operators/Other/UnlikelyOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Other; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -29,13 +28,13 @@ class UnlikelyOperator extends AbstractOperator /** * Compile unlikely operator * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Unary/MinusOperator.php b/Library/Operators/Unary/MinusOperator.php index 5532bba95c..38a3c94415 100644 --- a/Library/Operators/Unary/MinusOperator.php +++ b/Library/Operators/Unary/MinusOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Unary; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -26,13 +25,13 @@ class MinusOperator extends AbstractOperator /** * Compile expression. * - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Unary/NotOperator.php b/Library/Operators/Unary/NotOperator.php index 2d5eee5b57..ab9b10969f 100644 --- a/Library/Operators/Unary/NotOperator.php +++ b/Library/Operators/Unary/NotOperator.php @@ -13,7 +13,6 @@ namespace Zephir\Operators\Unary; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -24,13 +23,13 @@ class NotOperator extends AbstractOperator { /** - * @param $expression + * @param $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Optimizers/EvalExpression.php b/Library/Optimizers/EvalExpression.php index 94a64a9463..b87fe6af19 100644 --- a/Library/Optimizers/EvalExpression.php +++ b/Library/Optimizers/EvalExpression.php @@ -65,7 +65,7 @@ public function optimizeNot(array $expr, CompilationContext $compilationContext) /** * Optimizes expressions. * - * @param $exprRaw + * @param $exprRaw * @param CompilationContext $compilationContext * * @return bool|string @@ -166,7 +166,7 @@ public function optimize($exprRaw, CompilationContext $compilationContext) break; case 'int': - if (!(int) ($possibleValue->getCode())) { + if (!(int) $possibleValue->getCode()) { $this->unreachable = true; } else { $this->unreachableElse = true; @@ -174,7 +174,7 @@ public function optimize($exprRaw, CompilationContext $compilationContext) break; case 'double': - if (!(float) ($possibleValue->getCode())) { + if (!(float) $possibleValue->getCode()) { $this->unreachable = true; } else { $this->unreachableElse = true; @@ -182,7 +182,7 @@ public function optimize($exprRaw, CompilationContext $compilationContext) break; default: - //echo $possibleValue->getType(); + // echo $possibleValue->getType(); } } } diff --git a/Library/Optimizers/FunctionCall/AddslashesOptimizer.php b/Library/Optimizers/FunctionCall/AddslashesOptimizer.php index 27ed82adc8..84c75f6177 100644 --- a/Library/Optimizers/FunctionCall/AddslashesOptimizer.php +++ b/Library/Optimizers/FunctionCall/AddslashesOptimizer.php @@ -29,9 +29,9 @@ class AddslashesOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php b/Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php index 940864f57f..c423940905 100644 --- a/Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php +++ b/Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php @@ -29,9 +29,9 @@ class ArrayKeyExistsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -47,7 +47,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - //Note: the first parameter is key in php array_key_exists + // Note: the first parameter is key in php array_key_exists return new CompiledExpression('bool', 'zephir_array_key_exists('.$resolvedParams[1].', '.$resolvedParams[0].')', $expression); } } diff --git a/Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php b/Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php index f6ae4fdd06..9e86502c5e 100644 --- a/Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php +++ b/Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php @@ -29,9 +29,9 @@ class ArrayKeysOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php b/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php index 8135036d7d..a474f1196b 100644 --- a/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php +++ b/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php @@ -29,9 +29,9 @@ class ArrayMergeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/BasenameOptimizer.php b/Library/Optimizers/FunctionCall/BasenameOptimizer.php index 8a0c34c9fd..66c5e8f278 100644 --- a/Library/Optimizers/FunctionCall/BasenameOptimizer.php +++ b/Library/Optimizers/FunctionCall/BasenameOptimizer.php @@ -29,9 +29,9 @@ class BasenameOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/CamelizeOptimizer.php b/Library/Optimizers/FunctionCall/CamelizeOptimizer.php index 136235a192..ebd0166572 100644 --- a/Library/Optimizers/FunctionCall/CamelizeOptimizer.php +++ b/Library/Optimizers/FunctionCall/CamelizeOptimizer.php @@ -29,9 +29,9 @@ class CamelizeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/CeilOptimizer.php b/Library/Optimizers/FunctionCall/CeilOptimizer.php index 6c05009847..cc22851e7a 100644 --- a/Library/Optimizers/FunctionCall/CeilOptimizer.php +++ b/Library/Optimizers/FunctionCall/CeilOptimizer.php @@ -29,9 +29,9 @@ class CeilOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/ClassExistsOptimizer.php b/Library/Optimizers/FunctionCall/ClassExistsOptimizer.php index a448ca560d..dd539f3b08 100644 --- a/Library/Optimizers/FunctionCall/ClassExistsOptimizer.php +++ b/Library/Optimizers/FunctionCall/ClassExistsOptimizer.php @@ -29,9 +29,9 @@ class ClassExistsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php b/Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php index bc18878f5f..6495b4ba4e 100644 --- a/Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php +++ b/Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php @@ -29,9 +29,9 @@ class CompareMtimeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/Crc32Optimizer.php b/Library/Optimizers/FunctionCall/Crc32Optimizer.php index 71139b435c..bb425a165f 100644 --- a/Library/Optimizers/FunctionCall/Crc32Optimizer.php +++ b/Library/Optimizers/FunctionCall/Crc32Optimizer.php @@ -29,9 +29,9 @@ class Crc32Optimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/CreateArrayOptimizer.php b/Library/Optimizers/FunctionCall/CreateArrayOptimizer.php index bb4d76ec5a..be4584274c 100644 --- a/Library/Optimizers/FunctionCall/CreateArrayOptimizer.php +++ b/Library/Optimizers/FunctionCall/CreateArrayOptimizer.php @@ -29,9 +29,9 @@ class CreateArrayOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php b/Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php index 70117105f2..51040a4f90 100644 --- a/Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php +++ b/Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php @@ -29,9 +29,9 @@ class CreateInstanceOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php b/Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php index f4d164c949..8bd23407dd 100644 --- a/Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php +++ b/Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php @@ -29,9 +29,9 @@ class CreateSymbolTableOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/DoublevalOptimizer.php b/Library/Optimizers/FunctionCall/DoublevalOptimizer.php index 6cfde21ea5..e274e15c09 100644 --- a/Library/Optimizers/FunctionCall/DoublevalOptimizer.php +++ b/Library/Optimizers/FunctionCall/DoublevalOptimizer.php @@ -29,9 +29,9 @@ class DoublevalOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/EvalOptimizer.php b/Library/Optimizers/FunctionCall/EvalOptimizer.php index 143c06a619..1e51333066 100644 --- a/Library/Optimizers/FunctionCall/EvalOptimizer.php +++ b/Library/Optimizers/FunctionCall/EvalOptimizer.php @@ -29,10 +29,10 @@ class EvalOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * + * @return bool|CompiledExpression|mixed + * * @throws CompilerException * @throws \Zephir\Exception - * - * @return bool|CompiledExpression|mixed */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/ExitOptimizer.php b/Library/Optimizers/FunctionCall/ExitOptimizer.php index b2f6084c90..d04826fe4e 100644 --- a/Library/Optimizers/FunctionCall/ExitOptimizer.php +++ b/Library/Optimizers/FunctionCall/ExitOptimizer.php @@ -29,9 +29,9 @@ class ExitOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -41,7 +41,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $context->headersManager->add('kernel/exit'); if (isset($expression['parameters'])) { - //TODO: protect resolvedParams[0] from restore + // TODO: protect resolvedParams[0] from restore } if (!isset($expression['parameters'])) { $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); diff --git a/Library/Optimizers/FunctionCall/ExplodeOptimizer.php b/Library/Optimizers/FunctionCall/ExplodeOptimizer.php index 3ad81dc9d6..73f766a62e 100644 --- a/Library/Optimizers/FunctionCall/ExplodeOptimizer.php +++ b/Library/Optimizers/FunctionCall/ExplodeOptimizer.php @@ -31,9 +31,9 @@ class ExplodeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FcloseOptimizer.php b/Library/Optimizers/FunctionCall/FcloseOptimizer.php index af5db2b021..f5dc100353 100644 --- a/Library/Optimizers/FunctionCall/FcloseOptimizer.php +++ b/Library/Optimizers/FunctionCall/FcloseOptimizer.php @@ -29,9 +29,9 @@ class FcloseOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FileExistsOptimizer.php b/Library/Optimizers/FunctionCall/FileExistsOptimizer.php index d06e1e562c..5867ae067b 100644 --- a/Library/Optimizers/FunctionCall/FileExistsOptimizer.php +++ b/Library/Optimizers/FunctionCall/FileExistsOptimizer.php @@ -29,9 +29,9 @@ class FileExistsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php b/Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php index 6b2b6abd97..1008be680a 100644 --- a/Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php +++ b/Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php @@ -29,9 +29,9 @@ class FileGetContentsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php b/Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php index 894bc0b16d..0693608567 100644 --- a/Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php +++ b/Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php @@ -29,9 +29,9 @@ class FilePutContentsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php b/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php index b14e3e7b73..1958e8ecdb 100644 --- a/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php +++ b/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php @@ -29,9 +29,9 @@ class FilemtimeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FloorOptimizer.php b/Library/Optimizers/FunctionCall/FloorOptimizer.php index e3296ffe94..6719a2e6ae 100644 --- a/Library/Optimizers/FunctionCall/FloorOptimizer.php +++ b/Library/Optimizers/FunctionCall/FloorOptimizer.php @@ -29,9 +29,9 @@ class FloorOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php b/Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php index 44ce4ca16d..b0b624c05b 100644 --- a/Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php +++ b/Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php @@ -31,9 +31,9 @@ class FuncGetArgOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php b/Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php index 05c566024e..28f718b295 100644 --- a/Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php +++ b/Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php @@ -29,9 +29,9 @@ class FuncGetArgsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php b/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php index ace5a2b80e..66a5c7e64f 100644 --- a/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php +++ b/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php @@ -16,7 +16,6 @@ use Zephir\CompiledExpression; use Zephir\Optimizers\OptimizerAbstract; -use function count; use function Zephir\add_slashes; /** @@ -35,7 +34,7 @@ class FunctionExistsOptimizer extends OptimizerAbstract */ public function optimize(array $expression, Call $call, CompilationContext $context) { - if (!isset($expression['parameters']) || 1 !== count($expression['parameters'])) { + if (!isset($expression['parameters']) || 1 !== \count($expression['parameters'])) { return false; } diff --git a/Library/Optimizers/FunctionCall/FwriteOptimizer.php b/Library/Optimizers/FunctionCall/FwriteOptimizer.php index d77cf01b3e..4a01a27476 100644 --- a/Library/Optimizers/FunctionCall/FwriteOptimizer.php +++ b/Library/Optimizers/FunctionCall/FwriteOptimizer.php @@ -29,9 +29,9 @@ class FwriteOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php b/Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php index a771b5099d..899f457e6a 100644 --- a/Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php +++ b/Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php @@ -29,9 +29,9 @@ class GetCalledClassOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php b/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php index 10595eb489..41ee43c7fa 100644 --- a/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php +++ b/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php @@ -29,9 +29,9 @@ class GetClassLowerOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php b/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php index d00fce6168..0169caed01 100644 --- a/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php +++ b/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php @@ -29,9 +29,9 @@ class GetClassNsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/GetClassOptimizer.php b/Library/Optimizers/FunctionCall/GetClassOptimizer.php index c7afeab546..d896e88916 100644 --- a/Library/Optimizers/FunctionCall/GetClassOptimizer.php +++ b/Library/Optimizers/FunctionCall/GetClassOptimizer.php @@ -29,9 +29,9 @@ class GetClassOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/GetNsClassOptimizer.php b/Library/Optimizers/FunctionCall/GetNsClassOptimizer.php index d6d0208cc9..1c26badebf 100644 --- a/Library/Optimizers/FunctionCall/GetNsClassOptimizer.php +++ b/Library/Optimizers/FunctionCall/GetNsClassOptimizer.php @@ -29,9 +29,9 @@ class GetNsClassOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/GettypeOptimizer.php b/Library/Optimizers/FunctionCall/GettypeOptimizer.php index 3cb217ec27..d7f3eca7d1 100644 --- a/Library/Optimizers/FunctionCall/GettypeOptimizer.php +++ b/Library/Optimizers/FunctionCall/GettypeOptimizer.php @@ -29,9 +29,9 @@ class GettypeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php b/Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php index d71f69fb46..89364dc379 100644 --- a/Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php +++ b/Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php @@ -19,8 +19,6 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; -use function count; - /** * `globals_get()` internal function. * @@ -43,7 +41,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont return null; } - if (1 !== count($expression['parameters'])) { + if (1 !== \count($expression['parameters'])) { throw new CompilerException("'globals_get' only accepts one parameter", $expression); } @@ -59,7 +57,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $type = $context->compiler->getExtensionGlobal($globalName)['type']; - if (false !== strpos($globalName, '.')) { + if (str_contains($globalName, '.')) { $parts = explode('.', $globalName); return new CompiledExpression($type, 'ZEPHIR_GLOBAL('.$parts[0].').'.$parts[1], $expression); diff --git a/Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php b/Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php index 5ff8573b52..93599ab0bb 100644 --- a/Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php +++ b/Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php @@ -20,8 +20,6 @@ use Zephir\Exception\CompilerException; use Zephir\Optimizers\OptimizerAbstract; -use function count; - /** * `globals_set()` internal function. * @@ -34,9 +32,9 @@ class GlobalsSetOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context): CompiledExpression { @@ -44,7 +42,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont throw new CompilerException("'globals_set' requires two parameters", $expression); } - if (2 !== count($expression['parameters'])) { + if (2 !== \count($expression['parameters'])) { throw new CompilerException("'globals_set' only accepts two parameters", $expression); } diff --git a/Library/Optimizers/FunctionCall/HashEqualsOptimizer.php b/Library/Optimizers/FunctionCall/HashEqualsOptimizer.php index ed0840c3e6..d4a93e0266 100644 --- a/Library/Optimizers/FunctionCall/HashEqualsOptimizer.php +++ b/Library/Optimizers/FunctionCall/HashEqualsOptimizer.php @@ -29,9 +29,9 @@ class HashEqualsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/ImplodeOptimizer.php b/Library/Optimizers/FunctionCall/ImplodeOptimizer.php index 651c15b55e..fb4744f81d 100644 --- a/Library/Optimizers/FunctionCall/ImplodeOptimizer.php +++ b/Library/Optimizers/FunctionCall/ImplodeOptimizer.php @@ -31,9 +31,9 @@ class ImplodeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/InArrayOptimizer.php b/Library/Optimizers/FunctionCall/InArrayOptimizer.php index 58727048a7..2d248c6eb9 100644 --- a/Library/Optimizers/FunctionCall/InArrayOptimizer.php +++ b/Library/Optimizers/FunctionCall/InArrayOptimizer.php @@ -29,9 +29,9 @@ class InArrayOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php b/Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php index 5ffb906e13..ea60dc2ad8 100644 --- a/Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php +++ b/Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php @@ -29,9 +29,9 @@ class InterfaceExistsOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/IntvalOptimizer.php b/Library/Optimizers/FunctionCall/IntvalOptimizer.php index 081d8c37ca..5c45900cd1 100644 --- a/Library/Optimizers/FunctionCall/IntvalOptimizer.php +++ b/Library/Optimizers/FunctionCall/IntvalOptimizer.php @@ -29,9 +29,9 @@ class IntvalOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php b/Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php index 61e3612774..73d359c1e0 100644 --- a/Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php +++ b/Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php @@ -30,9 +30,9 @@ class IsPrivatePropertyOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/LdexpOptimizer.php b/Library/Optimizers/FunctionCall/LdexpOptimizer.php index 847b919b20..480f9f0107 100644 --- a/Library/Optimizers/FunctionCall/LdexpOptimizer.php +++ b/Library/Optimizers/FunctionCall/LdexpOptimizer.php @@ -39,9 +39,9 @@ public function getFunctionName() * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/Md5Optimizer.php b/Library/Optimizers/FunctionCall/Md5Optimizer.php index 75e276c446..89c5fbeb7a 100644 --- a/Library/Optimizers/FunctionCall/Md5Optimizer.php +++ b/Library/Optimizers/FunctionCall/Md5Optimizer.php @@ -29,9 +29,9 @@ class Md5Optimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/MergeAppendOptimizer.php b/Library/Optimizers/FunctionCall/MergeAppendOptimizer.php index ab708d1b3e..7d55d98641 100644 --- a/Library/Optimizers/FunctionCall/MergeAppendOptimizer.php +++ b/Library/Optimizers/FunctionCall/MergeAppendOptimizer.php @@ -29,9 +29,9 @@ class MergeAppendOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/MicrotimeOptimizer.php b/Library/Optimizers/FunctionCall/MicrotimeOptimizer.php index 18e97c0f61..9be95691bc 100644 --- a/Library/Optimizers/FunctionCall/MicrotimeOptimizer.php +++ b/Library/Optimizers/FunctionCall/MicrotimeOptimizer.php @@ -29,9 +29,9 @@ class MicrotimeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/PowOptimizer.php b/Library/Optimizers/FunctionCall/PowOptimizer.php index 3382d28818..f2a1495b89 100644 --- a/Library/Optimizers/FunctionCall/PowOptimizer.php +++ b/Library/Optimizers/FunctionCall/PowOptimizer.php @@ -29,9 +29,9 @@ class PowOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/PregMatchOptimizer.php b/Library/Optimizers/FunctionCall/PregMatchOptimizer.php index b1822b8c8a..23b50522aa 100644 --- a/Library/Optimizers/FunctionCall/PregMatchOptimizer.php +++ b/Library/Optimizers/FunctionCall/PregMatchOptimizer.php @@ -35,9 +35,9 @@ class PregMatchOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -118,9 +118,9 @@ public function optimize(array $expression, Call $call, CompilationContext $cont * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return array + * + * @throws CompilerException */ private function processOptionals(array &$expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php b/Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php index fa175f9464..cff2c8604e 100644 --- a/Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php +++ b/Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php @@ -29,9 +29,9 @@ class PrepareVirtualPathOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/RoundOptimizer.php b/Library/Optimizers/FunctionCall/RoundOptimizer.php index 7dcd0b0962..3b99a9d00c 100644 --- a/Library/Optimizers/FunctionCall/RoundOptimizer.php +++ b/Library/Optimizers/FunctionCall/RoundOptimizer.php @@ -30,9 +30,9 @@ class RoundOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { @@ -74,9 +74,9 @@ public function optimize(array $expression, Call $call, CompilationContext $cont ); break; - /* - * float $val, int $mode - */ + /* + * float $val, int $mode + */ case 2: $context->codePrinter->output( 'zephir_round('.$symbol.', '.$resolvedParams[0].', '.$resolvedParams[1].', NULL);' diff --git a/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php b/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php index 0e6535308e..6cee852152 100644 --- a/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php +++ b/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php @@ -29,9 +29,9 @@ class StrReplaceOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php b/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php index 102130fd20..c00f98faec 100644 --- a/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php +++ b/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php @@ -29,9 +29,9 @@ class StripcslashesOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/StripslashesOptimizer.php b/Library/Optimizers/FunctionCall/StripslashesOptimizer.php index 6bf84bbce6..b5bc457bd2 100644 --- a/Library/Optimizers/FunctionCall/StripslashesOptimizer.php +++ b/Library/Optimizers/FunctionCall/StripslashesOptimizer.php @@ -29,9 +29,9 @@ class StripslashesOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/StrposOptimizer.php b/Library/Optimizers/FunctionCall/StrposOptimizer.php index 6a68d4f294..fb6e2a0acf 100644 --- a/Library/Optimizers/FunctionCall/StrposOptimizer.php +++ b/Library/Optimizers/FunctionCall/StrposOptimizer.php @@ -29,9 +29,9 @@ class StrposOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/StrtokOptimizer.php b/Library/Optimizers/FunctionCall/StrtokOptimizer.php index e3b5040570..fa7f4e1a50 100644 --- a/Library/Optimizers/FunctionCall/StrtokOptimizer.php +++ b/Library/Optimizers/FunctionCall/StrtokOptimizer.php @@ -29,9 +29,9 @@ class StrtokOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php b/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php index 9543ac7f7f..19fc8aa29c 100644 --- a/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php +++ b/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php @@ -29,9 +29,9 @@ class StrtolowerOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/StrtoupperOptimizer.php b/Library/Optimizers/FunctionCall/StrtoupperOptimizer.php index 8c95e9d45e..0713304fb1 100644 --- a/Library/Optimizers/FunctionCall/StrtoupperOptimizer.php +++ b/Library/Optimizers/FunctionCall/StrtoupperOptimizer.php @@ -29,9 +29,9 @@ class StrtoupperOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/SubstrOptimizer.php b/Library/Optimizers/FunctionCall/SubstrOptimizer.php index 8dc69b8a5e..dd0e40c6d3 100644 --- a/Library/Optimizers/FunctionCall/SubstrOptimizer.php +++ b/Library/Optimizers/FunctionCall/SubstrOptimizer.php @@ -29,9 +29,9 @@ class SubstrOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/TimeOptimizer.php b/Library/Optimizers/FunctionCall/TimeOptimizer.php index a96dfa2db5..aa48887ff9 100644 --- a/Library/Optimizers/FunctionCall/TimeOptimizer.php +++ b/Library/Optimizers/FunctionCall/TimeOptimizer.php @@ -29,9 +29,9 @@ class TimeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/TrimOptimizer.php b/Library/Optimizers/FunctionCall/TrimOptimizer.php index b0f8377dd5..a22a660093 100644 --- a/Library/Optimizers/FunctionCall/TrimOptimizer.php +++ b/Library/Optimizers/FunctionCall/TrimOptimizer.php @@ -31,9 +31,9 @@ class TrimOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/UcfirstOptimizer.php b/Library/Optimizers/FunctionCall/UcfirstOptimizer.php index 0d2b49ddfb..13def33d99 100644 --- a/Library/Optimizers/FunctionCall/UcfirstOptimizer.php +++ b/Library/Optimizers/FunctionCall/UcfirstOptimizer.php @@ -29,9 +29,9 @@ class UcfirstOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php b/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php index 68036a8429..50daee809a 100644 --- a/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php +++ b/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php @@ -29,9 +29,9 @@ class UncamelizeOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php b/Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php index 69e4e3852a..2f06c54489 100644 --- a/Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php +++ b/Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php @@ -29,9 +29,9 @@ class UniqueKeyOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php b/Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php index b241f3528a..9ab964b968 100644 --- a/Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php +++ b/Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php @@ -29,9 +29,9 @@ class UniquePathKeyOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/VarExportOptimizer.php b/Library/Optimizers/FunctionCall/VarExportOptimizer.php index f99f0c3d4f..180e07ea36 100644 --- a/Library/Optimizers/FunctionCall/VarExportOptimizer.php +++ b/Library/Optimizers/FunctionCall/VarExportOptimizer.php @@ -30,9 +30,9 @@ class VarExportOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php b/Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php index 8b19da0264..c9357d95ee 100644 --- a/Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php +++ b/Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php @@ -29,9 +29,9 @@ class ZephirStringToHexOptimizer extends OptimizerAbstract * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Optimizers/IsTypeOptimizerAbstract.php b/Library/Optimizers/IsTypeOptimizerAbstract.php index 9b1e0b92b1..17186a38b8 100644 --- a/Library/Optimizers/IsTypeOptimizerAbstract.php +++ b/Library/Optimizers/IsTypeOptimizerAbstract.php @@ -18,8 +18,6 @@ use Zephir\CompiledExpression; use Zephir\Exception; -use function count; - abstract class IsTypeOptimizerAbstract extends OptimizerAbstract { /** @@ -33,7 +31,7 @@ abstract class IsTypeOptimizerAbstract extends OptimizerAbstract */ public function optimize(array $expression, Call $call, CompilationContext $context): ?CompiledExpression { - if (!isset($expression['parameters']) || count($expression['parameters']) !== 1) { + if (!isset($expression['parameters']) || \count($expression['parameters']) !== 1) { return null; } diff --git a/Library/Optimizers/MathOptimizer.php b/Library/Optimizers/MathOptimizer.php index 36e7ba3da8..36e1fb3ba6 100644 --- a/Library/Optimizers/MathOptimizer.php +++ b/Library/Optimizers/MathOptimizer.php @@ -32,9 +32,9 @@ abstract public function getFunctionName(); * @param Call $call * @param CompilationContext $context * - * @throws CompilerException - * * @return bool|CompiledExpression|mixed + * + * @throws CompilerException */ public function optimize(array $expression, Call $call, CompilationContext $context) { diff --git a/Library/Parser/Manager.php b/Library/Parser/Manager.php index 70cf7160cf..8eb8f3371c 100644 --- a/Library/Parser/Manager.php +++ b/Library/Parser/Manager.php @@ -32,8 +32,8 @@ public function getParser(): Parser */ public function isAvailable(): bool { - return $this->parser->isAvailable() && - version_compare(self::MINIMUM_PARSER_VERSION, $this->parser->getVersion(), '<='); + return $this->parser->isAvailable() + && version_compare(self::MINIMUM_PARSER_VERSION, $this->parser->getVersion(), '<='); } public function requirements(): string diff --git a/Library/Parser/Parser.php b/Library/Parser/Parser.php index be20898ba4..9973cbebc9 100644 --- a/Library/Parser/Parser.php +++ b/Library/Parser/Parser.php @@ -17,8 +17,6 @@ use Zephir\Exception\InvalidArgumentException; use Zephir\Exception\ParseException; -use function function_exists; - class Parser { /** @@ -28,7 +26,7 @@ class Parser */ public function isAvailable(): bool { - return function_exists('zephir_parse_file'); + return \function_exists('zephir_parse_file'); } /** diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index f160bbde3e..1dd6d0d16b 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -15,10 +15,6 @@ use Zephir\StatementsBlock; -use function constant; -use function defined; -use function gettype; - /** * This pass tries to check whether variables only do exist in the local context of the method block * or if they're used externally which will un allow variables to be placed in the stack @@ -88,7 +84,7 @@ public function markVariableNoLocal(string $variable): void * Marks the latest use/read of a variable. * * @param string $variable - * @param array $node + * @param array $node */ public function markLastUse(string $variable, array $node): void { @@ -203,8 +199,8 @@ public function passLetStatement(array $statement): void break; case 'constant': - if (defined($assignment['expr']['value'])) { - if ('string' === gettype(constant($assignment['expr']['value']))) { + if (\defined($assignment['expr']['value'])) { + if ('string' === \gettype(\constant($assignment['expr']['value']))) { $this->markVariableNoLocal($assignment['variable']); } } @@ -225,7 +221,7 @@ public function passLetStatement(array $statement): void break; default: - //echo '[', $assignment['expr']['type'], ']', PHP_EOL; + // echo '[', $assignment['expr']['type'], ']', PHP_EOL; } break; @@ -246,12 +242,12 @@ public function passLetStatement(array $statement): void $this->markVariableNoLocal($assignment['expr']['value']); break; default: - //echo '[', $assignment['assign-type'], ']'; + // echo '[', $assignment['assign-type'], ']'; } break; default: - //echo $assignment['assign-type']; + // echo $assignment['assign-type']; } } } diff --git a/Library/Passes/SkipVariantInit.php b/Library/Passes/SkipVariantInit.php index 2843a5a5c0..3587011a6c 100644 --- a/Library/Passes/SkipVariantInit.php +++ b/Library/Passes/SkipVariantInit.php @@ -13,8 +13,6 @@ use Zephir\StatementsBlock; -use function count; - /** * In 'if'/'else' statements sometimes dynamical variables are initialized in every branch * Same case in 'switch' statements @@ -28,7 +26,7 @@ class SkipVariantInit /** * Do the compilation pass. * - * @param int $branchNumber + * @param int $branchNumber * @param StatementsBlock $block */ public function pass(int $branchNumber, StatementsBlock $block): void @@ -40,7 +38,7 @@ public function pass(int $branchNumber, StatementsBlock $block): void /** * Check assignment types for possible skip. * - * @param int $branchNumber + * @param int $branchNumber * @param array $statement */ public function passLetStatement(int $branchNumber, array $statement): void @@ -99,7 +97,7 @@ public function getVariables(): array } $variables = []; - $numberBranches = count($this->branches); + $numberBranches = \count($this->branches); foreach ($variableStats as $variable => $number) { if ($number == $numberBranches) { $variables[] = $variable; @@ -110,7 +108,7 @@ public function getVariables(): array } /** - * @param int $branchNumber + * @param int $branchNumber * @param array $variablesToSkip */ public function setVariablesToSkip(int $branchNumber, array $variablesToSkip): void diff --git a/Library/Passes/StaticTypeInference.php b/Library/Passes/StaticTypeInference.php index 0b58a7ba90..9ae1278f8e 100644 --- a/Library/Passes/StaticTypeInference.php +++ b/Library/Passes/StaticTypeInference.php @@ -198,7 +198,7 @@ public function getInferedType($variable) if (isset($this->variables[$variable])) { $type = $this->variables[$variable]; if ('variable' != $type && 'undefined' != $type && 'string' != $type && 'istring' != $type && 'array' != $type && 'null' != $type && 'numeric' != $type) { - //echo $variable, ' ', $type, PHP_EOL; + // echo $variable, ' ', $type, PHP_EOL; return $type; } } @@ -457,8 +457,8 @@ public function passExpression(array $expression) case 'ternary': case 'short-ternary': - //$right = $this->passExpression($expression['right']); - //$extra = $this->passExpression($expression['extra']); + // $right = $this->passExpression($expression['right']); + // $extra = $this->passExpression($expression['extra']); /*if ($right == $extra) { if ($right != 'string' && $right != 'array') { return $right; @@ -576,7 +576,7 @@ public function passStatementBlock(array $statements) case 'unset': case 'cblock': case 'comment': - // empty statement != empty operator + // empty statement != empty operator case 'empty': break; diff --git a/Library/Statements/DoWhileStatement.php b/Library/Statements/DoWhileStatement.php index bf33f534d4..0a8afbc17e 100644 --- a/Library/Statements/DoWhileStatement.php +++ b/Library/Statements/DoWhileStatement.php @@ -11,7 +11,6 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Optimizers\EvalExpression; @@ -24,7 +23,8 @@ class DoWhileStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext - * @throws ReflectionException + * + * @throws \ReflectionException * @throws Exception */ public function compile(CompilationContext $compilationContext): void diff --git a/Library/Statements/EchoStatement.php b/Library/Statements/EchoStatement.php index 87f442fb8c..d640aaf9e9 100644 --- a/Library/Statements/EchoStatement.php +++ b/Library/Statements/EchoStatement.php @@ -11,7 +11,6 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; @@ -27,7 +26,7 @@ class EchoStatement extends StatementAbstract /** * @param CompilationContext $compilationContext * - * @throws ReflectionException + * @throws \ReflectionException * @throws Exception */ public function compile(CompilationContext $compilationContext): void diff --git a/Library/Statements/ForStatement.php b/Library/Statements/ForStatement.php index 5edf1e3a0d..63a0561da6 100644 --- a/Library/Statements/ForStatement.php +++ b/Library/Statements/ForStatement.php @@ -11,7 +11,6 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\CompilationContext; use Zephir\Detectors\ForValueUseDetector; use Zephir\Exception; @@ -22,6 +21,7 @@ use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; use Zephir\Variable\Variable; + use function Zephir\add_slashes; class ForStatement extends StatementAbstract @@ -29,11 +29,12 @@ class ForStatement extends StatementAbstract /** * Compiles a for statement that use a 'range' as expression. * - * @param array $exprRaw + * @param array $exprRaw * @param CompilationContext $compilationContext * * @return bool - * @throws ReflectionException + * + * @throws \ReflectionException * @throws Exception */ public function compileRange(array $exprRaw, CompilationContext $compilationContext): bool @@ -394,12 +395,13 @@ public function compileRange(array $exprRaw, CompilationContext $compilationCont /** * Compiles a 'for' statement that use an 'iterator' as expression. * - * @param array $exprRaw + * @param array $exprRaw * @param CompilationContext $compilationContext * * @return void + * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compileIterator(array $exprRaw, CompilationContext $compilationContext): void { @@ -520,11 +522,12 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC * - Every key must be an integer or compatible * - Every value must be a char/integer or compatible. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext - * @param Variable $exprVariable + * @param Variable $exprVariable + * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compileStringTraverse($expression, CompilationContext $compilationContext, $exprVariable) { @@ -745,7 +748,7 @@ public function compileHashTraverse(CompilationContext $compilationContext, Vari * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { diff --git a/Library/Statements/IfStatement.php b/Library/Statements/IfStatement.php index df1756947e..6c8c29c55a 100644 --- a/Library/Statements/IfStatement.php +++ b/Library/Statements/IfStatement.php @@ -11,7 +11,6 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\Branch; use Zephir\CompilationContext; use Zephir\Detectors\ReadDetector; @@ -27,7 +26,8 @@ class IfStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext - * @throws ReflectionException + * + * @throws \ReflectionException * @throws Exception */ public function compile(CompilationContext $compilationContext): void diff --git a/Library/Statements/Let/ArrayIndex.php b/Library/Statements/Let/ArrayIndex.php index 9880cbcef0..25a7fa1d15 100644 --- a/Library/Statements/Let/ArrayIndex.php +++ b/Library/Statements/Let/ArrayIndex.php @@ -96,9 +96,9 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return GlobalConstant|ZephirVariable + * + * @throws CompilerException */ protected function _getResolvedArrayItem(CompiledExpression $resolvedExpr, CompilationContext $compilationContext) { diff --git a/Library/Statements/Let/ObjectDynamicProperty.php b/Library/Statements/Let/ObjectDynamicProperty.php index 9c7ade5d1e..bdb85e1beb 100644 --- a/Library/Statements/Let/ObjectDynamicProperty.php +++ b/Library/Statements/Let/ObjectDynamicProperty.php @@ -13,7 +13,6 @@ namespace Zephir\Statements\Let; -use Exception; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; @@ -34,7 +33,7 @@ class ObjectDynamicProperty * @param array $statement * * @throws CompilerException - * @throws Exception + * @throws \Exception */ public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) { @@ -104,7 +103,7 @@ public function assign(string $variable, ZephirVariable $symbolVariable, Compile } elseif ('0' == $resolvedExpr->getBooleanCode()) { $value = 'false'; } else { - throw new Exception('?'); + throw new \Exception('?'); } $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $value, $compilationContext); diff --git a/Library/Statements/Let/ObjectProperty.php b/Library/Statements/Let/ObjectProperty.php index c277bb8c0a..09d9a63227 100644 --- a/Library/Statements/Let/ObjectProperty.php +++ b/Library/Statements/Let/ObjectProperty.php @@ -239,7 +239,7 @@ public function assign( $codePrinter->output('}'); break; - /* unreachable code */ + /* unreachable code */ case 'empty-array': $tempVariable = $context->symbolTable->getTempNonTrackedVariable('variable', $context); diff --git a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php b/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php index a27b54ae01..63edeadddb 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php +++ b/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php @@ -48,10 +48,10 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres /** * Compiles x->y[a][b][] = {expr} (multiple offset assignment). * - * @param ZephirVariable $symbolVariable + * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext - * @param array $statement + * @param array $statement * * @throws \ReflectionException * @throws Exception diff --git a/Library/Statements/Let/StaticProperty.php b/Library/Statements/Let/StaticProperty.php index 01258407c7..2f011da5a9 100644 --- a/Library/Statements/Let/StaticProperty.php +++ b/Library/Statements/Let/StaticProperty.php @@ -13,7 +13,6 @@ namespace Zephir\Statements\Let; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -28,13 +27,13 @@ class StaticProperty /** * Compiles ClassName::foo = {expr}. * - * @param string $className - * @param string $property + * @param string $className + * @param string $property * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext - * @param array $statement + * @param array $statement * - * @throws ReflectionException + * @throws \ReflectionException */ public function assignStatic( string $className, diff --git a/Library/Statements/Let/Variable.php b/Library/Statements/Let/Variable.php index 594e806009..0387e5fa06 100644 --- a/Library/Statements/Let/Variable.php +++ b/Library/Statements/Let/Variable.php @@ -18,6 +18,7 @@ use Zephir\Exception\CompilerException; use Zephir\Exception\IllegalOperationException; use Zephir\Variable\Variable as ZephirVariable; + use function Zephir\add_slashes; /** @@ -115,10 +116,10 @@ public function assign( * @throws \Zephir\Exception\IllegalOperationException */ private function doNumericAssignment( - Printer $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - string $variable, - array $statement, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -347,10 +348,10 @@ private function doNumericAssignment( * @throws IllegalOperationException */ private function doDoubleAssignment( - Printer $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - string $variable, - array $statement, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -528,11 +529,11 @@ private function doDoubleAssignment( * @throws \Zephir\Exception\IllegalOperationException */ private function doStringAssignment( - Printer $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, + ZephirVariable $symbolVariable, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -705,7 +706,7 @@ private function doStringAssignment( /** * Performs array assignment. * - * @param Printer $codePrinter + * @param Printer $codePrinter * @param CompiledExpression $resolvedExpr * @param ZephirVariable $symbolVariable * @param string $variable @@ -716,11 +717,11 @@ private function doStringAssignment( * @throws IllegalOperationException */ private function doArrayAssignment( - Printer $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, + ZephirVariable $symbolVariable, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -754,7 +755,7 @@ private function doArrayAssignment( /** * Performs boolean assignment. * - * @param Printer $codePrinter + * @param Printer $codePrinter * @param CompiledExpression $resolvedExpr * @param string $variable * @param array $statement @@ -764,10 +765,10 @@ private function doArrayAssignment( * @throws IllegalOperationException */ private function doBoolAssignment( - Printer $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - string $variable, - array $statement, + string $variable, + array $statement, CompilationContext $compilationContext ) { switch ($resolvedExpr->getType()) { @@ -889,7 +890,7 @@ private function doBoolAssignment( /** * Performs variable assignment. * - * @param Printer $codePrinter + * @param Printer $codePrinter * @param CompiledExpression $resolvedExpr * @param ZephirVariable $symbolVariable * @param string $variable @@ -901,13 +902,13 @@ private function doBoolAssignment( * @throws IllegalOperationException */ private function doVariableAssignment( - Printer $codePrinter, + Printer $codePrinter, CompiledExpression $resolvedExpr, - ZephirVariable $symbolVariable, - string $variable, - array $statement, + ZephirVariable $symbolVariable, + string $variable, + array $statement, CompilationContext $compilationContext, - ReadDetector $readDetector + ReadDetector $readDetector ) { switch ($resolvedExpr->getType()) { case 'null': diff --git a/Library/Statements/Let/VariableAppend.php b/Library/Statements/Let/VariableAppend.php index caccc18bfa..7b850d9dfd 100644 --- a/Library/Statements/Let/VariableAppend.php +++ b/Library/Statements/Let/VariableAppend.php @@ -26,11 +26,11 @@ class VariableAppend /** * Compiles foo[] = {expr}. * - * @param $variable + * @param $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext - * @param $statement + * @param $statement * * @throws CompilerException */ diff --git a/Library/Statements/ReturnStatement.php b/Library/Statements/ReturnStatement.php index 551236cf33..4104c0476a 100644 --- a/Library/Statements/ReturnStatement.php +++ b/Library/Statements/ReturnStatement.php @@ -11,13 +11,13 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Exception\InvalidTypeException; use Zephir\Expression; use Zephir\Types\Types; + use function Zephir\add_slashes; /** @@ -29,7 +29,7 @@ final class ReturnStatement extends StatementAbstract * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { diff --git a/Library/Statements/SwitchStatement.php b/Library/Statements/SwitchStatement.php index bff0c62b27..5db2f726df 100644 --- a/Library/Statements/SwitchStatement.php +++ b/Library/Statements/SwitchStatement.php @@ -17,7 +17,6 @@ use Zephir\Expression; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; -use function count; /** * Switch statement, the same as in PHP/C @@ -26,6 +25,7 @@ class SwitchStatement extends StatementAbstract { /** * @param CompilationContext $compilationContext + * * @throws \ReflectionException * @throws Exception */ @@ -122,7 +122,7 @@ public function compile(CompilationContext $compilationContext): void foreach ($blocks as $block) { $expressions = $block['expr']; - if (1 == count($expressions)) { + if (1 == \count($expressions)) { $condition = $evalExpr->optimize($expressions[0], $compilationContext); $codePrinter->output('if ('.$condition.') {'); } else { @@ -167,7 +167,7 @@ public function normalizeClauses($clauses) } } - if ($defaultIndex === count($clauses) - 1) { + if ($defaultIndex === \count($clauses) - 1) { return $clauses; } diff --git a/Library/Statements/ThrowStatement.php b/Library/Statements/ThrowStatement.php index f7394034e1..701cc7b69b 100644 --- a/Library/Statements/ThrowStatement.php +++ b/Library/Statements/ThrowStatement.php @@ -13,7 +13,6 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\Class\Entry; use Zephir\Code\Printer; use Zephir\CompilationContext; @@ -21,7 +20,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use function in_array; + use function Zephir\add_slashes; use function Zephir\fqcn; @@ -34,7 +33,7 @@ class ThrowStatement extends StatementAbstract * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -48,10 +47,10 @@ public function compile(CompilationContext $compilationContext): void * This optimizes throw new Exception("hello") */ if (!$compilationContext->insideTryCatch) { - if (isset($expr['class']) && - isset($expr['parameters']) && - 1 == \count($expr['parameters']) && - 'string' == $expr['parameters'][0]['parameter']['type'] + if (isset($expr['class']) + && isset($expr['parameters']) + && 1 == \count($expr['parameters']) + && 'string' == $expr['parameters'][0]['parameter']['type'] ) { $className = fqcn( $expr['class'], @@ -80,7 +79,7 @@ public function compile(CompilationContext $compilationContext): void } } } else { - if (in_array($expr['type'], ['string', 'char', 'int', 'double'])) { + if (\in_array($expr['type'], ['string', 'char', 'int', 'double'])) { $class = (new Entry('Exception', $compilationContext))->get(); $this->throwStringException($codePrinter, $class, $expr['value'], $expr); @@ -97,7 +96,7 @@ public function compile(CompilationContext $compilationContext): void throw new CompilerException($e->getMessage(), $expr, $e->getCode(), $e); } - if (!in_array($resolvedExpr->getType(), ['variable', 'string'])) { + if (!\in_array($resolvedExpr->getType(), ['variable', 'string'])) { throw new CompilerException( "Expression '".$resolvedExpr->getType().'" cannot be used as exception', $expr @@ -110,7 +109,7 @@ public function compile(CompilationContext $compilationContext): void $expr ); - if (!in_array($variableVariable->getType(), ['variable', 'string'])) { + if (!\in_array($variableVariable->getType(), ['variable', 'string'])) { throw new CompilerException( "Variable '".$variableVariable->getType()."' cannot be used as exception", $expr @@ -142,9 +141,9 @@ public function compile(CompilationContext $compilationContext): void * Throws an exception escaping the data. * * @param Printer $printer - * @param string $class - * @param string $message - * @param array $expression + * @param string $class + * @param string $message + * @param array $expression */ private function throwStringException(Printer $printer, string $class, string $message, array $expression): void { diff --git a/Library/Statements/UnsetStatement.php b/Library/Statements/UnsetStatement.php index e8eda65fcd..b6da495c60 100644 --- a/Library/Statements/UnsetStatement.php +++ b/Library/Statements/UnsetStatement.php @@ -13,14 +13,11 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use function in_array; - /** * unset() statement */ @@ -30,7 +27,7 @@ class UnsetStatement extends StatementAbstract * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -79,7 +76,7 @@ public function compile(CompilationContext $compilationContext): void throw new CompilerException('Cannot use expression type: '.$expression['type'].' in "unset"', $expression); } - if (!in_array($variable->getType(), ['variable', 'array'])) { + if (!\in_array($variable->getType(), ['variable', 'array'])) { throw new CompilerException('Cannot use variable type: '.$variable->gettype().' in "unset"', $expression['left']); } @@ -100,7 +97,7 @@ public function compile(CompilationContext $compilationContext): void * @return CompilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ private function generateUnsetPropertyFromObject(array $expression, CompilationContext $compilationContext): CompilationContext { diff --git a/Library/StatementsBlock.php b/Library/StatementsBlock.php index c29c9e112a..8cfafe5f97 100644 --- a/Library/StatementsBlock.php +++ b/Library/StatementsBlock.php @@ -11,7 +11,6 @@ namespace Zephir; -use ReflectionException; use Zephir\Passes\MutateGathererPass; use Zephir\Statements\BreakStatement; use Zephir\Statements\ContinueStatement; @@ -30,7 +29,6 @@ use Zephir\Statements\TryCatchStatement; use Zephir\Statements\UnsetStatement; use Zephir\Statements\WhileStatement; -use function count; /** * This represents a single basic block in Zephir. @@ -87,9 +85,9 @@ public function isLoop(bool $loop): static * @return Branch * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ - public function compile(CompilationContext $compilationContext, ?bool $unreachable = null, int $branchType = Branch::TYPE_UNKNOWN): Branch + public function compile(CompilationContext $compilationContext, bool $unreachable = null, int $branchType = Branch::TYPE_UNKNOWN): Branch { $compilationContext->codePrinter->increaseLevel(); ++$compilationContext->currentBranch; @@ -410,7 +408,7 @@ public function getLastStatement() */ public function isEmpty(): bool { - return 0 === count($this->statements); + return 0 === \count($this->statements); } /** diff --git a/Library/StaticCall.php b/Library/StaticCall.php index c1161bbebc..1d9a44da86 100644 --- a/Library/StaticCall.php +++ b/Library/StaticCall.php @@ -11,15 +11,11 @@ namespace Zephir; -use ReflectionException; use Zephir\Class\Definition\Definition; use Zephir\Class\Method\Method; use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; use Zephir\Variable\Variable; -use function count; -use function in_array; -use function is_string; /** * Call methods in a static context @@ -29,13 +25,13 @@ class StaticCall extends Call /** * Compiles a static method call. * - * @param Expression $expr + * @param Expression $expr * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(Expression $expr, CompilationContext $compilationContext): CompiledExpression { @@ -91,8 +87,8 @@ public function compile(Expression $expr, CompilationContext $compilationContext $className = $expression['class']; $classDefinition = false; - if (!in_array($className, ['self', 'static', 'parent'])) { - if (is_string($className)) { + if (!\in_array($className, ['self', 'static', 'parent'])) { + if (\is_string($className)) { $className = $compilationContext->getFullName($className); if ($compiler->isClass($className)) { $classDefinition = $compiler->getClassDefinition($className); @@ -147,7 +143,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext throw new CompilerException("Cannot call private method '".$methodName."' out of its scope", $expression); } - if (!in_array($className, ['self', 'static', 'parent']) && !$method->isStatic()) { + if (!\in_array($className, ['self', 'static', 'parent']) && !$method->isStatic()) { throw new CompilerException("Cannot call non-static method '".$methodName."' in a static way", $expression); } @@ -156,7 +152,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Try to produce an exception if method is called with a wrong number of parameters */ - $callNumberParameters = isset($expression['parameters']) ? count($expression['parameters']) : 0; + $callNumberParameters = isset($expression['parameters']) ? \count($expression['parameters']) : 0; $classMethod = $classDefinition->getMethod($methodName); $expectedNumberParameters = $classMethod->getNumberOfRequiredParameters(); @@ -191,7 +187,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($dynamicClass) { $this->callFromDynamicClass($methodName, $expression, $symbolVariable, $mustInit, $isExpecting, $compilationContext); } else { - if (in_array($className, ['self', 'static']) || $classDefinition == $compilationContext->classDefinition) { + if (\in_array($className, ['self', 'static']) || $classDefinition == $compilationContext->classDefinition) { $this->call(strtoupper($className), $methodName, $expression, $mustInit, $isExpecting, $compilationContext, $symbolVariable, $method ?? null); } else { if ('parent' == $className) { @@ -243,14 +239,15 @@ public function compile(Expression $expr, CompilationContext $compilationContext /** * Calls static methods on the 'self/static' context. * - * @param string $context SELF / STATIC - * @param string $methodName - * @param array $expression - * @param bool $mustInit - * @param bool $isExpecting + * @param string $context SELF / STATIC + * @param string $methodName + * @param array $expression + * @param bool $mustInit + * @param bool $isExpecting * @param CompilationContext $compilationContext - * @param Variable|null $symbolVariable - * @param Method|null $method + * @param Variable|null $symbolVariable + * @param Method|null $method + * * @throws Exception */ protected function call( @@ -260,10 +257,10 @@ protected function call( bool $mustInit, bool $isExpecting, CompilationContext $compilationContext, - ?Variable $symbolVariable = null, - ?Method $method = null + Variable $symbolVariable = null, + Method $method = null ): void { - if (!in_array($context, ['SELF', 'STATIC'])) { + if (!\in_array($context, ['SELF', 'STATIC'])) { $context = 'SELF'; } @@ -293,7 +290,7 @@ protected function call( $cachePointer = $methodCache->get($compilationContext, $method ?? null); $params = []; - if (isset($expression['parameters']) && count($expression['parameters'])) { + if (isset($expression['parameters']) && \count($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } @@ -301,7 +298,7 @@ protected function call( $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } - $paramCount = count($params); + $paramCount = \count($params); $paramsStr = $paramCount ? ', '.implode(', ', $params) : ''; $isInternal = isset($method) && $method->isInternal(); @@ -344,14 +341,15 @@ protected function call( /** * Calls static methods on the 'parent' context. * - * @param string $methodName - * @param array $expression - * @param Variable $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting - * @param Definition $classDefinition + * @param string $methodName + * @param array $expression + * @param Variable $symbolVariable + * @param bool $mustInit + * @param bool $isExpecting + * @param Definition $classDefinition * @param CompilationContext $compilationContext - * @param Method $method + * @param Method $method + * * @throws Exception */ protected function callParent(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method) @@ -376,11 +374,11 @@ protected function callParent(string $methodName, array $expression, $symbolVari $cachePointer = $methodCache->get($compilationContext, isset($method) ? $method : null); $params = []; - if (isset($expression['parameters']) && count($expression['parameters'])) { + if (isset($expression['parameters']) && \count($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } - if (!count($params)) { + if (!\count($params)) { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { $codePrinter->output('ZEPHIR_RETURN_CALL_PARENT('.$classCe.', getThis(), "'.$methodName.'", '.$cachePointer.');'); @@ -415,14 +413,15 @@ protected function callParent(string $methodName, array $expression, $symbolVari /** * Calls static methods on some class context. * - * @param string $methodName - * @param array $expression - * @param Variable $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting - * @param Definition $classDefinition + * @param string $methodName + * @param array $expression + * @param Variable $symbolVariable + * @param bool $mustInit + * @param bool $isExpecting + * @param Definition $classDefinition * @param CompilationContext $compilationContext - * @param Method $method + * @param Method $method + * * @throws Exception */ protected function callFromClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method) @@ -456,7 +455,7 @@ protected function callFromClass($methodName, array $expression, $symbolVariable $cachePointer = $methodCache->get($compilationContext, $method); $params = []; - if (isset($expression['parameters']) && count($expression['parameters'])) { + if (isset($expression['parameters']) && \count($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression); } @@ -464,7 +463,7 @@ protected function callFromClass($methodName, array $expression, $symbolVariable $symbol = $compilationContext->backend->getVariableCode($symbolVariable); } - $paramCount = count($params); + $paramCount = \count($params); $paramsStr = $paramCount ? ', '.implode(', ', $params) : ''; if ($method->isInternal()) { @@ -506,7 +505,7 @@ protected function callFromClass($methodName, array $expression, $symbolVariable /** * Calls static methods on using a dynamic variable as class. * - * @param string $methodName + * @param string $methodName * @param array $expression * @param Variable $symbolVariable * @param bool $mustInit @@ -523,7 +522,7 @@ protected function callFromDynamicClass(string $methodName, array $expression, $ $cachePointer = 'NULL, 0'; - if (!count($params)) { + if (!\count($params)) { if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { $compilationContext->codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC('.$classEntry.', "'.$methodName.'", '.$cachePointer.');'); @@ -558,10 +557,10 @@ protected function callFromDynamicClass(string $methodName, array $expression, $ /** * Calls static methods on using a dynamic variable as class and a dynamic method. * - * @param array $expression - * @param Variable $symbolVariable - * @param bool $mustInit - * @param bool $isExpecting + * @param array $expression + * @param Variable $symbolVariable + * @param bool $mustInit + * @param bool $isExpecting * @param CompilationContext $compilationContext */ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolVariable, bool $mustInit, bool $isExpecting, CompilationContext $compilationContext): void @@ -582,7 +581,7 @@ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolV $cachePointer = 'NULL, 0'; - if (!count($params)) { + if (!\count($params)) { if ($isExpecting) { if ('return_value' === $symbolVariable->getName()) { $compilationContext->codePrinter->output('ZEPHIR_RETURN_CALL_CE_STATIC_ZVAL('.$classEntry.', '.$methodNameVariable->getName().', '.$cachePointer.');'); diff --git a/Library/Stubs/DocBlock.php b/Library/Stubs/DocBlock.php index d31b576a47..f0ba7018e1 100644 --- a/Library/Stubs/DocBlock.php +++ b/Library/Stubs/DocBlock.php @@ -13,8 +13,6 @@ namespace Zephir\Stubs; -use function count; - /** * @author Gusakov Nikita */ @@ -43,7 +41,7 @@ public function __construct(?string $source, string $indent = ' ') { $this->indent = $indent; $lines = explode("\n", trim($source ?: '')); - $count = count($lines); + $count = \count($lines); foreach ($lines as $i => $line) { $line = preg_replace('#^([\s\t]+)?/?([*]+)([\s\t]+)?$#im', '', rtrim($line)); @@ -56,7 +54,7 @@ public function __construct(?string $source, string $indent = ' ') $cleaned = trim($line, "\t*\0 "); $cleaned = str_replace('$$', '$', $cleaned); - if (0 === strpos($cleaned, '@')) { + if (str_starts_with($cleaned, '@')) { $this->lines[] = $cleaned; } else { $line = preg_replace('#([\s\t]+)?[*]#', '', $line); @@ -68,7 +66,7 @@ public function __construct(?string $source, string $indent = ' ') } } - if (!empty($this->lines) && 0 !== strpos(trim($this->lines[0], "\t*\0 "), '@')) { + if (!empty($this->lines) && !str_starts_with(trim($this->lines[0], "\t*\0 "), '@')) { $description = array_shift($this->lines); $description = explode("\n", $description); diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index f1ec5af964..049cd823a2 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -14,15 +14,13 @@ namespace Zephir\Stubs; use Zephir\AliasManager; -use Zephir\Class\Property; use Zephir\Class\Constant; use Zephir\Class\Definition\Definition; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; use Zephir\CompilerFile; use Zephir\Exception; -use function array_key_exists; -use function in_array; class Generator { @@ -37,6 +35,7 @@ class Generator 'scoped', 'deprecated', ]; + /** * @param CompilerFile[] $files */ @@ -90,12 +89,12 @@ public function generate(string $namespace, string $path, string $indent, string * Build class. * * @param Definition $class - * @param string $indent - * @param string $banner + * @param string $indent + * @param string $banner * * @return string - *@throws Exception\RuntimeException * + * @throws Exception\RuntimeException */ protected function buildClass(Definition $class, string $indent, string $banner): string { @@ -209,7 +208,7 @@ protected function buildClass(Definition $class, string $indent, string $banner) * Build property. * * @param Property $property - * @param string $indent + * @param string $indent * * @return string */ @@ -239,7 +238,7 @@ protected function buildProperty(Property $property, string $indent): string /** * @param Constant $constant - * @param string $indent + * @param string $indent * * @return string */ @@ -256,8 +255,8 @@ protected function buildConstant(Constant $constant, string $indent): string /** * @param Method $method - * @param bool $isInterface - * @param string $indent + * @param bool $isInterface + * @param string $indent * * @return string */ @@ -285,13 +284,13 @@ protected function buildMethod(Method $method, bool $isInterface, string $indent } elseif (isset($parameter['data-type']) && 'array' === $parameter['data-type']) { $paramStr .= 'array '; } elseif (isset($parameter['data-type'])) { - if (in_array($parameter['data-type'], ['bool', 'boolean'])) { + if (\in_array($parameter['data-type'], ['bool', 'boolean'])) { $paramStr .= 'bool '; } elseif ('double' == $parameter['data-type']) { $paramStr .= 'float '; - } elseif (in_array($parameter['data-type'], ['int', 'uint', 'long', 'ulong', 'uchar'])) { + } elseif (\in_array($parameter['data-type'], ['int', 'uint', 'long', 'ulong', 'uchar'])) { $paramStr .= 'int '; - } elseif (in_array($parameter['data-type'], ['char', 'string'])) { + } elseif (\in_array($parameter['data-type'], ['char', 'string'])) { $paramStr .= 'string '; } } @@ -310,7 +309,7 @@ protected function buildMethod(Method $method, bool $isInterface, string $indent if ($method->hasReturnTypes()) { $supported = 0; - if (array_key_exists('object', $method->getReturnTypes())) { + if (\array_key_exists('object', $method->getReturnTypes())) { $return = key($method->getReturnClassTypes()); ++$supported; } @@ -335,7 +334,7 @@ protected function buildMethod(Method $method, bool $isInterface, string $indent ++$supported; } - if (array_key_exists('array', $method->getReturnTypes())) { + if (\array_key_exists('array', $method->getReturnTypes())) { $return = 'array'; ++$supported; } @@ -345,7 +344,7 @@ protected function buildMethod(Method $method, bool $isInterface, string $indent } // PHP doesn't support multiple return types (yet?) - if ($supported > 1 || array_key_exists('variable', $method->getReturnTypes())) { + if ($supported > 1 || \array_key_exists('variable', $method->getReturnTypes())) { $return = ''; } } elseif ($method->isVoid()) { @@ -376,9 +375,9 @@ protected function buildMethod(Method $method, bool $isInterface, string $indent * * @param array $parameter * - * @throws Exception\NotImplementedException - * * @return string + * + * @throws Exception\NotImplementedException */ protected function wrapPHPValue(array $parameter): string { diff --git a/Library/Stubs/MethodDocBlock.php b/Library/Stubs/MethodDocBlock.php index 3f29b84e9b..31722746cd 100644 --- a/Library/Stubs/MethodDocBlock.php +++ b/Library/Stubs/MethodDocBlock.php @@ -64,10 +64,10 @@ class MethodDocBlock extends DocBlock private Types $types; public function __construct( - Method $method, + Method $method, AliasManager $aliasManager, - string $indent = ' ', - ?Types $types = null + string $indent = ' ', + Types $types = null ) { parent::__construct($method->getDocBlock(), $indent); diff --git a/Library/SymbolTable.php b/Library/SymbolTable.php index 818d6f9b26..553a53a0af 100644 --- a/Library/SymbolTable.php +++ b/Library/SymbolTable.php @@ -17,7 +17,6 @@ use Zephir\Passes\LocalContextPass; use Zephir\Variable\Globals; use Zephir\Variable\Variable; -use function count; /** * A symbol table stores all the variables defined in a method, their data types and default values. @@ -94,7 +93,7 @@ public function setLocalContext(LocalContextPass $localContext): void /** * Check if a variable is declared in the current symbol table. * - * @param string $name + * @param string $name * @param CompilationContext|null $compilationContext * * @return bool @@ -174,7 +173,7 @@ public function addRawVariable(Variable $variable): Variable /** * Returns a variable in the symbol table. * - * @param $name + * @param $name * @param CompilationContext|null $compilationContext * * @return bool|Variable @@ -184,7 +183,7 @@ public function getVariable($name, CompilationContext $compilationContext = null /* Check if the variable already is referencing a branch */ $pos = strpos($name, Variable::BRANCH_MAGIC); if ($pos > -1) { - $branchId = (int) (substr($name, $pos + \strlen(Variable::BRANCH_MAGIC))); + $branchId = (int) substr($name, $pos + \strlen(Variable::BRANCH_MAGIC)); $name = substr($name, 0, $pos); } else { $compilationContext = $compilationContext ?: $this->compilationContext; @@ -225,9 +224,9 @@ public function getVariables() * @param CompilationContext $compilationContext * @param array $statement * - * @throws CompilerException - * * @return Variable + * + * @throws CompilerException */ public function getVariableForRead($name, CompilationContext $compilationContext = null, array $statement = null) { @@ -298,7 +297,7 @@ public function getVariableForRead($name, CompilationContext $compilationContext /** @var Branch[] $branches */ $branches = array_reverse($initBranches); - if (1 == count($branches)) { + if (1 == \count($branches)) { if (Branch::TYPE_CONDITIONAL_TRUE == $branches[0]->getType()) { if (true === $branches[0]->isUnreachable()) { throw new CompilerException('Initialization of variable "'.$name.'" depends on unreachable branch, consider initialize it at its declaration', $statement); @@ -348,7 +347,7 @@ public function getVariableForRead($name, CompilationContext $compilationContext * Variable was initialized in a sub-branch, and it's being used in a parent branch. */ $possibleBadAssignment = $currentBranch->getLevel() < $branches[0]->getLevel(); - if ($possibleBadAssignment && count($branches) === 1) { + if ($possibleBadAssignment && \count($branches) === 1) { /** * Variable is assigned just once, and it's assigned in a conditional branch */ @@ -402,8 +401,8 @@ public function getVariableForRead($name, CompilationContext $compilationContext * @param array $statement * * @return bool|\Zephir\Variable\Variable - *@throws CompilerException * + * @throws CompilerException */ public function getVariableForWrite($name, CompilationContext $compilationContext, array $statement = null) { @@ -454,9 +453,9 @@ public function getVariableForWrite($name, CompilationContext $compilationContex * Return a variable in the symbol table, it will be used for a mutating operation * This method implies mutation of one of the members of the variable but no the variables itself. * - * @param string $name + * @param string $name * @param CompilationContext $compilationContext - * @param array|null $statement + * @param array|null $statement * * @return Variable */ @@ -549,7 +548,7 @@ public function getTempVariable(string $type, CompilationContext $compilationCon /** * Creates a temporary variable to be used in a write operation. * - * @param string $type + * @param string $type * @param CompilationContext $context * @param mixed $init * @@ -587,7 +586,7 @@ public function getTempVariableForWrite(string $type, CompilationContext $contex * Creates a temporary variable to be used to point to a heap variable * These kind of variables MUST not be tracked by the Zephir memory manager. * - * @param $type + * @param $type * @param CompilationContext $context * @param bool $initNonReferenced * @@ -839,7 +838,7 @@ public function markTemporalVariablesIdle(CompilationContext $compilationContext $pos = strpos($variable->getName(), Variable::BRANCH_MAGIC); $otherBranchId = 1; if ($pos > -1) { - $otherBranchId = (int) (substr($variable->getName(), $pos + \strlen(Variable::BRANCH_MAGIC))); + $otherBranchId = (int) substr($variable->getName(), $pos + \strlen(Variable::BRANCH_MAGIC)); } if ($branchId == $otherBranchId) { $variable->setIdle(true); @@ -919,9 +918,10 @@ protected function registerTempVariable($type, $location, Variable $variable, Co /** * Reuse variables marked as idle after leave a branch. * - * @param string $type - * @param string $location + * @param string $type + * @param string $location * @param CompilationContext|null $compilationContext + * * @return Variable|null */ protected function reuseTempVariable(string $type, string $location, CompilationContext $compilationContext = null): ?Variable diff --git a/Library/Types/AbstractType.php b/Library/Types/AbstractType.php index 7c52906e15..76e6e63b49 100644 --- a/Library/Types/AbstractType.php +++ b/Library/Types/AbstractType.php @@ -13,7 +13,6 @@ namespace Zephir\Types; -use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -32,16 +31,16 @@ abstract class AbstractType /** * Intercepts calls to built-in methods. * - * @param string $methodName - * @param object $caller + * @param string $methodName + * @param object $caller * @param CompilationContext $compilationContext - * @param Call $call - * @param array $expression + * @param Call $call + * @param array $expression * * @return bool|CompiledExpression * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function invokeMethod( $methodName, diff --git a/Library/Types/ArrayType.php b/Library/Types/ArrayType.php index 7ecbb04593..5d3b00d1b2 100644 --- a/Library/Types/ArrayType.php +++ b/Library/Types/ArrayType.php @@ -11,7 +11,6 @@ namespace Zephir\Types; -use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -78,13 +77,14 @@ public function getTypeName(): string /** * Transforms calls to method "join" to function calls to "join". * - * @param object $caller + * @param object $caller * @param CompilationContext $compilationContext - * @param Call $call - * @param array $expression + * @param Call $call + * @param array $expression * * @return bool|CompiledExpression - * @throws ReflectionException + * + * @throws \ReflectionException * @throws Exception */ public function join($caller, CompilationContext $compilationContext, Call $call, array $expression) diff --git a/Library/Types/CharType.php b/Library/Types/CharType.php index 607a3bceb5..2233f73f6f 100644 --- a/Library/Types/CharType.php +++ b/Library/Types/CharType.php @@ -13,7 +13,6 @@ namespace Zephir\Types; -use ReflectionException; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; @@ -31,13 +30,14 @@ public function getTypeName(): string /** * Transforms calls to method "toHex" to sprintf('%X') call. * - * @param object $caller + * @param object $caller * @param CompilationContext $compilationContext - * @param Call $call - * @param array $expression + * @param Call $call + * @param array $expression * * @return bool|mixed|CompiledExpression - * @throws ReflectionException + * + * @throws \ReflectionException * @throws Exception */ public function toHex($caller, CompilationContext $compilationContext, Call $call, array $expression) diff --git a/Library/Types/Types.php b/Library/Types/Types.php index ecfcdbc7b3..4f7a95eb46 100644 --- a/Library/Types/Types.php +++ b/Library/Types/Types.php @@ -14,9 +14,6 @@ namespace Zephir\Types; use Zephir\Class\Method\Method; -use function array_key_exists; -use function count; -use function in_array; final class Types { @@ -55,9 +52,9 @@ public function getReturnTypeAnnotation(Method $method, array $returnTypes = nul $isProcessedReturnType = null !== $returnTypes; $returnTypes = $returnTypes ?? $method->getReturnTypes(); - $typesCount = count($returnTypes); + $typesCount = \count($returnTypes); - $isDynamic = in_array('var', array_keys($returnTypes)); + $isDynamic = \in_array('var', array_keys($returnTypes)); $isNullable = $this->isNullable($returnTypes); $isBool = $this->areReturnTypesBoolCompatible($returnTypes); @@ -275,9 +272,9 @@ private function isNumeric(array $types): bool */ private function isNullable(array $types): bool { - return (array_key_exists(self::T_NULL, $types) - || in_array(self::T_NULL, $types)) - && 1 !== count($types); + return (\array_key_exists(self::T_NULL, $types) + || \in_array(self::T_NULL, $types)) + && 1 !== \count($types); } /** @@ -305,7 +302,7 @@ private function areReturnTypesCompatible(array $types, array $allowedTypes, boo } foreach ($types as $type => $data) { - $areEquals = in_array($type, $allowedTypes); + $areEquals = \in_array($type, $allowedTypes); $result = isset($result) ? ($areEquals && $result) diff --git a/Library/Variable/Variable.php b/Library/Variable/Variable.php index fef290049e..8924fe6b71 100644 --- a/Library/Variable/Variable.php +++ b/Library/Variable/Variable.php @@ -13,7 +13,6 @@ namespace Zephir\Variable; -use ReflectionClass; use Zephir\Branch; use Zephir\BranchManager; use Zephir\Class\Definition\Definition; @@ -21,8 +20,6 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\TypeAwareInterface; -use function in_array; -use function is_string; /** * This represents a variable in a symbol table @@ -102,7 +99,7 @@ class Variable implements TypeAwareInterface protected array $classTypes = []; - protected Definition|ReflectionClass|null $associatedClass = null; + protected Definition | \ReflectionClass | null $associatedClass = null; /** * Initialization skips. @@ -142,7 +139,7 @@ class Variable implements TypeAwareInterface public function __construct(protected string $type, protected string $name, protected ?Branch $branch = null) { $this->globalsManager = new Globals(); - $this->type = in_array($type, ['callable', 'object', 'resource'], true) ? 'variable' : $type; + $this->type = \in_array($type, ['callable', 'object', 'resource'], true) ? 'variable' : $type; } /** @@ -428,10 +425,10 @@ public function getOriginal(): array * * @param array|string $classTypes */ - public function setClassTypes(array|string $classTypes): void + public function setClassTypes(array | string $classTypes): void { - if (is_string($classTypes)) { - if (!in_array($classTypes, $this->classTypes)) { + if (\is_string($classTypes)) { + if (!\in_array($classTypes, $this->classTypes)) { $this->classTypes[] = $classTypes; } @@ -439,7 +436,7 @@ public function setClassTypes(array|string $classTypes): void } foreach ($classTypes as $classType) { - if (!in_array($classType, $this->classTypes)) { + if (!\in_array($classType, $this->classTypes)) { $this->classTypes[] = $classType; } } @@ -458,9 +455,9 @@ public function getClassTypes(): array /** * Sets the PHP class related to variable. * - * @param ReflectionClass|Definition $associatedClass + * @param \ReflectionClass|Definition $associatedClass */ - public function setAssociatedClass(ReflectionClass|Definition $associatedClass): void + public function setAssociatedClass(\ReflectionClass | Definition $associatedClass): void { $this->associatedClass = $associatedClass; } @@ -468,7 +465,7 @@ public function setAssociatedClass(ReflectionClass|Definition $associatedClass): /** * Returns the class related to the variable. */ - public function getAssociatedClass(): Definition|ReflectionClass|null + public function getAssociatedClass(): Definition | \ReflectionClass | null { return $this->associatedClass; } @@ -478,11 +475,11 @@ public function getAssociatedClass(): Definition|ReflectionClass|null * * @param array|string $types */ - public function setDynamicTypes(array|string $types): void + public function setDynamicTypes(array | string $types): void { unset($this->dynamicTypes['unknown']); - if (is_string($types)) { + if (\is_string($types)) { $types = [$types]; } @@ -510,9 +507,9 @@ public function getDynamicTypes(): array * * @return bool */ - public function hasAnyDynamicType(array|string $types): bool + public function hasAnyDynamicType(array | string $types): bool { - if (is_string($types)) { + if (\is_string($types)) { $types = [$types]; } @@ -712,7 +709,7 @@ public function getDefaultInitValue(): mixed */ public function separate(CompilationContext $compilationContext): void { - if (!in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { + if (!\in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { $compilationContext->codePrinter->output('ZEPHIR_SEPARATE('.$compilationContext->backend->getVariableCode($this).');'); } } @@ -955,7 +952,7 @@ public function observeOrNullifyVariant(CompilationContext $compilationContext): return; } - if (in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { + if (\in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { return; } diff --git a/Library/functions.php b/Library/functions.php index dbb29bf847..39755a2443 100644 --- a/Library/functions.php +++ b/Library/functions.php @@ -12,10 +12,6 @@ namespace Zephir; use Zephir\Exception\InvalidArgumentException; -use const INFO_GENERAL; -use const PHP_INT_SIZE; -use const PHP_OS; -use const PHP_ZTS; /** * Camelize a string. @@ -179,7 +175,7 @@ function file_put_contents_ex($content, $path) */ function is_windows() { - return 0 === stripos(PHP_OS, 'WIN'); + return 0 === stripos(\PHP_OS, 'WIN'); } /** @@ -189,12 +185,12 @@ function is_windows() */ function is_zts() { - if (\defined('PHP_ZTS') && PHP_ZTS === 1) { + if (\defined('PHP_ZTS') && \PHP_ZTS === 1) { return true; } ob_start(); - phpinfo(INFO_GENERAL); + phpinfo(\INFO_GENERAL); return (bool) preg_match('/Thread\s*Safety\s*enabled/i', strip_tags(ob_get_clean())); } @@ -207,12 +203,12 @@ function is_zts() function windows_release_dir() { if (is_zts()) { - if (PHP_INT_SIZE === 4) { + if (\PHP_INT_SIZE === 4) { // 32-bit version of PHP return 'ext\\Release_TS'; } - if (PHP_INT_SIZE === 8) { + if (\PHP_INT_SIZE === 8) { // 64-bit version of PHP return 'ext\\x64\\Release_TS'; } @@ -221,12 +217,12 @@ function windows_release_dir() return 'ext\\Release_TS'; } - if (PHP_INT_SIZE === 4) { + if (\PHP_INT_SIZE === 4) { // 32-bit version of PHP return 'ext\\Release'; } - if (PHP_INT_SIZE === 8) { + if (\PHP_INT_SIZE === 8) { // 64-bit version of PHP return 'ext\\x64\\Release'; } diff --git a/prototypes/apc.php b/prototypes/apc.php index d488269dcc..b378522b47 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -120,8 +120,8 @@ function apc_sma_info($limited = false) /** * @see https://www.php.net/manual/en/function.apc-store.php * - * @param $key - * @param $var + * @param $key + * @param $var * @param int $ttl */ function apc_store($key, $var, $ttl = 0) @@ -131,7 +131,7 @@ function apc_store($key, $var, $ttl = 0) /** * @see https://www.php.net/manual/en/function.apc-fetch.php * - * @param $key + * @param $key * @param null $success * * @return mixed @@ -152,7 +152,7 @@ function apc_delete($key) /** * @see https://www.php.net/manual/en/function.apc-define-constants.php * - * @param $key + * @param $key * @param array $constants * @param bool $case_sensitive */ @@ -163,8 +163,8 @@ function apc_define_constants($key, array $constants, $case_sensitive = true) /** * @see https://www.php.net/manual/en/function.apc-add.php * - * @param $key - * @param $var + * @param $key + * @param $var * @param int $ttl */ function apc_add($key, $var, $ttl = 0) @@ -174,7 +174,7 @@ function apc_add($key, $var, $ttl = 0) /** * @see https://www.php.net/manual/en/function.apc-compile-file.php * - * @param $filename + * @param $filename * @param bool $atomic */ function apc_compile_file($filename, $atomic = true) @@ -184,7 +184,7 @@ function apc_compile_file($filename, $atomic = true) /** * @see https://www.php.net/manual/en/function.apc-load-constants.php * - * @param $key + * @param $key * @param bool $case_sensitive */ function apc_load_constants($key, $case_sensitive = true) @@ -212,7 +212,7 @@ function apc_delete_file($keys) /** * @see https://www.php.net/manual/en/function.apc-inc.php * - * @param $key + * @param $key * @param int $step * @param null $success */ @@ -223,7 +223,7 @@ function apc_inc($key, $step = 1, &$success = null) /** * @see https://www.php.net/manual/en/function.apc-dec.php * - * @param $key + * @param $key * @param int $step * @param null $success */ @@ -255,9 +255,9 @@ function apc_bin_dump($files = null, $user_vars = null) /** * @see https://php.net/manual/en/function.apc-bin-dumpfile.php * - * @param $files - * @param $user_vars - * @param $filename + * @param $files + * @param $user_vars + * @param $filename * @param int $flags * @param null $context */ @@ -268,7 +268,7 @@ function apc_bin_dumpfile($files, $user_vars, $filename, $flags = 0, $context = /** * @see https://php.net/manual/en/function.apc-bin-load.php * - * @param $data + * @param $data * @param int $flags */ function apc_bin_load($data, $flags = 0) @@ -278,7 +278,7 @@ function apc_bin_load($data, $flags = 0) /** * @see https://php.net/manual/en/function.apc-bin-loadfile.php * - * @param $filename + * @param $filename * @param null $context * @param int $flags */ diff --git a/prototypes/gd.php b/prototypes/gd.php index 058bfbdf39..0492995137 100644 --- a/prototypes/gd.php +++ b/prototypes/gd.php @@ -60,7 +60,7 @@ function getimagesizefromstring($imagedata, array &$imageinfo) * * @see https://www.php.net/manual/en/function.image-type-to-extension.php * - * @param $imagetype + * @param $imagetype * @param bool $include_dot * * @return string diff --git a/tests/Extension/ArrayAccessTest.php b/tests/Extension/ArrayAccessTest.php index 97ea15ba81..737bc8d083 100644 --- a/tests/Extension/ArrayAccessTest.php +++ b/tests/Extension/ArrayAccessTest.php @@ -21,9 +21,9 @@ final class ArrayAccessTest extends TestCase 'key_a' => 'marcin', 'key_b' => 'paula', 3 => 'long value', - //3.14 => 'double value', // Not supported yet - //false => 'bool value', // Not supported yet - //null => 'null value', // Not supported yet + // 3.14 => 'double value', // Not supported yet + // false => 'bool value', // Not supported yet + // null => 'null value', // Not supported yet ]; public function testTest(): void diff --git a/tests/Extension/ExitDieTest.php b/tests/Extension/ExitDieTest.php index fb5896289f..91fe030cce 100644 --- a/tests/Extension/ExitDieTest.php +++ b/tests/Extension/ExitDieTest.php @@ -15,9 +15,6 @@ use PHPUnit\Framework\TestCase; -use function constant; -use function defined; - final class ExitDieTest extends TestCase { private string $phpBinary; @@ -27,9 +24,9 @@ final class ExitDieTest extends TestCase */ protected function setUp(): void { - $this->phpBinary = constant('PHP_BINARY'); + $this->phpBinary = \constant('PHP_BINARY'); /* If we use phpdbg, you need to add options -qrr */ - if (defined('PHP_SAPI') && 'phpdbg' == constant('PHP_SAPI')) { + if (\defined('PHP_SAPI') && 'phpdbg' == \constant('PHP_SAPI')) { $this->phpBinary .= ' -qrr'; } diff --git a/tests/Extension/FunctionExistsTest.php b/tests/Extension/FunctionExistsTest.php index 48c45b6df1..b5d633265b 100644 --- a/tests/Extension/FunctionExistsTest.php +++ b/tests/Extension/FunctionExistsTest.php @@ -27,6 +27,7 @@ protected function setUp(): void /** * @dataProvider providerInternalFunctions + * * @issue https://github.com/zephir-lang/zephir/issues/1547 * * @param string $func The internal (built-in) function name diff --git a/tests/Extension/Globals/EnvTest.php b/tests/Extension/Globals/EnvTest.php index e2f5b2582d..806341e3e2 100644 --- a/tests/Extension/Globals/EnvTest.php +++ b/tests/Extension/Globals/EnvTest.php @@ -22,7 +22,7 @@ protected function setUp(): void { parent::setUp(); - if (false === strpos(ini_get('variables_order'), 'E')) { + if (!str_contains(ini_get('variables_order'), 'E')) { $this->markTestSkipped( "variables_order ini directive does not contain 'E'. ". "Make sure you have set variables_order to 'EGPCS' in php.ini." diff --git a/tests/Extension/Integral/RegexDNATest.php b/tests/Extension/Integral/RegexDNATest.php index d95548fb3b..d2f09717a0 100644 --- a/tests/Extension/Integral/RegexDNATest.php +++ b/tests/Extension/Integral/RegexDNATest.php @@ -16,7 +16,6 @@ use PHPUnit\Framework\TestCase; use Stub\RegexDNA; -use function dirname; use function Zephir\is_windows; final class RegexDNATest extends TestCase @@ -30,12 +29,12 @@ public function testProcess(): void $test = new RegexDNA(); ob_start(); - $test->process(dirname(__DIR__).'/../fixtures/regexdna/input.txt'); + $test->process(\dirname(__DIR__).'/../fixtures/regexdna/input.txt'); $content = ob_get_clean(); $this->assertSame( $content, - file_get_contents(dirname(__DIR__).'/../fixtures/regexdna/output.txt') + file_get_contents(\dirname(__DIR__).'/../fixtures/regexdna/output.txt') ); } } diff --git a/tests/Extension/Issue1134Test.php b/tests/Extension/Issue1134Test.php index bad9995745..48e9be1c0f 100644 --- a/tests/Extension/Issue1134Test.php +++ b/tests/Extension/Issue1134Test.php @@ -14,8 +14,6 @@ namespace Extension; use PHPUnit\Framework\TestCase; -use ReflectionClass; -use ReflectionException; use Stub\Issue1134; /** @@ -24,11 +22,11 @@ final class Issue1134Test extends TestCase { /** - * @throws ReflectionException + * @throws \ReflectionException */ public function testIssue914ReflectionParamDefaultValueShouldReturnTrue(): void { - $ref = new ReflectionClass(Issue1134::class); + $ref = new \ReflectionClass(Issue1134::class); $constructor = $ref->getConstructor(); $params = $constructor->getParameters(); diff --git a/tests/Extension/MCallTest.php b/tests/Extension/MCallTest.php index f6e48fa431..d209487b01 100644 --- a/tests/Extension/MCallTest.php +++ b/tests/Extension/MCallTest.php @@ -14,8 +14,6 @@ namespace Extension; use PHPUnit\Framework\TestCase; -use ReflectionClass; -use ReflectionParameter; use Stub\Mcall; use Stub\Oo\Param; @@ -132,7 +130,7 @@ public function testObjectParamCastStdClass(): void $this->assertNumberOfParameters(1); $this->assertNumberOfRequiredParameters(1); - $this->assertSame(\StdClass::class, $this->getMethodFirstParameter()->getType()->getName()); + $this->assertSame(\stdClass::class, $this->getMethodFirstParameter()->getType()->getName()); $this->assertInstanceOf(\stdClass::class, $this->test->testObjectParamCastStdClass(new \stdClass())); } @@ -145,7 +143,7 @@ public function testObjectParamCastOoParam(): void $this->assertInstanceOf(Param::class, $this->test->testObjectParamCastOoParam(new Param())); } - protected function getMethodFirstParameter(): ReflectionParameter + protected function getMethodFirstParameter(): \ReflectionParameter { $methodInfo = $this->reflection->getMethod($this->getName()); $parameters = $methodInfo->getParameters(); @@ -154,12 +152,12 @@ protected function getMethodFirstParameter(): ReflectionParameter } /** - * @return mixed|ReflectionClass + * @return mixed|\ReflectionClass */ private function getReflection() { if (null === $this->reflection) { - return $this->reflection = new ReflectionClass(Mcall::class); + return $this->reflection = new \ReflectionClass(Mcall::class); } return $this->reflection; diff --git a/tests/Extension/NewInstanceOperatorTest.php b/tests/Extension/NewInstanceOperatorTest.php index 818d44849f..f35793aa3d 100644 --- a/tests/Extension/NewInstanceOperatorTest.php +++ b/tests/Extension/NewInstanceOperatorTest.php @@ -38,8 +38,7 @@ protected function tearDown(): void public function autoload(string $className): void { - if (version_compare(PHP_VERSION, '8.1.0', '>=') && - version_compare(PHP_VERSION, '8.3.0', '<')) { + if (version_compare(PHP_VERSION, '8.1.0', '>=')) { try { if (isset($this->autoloadMap[$className])) { include $this->autoloadMap[$className]; diff --git a/tests/Extension/Oo/ExtendClassTest.php b/tests/Extension/Oo/ExtendClassTest.php index 1586003099..a868477908 100644 --- a/tests/Extension/Oo/ExtendClassTest.php +++ b/tests/Extension/Oo/ExtendClassTest.php @@ -13,7 +13,6 @@ namespace Extension\Oo; -use PDO; use PHPUnit\Framework\TestCase; use Stub\Integration\Psr\Http\Message\MessageInterfaceEx; use Stub\Oo\ConcreteStatic; @@ -27,13 +26,13 @@ public function testPDOExtending(): void $this->markTestSkipped('The PDO extension is not loaded'); } - $this->assertSame(PDO::getAvailableDrivers(), ExtendPdoClass::getAvailableDrivers()); - $this->assertSame(PDO::PARAM_STR, ExtendPdoClass::PARAM_STR); + $this->assertSame(\PDO::getAvailableDrivers(), ExtendPdoClass::getAvailableDrivers()); + $this->assertSame(\PDO::PARAM_STR, ExtendPdoClass::PARAM_STR); } public function testPDOStatementExtending(): void { - $pdo = new ExtendPdoClass('sqlite::memory:', '', '', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); + $pdo = new ExtendPdoClass('sqlite::memory:', '', '', [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]); $stmt = $pdo->prepare('SELECT CURRENT_TIME'); $this->assertInstanceof('Stub\\PdoStatement', $stmt); diff --git a/tests/Extension/Oo/Scopes/PrivateScopeTest.php b/tests/Extension/Oo/Scopes/PrivateScopeTest.php index 4c593fb5ad..b240cbb9f5 100644 --- a/tests/Extension/Oo/Scopes/PrivateScopeTest.php +++ b/tests/Extension/Oo/Scopes/PrivateScopeTest.php @@ -13,16 +13,9 @@ namespace Extension\Oo\Scopes; -use Error; use PHPUnit\Framework\Error\Notice; use PHPUnit\Framework\TestCase; use Stub\Oo\Scopes\PrivateScopeTester; -use TestScopeExtending; -use TestScopeExtendingMagic; -use TestScopePhp; -use TestScopePhpMagic; -use TestScopePhpMagicExtending; -use UserExample; final class PrivateScopeTest extends TestCase { @@ -36,13 +29,13 @@ public function testShouldCallPrivateMethod(): void */ public function testShouldNotSetPrivatePropertyObjPhp(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopePhp::$privateProperty' ); $tester = new PrivateScopeTester(); - $tester->setPropertyObj(new TestScopePhp(), 'privateProperty', 'test'); + $tester->setPropertyObj(new \TestScopePhp(), 'privateProperty', 'test'); } /** @@ -50,13 +43,13 @@ public function testShouldNotSetPrivatePropertyObjPhp(): void */ public function testShouldNotSetPrivatePropertyNewPhp(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopePhp::$privateProperty' ); $tester = new PrivateScopeTester(); - $tester->setPropertyNew(TestScopePhp::class, 'privateProperty', 'test'); + $tester->setPropertyNew(\TestScopePhp::class, 'privateProperty', 'test'); } /** @@ -64,13 +57,13 @@ public function testShouldNotSetPrivatePropertyNewPhp(): void */ public function testShouldNotSetPrivatePropertyObjInternal(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopeExtending::$privateProperty' ); $tester = new PrivateScopeTester(); - $tester->setPropertyObj(new TestScopeExtending(), 'privateProperty', 'test'); + $tester->setPropertyObj(new \TestScopeExtending(), 'privateProperty', 'test'); } /** @@ -78,13 +71,13 @@ public function testShouldNotSetPrivatePropertyObjInternal(): void */ public function testShouldNotSetPrivatePropertyNewInternal(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopeExtending::$privateProperty' ); $tester = new PrivateScopeTester(); - $tester->setPropertyNew(TestScopeExtending::class, 'privateProperty', 'test'); + $tester->setPropertyNew(\TestScopeExtending::class, 'privateProperty', 'test'); } /** @@ -92,7 +85,7 @@ public function testShouldNotSetPrivatePropertyNewInternal(): void */ public function testShouldSetPrivatePropertyObjPhp(): void { - $object = new TestScopePhpMagic(); + $object = new \TestScopePhpMagic(); $tester = new PrivateScopeTester(); $actual = $tester->setPropertyObj($object, 'privateProperty', 'test'); @@ -106,7 +99,7 @@ public function testShouldSetPrivatePropertyObjPhp(): void public function testShouldSetPrivatePropertyNewPhp(): void { $tester = new PrivateScopeTester(); - $obj = $tester->setPropertyNew(TestScopePhpMagic::class, 'privateProperty', 'test'); + $obj = $tester->setPropertyNew(\TestScopePhpMagic::class, 'privateProperty', 'test'); $this->assertEquals('test', $obj->privateProperty); $this->assertEquals(1, $obj->setCount); @@ -118,7 +111,7 @@ public function testShouldSetPrivatePropertyNewPhp(): void public function testShouldSetPrivatePropertyObjInternal(): void { $tester = new PrivateScopeTester(); - $object = new TestScopeExtendingMagic(); + $object = new \TestScopeExtendingMagic(); $actual = $tester->setPropertyObj($object, 'privateProperty', 'test'); $this->assertEquals('test', $actual); @@ -131,7 +124,7 @@ public function testShouldSetPrivatePropertyObjInternal(): void public function testShouldSetPrivatePropertyNewInternal(): void { $tester = new PrivateScopeTester(); - $obj = $tester->setPropertyNew(TestScopeExtendingMagic::class, 'privateProperty', 'test'); + $obj = $tester->setPropertyNew(\TestScopeExtendingMagic::class, 'privateProperty', 'test'); $this->assertEquals('test', $obj->privateProperty); $this->assertEquals(1, $obj->setCount); @@ -142,12 +135,12 @@ public function testShouldSetPrivatePropertyNewInternal(): void */ public function testShouldNotSetPrivatePropertyViaThis(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopeExtending::$privateProperty' ); - $obj = new TestScopeExtending(); + $obj = new \TestScopeExtending(); $obj->setProperty('privateProperty', 'test'); } @@ -156,7 +149,7 @@ public function testShouldNotSetPrivatePropertyViaThis(): void */ public function testShouldSetPrivatePropertyViaThis(): void { - $obj = new TestScopeExtending(); + $obj = new \TestScopeExtending(); $obj->setProperty('privateProperty2', 'test'); $this->assertEquals('test', $obj->getPrivateProperty2()); @@ -167,12 +160,12 @@ public function testShouldSetPrivatePropertyViaThis(): void */ public function testShouldNotSetPrivatePropertyExtendedMagicObjInternal(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopeExtendingMagic::$privateProperty2' ); - $object = new TestScopeExtendingMagic(); + $object = new \TestScopeExtendingMagic(); $tester = new PrivateScopeTester(); $this->assertEquals('private', $object->getPrivateProperty2()); @@ -184,14 +177,14 @@ public function testShouldNotSetPrivatePropertyExtendedMagicObjInternal(): void */ public function testShouldNotSetPrivatePropertyExtendedMagicNewInternal(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopeExtendingMagic::$privateProperty2' ); $tester = new PrivateScopeTester(); $tester->setPropertyNew( - TestScopeExtendingMagic::class, + \TestScopeExtendingMagic::class, 'privateProperty2', 'CHANGED' ); @@ -208,13 +201,13 @@ public function testShouldNotSetPrivatePropertyExtendedMagicObjPhp(): void 'Undefined property: TestScopePhpMagicExtending::$privateProperty2' ); } else { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopePhpMagicExtending::$privateProperty2' ); } - $obj = new TestScopePhpMagicExtending(); + $obj = new \TestScopePhpMagicExtending(); $tester = new PrivateScopeTester(); $tester->setPropertyObj($obj, 'privateProperty2', 'test'); @@ -225,14 +218,14 @@ public function testShouldNotSetPrivatePropertyExtendedMagicObjPhp(): void */ public function testShouldNotSetPrivatePropertyExtendedMagicNewPhp(): void { - $this->expectException(Error::class); + $this->expectException(\Error::class); $this->expectExceptionMessage( 'Cannot access private property TestScopePhpMagicExtending::$privateProperty2' ); $tester = new PrivateScopeTester(); $tester->setPropertyNew( - TestScopePhpMagicExtending::class, + \TestScopePhpMagicExtending::class, 'privateProperty2', 'CHANGED' ); @@ -244,7 +237,7 @@ public function testShouldNotSetPrivatePropertyExtendedMagicNewPhp(): void public function testShouldNotGetObjectVarsPrivatePropertyObjPhp(): void { $tester = new PrivateScopeTester(); - $object = new TestScopePhp(); + $object = new \TestScopePhp(); $objectVars = $tester->getObjVars($object); $this->assertArrayNotHasKey('privateProperty', $objectVars); @@ -256,7 +249,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyObjPhp(): void public function testShouldNotGetObjectVarsPrivatePropertyNewPhp(): void { $tester = new PrivateScopeTester(); - $objectVars = $tester->getNewVars(TestScopePhp::class); + $objectVars = $tester->getNewVars(\TestScopePhp::class); $this->assertArrayNotHasKey('privateProperty', $objectVars); } @@ -267,7 +260,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyNewPhp(): void public function testShouldNotGetObjectVarsPrivatePropertyObjInternal(): void { $tester = new PrivateScopeTester(); - $object = new TestScopeExtending(); + $object = new \TestScopeExtending(); $objectVars = $tester->getObjVars($object); $this->assertArrayNotHasKey('privateProperty', $objectVars); @@ -279,7 +272,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyObjInternal(): void public function testShouldNotGetObjectVarsPrivatePropertyNewInternal(): void { $tester = new PrivateScopeTester(); - $objectVars = $tester->getNewVars(TestScopeExtending::class); + $objectVars = $tester->getNewVars(\TestScopeExtending::class); $this->assertArrayNotHasKey('privateProperty', $objectVars); } @@ -289,7 +282,7 @@ public function testShouldNotGetObjectVarsPrivatePropertyNewInternal(): void */ public function testShouldGetAndSetPrivatePropertyUsingParentGetterAndSetter(): void { - $tester = new UserExample(); + $tester = new \UserExample(); $tester->setPrivateVariable('test'); $this->assertEquals('test', $tester->getPrivateVariable()); diff --git a/tests/Extension/Optimizers/IsPhpVersionTest.php b/tests/Extension/Optimizers/IsPhpVersionTest.php index 2cb88d0090..4313ea71b0 100644 --- a/tests/Extension/Optimizers/IsPhpVersionTest.php +++ b/tests/Extension/Optimizers/IsPhpVersionTest.php @@ -11,10 +11,8 @@ namespace Extension\Optimizers; -use Exception; use PHPUnit\Framework\TestCase; use Stub\Issue1404; -use Throwable; /** * Extension\Optimizers\IsPhpVersionTest. @@ -61,7 +59,7 @@ public function phpVersionProvider(): array * @param mixed $version * @param mixed $expected * - * @throws Exception + * @throws \Exception */ public function testOptimizer($version, $expected): void { @@ -72,7 +70,7 @@ public function testOptimizer($version, $expected): void public function testOptimizerExceptionLLU(): void { - $this->expectException(Exception::class); + $this->expectException(\Exception::class); $this->expectExceptionMessage('Could not parse PHP version'); $this->isPhpVersion(92233720368547758079); @@ -80,7 +78,7 @@ public function testOptimizerExceptionLLU(): void public function testOptimizerExceptionNegativeNumber(): void { - $this->expectException(Exception::class); + $this->expectException(\Exception::class); $this->expectExceptionMessage('Could not parse PHP version'); $this->isPhpVersion(-7); @@ -88,7 +86,7 @@ public function testOptimizerExceptionNegativeNumber(): void public function testOptimizerExceptionEmpty(): void { - $this->expectException(Exception::class); + $this->expectException(\Exception::class); $this->expectExceptionMessage('Could not parse PHP version'); /** @@ -151,7 +149,7 @@ public function releaseVersionProvider(): array * @param mixed $testName * @param mixed $version * - * @throws Exception + * @throws \Exception */ public function testIsPhpVersionVersionUsing701XX($testName, $version): void { @@ -178,7 +176,7 @@ public function minorVersionProvider(): array * @param mixed $testName * @param mixed $version * - * @throws Exception + * @throws \Exception */ public function testIsPhpVersionVersionUsing70X00($testName, $version): void { @@ -213,11 +211,11 @@ public function testZephirUsingString50600(): void } /** - * @param Throwable $error + * @param \Throwable $error * - * @throws Throwable + * @throws \Throwable */ - protected function onNotSuccessfulTest(Throwable $error): void + protected function onNotSuccessfulTest(\Throwable $error): void { $phpVer = sprintf( 'PHP_VERSION_ID:%d(%d.%d.%d)', @@ -241,13 +239,13 @@ protected function onNotSuccessfulTest(Throwable $error): void * * @return bool * - * @throws Exception + * @throws \Exception */ private function isPhpVersion($version): bool { preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', $version, $matches); if (!\count($matches)) { - throw new Exception('Could not parse PHP version'); + throw new \Exception('Could not parse PHP version'); } $minorVersion = 0; diff --git a/tests/Extension/Properties/StaticPublicPropertiesTest.php b/tests/Extension/Properties/StaticPublicPropertiesTest.php index 352890bae8..95ecc6cb60 100644 --- a/tests/Extension/Properties/StaticPublicPropertiesTest.php +++ b/tests/Extension/Properties/StaticPublicPropertiesTest.php @@ -49,9 +49,9 @@ public function testIssues2020(): void $this->assertEquals(-1, StaticPublicProperties::$someSub); // PHP Notice: A non well formed numeric value encountered - //\Stub\Properties\StaticPublicProperties::testAddAndSub2(); - //$this->assertEquals(2, \Stub\Properties\StaticPublicProperties::$someAdd); - //$this->assertEquals(-2, \Stub\Properties\StaticPublicProperties::$someSub); + // \Stub\Properties\StaticPublicProperties::testAddAndSub2(); + // $this->assertEquals(2, \Stub\Properties\StaticPublicProperties::$someAdd); + // $this->assertEquals(-2, \Stub\Properties\StaticPublicProperties::$someSub); StaticPublicProperties::testAddAndSub3(); $this->assertEquals(2, StaticPublicProperties::$someAdd); diff --git a/tests/Extension/ReflectionTest.php b/tests/Extension/ReflectionTest.php index 15da5ed41e..fad207f0fb 100644 --- a/tests/Extension/ReflectionTest.php +++ b/tests/Extension/ReflectionTest.php @@ -14,9 +14,6 @@ namespace Extension; use PHPUnit\Framework\TestCase; -use ReflectionClass; -use ReflectionFunction; -use ReflectionParameter; use Stub\Reflection as StubReflection; final class ReflectionTest extends TestCase @@ -25,14 +22,14 @@ public function testMethods(): void { $class = new StubReflection(); - $this->assertInstanceOf(ReflectionClass::class, $class->getReflectionClass()); - $this->assertInstanceOf(ReflectionFunction::class, $class->getReflectionFunction()); + $this->assertInstanceOf(\ReflectionClass::class, $class->getReflectionClass()); + $this->assertInstanceOf(\ReflectionFunction::class, $class->getReflectionFunction()); $this->assertNull($class->getReflectionParameter()); - $class->setReflectionParameter(new ReflectionParameter(function ($test) { + $class->setReflectionParameter(new \ReflectionParameter(function ($test) { return 1; }, 0)); - $this->assertInstanceOf(ReflectionParameter::class, $class->getReflectionParameter()); + $this->assertInstanceOf(\ReflectionParameter::class, $class->getReflectionParameter()); } } diff --git a/tests/Extension/RequiresTest.php b/tests/Extension/RequiresTest.php index 99bd7ad134..099e0b32a3 100644 --- a/tests/Extension/RequiresTest.php +++ b/tests/Extension/RequiresTest.php @@ -16,8 +16,6 @@ use PHPUnit\Framework\TestCase; use Stub\Requires; -use function defined; - final class RequiresTest extends TestCase { private Requires $test; @@ -34,9 +32,9 @@ public function testRequireExternal1(): void $this->test->requireExternal1(__DIR__.'/../fixtures/require-me-1.php') ); - $this->assertFalse(defined('REQUIRE_ME')); + $this->assertFalse(\defined('REQUIRE_ME')); $this->test->requireExternal1(__DIR__.'/../fixtures/require-me-2.php'); - $this->assertTrue(defined('REQUIRE_ME')); + $this->assertTrue(\defined('REQUIRE_ME')); } /** @@ -88,10 +86,10 @@ public function testRequireOnce(): void $this->test->requireOnce(__DIR__.'/../fixtures/require-me-before-once.php') ); - $this->assertFalse(defined('REQUIRE_ONCE_ME')); + $this->assertFalse(\defined('REQUIRE_ONCE_ME')); $this->test->requireOnce(__DIR__.'/../fixtures/require-me-once.php'); - $this->assertTrue(defined('REQUIRE_ONCE_ME')); + $this->assertTrue(\defined('REQUIRE_ONCE_ME')); $this->test->requireOnce(__DIR__.'/../fixtures/require-me-once.php'); - $this->assertTrue(defined('REQUIRE_ONCE_ME')); + $this->assertTrue(\defined('REQUIRE_ONCE_ME')); } } diff --git a/tests/Extension/TypeHinting/AbstractTest.php b/tests/Extension/TypeHinting/AbstractTest.php index aa782f1f10..8db2cbc3c1 100644 --- a/tests/Extension/TypeHinting/AbstractTest.php +++ b/tests/Extension/TypeHinting/AbstractTest.php @@ -14,7 +14,6 @@ namespace Extension\TypeHinting; use PHPUnit\Framework\TestCase; -use TestConcreteClass; final class AbstractTest extends TestCase { @@ -23,7 +22,7 @@ final class AbstractTest extends TestCase */ public function testShouldCreateCompatibleChildClassUsingTypeHintedParams(): void { - $childClass = new TestConcreteClass(); + $childClass = new \TestConcreteClass(); $this->assertEquals( [[1667], '/', true, null], @@ -41,7 +40,7 @@ public function testShouldCreateCompatibleChildClassUsingTypeHintedParams(): voi */ public function testShouldCreateCompatibleChildClassWithMultipleReturnTypesHint(): void { - $childClass = new TestConcreteClass(); + $childClass = new \TestConcreteClass(); $this->assertEquals('TestConcreteClass::returnOneOfScalar', $childClass->returnOneOfScalar()); } @@ -50,7 +49,7 @@ public function testShouldCreateCompatibleChildClassWithMultipleReturnTypesHint( */ public function testShouldCreateCompatibleChildClassWithScalarType(): void { - $childClass = new TestConcreteClass(); + $childClass = new \TestConcreteClass(); $this->assertEquals(1, $childClass->returnInt()); $this->assertEquals(1, $childClass->returnUint()); diff --git a/tests/Extension/Types/MixedTypeTest.php b/tests/Extension/Types/MixedTypeTest.php index 162edba89c..f544f56d84 100644 --- a/tests/Extension/Types/MixedTypeTest.php +++ b/tests/Extension/Types/MixedTypeTest.php @@ -22,7 +22,7 @@ public function testReturnsOfMixedType(): void { $returns = new MixedType(); - $this->assertEquals((new \stdClass()), $returns->returnMixedObject()); + $this->assertEquals(new \stdClass(), $returns->returnMixedObject()); $this->assertSame([], $returns->returnMixedArray()); $this->assertSame('mixed string', $returns->returnMixedString()); $this->assertSame(1, $returns->returnMixedInt()); @@ -38,16 +38,16 @@ public function testReturnsOfMixedType(): void $this->assertNotNull($returns->returnMixedBool()); $this->assertNull($returns->returnMixedNull()); - $this->assertEquals((new \stdClass()), $returns->returnMixed74()); + $this->assertEquals(new \stdClass(), $returns->returnMixed74()); $this->assertSame('string', $returns->returnMixed74(true)); - $this->assertEquals((new \stdClass()), $returns->returnMixed74(false)); + $this->assertEquals(new \stdClass(), $returns->returnMixed74(false)); } public function testParamsOfMixedType(): void { $returns = new MixedType(); - $this->assertEquals((new \stdClass()), $returns->paramMixed((new \stdClass()))); + $this->assertEquals(new \stdClass(), $returns->paramMixed(new \stdClass())); $this->assertSame([], $returns->paramMixed([])); $this->assertSame('mixed string', $returns->paramMixed('mixed string')); $this->assertSame(1, $returns->paramMixed(1)); @@ -55,14 +55,14 @@ public function testParamsOfMixedType(): void $this->assertTrue($returns->paramMixed(true)); $this->assertNull($returns->paramMixed(null)); - $this->assertEquals([(new \stdClass()), []], $returns->paramMixedTwo((new \stdClass()), [])); + $this->assertEquals([new \stdClass(), []], $returns->paramMixedTwo(new \stdClass(), [])); $this->assertSame([[], 'mixed string'], $returns->paramMixedTwo([], 'mixed string')); $this->assertSame([1, 3.14], $returns->paramMixedTwo(1, 3.14)); $this->assertSame([3.14, true], $returns->paramMixedTwo(3.14, true)); $this->assertSame([true, null], $returns->paramMixedTwo(true, null)); $this->assertSame([null, null], $returns->paramMixedTwo(null, null)); - $this->assertEquals([1337, 'object', (new \stdClass())], $returns->paramMixedWithMulti(1337, 'object', (new \stdClass()))); + $this->assertEquals([1337, 'object', new \stdClass()], $returns->paramMixedWithMulti(1337, 'object', new \stdClass())); $this->assertSame([1337, 'array', []], $returns->paramMixedWithMulti(1337, 'array', [])); $this->assertSame([1337, 'string', 'mixed string'], $returns->paramMixedWithMulti(1337, 'string', 'mixed string')); $this->assertSame([1337, 'int', 123], $returns->paramMixedWithMulti(1337, 'int', 123)); @@ -75,7 +75,7 @@ public function testParamsAndReturnsOfMixedType(): void { $returns = new MixedType(); - $this->assertEquals((new \stdClass()), $returns->paramAndReturnMixed((new \stdClass()))); + $this->assertEquals(new \stdClass(), $returns->paramAndReturnMixed(new \stdClass())); $this->assertSame([], $returns->paramAndReturnMixed([])); $this->assertSame('mixed string', $returns->paramAndReturnMixed('mixed string')); $this->assertSame(1, $returns->paramAndReturnMixed(1)); diff --git a/tests/Extension/Types/ObjTypeTest.php b/tests/Extension/Types/ObjTypeTest.php index cf3539fdf3..e77883d5ad 100644 --- a/tests/Extension/Types/ObjTypeTest.php +++ b/tests/Extension/Types/ObjTypeTest.php @@ -14,7 +14,6 @@ namespace Extension\Types; use PHPUnit\Framework\TestCase; -use stdClass; use Stub\Types\Obj; final class ObjTypeTest extends TestCase @@ -24,7 +23,7 @@ public function testIntFalse(): void $class = new Obj(); $this->assertNull($class->nullableObjectReturnNull()); - $this->assertInstanceOf(stdClass::class, $class->nullableObjectReturnObj()); - $this->assertInstanceOf(stdClass::class, $class->objectReturn()); + $this->assertInstanceOf(\stdClass::class, $class->nullableObjectReturnObj()); + $this->assertInstanceOf(\stdClass::class, $class->objectReturn()); } } diff --git a/tests/Extension/UnsetTest.php b/tests/Extension/UnsetTest.php index f448537875..6f8ed957b5 100644 --- a/tests/Extension/UnsetTest.php +++ b/tests/Extension/UnsetTest.php @@ -49,7 +49,7 @@ public function xtestUnsetValueFromProperty(): void public function xtestStdClassUnset(): void { - $equalsStdClass = new \StdClass(); + $equalsStdClass = new \stdClass(); $equalsStdClass->property1 = 12345; $equalsStdClass->property3 = 12345; diff --git a/tests/Zephir/CompilerFile/CheckDependenciesTest.php b/tests/Zephir/CompilerFile/CheckDependenciesTest.php index cf88d15bda..acf9e52d43 100644 --- a/tests/Zephir/CompilerFile/CheckDependenciesTest.php +++ b/tests/Zephir/CompilerFile/CheckDependenciesTest.php @@ -15,7 +15,6 @@ use PHPUnit\Framework\TestCase; use Psr\Log\Test\TestLogger; -use ReflectionException; use Zephir\AliasManager; use Zephir\Backend\Backend; use Zephir\Compiler; @@ -29,7 +28,7 @@ final class CheckDependenciesTest extends TestCase { /** - * @throws ReflectionException + * @throws \ReflectionException */ public function testExtendsClassThatDoesNotExist(): void { diff --git a/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php b/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php index c5dd8fc521..d3c113e3a8 100644 --- a/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php +++ b/tests/Zephir/CompilerFile/CheckPathSeparatorTest.php @@ -22,6 +22,6 @@ public function testExtendsClassThatDoesNotExist(): void $configM4Path = realpath(__DIR__.'/../../../ext/config.m4'); $configM4Contents = file_get_contents($configM4Path); - $this->assertTrue(strpos($configM4Contents, 'stub/oo/abstractstatic.zep.c') !== false); + $this->assertTrue(str_contains($configM4Contents, 'stub/oo/abstractstatic.zep.c')); } } diff --git a/tests/Zephir/ConfigTest.php b/tests/Zephir/ConfigTest.php index e7debd114c..a434673bb1 100644 --- a/tests/Zephir/ConfigTest.php +++ b/tests/Zephir/ConfigTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase; use Zephir\Config; + use function Zephir\is_windows; final class ConfigTest extends TestCase diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index e607da7317..efd88defe2 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -14,14 +14,14 @@ namespace Zephir\Test\Stubs; use PHPUnit\Framework\TestCase; -use ReflectionException; use Zephir\AliasManager; -use Zephir\Class\Property; use Zephir\Class\Constant; use Zephir\Class\Definition\Definition; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; +use Zephir\Class\Property; use Zephir\Stubs\Generator; + use function Zephir\is_windows; class GeneratorTest extends TestCase @@ -47,7 +47,7 @@ protected function setUp(): void * * @return mixed * - * @throws ReflectionException + * @throws \ReflectionException */ private function getMethod(string $name) { @@ -238,14 +238,15 @@ public function propertyProvider(): array /** * @dataProvider propertyProvider + * * @covers \Zephir\Stubs\Generator::buildProperty * * @param array $visibility * @param string $type - * @param $value + * @param $value * @param string $expected * - * @throws ReflectionException + * @throws \ReflectionException */ public function testShouldBuildProperty(array $visibility, string $type, $value, string $expected): void { @@ -330,10 +331,10 @@ public function constantProvider(): array * @dataProvider constantProvider * * @param string $type - * @param $value + * @param $value * @param string $expected * - * @throws ReflectionException + * @throws \ReflectionException */ public function testShouldBuildConstant(string $type, $value, string $expected): void { diff --git a/tests/Zephir/Stubs/MethodDocBlockTest.php b/tests/Zephir/Stubs/MethodDocBlockTest.php index 2a396a7b32..794b68f90b 100644 --- a/tests/Zephir/Stubs/MethodDocBlockTest.php +++ b/tests/Zephir/Stubs/MethodDocBlockTest.php @@ -16,8 +16,8 @@ use PHPUnit\Framework\TestCase; use Zephir\AliasManager; use Zephir\Class\Definition\Definition; -use Zephir\Class\Method\Parameters; use Zephir\Class\Method\Method; +use Zephir\Class\Method\Parameters; use Zephir\StatementsBlock; use Zephir\Stubs\MethodDocBlock; @@ -45,14 +45,14 @@ public function prepareMethod(array $params): MethodDocBlock /** * ClassMethod constructor. * - * @param Definition $classDefinition - * @param array $visibility - * @param string $name - * @param Parameters|null $parameters - * @param StatementsBlock|null $statements - * @param string|null $docblock - * @param array|null $returnType - * @param array|null $original + * @param Definition $classDefinition + * @param array $visibility + * @param string $name + * @param Parameters|null $parameters + * @param StatementsBlock|null $statements + * @param string|null $docblock + * @param array|null $returnType + * @param array|null $original */ $methodVisibility = $params['method']['visibility']; $methodName = $params['method']['name']; diff --git a/tests/Zephir/TypesTest.php b/tests/Zephir/TypesTest.php index ca9bb7f409..0729181637 100644 --- a/tests/Zephir/TypesTest.php +++ b/tests/Zephir/TypesTest.php @@ -285,7 +285,7 @@ public function testShouldResolveCompatibleTypeForCollections(array $returnTypes $typesList = []; $collections = []; foreach ($returnTypes as $type) { - if (false !== strpos($type, '[]')) { + if (str_contains($type, '[]')) { $typesList[] = $this->variableReturnTypeDefinition([$type], 1)[0]; $collectionType = trim($type, '<>'); $collections[$collectionType] = $collectionType; From cf22bd968a68e1cea1fd3ffe71352cb669e84bc4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 19:31:20 +0100 Subject: [PATCH 076/375] #2407 - Change to `require_once` --- Library/Class/Entry.php | 2 +- Library/Code/ArgInfoDefinition.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index 9aba0a2e22..454b4d3517 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -39,7 +39,7 @@ class Entry public function __construct(string $className, private CompilationContext $compilationContext) { $this->classname = $this->compilationContext->getFullName($className); - $this->classEntries = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; + $this->classEntries = require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; foreach ($this->classEntries as $key => $val) { unset($this->classEntries[$key]); diff --git a/Library/Code/ArgInfoDefinition.php b/Library/Code/ArgInfoDefinition.php index de4c4d816c..6d91549d63 100644 --- a/Library/Code/ArgInfoDefinition.php +++ b/Library/Code/ArgInfoDefinition.php @@ -510,7 +510,7 @@ private function getReturnType(): string */ private function renderPhalconCompatible(): bool { - $compatibilityClasses = require __DIR__.'/../../config/phalcon-compatibility-headers.php'; + $compatibilityClasses = require_once __DIR__.'/../../config/phalcon-compatibility-headers.php'; $classDefinition = $this->functionLike->getClassDefinition(); $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; $extendsClass = $classDefinition !== null ? $classDefinition->getExtendsClass() : null; From c18ba4e54fe45ea91cec1a459c06a5a501579c4e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 19:42:55 +0100 Subject: [PATCH 077/375] #2407 - Adjust name of `stdClass` inside Zephir code --- stub/cast.zep | 12 ++++++------ stub/mcall.zep | 2 +- stub/unsettest.zep | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stub/cast.zep b/stub/cast.zep index 3ca8f02aa1..f59497baca 100644 --- a/stub/cast.zep +++ b/stub/cast.zep @@ -164,7 +164,7 @@ class Cast */ public function testIntCastFromStdClass() -> int { - return (int) (new \StdClass); + return (int) (new \stdClass); } /** @@ -174,7 +174,7 @@ class Cast public function testIntCastFromVariableStdClass() -> int { var a; - let a = new \StdClass; + let a = new \stdClass; return (int) a; } @@ -271,7 +271,7 @@ class Cast */ public function testFloatCastFromStdClass() -> float { - return (float) (new \StdClass); + return (float) (new \stdClass); } /** @@ -281,7 +281,7 @@ class Cast public function testFloatCastFromVariableStdClass() -> float { var a; - let a = new \StdClass; + let a = new \stdClass; return (float) a; } @@ -324,7 +324,7 @@ class Cast public function testBooleanCastFromObject() -> boolean { var simpleObject; - let simpleObject = new \StdClass(); + let simpleObject = new \stdClass(); return (boolean) simpleObject; } @@ -486,7 +486,7 @@ class Cast public function testArrayCastFromVariableStdClass() -> array { var uids; - let uids = new \StdClass; + let uids = new \stdClass; let uids->p1 = "v1"; let uids->p2 = "v2"; let uids = (array) uids; diff --git a/stub/mcall.zep b/stub/mcall.zep index ad6d55ff5d..218b4edcd3 100644 --- a/stub/mcall.zep +++ b/stub/mcall.zep @@ -223,7 +223,7 @@ class Mcall return driverOptions; } - public function testObjectParamCastStdClass(<\StdClass> param) + public function testObjectParamCastStdClass(<\stdClass> param) { return param; } diff --git a/stub/unsettest.zep b/stub/unsettest.zep index 441add51f8..367d1d8706 100644 --- a/stub/unsettest.zep +++ b/stub/unsettest.zep @@ -45,7 +45,7 @@ class Unsettest public function testStdClassUnset() { var simpleObject; - let simpleObject = new \StdClass(); + let simpleObject = new \stdClass(); let simpleObject->property1 = 12345; let simpleObject->property2 = "test"; From d47a5aa2d87e0ff4a8f030372ef2827f9f9c0716 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 19:44:03 +0100 Subject: [PATCH 078/375] #2407 - Change to `require` --- Library/Class/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index 454b4d3517..9aba0a2e22 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -39,7 +39,7 @@ class Entry public function __construct(string $className, private CompilationContext $compilationContext) { $this->classname = $this->compilationContext->getFullName($className); - $this->classEntries = require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; + $this->classEntries = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; foreach ($this->classEntries as $key => $val) { unset($this->classEntries[$key]); From 4779eeadfbb0ca99e1013fcb61e02cb01728ddf3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 10 Sep 2023 19:54:54 +0100 Subject: [PATCH 079/375] #2407 - Unify test cases --- .../InterfaceMethodSignatureTest.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php index 2d41ad99c1..62661e30de 100644 --- a/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php +++ b/tests/Extension/Interfaces/InterfaceMethodSignatureTest.php @@ -32,11 +32,7 @@ public function testImplementInterfaceInMethodSignature(): void public function testImplementInterfaceInMethodSignatureInt(): void { $this->expectException(\TypeError::class); - if (version_compare(PHP_VERSION, '8.3.0beta3', '>=')) { - $this->expectExceptionMessageMatches('/must be of type int, true given/'); - } else { - $this->expectExceptionMessageMatches('/must be of (the\s)?type int, bool given/'); - } + $this->expectExceptionMessageMatches('/must be of type int, (true|bool) given/'); (new ImplementInt())->set(true); } @@ -44,15 +40,9 @@ public function testImplementInterfaceInMethodSignatureInt(): void public function testImplementInterfaceInMethodSignatureInterface(): void { $this->expectException(\TypeError::class); - if (version_compare(PHP_VERSION, '8.3.0beta3', '>=')) { - $this->expectExceptionMessageMatches( - '/(must be of type) Stub\\\\Interfaces\\\\InterfaceInt, true given/' - ); - } else { - $this->expectExceptionMessageMatches( - '/(must be of type|implement interface) Stub\\\\Interfaces\\\\InterfaceInt, bool given/' - ); - } + $this->expectExceptionMessageMatches( + '/(must be of type) Stub\\\\Interfaces\\\\InterfaceInt, (true|bool) given/' + ); (new ImplementInterface())->getVoid(true); } From 41db5752770c0eed51869a92a14f4591a12522e3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 8 Oct 2023 13:07:56 +0100 Subject: [PATCH 080/375] #2407 - Update docker image to `8.3.0RC3-fpm` --- .docker/8.3/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/8.3/Dockerfile b/.docker/8.3/Dockerfile index 1899dd3203..3fdb937705 100644 --- a/.docker/8.3/Dockerfile +++ b/.docker/8.3/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest AS composer -FROM php:8.3.0beta3-fpm +FROM 8.3.0RC3-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" From f0ed8badc6df4795b238908381b47d1b542de168 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 8 Oct 2023 23:48:16 +0100 Subject: [PATCH 081/375] #2407 - Fix docker image --- .docker/8.3/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/8.3/Dockerfile b/.docker/8.3/Dockerfile index 3fdb937705..6557fe4885 100644 --- a/.docker/8.3/Dockerfile +++ b/.docker/8.3/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest AS composer -FROM 8.3.0RC3-fpm +FROM php:8.3.0RC3-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" From 7436a5be4951d2d2ece5a1f5589c618c7d881fde Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 15 Oct 2023 18:38:06 +0100 Subject: [PATCH 082/375] #2407 - Remove unused property `$lines` --- Library/Documentation/DocblockParser.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Documentation/DocblockParser.php b/Library/Documentation/DocblockParser.php index f37f50bed1..fe746af5c1 100644 --- a/Library/Documentation/DocblockParser.php +++ b/Library/Documentation/DocblockParser.php @@ -22,7 +22,6 @@ class DocblockParser protected $currentChar; protected $currentCharIndex; protected $currentLine; - protected $lines = []; // Parsing helpers protected $ignoreSpaces; From 6cb7efe9edf4179a0307c186df2b260de4fbfd31 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 15 Oct 2023 18:46:22 +0100 Subject: [PATCH 083/375] #2407 - Remove redundant comments --- Library/Backend/FcallManager.php | 2 -- .../Operators/AbstractOperatorBuilder.php | 2 -- .../Builder/Operators/CastOperatorBuilder.php | 5 ---- .../Operators/UnaryOperatorBuilder.php | 7 ------ .../Builder/Statements/IfStatementBuilder.php | 5 ---- .../Statements/LetStatementBuilder.php | 5 ---- Library/Builder/StatementsBlockBuilder.php | 3 --- Library/Cache/Manager.php | 25 ------------------- Library/Code/ArgInfoDefinition.php | 1 - Library/GlobalConstant.php | 6 ++--- 10 files changed, 2 insertions(+), 59 deletions(-) diff --git a/Library/Backend/FcallManager.php b/Library/Backend/FcallManager.php index ffa27b55c6..04c3ca61ea 100644 --- a/Library/Backend/FcallManager.php +++ b/Library/Backend/FcallManager.php @@ -22,8 +22,6 @@ class FcallManager implements FcallManagerInterface protected array $requiredMacros = []; /** - * {@inheritdoc} - * * @param bool $static * @param int $doReturn tri-state: 0 -> no return value, 1 -> do return, 2 -> do return to given variable * @param int $paramCount diff --git a/Library/Builder/Operators/AbstractOperatorBuilder.php b/Library/Builder/Operators/AbstractOperatorBuilder.php index 4fad1c2726..99a63335be 100644 --- a/Library/Builder/Operators/AbstractOperatorBuilder.php +++ b/Library/Builder/Operators/AbstractOperatorBuilder.php @@ -26,8 +26,6 @@ abstract class AbstractOperatorBuilder /** * Returns a builder definition. - * - * @return array */ abstract public function get(): array; } diff --git a/Library/Builder/Operators/CastOperatorBuilder.php b/Library/Builder/Operators/CastOperatorBuilder.php index e57e855e6d..e211bca3e0 100644 --- a/Library/Builder/Operators/CastOperatorBuilder.php +++ b/Library/Builder/Operators/CastOperatorBuilder.php @@ -38,11 +38,6 @@ public function __construct( $this->char = $char; } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { return [ diff --git a/Library/Builder/Operators/UnaryOperatorBuilder.php b/Library/Builder/Operators/UnaryOperatorBuilder.php index e68231881e..82e5106a17 100644 --- a/Library/Builder/Operators/UnaryOperatorBuilder.php +++ b/Library/Builder/Operators/UnaryOperatorBuilder.php @@ -20,8 +20,6 @@ class UnaryOperatorBuilder extends AbstractOperatorBuilder { /** * Operator name - * - * @var string */ protected string $operator; @@ -41,11 +39,6 @@ public function __construct(string $operator, $leftExpression, string $file = nu $this->char = $char; } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { if (\is_object($this->leftExpression) && method_exists($this->leftExpression, 'get')) { diff --git a/Library/Builder/Statements/IfStatementBuilder.php b/Library/Builder/Statements/IfStatementBuilder.php index 44c36ea48f..fbb5acebe0 100644 --- a/Library/Builder/Statements/IfStatementBuilder.php +++ b/Library/Builder/Statements/IfStatementBuilder.php @@ -28,11 +28,6 @@ public function __construct( ) { } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { $expression = [ diff --git a/Library/Builder/Statements/LetStatementBuilder.php b/Library/Builder/Statements/LetStatementBuilder.php index 721ce2a292..ff04172015 100644 --- a/Library/Builder/Statements/LetStatementBuilder.php +++ b/Library/Builder/Statements/LetStatementBuilder.php @@ -22,11 +22,6 @@ public function __construct(private array $assignments, private mixed $expr) { } - /** - * Returns a builder definition. - * - * @return array - */ public function get(): array { return [ diff --git a/Library/Builder/StatementsBlockBuilder.php b/Library/Builder/StatementsBlockBuilder.php index 5d155c0bf8..9291e3c43a 100644 --- a/Library/Builder/StatementsBlockBuilder.php +++ b/Library/Builder/StatementsBlockBuilder.php @@ -22,9 +22,6 @@ public function __construct(protected array $statements, protected bool $raw = f { } - /** - * Returns a builder definition. - */ public function get(): array { if ($this->raw) { diff --git a/Library/Cache/Manager.php b/Library/Cache/Manager.php index 16b6b70824..1ce933f320 100644 --- a/Library/Cache/Manager.php +++ b/Library/Cache/Manager.php @@ -20,35 +20,18 @@ */ class Manager { - /** - * @var FunctionCache|null - */ protected ?FunctionCache $functionCache = null; - /** - * @var MethodCache|null - */ protected ?MethodCache $methodCache = null; - /** - * @var StaticMethodCache|null - */ protected ?StaticMethodCache $staticMethodCache = null; - /** - * @var ClassEntryCache|null - */ protected ?ClassEntryCache $classEntryCache = null; - /** - * @var CallGathererPass|null - */ protected ?CallGathererPass $gatherer = null; /** * Sets the CallGathererPass. - * - * @param CallGathererPass|null $gatherer */ public function setGatherer(CallGathererPass $gatherer = null): void { @@ -57,8 +40,6 @@ public function setGatherer(CallGathererPass $gatherer = null): void /** * Creates or returns an existing class entry cache. - * - * @return ClassEntryCache */ public function getClassEntryCache(): ClassEntryCache { @@ -71,8 +52,6 @@ public function getClassEntryCache(): ClassEntryCache /** * Creates or returns an existing function cache. - * - * @return FunctionCache|null */ public function getFunctionCache(): ?FunctionCache { @@ -85,8 +64,6 @@ public function getFunctionCache(): ?FunctionCache /** * Creates or returns an existing method cache. - * - * @return MethodCache|null */ public function getMethodCache(): ?MethodCache { @@ -99,8 +76,6 @@ public function getMethodCache(): ?MethodCache /** * Creates or returns an existing method cache. - * - * @return StaticMethodCache|null */ public function getStaticMethodCache(): ?StaticMethodCache { diff --git a/Library/Code/ArgInfoDefinition.php b/Library/Code/ArgInfoDefinition.php index 6d91549d63..4a2fd02aa6 100644 --- a/Library/Code/ArgInfoDefinition.php +++ b/Library/Code/ArgInfoDefinition.php @@ -18,7 +18,6 @@ use Zephir\CompilationContext; use Zephir\Exception; -use function array_key_exists; use function Zephir\escape_class; class ArgInfoDefinition diff --git a/Library/GlobalConstant.php b/Library/GlobalConstant.php index f818b9d2dc..ccdb393665 100644 --- a/Library/GlobalConstant.php +++ b/Library/GlobalConstant.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; /** @@ -25,8 +27,6 @@ public function __construct(protected string $name) /** * Returns global constant name. - * - * @return string */ public function getName(): string { @@ -35,8 +35,6 @@ public function getName(): string /** * Check if the global constant is temporal. - * - * @return bool */ public function isTemporal(): bool { From 29b44b451a779d6d967a7ae8a0018ce0629a0ba6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 26 Oct 2023 08:12:10 +0200 Subject: [PATCH 084/375] fast_add_function removed in 8.3 --- kernels/ZendEngine3/operators.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernels/ZendEngine3/operators.h b/kernels/ZendEngine3/operators.h index 059f0a0fe2..f481d7c3ea 100755 --- a/kernels/ZendEngine3/operators.h +++ b/kernels/ZendEngine3/operators.h @@ -146,7 +146,11 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define zephir_get_boolval(z) (Z_TYPE_P(z) == IS_TRUE ? 1 : (Z_TYPE_P(z) == IS_FALSE ? 0 : zephir_get_boolval_ex(z))) #define zephir_get_charval(z) (Z_TYPE_P(z) == IS_LONG ? Z_LVAL_P(z) : zephir_get_charval_ex(z)) +#if PHP_VERSION_ID >= 80300 +#define zephir_add_function(result, left, right) add_function(result, left, right) +#else #define zephir_add_function(result, left, right) fast_add_function(result, left, right) +#endif #define zephir_sub_function(result, left, right) sub_function(result, left, right) #define zephir_pow_function(result, op1, op2) pow_function(result, op1, op2) #define zephir_increment(var) increment_function(var) From cd45ef18c2e2280676a67dc5e4a6082637c8292f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 28 Oct 2023 17:33:42 +0100 Subject: [PATCH 085/375] #2407 - Update docker image to `8.3.0RC5-fpm` --- .docker/8.3/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/8.3/Dockerfile b/.docker/8.3/Dockerfile index 6557fe4885..1e1d267118 100644 --- a/.docker/8.3/Dockerfile +++ b/.docker/8.3/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest AS composer -FROM php:8.3.0RC3-fpm +FROM php:8.3.0RC5-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" From 8a33e650544c68533359adff2a8eb044cbc2939d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 28 Oct 2023 19:32:10 +0100 Subject: [PATCH 086/375] #2407 - Simplify conditions --- Library/CompilerFile.php | 12 ++--- .../Arithmetical/ArithmeticalBaseOperator.php | 4 +- Library/Passes/LocalContextPass.php | 22 ++++---- Library/Passes/SkipVariantInit.php | 52 ++++++++----------- Library/Passes/StaticTypeInference.php | 6 +-- 5 files changed, 43 insertions(+), 53 deletions(-) diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 01c917e70c..b3722bb9c1 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -893,16 +893,16 @@ public function applyClassHeaders(CompilationContext $compilationContext) $separators = str_repeat('../', \count(explode('\\', $classDefinition->getCompleteName())) - 1); - $code = ''.PHP_EOL; + $code = PHP_EOL; $code .= '#ifdef HAVE_CONFIG_H'.PHP_EOL; $code .= '#include "'.$separators.'ext_config.h"'.PHP_EOL; $code .= '#endif'.PHP_EOL; - $code .= ''.PHP_EOL; + $code .= PHP_EOL; $code .= '#include '.PHP_EOL; $code .= '#include "'.$separators.'php_ext.h"'.PHP_EOL; $code .= '#include "'.$separators.'ext.h"'.PHP_EOL; - $code .= ''.PHP_EOL; + $code .= PHP_EOL; if ('class' == $classDefinition->getType()) { $code .= '#include '.PHP_EOL; @@ -911,7 +911,7 @@ public function applyClassHeaders(CompilationContext $compilationContext) } else { $code .= '#include '.PHP_EOL; } - $code .= ''.PHP_EOL; + $code .= PHP_EOL; $code .= '#include "kernel/main.h"'.PHP_EOL; @@ -925,7 +925,7 @@ public function applyClassHeaders(CompilationContext $compilationContext) $code .= implode(PHP_EOL, $this->headerCBlocks).PHP_EOL; } - /* + /** * Prepend the required files to the header */ $compilationContext->codePrinter->preOutput($code); @@ -974,7 +974,7 @@ protected function processShortcuts(array $property, Definition $classDefinition if ($annotations = $docBlockParsed->getAnnotationsByType('var')) { $returnsType = array_map(function ($type) { return 'mixed' == ($type = trim($type)) ? 'variable' : $type; - }, (array) explode('|', $annotations[0]->getString())); + }, explode('|', $annotations[0]->getString())); } // Clear annotations diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php index ac6b94bcae..d0e9f97cb9 100644 --- a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php +++ b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php @@ -523,9 +523,9 @@ public function compile($expression, CompilationContext $compilationContext) * * @return string */ - private function getDynamicTypes(Variable $left, Variable $right) + private function getDynamicTypes(Variable $left, Variable $right): string { - if ('/' == $this->operator) { + if ('/' === $this->operator) { return 'double'; } diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index 1dd6d0d16b..aee0d95638 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -50,18 +50,22 @@ public function pass(StatementsBlock $block): void public function declareVariables(array $statement): void { - if (isset($statement['data-type'])) { - if ('variable' != $statement['data-type']) { - return; - } + if (isset($statement['data-type']) && 'variable' !== $statement['data-type']) { + return; } + foreach ($statement['variables'] as $variable) { if (isset($variable['expr'])) { - if ('string' == $variable['expr']['type'] || 'empty-array' == $variable['expr']['type'] || 'array' == $variable['expr']['type']) { + if ( + 'string' === $variable['expr']['type'] || + 'empty-array' === $variable['expr']['type'] || + 'array' === $variable['expr']['type'] + ) { $this->variables[$variable['variable']] = false; continue; } } + if (!isset($this->variables[$variable['variable']])) { $this->variables[$variable['variable']] = true; } @@ -219,9 +223,6 @@ public function passLetStatement(array $statement): void break; } break; - - default: - // echo '[', $assignment['expr']['type'], ']', PHP_EOL; } break; @@ -241,13 +242,8 @@ public function passLetStatement(array $statement): void case 'variable': $this->markVariableNoLocal($assignment['expr']['value']); break; - default: - // echo '[', $assignment['assign-type'], ']'; } break; - - default: - // echo $assignment['assign-type']; } } } diff --git a/Library/Passes/SkipVariantInit.php b/Library/Passes/SkipVariantInit.php index 3587011a6c..9864cc534a 100644 --- a/Library/Passes/SkipVariantInit.php +++ b/Library/Passes/SkipVariantInit.php @@ -9,10 +9,14 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Passes; use Zephir\StatementsBlock; +use function count; + /** * In 'if'/'else' statements sometimes dynamical variables are initialized in every branch * Same case in 'switch' statements @@ -25,9 +29,6 @@ class SkipVariantInit /** * Do the compilation pass. - * - * @param int $branchNumber - * @param StatementsBlock $block */ public function pass(int $branchNumber, StatementsBlock $block): void { @@ -37,30 +38,29 @@ public function pass(int $branchNumber, StatementsBlock $block): void /** * Check assignment types for possible skip. - * - * @param int $branchNumber - * @param array $statement */ public function passLetStatement(int $branchNumber, array $statement): void { + $skipTypes = [ + 'variable', + 'array-access', + 'property-access', + 'static-property-access', + 'fcall', + 'mcall', + 'scall', + ]; + foreach ($statement['assignments'] as $assignment) { - if ('variable' == $assignment['assign-type']) { - if ('assign' == $assignment['operator']) { - switch ($assignment['expr']['type']) { - case 'variable': - case 'array-access': - case 'property-access': - case 'static-property-access': - case 'fcall': - case 'mcall': - case 'scall': - break; - default: - $this->variablesToSkip[$branchNumber][$assignment['variable']] = 1; - break; - } - } + if ($assignment['assign-type'] !== 'variable' || $assignment['operator'] !== 'assign') { + continue; } + + if (in_array($assignment['expr']['type'], $skipTypes, true)) { + continue; + } + + $this->variablesToSkip[$branchNumber][$assignment['variable']] = 1; } } @@ -79,8 +79,6 @@ public function passStatementBlock($branchNumber, array $statements): void /** * Returns a list of variables that are initialized in every analyzed branch. - * - * @return array */ public function getVariables(): array { @@ -97,7 +95,7 @@ public function getVariables(): array } $variables = []; - $numberBranches = \count($this->branches); + $numberBranches = count($this->branches); foreach ($variableStats as $variable => $number) { if ($number == $numberBranches) { $variables[] = $variable; @@ -107,10 +105,6 @@ public function getVariables(): array return $variables; } - /** - * @param int $branchNumber - * @param array $variablesToSkip - */ public function setVariablesToSkip(int $branchNumber, array $variablesToSkip): void { $this->variablesToSkip[$branchNumber] = $variablesToSkip; diff --git a/Library/Passes/StaticTypeInference.php b/Library/Passes/StaticTypeInference.php index 9ae1278f8e..5a48d99149 100644 --- a/Library/Passes/StaticTypeInference.php +++ b/Library/Passes/StaticTypeInference.php @@ -54,7 +54,7 @@ public function declareVariables(array $statement) * @param string $variable * @param string $type */ - public function markVariableIfUnknown($variable, $type) + public function markVariableIfUnknown($variable, $type): void { $this->variables[$variable] = $type; $this->infered[$variable] = $type; @@ -66,7 +66,7 @@ public function markVariableIfUnknown($variable, $type) * @param string $variable * @param string $type */ - public function markVariable($variable, $type) + public function markVariable($variable, $type): void { if (isset($this->variables[$variable])) { $currentType = $this->variables[$variable]; @@ -171,7 +171,7 @@ public function markVariable($variable, $type) * * @return bool */ - public function reduce() + public function reduce(): bool { $pass = false; foreach ($this->variables as $variable => $type) { From 66f9b7c7ff006346b898dd5ede0d768b285fd602 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 28 Oct 2023 23:02:17 +0100 Subject: [PATCH 087/375] #2407 - Cleanup code --- Library/Backend/Backend.php | 29 ++++++++++++----------------- Library/Backend/StringsManager.php | 2 -- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 9a28076e28..b5187a8267 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -27,6 +27,7 @@ use Zephir\Variable\Globals; use Zephir\Variable\Variable; +use function in_array; use function Zephir\add_slashes; class Backend @@ -43,8 +44,6 @@ public function __construct( /** * Resolves the path to the source kernel files of the backend. - * - * @return string */ public function getInternalKernelPath(): string { @@ -53,10 +52,6 @@ public function getInternalKernelPath(): string /** * Resolves the path to the source template file of the backend. - * - * @param string $filename - * - * @return string */ public function getTemplateFileContents(string $filename): string { @@ -121,8 +116,8 @@ public function initVar(Variable $variable, CompilationContext $context, $useCod public function getVariableCode(Variable $variable): string { if ($variable->isDoublePointer() - || \in_array($variable->getName(), ['this_ptr', 'return_value']) - || \in_array($variable->getType(), ['int', 'long'])) { + || in_array($variable->getName(), ['this_ptr', 'return_value']) + || in_array($variable->getType(), ['int', 'long'])) { return $variable->getName(); } @@ -342,7 +337,7 @@ public function onPostCompile(Method $method, CompilationContext $context): void public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) { - $isComplex = \in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); + $isComplex = in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); if ($isComplex && !$variable->isDoublePointer()) { $groupVariables[] = $variable->getName(); @@ -645,7 +640,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'; } } @@ -770,16 +765,16 @@ public function arrayIssetFetch2(Variable $target, Variable $var, $resolvedExpr, if (!($resolvedExpr instanceof Variable)) { if ('string' === $resolvedExpr->getType()) { return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); - } elseif (\in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { + } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression); } else { $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); } } - if (\in_array($resolvedExpr->getType(), ['int', 'long'])) { + if (in_array($resolvedExpr->getType(), ['int', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } elseif (\in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { + } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); } @@ -988,7 +983,7 @@ public function resolveValue($value, CompilationContext $context): Variable | bo $value = $this->getVariableCode($tempVariable); } else { if ($value instanceof CompiledExpression) { - if (\in_array($value->getType(), ['array', 'variable', 'mixed'])) { + if (in_array($value->getType(), ['array', 'variable', 'mixed'])) { $value = $context->symbolTable->getVariableForWrite($value->getCode(), $context); } else { return $value->getCode(); @@ -1419,7 +1414,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA $arrayAccess['right'] ); } - if ($isVariable && \in_array($index->getType(), ['variable', 'string', 'mixed'])) { + if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { $output = 'zephir_array_fetch('.$this->getVariableCode($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; } else { if ($isVariable) { @@ -1458,7 +1453,7 @@ public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExp ); } - public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) + public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext): void { list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); @@ -1495,7 +1490,7 @@ public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $pro ); } - public function checkConstructor(Variable $var, CompilationContext $context) + public function checkConstructor(Variable $var, CompilationContext $context): void { $context->codePrinter->output('if (zephir_has_constructor('.$this->getVariableCode($var).')) {'); } diff --git a/Library/Backend/StringsManager.php b/Library/Backend/StringsManager.php index 92f964d107..d90559deb8 100644 --- a/Library/Backend/StringsManager.php +++ b/Library/Backend/StringsManager.php @@ -24,8 +24,6 @@ class StringsManager extends BaseStringsManager { /** * Adds a concatenation combination to the manager. - * - * @param string $key */ public function addConcatKey(string $key): void { From 2ac85892609e9466b598754228ccb5b705355749 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 28 Oct 2023 23:10:25 +0100 Subject: [PATCH 088/375] #2407 - Move `escape()` function into `Entry` class --- Library/Class/Entry.php | 8 +++++ Library/Code/ArgInfoDefinition.php | 7 ++--- .../Operators/Other/InstanceOfOperator.php | 6 ++-- .../Operators/Other/NewInstanceOperator.php | 4 +-- Library/functions.php | 12 -------- tests/Zephir/Class/EntryTest.php | 29 +++++++++++++++++++ tests/Zephir/HelpersTest.php | 10 ------- 7 files changed, 43 insertions(+), 33 deletions(-) create mode 100644 tests/Zephir/Class/EntryTest.php diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index 9aba0a2e22..78edc8227a 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -115,6 +115,14 @@ public function isInternal(): bool return $this->isInternal; } + /** + * Prepares a class name to be used as a C-string. + */ + public static function escape(string $className): string + { + return str_replace(static::NAMESPACE_SEPARATOR, '\\\\', $className); + } + /** * Detect if start of namespace class belongs to project namespace. */ diff --git a/Library/Code/ArgInfoDefinition.php b/Library/Code/ArgInfoDefinition.php index 4a2fd02aa6..029bc97791 100644 --- a/Library/Code/ArgInfoDefinition.php +++ b/Library/Code/ArgInfoDefinition.php @@ -13,13 +13,12 @@ namespace Zephir\Code; +use Zephir\Class\Entry; use Zephir\Class\Method\Method; use Zephir\Class\Method\Parameters; use Zephir\CompilationContext; use Zephir\Exception; -use function Zephir\escape_class; - class ArgInfoDefinition { private ?Parameters $parameters; @@ -125,7 +124,7 @@ private function richRenderStart(): void { if (\array_key_exists('object', $this->functionLike->getReturnTypes()) && 1 === \count($this->functionLike->getReturnClassTypes())) { $class = key($this->functionLike->getReturnClassTypes()); - $class = escape_class($this->compilationContext->getFullName($class)); + $class = Entry::escape($this->compilationContext->getFullName($class)); $this->codePrinter->output( sprintf( @@ -345,7 +344,7 @@ private function renderEnd(): void "\tZEND_ARG_OBJ_INFO(%d, %s, %s, %d)", $this->passByReference($parameter), $parameter['name'], - escape_class($this->compilationContext->getFullName($parameter['cast']['value'])), + Entry::escape($this->compilationContext->getFullName($parameter['cast']['value'])), (int) $this->allowNull($parameter) ) ); diff --git a/Library/Operators/Other/InstanceOfOperator.php b/Library/Operators/Other/InstanceOfOperator.php index a1b9bedfee..f7eac3c004 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/Library/Operators/Other/InstanceOfOperator.php @@ -21,8 +21,6 @@ use Zephir\Expression; use Zephir\Operators\AbstractOperator; -use function Zephir\escape_class; - /** * Checks if a variable is an instance of a class */ @@ -85,13 +83,13 @@ public function compile($expression, CompilationContext $context): CompiledExpre $classEntry = $classDefinition->getClassEntry($context); } else { if (!class_exists($className, false)) { - $code = 'SL("'.trim(escape_class($className), '\\').'")'; + $code = 'SL("'.trim(Entry::escape($className), '\\').'")'; } else { $entry = (new Entry($resolvedVariable, $context)); $classEntry = $entry->get(); if (!$entry->isInternal()) { - $code = 'SL("'.trim(escape_class($className), '\\').'")'; + $code = 'SL("'.trim(Entry::escape($className), '\\').'")'; } } } diff --git a/Library/Operators/Other/NewInstanceOperator.php b/Library/Operators/Other/NewInstanceOperator.php index 6787949683..4b96cff893 100644 --- a/Library/Operators/Other/NewInstanceOperator.php +++ b/Library/Operators/Other/NewInstanceOperator.php @@ -22,8 +22,6 @@ use Zephir\MethodCall; use Zephir\Operators\AbstractOperator; -use function Zephir\escape_class; - /** * Creates a new instance of a class */ @@ -151,7 +149,7 @@ public function compile(array $expression, CompilationContext $compilationContex 'Class "'.$className.'" does not exist at compile time', ['nonexistent-class', $expression] ); - $classNameToFetch = 'SL("'.escape_class($className).'")'; + $classNameToFetch = 'SL("'.Entry::escape($className).'")'; $zendClassEntry = $compilationContext->cacheManager->getClassEntryCache()->get($classNameToFetch, false, $compilationContext); $classEntry = $zendClassEntry->getName(); diff --git a/Library/functions.php b/Library/functions.php index 39755a2443..9c9990428b 100644 --- a/Library/functions.php +++ b/Library/functions.php @@ -25,18 +25,6 @@ function camelize($string) return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); } -/** - * Prepares a class name to be used as a C-string. - * - * @param string $className - * - * @return string - */ -function escape_class($className) -{ - return str_replace('\\', '\\\\', $className); -} - /** * Prepares a string to be used as a C-string. * diff --git a/tests/Zephir/Class/EntryTest.php b/tests/Zephir/Class/EntryTest.php new file mode 100644 index 0000000000..a58522ac57 --- /dev/null +++ b/tests/Zephir/Class/EntryTest.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Test\Class; + +use PHPUnit\Framework\TestCase; +use Zephir\Class\Entry; + +final class EntryTest extends TestCase +{ + public function testShouldEscapeClassName(): void + { + $classname = '\Bar\Foo'; + $this->assertSame( + Entry::escape($classname), + '\\\\Bar\\\\Foo' + ); + } +} diff --git a/tests/Zephir/HelpersTest.php b/tests/Zephir/HelpersTest.php index 376d81467d..c21db61d84 100644 --- a/tests/Zephir/HelpersTest.php +++ b/tests/Zephir/HelpersTest.php @@ -17,19 +17,9 @@ use function Zephir\add_slashes; use function Zephir\camelize; -use function Zephir\escape_class; final class HelpersTest extends TestCase { - public function testShouldEscapeClassName(): void - { - $classname = '\Bar\Foo'; - $this->assertSame( - escape_class($classname), - '\\\\Bar\\\\Foo' - ); - } - public function testShouldCamelizeClassName(): void { $name = 'foo_Bar_Foo_bar'; From 17524785f3eb7294d70f88c7548507e18607465a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 28 Oct 2023 23:10:35 +0100 Subject: [PATCH 089/375] #2407 - Update composer.lock --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 84653db5d7..1151b80e0d 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "monolog/monolog", - "version": "2.9.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1" + "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437cb3628f4cf6042cc10ae97fc2b8472e48ca1f", + "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f", "shasum": "" }, "require": { @@ -94,7 +94,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.9.1" + "source": "https://github.com/Seldaek/monolog/tree/2.9.2" }, "funding": [ { @@ -106,7 +106,7 @@ "type": "tidelift" } ], - "time": "2023-02-06T13:44:46+00:00" + "time": "2023-10-27T15:25:26+00:00" }, { "name": "psr/container", @@ -1550,16 +1550,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.27", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { @@ -1616,7 +1616,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, "funding": [ { @@ -1624,7 +1624,7 @@ "type": "github" } ], - "time": "2023-07-26T13:44:30+00:00" + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3005,5 +3005,5 @@ "ext-pdo_sqlite": "*", "ext-zip": "*" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 7c3d6303633b3576d0218b2f30a8e88a35cf1228 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 28 Oct 2023 23:26:51 +0100 Subject: [PATCH 090/375] #2407 - Fix CS --- Library/Backend/Backend.php | 19 +++++++++---------- Library/CompilerFile.php | 2 +- Library/Passes/LocalContextPass.php | 6 +++--- Library/Passes/SkipVariantInit.php | 4 +--- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index b5187a8267..6d03c484a5 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -27,7 +27,6 @@ use Zephir\Variable\Globals; use Zephir\Variable\Variable; -use function in_array; use function Zephir\add_slashes; class Backend @@ -116,8 +115,8 @@ public function initVar(Variable $variable, CompilationContext $context, $useCod public function getVariableCode(Variable $variable): string { if ($variable->isDoublePointer() - || in_array($variable->getName(), ['this_ptr', 'return_value']) - || in_array($variable->getType(), ['int', 'long'])) { + || \in_array($variable->getName(), ['this_ptr', 'return_value']) + || \in_array($variable->getType(), ['int', 'long'])) { return $variable->getName(); } @@ -337,7 +336,7 @@ public function onPostCompile(Method $method, CompilationContext $context): void public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) { - $isComplex = in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); + $isComplex = \in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); if ($isComplex && !$variable->isDoublePointer()) { $groupVariables[] = $variable->getName(); @@ -640,7 +639,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'; } } @@ -765,16 +764,16 @@ public function arrayIssetFetch2(Variable $target, Variable $var, $resolvedExpr, if (!($resolvedExpr instanceof Variable)) { if ('string' === $resolvedExpr->getType()) { return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { + } elseif (\in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression); } else { $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); } } - if (in_array($resolvedExpr->getType(), ['int', 'long'])) { + if (\in_array($resolvedExpr->getType(), ['int', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { + } elseif (\in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); } @@ -983,7 +982,7 @@ public function resolveValue($value, CompilationContext $context): Variable | bo $value = $this->getVariableCode($tempVariable); } else { if ($value instanceof CompiledExpression) { - if (in_array($value->getType(), ['array', 'variable', 'mixed'])) { + if (\in_array($value->getType(), ['array', 'variable', 'mixed'])) { $value = $context->symbolTable->getVariableForWrite($value->getCode(), $context); } else { return $value->getCode(); @@ -1414,7 +1413,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA $arrayAccess['right'] ); } - if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { + if ($isVariable && \in_array($index->getType(), ['variable', 'string', 'mixed'])) { $output = 'zephir_array_fetch('.$this->getVariableCode($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; } else { if ($isVariable) { diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index b3722bb9c1..03c4042f06 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -893,7 +893,7 @@ public function applyClassHeaders(CompilationContext $compilationContext) $separators = str_repeat('../', \count(explode('\\', $classDefinition->getCompleteName())) - 1); - $code = PHP_EOL; + $code = PHP_EOL; $code .= '#ifdef HAVE_CONFIG_H'.PHP_EOL; $code .= '#include "'.$separators.'ext_config.h"'.PHP_EOL; $code .= '#endif'.PHP_EOL; diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index aee0d95638..395fc75fb5 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -57,9 +57,9 @@ public function declareVariables(array $statement): void foreach ($statement['variables'] as $variable) { if (isset($variable['expr'])) { if ( - 'string' === $variable['expr']['type'] || - 'empty-array' === $variable['expr']['type'] || - 'array' === $variable['expr']['type'] + 'string' === $variable['expr']['type'] + || 'empty-array' === $variable['expr']['type'] + || 'array' === $variable['expr']['type'] ) { $this->variables[$variable['variable']] = false; continue; diff --git a/Library/Passes/SkipVariantInit.php b/Library/Passes/SkipVariantInit.php index 9864cc534a..1fd968bac5 100644 --- a/Library/Passes/SkipVariantInit.php +++ b/Library/Passes/SkipVariantInit.php @@ -15,8 +15,6 @@ use Zephir\StatementsBlock; -use function count; - /** * In 'if'/'else' statements sometimes dynamical variables are initialized in every branch * Same case in 'switch' statements @@ -95,7 +93,7 @@ public function getVariables(): array } $variables = []; - $numberBranches = count($this->branches); + $numberBranches = \count($this->branches); foreach ($variableStats as $variable => $number) { if ($number == $numberBranches) { $variables[] = $variable; From 16517c896385129f65706b3d4b8d32e4ab97f653 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 28 Oct 2023 23:27:10 +0100 Subject: [PATCH 091/375] #2407 - Bump version of `PHP_CS_FIXER_VERSION` variable to `3.37.0` --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 96e5fcb419..433e64637b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 env: - PHP_CS_FIXER_VERSION: 3.26.1 + PHP_CS_FIXER_VERSION: 3.37.0 with: php-version: '8.0' coverage: none From 3cf64393b097c2cc45c983788935cc4723ac2e1f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 10:39:34 +0000 Subject: [PATCH 092/375] #2407 - Fix CS --- Library/Passes/LocalContextPass.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index 395fc75fb5..efa8cb5acc 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -56,8 +56,7 @@ public function declareVariables(array $statement): void foreach ($statement['variables'] as $variable) { if (isset($variable['expr'])) { - if ( - 'string' === $variable['expr']['type'] + if ('string' === $variable['expr']['type'] || 'empty-array' === $variable['expr']['type'] || 'array' === $variable['expr']['type'] ) { From ab1ffb17306f86838332090ab4284a3899012488 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 10:40:32 +0000 Subject: [PATCH 093/375] #2407 - Change to 'require_once' --- Library/Class/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index 78edc8227a..ce39db954e 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -39,7 +39,7 @@ class Entry public function __construct(string $className, private CompilationContext $compilationContext) { $this->classname = $this->compilationContext->getFullName($className); - $this->classEntries = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; + $this->classEntries = require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; foreach ($this->classEntries as $key => $val) { unset($this->classEntries[$key]); From 1dd4c8a003e868bc1b5e381d04befe7f326ee274 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 10:49:05 +0000 Subject: [PATCH 094/375] #2407 - Change from switch to if --- Library/Backend/Backend.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 6d03c484a5..7d84f80b91 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -135,12 +135,10 @@ public function getBoolCode(Variable $variable, CompilationContext $context, $us public function getTypeDefinition($type): array { - switch ($type) { - case 'zend_ulong': - return ['', 'zend_ulong']; - - case 'zend_string': - return ['*', 'zend_string']; + if ($type === 'zend_ulong') { + return ['', 'zend_ulong']; + } elseif ($type === 'zend_string') { + return ['*', 'zend_string']; } $pointer = null; From c0ae9c1f430b55e0528014a0975688d34f6efe0c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 10:52:23 +0000 Subject: [PATCH 095/375] #2407 - Replace switch to match --- Library/Backend/Backend.php | 58 ++++++++----------------------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 7d84f80b91..799525349e 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -249,52 +249,18 @@ public function getTypeofCondition( ): string { $variableName = $this->getVariableCode($variableVariable); - switch ($value) { - case 'array': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_ARRAY'; - break; - - case 'object': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_OBJECT'; - break; - - case 'null': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_NULL'; - break; - - case 'string': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_STRING'; - break; - - case 'int': - case 'long': - case 'integer': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_LONG'; - break; - - case 'double': - case 'float': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_DOUBLE'; - break; - - case 'boolean': - case 'bool': - $condition = '((Z_TYPE_P('.$variableName.') == IS_TRUE || Z_TYPE_P('.$variableName.') == IS_FALSE) '.$operator.' 1)'; - break; - - case 'resource': - $condition = 'Z_TYPE_P('.$variableName.') '.$operator.' IS_RESOURCE'; - break; - - case 'callable': - $condition = 'zephir_is_callable('.$variableName.') '.$operator.' 1'; - break; - - default: - throw new CompilerException(sprintf('Unknown type: "%s" in typeof comparison', $value)); - } - - return $condition; + return match ($value) { + 'array' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_ARRAY', + 'object' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_OBJECT', + 'null' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_NULL', + 'string' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_STRING', + 'int', 'long', 'integer' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_LONG', + 'double', 'float' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_DOUBLE', + 'boolean', 'bool' => '((Z_TYPE_P(' . $variableName . ') == IS_TRUE || Z_TYPE_P(' . $variableName . ') == IS_FALSE) ' . $operator . ' 1)', + 'resource' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_RESOURCE', + 'callable' => 'zephir_is_callable(' . $variableName . ') ' . $operator . ' 1', + default => throw new CompilerException(sprintf('Unknown type: "%s" in typeof comparison', $value)), + }; } public function onPreInitVar(Method $method): string From 0945f048f037e0df675076e715bb4ed64ac809bd Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 11:02:48 +0000 Subject: [PATCH 096/375] #2407 - Fix return type --- Library/Backend/Backend.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index 799525349e..e9845001bd 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -298,34 +298,30 @@ public function onPostCompile(Method $method, CompilationContext $context): void } } - public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable) + public function generateInitCode(&$groupVariables, $type, $pointer, Variable $variable): ?string { $isComplex = \in_array($type, ['variable', 'string', 'array', 'resource', 'callable', 'object', 'mixed'], true); if ($isComplex && !$variable->isDoublePointer()) { $groupVariables[] = $variable->getName(); - switch ($variable->getRealname()) { - case '__$null': - return "\t".'ZVAL_NULL(&'.$variable->getName().');'; - case '__$true': - return "\t".'ZVAL_BOOL(&'.$variable->getName().', 1);'; - case '__$false': - return "\t".'ZVAL_BOOL(&'.$variable->getName().', 0);'; - default: - return "\t".'ZVAL_UNDEF(&'.$variable->getName().');'; - } + return match ($variable->getRealname()) { + '__$null' => "\t" . 'ZVAL_NULL(&' . $variable->getName() . ');', + '__$true' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 1);', + '__$false' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 0);', + default => "\t" . 'ZVAL_UNDEF(&' . $variable->getName() . ');', + }; } if ($variable->isLocalOnly()) { $groupVariables[] = $variable->getName(); - return; + return null; } if ($variable->isSuperGlobal()) { $groupVariables[] = $variable->getName(); - return; + return null; } if ($variable->isDoublePointer()) { @@ -337,7 +333,7 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va $groupVariables[] = $ptr.$variable->getName(); } - return; + return null; } $defaultValue = $variable->getDefaultInitValue(); @@ -369,16 +365,18 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va break; } - return; + return null; } if ($variable->mustInitNull() && $pointer) { $groupVariables[] = $pointer.$variable->getName().' = NULL'; - return; + return null; } $groupVariables[] = $pointer.$variable->getName(); + + return null; } /** From d3190468a41bd9d5b1ea1bce010da9e9150e74f9 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 20:18:15 +0000 Subject: [PATCH 097/375] #2407 - Change to `require` --- Library/Class/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Class/Entry.php b/Library/Class/Entry.php index ce39db954e..78edc8227a 100644 --- a/Library/Class/Entry.php +++ b/Library/Class/Entry.php @@ -39,7 +39,7 @@ class Entry public function __construct(string $className, private CompilationContext $compilationContext) { $this->classname = $this->compilationContext->getFullName($className); - $this->classEntries = require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; + $this->classEntries = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/class-entries.php'; foreach ($this->classEntries as $key => $val) { unset($this->classEntries[$key]); From 5b8e2b1680cf80569f44c5bf7a0eae71db8eadb7 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 20:18:24 +0000 Subject: [PATCH 098/375] #2407 - Fix CS --- Library/Backend/Backend.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index e9845001bd..c37867a6d5 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -250,15 +250,15 @@ public function getTypeofCondition( $variableName = $this->getVariableCode($variableVariable); return match ($value) { - 'array' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_ARRAY', - 'object' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_OBJECT', - 'null' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_NULL', - 'string' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_STRING', - 'int', 'long', 'integer' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_LONG', - 'double', 'float' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_DOUBLE', - 'boolean', 'bool' => '((Z_TYPE_P(' . $variableName . ') == IS_TRUE || Z_TYPE_P(' . $variableName . ') == IS_FALSE) ' . $operator . ' 1)', - 'resource' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_RESOURCE', - 'callable' => 'zephir_is_callable(' . $variableName . ') ' . $operator . ' 1', + 'array' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_ARRAY', + 'object' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_OBJECT', + 'null' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_NULL', + 'string' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_STRING', + 'int', 'long', 'integer' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_LONG', + 'double', 'float' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_DOUBLE', + 'boolean', 'bool' => '((Z_TYPE_P('.$variableName.') == IS_TRUE || Z_TYPE_P('.$variableName.') == IS_FALSE) '.$operator.' 1)', + 'resource' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_RESOURCE', + 'callable' => 'zephir_is_callable('.$variableName.') '.$operator.' 1', default => throw new CompilerException(sprintf('Unknown type: "%s" in typeof comparison', $value)), }; } @@ -304,11 +304,12 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va if ($isComplex && !$variable->isDoublePointer()) { $groupVariables[] = $variable->getName(); + return match ($variable->getRealname()) { - '__$null' => "\t" . 'ZVAL_NULL(&' . $variable->getName() . ');', - '__$true' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 1);', - '__$false' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 0);', - default => "\t" . 'ZVAL_UNDEF(&' . $variable->getName() . ');', + '__$null' => "\t".'ZVAL_NULL(&'.$variable->getName().');', + '__$true' => "\t".'ZVAL_BOOL(&'.$variable->getName().', 1);', + '__$false' => "\t".'ZVAL_BOOL(&'.$variable->getName().', 0);', + default => "\t".'ZVAL_UNDEF(&'.$variable->getName().');', }; } From a41f4f6d6ab003f5175cf3aef7c5da9f865ba0bf Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 20:54:44 +0000 Subject: [PATCH 099/375] Update badges --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 267f5cf880..c3f9080951 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # [![Zephir][zephir logo]][web site] +[![Discord][discord-badge]](https://phalcon.io/discord) [![Build on Linux|macOS|Windows][actions main]][actions link] -[![Nightly Builds on Linux][actions nightly]][actions link] [![Latest Stable Version][version badge]][packagist link] +[![PHP from Packagist][packagist ver]][packagist link] +[![Packagist][packagist dd]][packagist stats] [![MIT License][license badge]](./LICENSE) [Zephir][web site] - is a high level programming language that eases the creation and maintainability of extensions for PHP. @@ -56,8 +58,11 @@ Zephir licensed under the MIT License. See the [LICENSE](./LICENSE) file for mor [actions link]: https://github.com/zephir-lang/zephir/actions [actions main]: https://github.com/zephir-lang/zephir/actions/workflows/main.yml/badge.svg -[actions nightly]: https://github.com/zephir-lang/zephir/actions/workflows/nightly.yml/badge.svg [version badge]: https://poser.pugx.org/phalcon/zephir/v/stable.svg [packagist link]: https://packagist.org/packages/phalcon/zephir +[packagist dd]: https://img.shields.io/packagist/dd/phalcon/zephir +[packagist stats]: https://packagist.org/packages/phalcon/zephir/stats +[packagist ver]: https://img.shields.io/packagist/php-v/phalcon/migrations [license badge]: https://poser.pugx.org/phalcon/zephir/license.svg +[discord-badge]: https://img.shields.io/discord/310910488152375297?label=Discord&logo=discord&style=flat-square From 72659ea9919fb4d08a629ad38924818367b3325e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 21:10:09 +0000 Subject: [PATCH 100/375] Rename `Library/` to `src/` --- .php-cs-fixer.dist.php | 4 ++-- box.json.dist | 4 ++-- composer.json | 4 ++-- phpcs.xml.dist | 2 +- phpunit.xml.dist | 2 +- {Library => src}/AliasManager.php | 0 {Library => src}/Backend/Backend.php | 0 {Library => src}/Backend/FcallManager.php | 0 {Library => src}/Backend/FcallManagerInterface.php | 0 {Library => src}/Backend/StringsManager.php | 0 {Library => src}/Backend/VariablesManager.php | 0 {Library => src}/Branch.php | 0 {Library => src}/BranchManager.php | 0 {Library => src}/Builder/FunctionCallBuilder.php | 0 .../Builder/Operators/AbstractOperatorBuilder.php | 0 {Library => src}/Builder/Operators/CastOperatorBuilder.php | 0 {Library => src}/Builder/Operators/UnaryOperatorBuilder.php | 0 .../Builder/Statements/AbstractStatementBuilder.php | 0 {Library => src}/Builder/Statements/IfStatementBuilder.php | 0 {Library => src}/Builder/Statements/LetStatementBuilder.php | 0 {Library => src}/Builder/StatementsBlockBuilder.php | 0 {Library => src}/Cache/ClassEntryCache.php | 0 {Library => src}/Cache/FunctionCache.php | 0 {Library => src}/Cache/Manager.php | 0 {Library => src}/Cache/MethodCache.php | 0 {Library => src}/Cache/SlotsCache.php | 0 {Library => src}/Cache/StaticMethodCache.php | 0 {Library => src}/Call.php | 0 {Library => src}/Class/Constant.php | 0 {Library => src}/Class/Definition/AbstractDefinition.php | 0 {Library => src}/Class/Definition/Definition.php | 0 {Library => src}/Class/Definition/DefinitionRuntime.php | 0 {Library => src}/Class/Entry.php | 0 {Library => src}/Class/Method/Method.php | 0 {Library => src}/Class/Method/Parameters.php | 0 {Library => src}/Class/Property.php | 0 {Library => src}/Code/ArgInfoDefinition.php | 0 {Library => src}/Code/Builder/Struct.php | 0 {Library => src}/Code/Printer.php | 0 {Library => src}/CompilationContext.php | 0 {Library => src}/CompiledExpression.php | 0 {Library => src}/Compiler.php | 0 {Library => src}/Compiler/CompilerFileFactory.php | 0 {Library => src}/Compiler/FileInterface.php | 0 {Library => src}/CompilerFile.php | 0 {Library => src}/CompilerFileAnonymous.php | 0 {Library => src}/Config.php | 0 {Library => src}/ConfigException.php | 0 {Library => src}/Console/Application.php | 0 {Library => src}/Console/Command/AbstractCommand.php | 0 {Library => src}/Console/Command/ApiCommand.php | 0 {Library => src}/Console/Command/BuildCommand.php | 0 {Library => src}/Console/Command/CleanCommand.php | 0 {Library => src}/Console/Command/CompileCommand.php | 0 .../Console/Command/DevelopmentModeAwareTrait.php | 0 {Library => src}/Console/Command/FullCleanCommand.php | 0 {Library => src}/Console/Command/GenerateCommand.php | 0 {Library => src}/Console/Command/InitCommand.php | 0 {Library => src}/Console/Command/InstallCommand.php | 0 {Library => src}/Console/Command/ListCommand.php | 0 {Library => src}/Console/Command/RemoveOptionsTrait.php | 0 {Library => src}/Console/Command/StubsCommand.php | 0 {Library => src}/Console/Command/ZflagsAwareTrait.php | 0 {Library => src}/Console/ErrorListener.php | 0 {Library => src}/Detectors/ForValueUseDetector.php | 0 {Library => src}/Detectors/ReadDetector.php | 0 {Library => src}/Detectors/WriteDetector.php | 0 {Library => src}/Documentation.php | 0 {Library => src}/Documentation/Annotation.php | 0 {Library => src}/Documentation/Annotation/Link.php | 0 .../Documentation/Annotation/ReturnAnnotation.php | 0 {Library => src}/Documentation/Annotation/See.php | 0 {Library => src}/Documentation/Docblock.php | 0 {Library => src}/Documentation/DocblockParser.php | 0 {Library => src}/Documentation/File/ClassFile.php | 0 {Library => src}/Documentation/File/ClassesFile.php | 0 {Library => src}/Documentation/File/IndexFile.php | 0 {Library => src}/Documentation/File/NamespaceFile.php | 0 {Library => src}/Documentation/File/NamespacesFile.php | 0 {Library => src}/Documentation/File/Sitemap.php | 0 {Library => src}/Documentation/File/SourceFile.php | 0 {Library => src}/Documentation/FileInterface.php | 0 {Library => src}/Documentation/NamespaceAccessor.php | 0 {Library => src}/Documentation/NamespaceHelper.php | 0 {Library => src}/Documentation/Template.php | 0 {Library => src}/Documentation/Theme.php | 0 {Library => src}/Exception.php | 0 {Library => src}/Exception/CompilerException.php | 0 {Library => src}/Exception/ExceptionExtraAwareTrait.php | 0 {Library => src}/Exception/ExceptionInterface.php | 0 {Library => src}/Exception/FileSystemException.php | 0 {Library => src}/Exception/IllegalOperationException.php | 0 {Library => src}/Exception/IllegalStateException.php | 0 {Library => src}/Exception/InvalidArgumentException.php | 0 {Library => src}/Exception/InvalidTypeException.php | 0 {Library => src}/Exception/LogicException.php | 0 {Library => src}/Exception/NotImplementedException.php | 0 {Library => src}/Exception/ParseException.php | 0 {Library => src}/Exception/RuntimeException.php | 0 {Library => src}/Expression.php | 0 {Library => src}/Expression/Builder/AbstractBuilder.php | 0 {Library => src}/Expression/Builder/BuilderFactory.php | 0 .../Expression/Builder/Factory/OperatorsFactory.php | 0 .../Expression/Builder/Factory/StatementsFactory.php | 0 .../Expression/Builder/Operators/AbstractOperator.php | 0 .../Expression/Builder/Operators/AssignPropertyOperator.php | 0 .../Expression/Builder/Operators/AssignVariableOperator.php | 0 .../Expression/Builder/Operators/BinaryOperator.php | 0 {Library => src}/Expression/Builder/Operators/RawOperator.php | 0 .../Expression/Builder/Operators/UnaryOperator.php | 0 {Library => src}/Expression/Builder/RawExpression.php | 0 .../Expression/Builder/Statements/AbstractStatement.php | 0 .../Expression/Builder/Statements/CallFunctionStatement.php | 0 .../Expression/Builder/Statements/CallMethodStatement.php | 0 .../Expression/Builder/Statements/CallStaticStatement.php | 0 .../Expression/Builder/Statements/IfStatement.php | 0 .../Expression/Builder/Statements/LetStatement.php | 0 .../Expression/Builder/Statements/RawStatement.php | 0 .../Expression/Builder/Statements/StatementsBlock.php | 0 {Library => src}/Expression/Closure.php | 0 {Library => src}/Expression/ClosureArrow.php | 0 {Library => src}/Expression/Constants.php | 0 {Library => src}/Expression/NativeArray.php | 0 {Library => src}/Expression/NativeArrayAccess.php | 0 {Library => src}/Expression/PropertyAccess.php | 0 {Library => src}/Expression/PropertyDynamicAccess.php | 0 {Library => src}/Expression/Reference.php | 0 {Library => src}/Expression/StaticConstantAccess.php | 0 {Library => src}/Expression/StaticPropertyAccess.php | 0 {Library => src}/FileSystem/FileSystemInterface.php | 0 {Library => src}/FileSystem/HardDisk.php | 0 {Library => src}/FunctionCall.php | 0 {Library => src}/FunctionDefinition.php | 0 {Library => src}/GlobalConstant.php | 0 {Library => src}/HeadersManager.php | 0 {Library => src}/LiteralCompiledExpression.php | 0 {Library => src}/Logger/Formatter/CompilerFormatter.php | 0 {Library => src}/MethodCall.php | 0 {Library => src}/Operators/AbstractOperator.php | 0 {Library => src}/Operators/Arithmetical/AddOperator.php | 0 .../Operators/Arithmetical/ArithmeticalBaseOperator.php | 0 {Library => src}/Operators/Arithmetical/DivOperator.php | 0 {Library => src}/Operators/Arithmetical/ModOperator.php | 0 {Library => src}/Operators/Arithmetical/MulOperator.php | 0 {Library => src}/Operators/Arithmetical/SubOperator.php | 0 {Library => src}/Operators/Bitwise/BitwiseAndOperator.php | 0 {Library => src}/Operators/Bitwise/BitwiseBaseOperator.php | 0 {Library => src}/Operators/Bitwise/BitwiseNotOperator.php | 0 {Library => src}/Operators/Bitwise/BitwiseOrOperator.php | 0 {Library => src}/Operators/Bitwise/BitwiseXorOperator.php | 0 {Library => src}/Operators/Bitwise/ShiftLeftOperator.php | 0 {Library => src}/Operators/Bitwise/ShiftRightOperator.php | 0 .../Operators/Comparison/ComparisonBaseOperator.php | 0 {Library => src}/Operators/Comparison/EqualsOperator.php | 0 .../Operators/Comparison/GreaterEqualOperator.php | 0 {Library => src}/Operators/Comparison/GreaterOperator.php | 0 {Library => src}/Operators/Comparison/IdenticalOperator.php | 0 {Library => src}/Operators/Comparison/LessEqualOperator.php | 0 {Library => src}/Operators/Comparison/LessOperator.php | 0 {Library => src}/Operators/Comparison/NotEqualsOperator.php | 0 .../Operators/Comparison/NotIdenticalOperator.php | 0 {Library => src}/Operators/Logical/AndOperator.php | 0 {Library => src}/Operators/Logical/LogicalBaseOperator.php | 0 {Library => src}/Operators/Logical/OrOperator.php | 0 {Library => src}/Operators/Other/CastOperator.php | 0 {Library => src}/Operators/Other/CloneOperator.php | 0 {Library => src}/Operators/Other/ConcatOperator.php | 0 {Library => src}/Operators/Other/EmptyOperator.php | 0 {Library => src}/Operators/Other/FetchOperator.php | 0 {Library => src}/Operators/Other/InstanceOfOperator.php | 0 {Library => src}/Operators/Other/IssetOperator.php | 0 {Library => src}/Operators/Other/LikelyOperator.php | 0 {Library => src}/Operators/Other/NewInstanceOperator.php | 0 {Library => src}/Operators/Other/NewInstanceTypeOperator.php | 0 {Library => src}/Operators/Other/RangeExclusiveOperator.php | 0 {Library => src}/Operators/Other/RangeInclusiveOperator.php | 0 {Library => src}/Operators/Other/RequireOnceOperator.php | 0 {Library => src}/Operators/Other/RequireOperator.php | 0 {Library => src}/Operators/Other/ShortTernaryOperator.php | 0 {Library => src}/Operators/Other/TernaryOperator.php | 0 {Library => src}/Operators/Other/TypeHintOperator.php | 0 {Library => src}/Operators/Other/TypeOfOperator.php | 0 {Library => src}/Operators/Other/UnlikelyOperator.php | 0 {Library => src}/Operators/Unary/MinusOperator.php | 0 {Library => src}/Operators/Unary/NotOperator.php | 0 {Library => src}/Optimizers/EvalExpression.php | 0 {Library => src}/Optimizers/FunctionCall/ACosOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/ASinOptimizer.php | 0 .../Optimizers/FunctionCall/AddslashesOptimizer.php | 0 .../Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php | 0 .../Optimizers/FunctionCall/ArrayKeysOptimizer.php | 0 .../Optimizers/FunctionCall/ArrayMergeOptimizer.php | 0 .../Optimizers/FunctionCall/BasenameOptimizer.php | 0 .../Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php | 0 .../Optimizers/FunctionCall/CallUserFuncOptimizer.php | 0 .../Optimizers/FunctionCall/CamelizeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/CeilOptimizer.php | 0 .../Optimizers/FunctionCall/ClassExistsOptimizer.php | 0 .../Optimizers/FunctionCall/CompareMtimeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/CosOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/CountOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/Crc32Optimizer.php | 0 .../Optimizers/FunctionCall/CreateArrayOptimizer.php | 0 .../Optimizers/FunctionCall/CreateInstanceOptimizer.php | 0 .../Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php | 0 .../Optimizers/FunctionCall/CreateSymbolTableOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/DieOptimizer.php | 0 .../Optimizers/FunctionCall/DoublevalOptimizer.php | 0 .../Optimizers/FunctionCall/EndsWithOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/EvalOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/ExitOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/ExplodeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/FcloseOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/FeofOptimizer.php | 0 .../Optimizers/FunctionCall/FileExistsOptimizer.php | 0 .../Optimizers/FunctionCall/FileGetContentsOptimizer.php | 0 .../Optimizers/FunctionCall/FilePutContentsOptimizer.php | 0 .../Optimizers/FunctionCall/FilemtimeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/FloorOptimizer.php | 0 .../Optimizers/FunctionCall/FuncGetArgOptimizer.php | 0 .../Optimizers/FunctionCall/FuncGetArgsOptimizer.php | 0 .../Optimizers/FunctionCall/FuncNumArgsOptimizer.php | 0 .../Optimizers/FunctionCall/FunctionExistsOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/FwriteOptimizer.php | 0 .../Optimizers/FunctionCall/GetCalledClassOptimizer.php | 0 .../Optimizers/FunctionCall/GetClassLowerOptimizer.php | 0 .../Optimizers/FunctionCall/GetClassNsOptimizer.php | 0 .../Optimizers/FunctionCall/GetClassOptimizer.php | 0 .../Optimizers/FunctionCall/GetDefinedVarsOptimizer.php | 0 .../Optimizers/FunctionCall/GetNsClassOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/GettypeOptimizer.php | 0 .../Optimizers/FunctionCall/GlobalsGetOptimizer.php | 0 .../Optimizers/FunctionCall/GlobalsSetOptimizer.php | 0 .../Optimizers/FunctionCall/HashEqualsOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/ImplodeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/InArrayOptimizer.php | 0 .../Optimizers/FunctionCall/InterfaceExistsOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/IntvalOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/IsArrayOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/IsBoolOptimizer.php | 0 .../Optimizers/FunctionCall/IsCallableOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/IsIntOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/IsNullOptimizer.php | 0 .../Optimizers/FunctionCall/IsNumericOptimizer.php | 0 .../Optimizers/FunctionCall/IsObjectOptimizer.php | 0 .../Optimizers/FunctionCall/IsPhpVersionOptimizer.php | 0 .../Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php | 0 .../Optimizers/FunctionCall/IsResourceOptimizer.php | 0 .../Optimizers/FunctionCall/IsScalarOptimizer.php | 0 .../Optimizers/FunctionCall/IsStringOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/JoinOptimizer.php | 0 .../Optimizers/FunctionCall/JsonDecodeOptimizer.php | 0 .../Optimizers/FunctionCall/JsonEncodeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/LdexpOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/LtrimOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/Md5Optimizer.php | 0 {Library => src}/Optimizers/FunctionCall/MemstrOptimizer.php | 0 .../Optimizers/FunctionCall/MergeAppendOptimizer.php | 0 .../Optimizers/FunctionCall/MethodExistsOptimizer.php | 0 .../Optimizers/FunctionCall/MicrotimeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/PowOptimizer.php | 0 .../Optimizers/FunctionCall/PregMatchAllOptimizer.php | 0 .../Optimizers/FunctionCall/PregMatchOptimizer.php | 0 .../Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/RoundOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/RtrimOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/SinOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/SqrtOptimizer.php | 0 .../Optimizers/FunctionCall/StartsWithOptimizer.php | 0 .../Optimizers/FunctionCall/StrReplaceOptimizer.php | 0 .../Optimizers/FunctionCall/StripcslashesOptimizer.php | 0 .../Optimizers/FunctionCall/StripslashesOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/StrlenOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/StrposOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/StrtokOptimizer.php | 0 .../Optimizers/FunctionCall/StrtolowerOptimizer.php | 0 .../Optimizers/FunctionCall/StrtoupperOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/SubstrOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/TanOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/TimeOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/TrimOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/UcfirstOptimizer.php | 0 .../Optimizers/FunctionCall/UncamelizeOptimizer.php | 0 .../Optimizers/FunctionCall/UniqueKeyOptimizer.php | 0 .../Optimizers/FunctionCall/UniquePathKeyOptimizer.php | 0 {Library => src}/Optimizers/FunctionCall/VarDumpOptimizer.php | 0 .../Optimizers/FunctionCall/VarExportOptimizer.php | 0 .../Optimizers/FunctionCall/ZephirStringToHexOptimizer.php | 0 {Library => src}/Optimizers/IsTypeOptimizerAbstract.php | 0 {Library => src}/Optimizers/MathOptimizer.php | 0 {Library => src}/Optimizers/OptimizerAbstract.php | 0 {Library => src}/Parser/Manager.php | 0 {Library => src}/Parser/Parser.php | 0 {Library => src}/Passes/CallGathererPass.php | 0 {Library => src}/Passes/LocalContextPass.php | 0 {Library => src}/Passes/LoopBreakPass.php | 0 {Library => src}/Passes/MutateGathererPass.php | 0 {Library => src}/Passes/SkipVariantInit.php | 0 {Library => src}/Passes/StaticTypeInference.php | 0 {Library => src}/Statements/BreakStatement.php | 0 {Library => src}/Statements/ContinueStatement.php | 0 {Library => src}/Statements/DeclareStatement.php | 0 {Library => src}/Statements/DoWhileStatement.php | 0 {Library => src}/Statements/EchoStatement.php | 0 {Library => src}/Statements/ForStatement.php | 0 {Library => src}/Statements/IfStatement.php | 0 {Library => src}/Statements/Let/ArrayIndex.php | 0 {Library => src}/Statements/Let/ArrayIndexAppend.php | 0 {Library => src}/Statements/Let/Decr.php | 0 {Library => src}/Statements/Let/ExportSymbol.php | 0 {Library => src}/Statements/Let/ExportSymbolString.php | 0 {Library => src}/Statements/Let/Incr.php | 0 {Library => src}/Statements/Let/ObjectDynamicProperty.php | 0 .../Statements/Let/ObjectDynamicStringProperty.php | 0 {Library => src}/Statements/Let/ObjectProperty.php | 0 {Library => src}/Statements/Let/ObjectPropertyAppend.php | 0 {Library => src}/Statements/Let/ObjectPropertyArrayIndex.php | 0 .../Statements/Let/ObjectPropertyArrayIndexAppend.php | 0 {Library => src}/Statements/Let/ObjectPropertyDecr.php | 0 {Library => src}/Statements/Let/ObjectPropertyIncr.php | 0 {Library => src}/Statements/Let/StaticProperty.php | 0 {Library => src}/Statements/Let/StaticPropertyAdd.php | 0 {Library => src}/Statements/Let/StaticPropertyAppend.php | 0 {Library => src}/Statements/Let/StaticPropertyArrayIndex.php | 0 .../Statements/Let/StaticPropertyArrayIndexAppend.php | 0 {Library => src}/Statements/Let/StaticPropertySub.php | 0 {Library => src}/Statements/Let/Variable.php | 0 {Library => src}/Statements/Let/VariableAppend.php | 0 {Library => src}/Statements/LetStatement.php | 0 {Library => src}/Statements/LoopStatement.php | 0 {Library => src}/Statements/RequireOnceStatement.php | 0 {Library => src}/Statements/RequireStatement.php | 0 {Library => src}/Statements/ReturnStatement.php | 0 {Library => src}/Statements/StatementAbstract.php | 0 {Library => src}/Statements/SwitchStatement.php | 0 {Library => src}/Statements/ThrowStatement.php | 0 {Library => src}/Statements/TryCatchStatement.php | 0 {Library => src}/Statements/UnsetStatement.php | 0 {Library => src}/Statements/WhileStatement.php | 0 {Library => src}/StatementsBlock.php | 0 {Library => src}/StaticCall.php | 0 {Library => src}/StringsManager.php | 0 {Library => src}/Stubs/DocBlock.php | 0 {Library => src}/Stubs/Generator.php | 0 {Library => src}/Stubs/MethodDocBlock.php | 0 {Library => src}/SymbolTable.php | 0 {Library => src}/TypeAwareInterface.php | 0 {Library => src}/Types/AbstractType.php | 0 {Library => src}/Types/ArrayType.php | 0 {Library => src}/Types/CharType.php | 0 {Library => src}/Types/DoubleType.php | 0 {Library => src}/Types/IntType.php | 0 {Library => src}/Types/IstringType.php | 0 {Library => src}/Types/StringType.php | 0 {Library => src}/Types/Types.php | 0 {Library => src}/Variable/Globals.php | 0 {Library => src}/Variable/Variable.php | 0 {Library => src}/Zephir.php | 0 {Library => src}/functions.php | 0 zephir | 2 +- 360 files changed, 9 insertions(+), 9 deletions(-) rename {Library => src}/AliasManager.php (100%) rename {Library => src}/Backend/Backend.php (100%) rename {Library => src}/Backend/FcallManager.php (100%) rename {Library => src}/Backend/FcallManagerInterface.php (100%) rename {Library => src}/Backend/StringsManager.php (100%) rename {Library => src}/Backend/VariablesManager.php (100%) rename {Library => src}/Branch.php (100%) rename {Library => src}/BranchManager.php (100%) rename {Library => src}/Builder/FunctionCallBuilder.php (100%) rename {Library => src}/Builder/Operators/AbstractOperatorBuilder.php (100%) rename {Library => src}/Builder/Operators/CastOperatorBuilder.php (100%) rename {Library => src}/Builder/Operators/UnaryOperatorBuilder.php (100%) rename {Library => src}/Builder/Statements/AbstractStatementBuilder.php (100%) rename {Library => src}/Builder/Statements/IfStatementBuilder.php (100%) rename {Library => src}/Builder/Statements/LetStatementBuilder.php (100%) rename {Library => src}/Builder/StatementsBlockBuilder.php (100%) rename {Library => src}/Cache/ClassEntryCache.php (100%) rename {Library => src}/Cache/FunctionCache.php (100%) rename {Library => src}/Cache/Manager.php (100%) rename {Library => src}/Cache/MethodCache.php (100%) rename {Library => src}/Cache/SlotsCache.php (100%) rename {Library => src}/Cache/StaticMethodCache.php (100%) rename {Library => src}/Call.php (100%) rename {Library => src}/Class/Constant.php (100%) rename {Library => src}/Class/Definition/AbstractDefinition.php (100%) rename {Library => src}/Class/Definition/Definition.php (100%) rename {Library => src}/Class/Definition/DefinitionRuntime.php (100%) rename {Library => src}/Class/Entry.php (100%) rename {Library => src}/Class/Method/Method.php (100%) rename {Library => src}/Class/Method/Parameters.php (100%) rename {Library => src}/Class/Property.php (100%) rename {Library => src}/Code/ArgInfoDefinition.php (100%) rename {Library => src}/Code/Builder/Struct.php (100%) rename {Library => src}/Code/Printer.php (100%) rename {Library => src}/CompilationContext.php (100%) rename {Library => src}/CompiledExpression.php (100%) rename {Library => src}/Compiler.php (100%) rename {Library => src}/Compiler/CompilerFileFactory.php (100%) rename {Library => src}/Compiler/FileInterface.php (100%) rename {Library => src}/CompilerFile.php (100%) rename {Library => src}/CompilerFileAnonymous.php (100%) rename {Library => src}/Config.php (100%) rename {Library => src}/ConfigException.php (100%) rename {Library => src}/Console/Application.php (100%) rename {Library => src}/Console/Command/AbstractCommand.php (100%) rename {Library => src}/Console/Command/ApiCommand.php (100%) rename {Library => src}/Console/Command/BuildCommand.php (100%) rename {Library => src}/Console/Command/CleanCommand.php (100%) rename {Library => src}/Console/Command/CompileCommand.php (100%) rename {Library => src}/Console/Command/DevelopmentModeAwareTrait.php (100%) rename {Library => src}/Console/Command/FullCleanCommand.php (100%) rename {Library => src}/Console/Command/GenerateCommand.php (100%) rename {Library => src}/Console/Command/InitCommand.php (100%) rename {Library => src}/Console/Command/InstallCommand.php (100%) rename {Library => src}/Console/Command/ListCommand.php (100%) rename {Library => src}/Console/Command/RemoveOptionsTrait.php (100%) rename {Library => src}/Console/Command/StubsCommand.php (100%) rename {Library => src}/Console/Command/ZflagsAwareTrait.php (100%) rename {Library => src}/Console/ErrorListener.php (100%) rename {Library => src}/Detectors/ForValueUseDetector.php (100%) rename {Library => src}/Detectors/ReadDetector.php (100%) rename {Library => src}/Detectors/WriteDetector.php (100%) rename {Library => src}/Documentation.php (100%) rename {Library => src}/Documentation/Annotation.php (100%) rename {Library => src}/Documentation/Annotation/Link.php (100%) rename {Library => src}/Documentation/Annotation/ReturnAnnotation.php (100%) rename {Library => src}/Documentation/Annotation/See.php (100%) rename {Library => src}/Documentation/Docblock.php (100%) rename {Library => src}/Documentation/DocblockParser.php (100%) rename {Library => src}/Documentation/File/ClassFile.php (100%) rename {Library => src}/Documentation/File/ClassesFile.php (100%) rename {Library => src}/Documentation/File/IndexFile.php (100%) rename {Library => src}/Documentation/File/NamespaceFile.php (100%) rename {Library => src}/Documentation/File/NamespacesFile.php (100%) rename {Library => src}/Documentation/File/Sitemap.php (100%) rename {Library => src}/Documentation/File/SourceFile.php (100%) rename {Library => src}/Documentation/FileInterface.php (100%) rename {Library => src}/Documentation/NamespaceAccessor.php (100%) rename {Library => src}/Documentation/NamespaceHelper.php (100%) rename {Library => src}/Documentation/Template.php (100%) rename {Library => src}/Documentation/Theme.php (100%) rename {Library => src}/Exception.php (100%) rename {Library => src}/Exception/CompilerException.php (100%) rename {Library => src}/Exception/ExceptionExtraAwareTrait.php (100%) rename {Library => src}/Exception/ExceptionInterface.php (100%) rename {Library => src}/Exception/FileSystemException.php (100%) rename {Library => src}/Exception/IllegalOperationException.php (100%) rename {Library => src}/Exception/IllegalStateException.php (100%) rename {Library => src}/Exception/InvalidArgumentException.php (100%) rename {Library => src}/Exception/InvalidTypeException.php (100%) rename {Library => src}/Exception/LogicException.php (100%) rename {Library => src}/Exception/NotImplementedException.php (100%) rename {Library => src}/Exception/ParseException.php (100%) rename {Library => src}/Exception/RuntimeException.php (100%) rename {Library => src}/Expression.php (100%) rename {Library => src}/Expression/Builder/AbstractBuilder.php (100%) rename {Library => src}/Expression/Builder/BuilderFactory.php (100%) rename {Library => src}/Expression/Builder/Factory/OperatorsFactory.php (100%) rename {Library => src}/Expression/Builder/Factory/StatementsFactory.php (100%) rename {Library => src}/Expression/Builder/Operators/AbstractOperator.php (100%) rename {Library => src}/Expression/Builder/Operators/AssignPropertyOperator.php (100%) rename {Library => src}/Expression/Builder/Operators/AssignVariableOperator.php (100%) rename {Library => src}/Expression/Builder/Operators/BinaryOperator.php (100%) rename {Library => src}/Expression/Builder/Operators/RawOperator.php (100%) rename {Library => src}/Expression/Builder/Operators/UnaryOperator.php (100%) rename {Library => src}/Expression/Builder/RawExpression.php (100%) rename {Library => src}/Expression/Builder/Statements/AbstractStatement.php (100%) rename {Library => src}/Expression/Builder/Statements/CallFunctionStatement.php (100%) rename {Library => src}/Expression/Builder/Statements/CallMethodStatement.php (100%) rename {Library => src}/Expression/Builder/Statements/CallStaticStatement.php (100%) rename {Library => src}/Expression/Builder/Statements/IfStatement.php (100%) rename {Library => src}/Expression/Builder/Statements/LetStatement.php (100%) rename {Library => src}/Expression/Builder/Statements/RawStatement.php (100%) rename {Library => src}/Expression/Builder/Statements/StatementsBlock.php (100%) rename {Library => src}/Expression/Closure.php (100%) rename {Library => src}/Expression/ClosureArrow.php (100%) rename {Library => src}/Expression/Constants.php (100%) rename {Library => src}/Expression/NativeArray.php (100%) rename {Library => src}/Expression/NativeArrayAccess.php (100%) rename {Library => src}/Expression/PropertyAccess.php (100%) rename {Library => src}/Expression/PropertyDynamicAccess.php (100%) rename {Library => src}/Expression/Reference.php (100%) rename {Library => src}/Expression/StaticConstantAccess.php (100%) rename {Library => src}/Expression/StaticPropertyAccess.php (100%) rename {Library => src}/FileSystem/FileSystemInterface.php (100%) rename {Library => src}/FileSystem/HardDisk.php (100%) rename {Library => src}/FunctionCall.php (100%) rename {Library => src}/FunctionDefinition.php (100%) rename {Library => src}/GlobalConstant.php (100%) rename {Library => src}/HeadersManager.php (100%) rename {Library => src}/LiteralCompiledExpression.php (100%) rename {Library => src}/Logger/Formatter/CompilerFormatter.php (100%) rename {Library => src}/MethodCall.php (100%) rename {Library => src}/Operators/AbstractOperator.php (100%) rename {Library => src}/Operators/Arithmetical/AddOperator.php (100%) rename {Library => src}/Operators/Arithmetical/ArithmeticalBaseOperator.php (100%) rename {Library => src}/Operators/Arithmetical/DivOperator.php (100%) rename {Library => src}/Operators/Arithmetical/ModOperator.php (100%) rename {Library => src}/Operators/Arithmetical/MulOperator.php (100%) rename {Library => src}/Operators/Arithmetical/SubOperator.php (100%) rename {Library => src}/Operators/Bitwise/BitwiseAndOperator.php (100%) rename {Library => src}/Operators/Bitwise/BitwiseBaseOperator.php (100%) rename {Library => src}/Operators/Bitwise/BitwiseNotOperator.php (100%) rename {Library => src}/Operators/Bitwise/BitwiseOrOperator.php (100%) rename {Library => src}/Operators/Bitwise/BitwiseXorOperator.php (100%) rename {Library => src}/Operators/Bitwise/ShiftLeftOperator.php (100%) rename {Library => src}/Operators/Bitwise/ShiftRightOperator.php (100%) rename {Library => src}/Operators/Comparison/ComparisonBaseOperator.php (100%) rename {Library => src}/Operators/Comparison/EqualsOperator.php (100%) rename {Library => src}/Operators/Comparison/GreaterEqualOperator.php (100%) rename {Library => src}/Operators/Comparison/GreaterOperator.php (100%) rename {Library => src}/Operators/Comparison/IdenticalOperator.php (100%) rename {Library => src}/Operators/Comparison/LessEqualOperator.php (100%) rename {Library => src}/Operators/Comparison/LessOperator.php (100%) rename {Library => src}/Operators/Comparison/NotEqualsOperator.php (100%) rename {Library => src}/Operators/Comparison/NotIdenticalOperator.php (100%) rename {Library => src}/Operators/Logical/AndOperator.php (100%) rename {Library => src}/Operators/Logical/LogicalBaseOperator.php (100%) rename {Library => src}/Operators/Logical/OrOperator.php (100%) rename {Library => src}/Operators/Other/CastOperator.php (100%) rename {Library => src}/Operators/Other/CloneOperator.php (100%) rename {Library => src}/Operators/Other/ConcatOperator.php (100%) rename {Library => src}/Operators/Other/EmptyOperator.php (100%) rename {Library => src}/Operators/Other/FetchOperator.php (100%) rename {Library => src}/Operators/Other/InstanceOfOperator.php (100%) rename {Library => src}/Operators/Other/IssetOperator.php (100%) rename {Library => src}/Operators/Other/LikelyOperator.php (100%) rename {Library => src}/Operators/Other/NewInstanceOperator.php (100%) rename {Library => src}/Operators/Other/NewInstanceTypeOperator.php (100%) rename {Library => src}/Operators/Other/RangeExclusiveOperator.php (100%) rename {Library => src}/Operators/Other/RangeInclusiveOperator.php (100%) rename {Library => src}/Operators/Other/RequireOnceOperator.php (100%) rename {Library => src}/Operators/Other/RequireOperator.php (100%) rename {Library => src}/Operators/Other/ShortTernaryOperator.php (100%) rename {Library => src}/Operators/Other/TernaryOperator.php (100%) rename {Library => src}/Operators/Other/TypeHintOperator.php (100%) rename {Library => src}/Operators/Other/TypeOfOperator.php (100%) rename {Library => src}/Operators/Other/UnlikelyOperator.php (100%) rename {Library => src}/Operators/Unary/MinusOperator.php (100%) rename {Library => src}/Operators/Unary/NotOperator.php (100%) rename {Library => src}/Optimizers/EvalExpression.php (100%) rename {Library => src}/Optimizers/FunctionCall/ACosOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ASinOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/AddslashesOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ArrayKeysOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ArrayMergeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/BasenameOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CallUserFuncOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CamelizeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CeilOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ClassExistsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CompareMtimeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CosOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CountOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/Crc32Optimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CreateArrayOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CreateInstanceOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/DieOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/DoublevalOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/EndsWithOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/EvalOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ExitOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ExplodeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FcloseOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FeofOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FileExistsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FileGetContentsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FilePutContentsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FilemtimeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FloorOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FuncGetArgOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FuncGetArgsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FuncNumArgsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FunctionExistsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/FwriteOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GetCalledClassOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GetClassLowerOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GetClassNsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GetClassOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GetNsClassOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GettypeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GlobalsGetOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/GlobalsSetOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/HashEqualsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ImplodeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/InArrayOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/InterfaceExistsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IntvalOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsArrayOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsBoolOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsCallableOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsIntOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsNullOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsNumericOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsObjectOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsPhpVersionOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsResourceOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsScalarOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/IsStringOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/JoinOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/JsonDecodeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/JsonEncodeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/LdexpOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/LtrimOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/Md5Optimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/MemstrOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/MergeAppendOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/MethodExistsOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/MicrotimeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/PowOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/PregMatchAllOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/PregMatchOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/RoundOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/RtrimOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/SinOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/SqrtOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StartsWithOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StrReplaceOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StripcslashesOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StripslashesOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StrlenOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StrposOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StrtokOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StrtolowerOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/StrtoupperOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/SubstrOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/TanOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/TimeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/TrimOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/UcfirstOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/UncamelizeOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/UniqueKeyOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/UniquePathKeyOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/VarDumpOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/VarExportOptimizer.php (100%) rename {Library => src}/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php (100%) rename {Library => src}/Optimizers/IsTypeOptimizerAbstract.php (100%) rename {Library => src}/Optimizers/MathOptimizer.php (100%) rename {Library => src}/Optimizers/OptimizerAbstract.php (100%) rename {Library => src}/Parser/Manager.php (100%) rename {Library => src}/Parser/Parser.php (100%) rename {Library => src}/Passes/CallGathererPass.php (100%) rename {Library => src}/Passes/LocalContextPass.php (100%) rename {Library => src}/Passes/LoopBreakPass.php (100%) rename {Library => src}/Passes/MutateGathererPass.php (100%) rename {Library => src}/Passes/SkipVariantInit.php (100%) rename {Library => src}/Passes/StaticTypeInference.php (100%) rename {Library => src}/Statements/BreakStatement.php (100%) rename {Library => src}/Statements/ContinueStatement.php (100%) rename {Library => src}/Statements/DeclareStatement.php (100%) rename {Library => src}/Statements/DoWhileStatement.php (100%) rename {Library => src}/Statements/EchoStatement.php (100%) rename {Library => src}/Statements/ForStatement.php (100%) rename {Library => src}/Statements/IfStatement.php (100%) rename {Library => src}/Statements/Let/ArrayIndex.php (100%) rename {Library => src}/Statements/Let/ArrayIndexAppend.php (100%) rename {Library => src}/Statements/Let/Decr.php (100%) rename {Library => src}/Statements/Let/ExportSymbol.php (100%) rename {Library => src}/Statements/Let/ExportSymbolString.php (100%) rename {Library => src}/Statements/Let/Incr.php (100%) rename {Library => src}/Statements/Let/ObjectDynamicProperty.php (100%) rename {Library => src}/Statements/Let/ObjectDynamicStringProperty.php (100%) rename {Library => src}/Statements/Let/ObjectProperty.php (100%) rename {Library => src}/Statements/Let/ObjectPropertyAppend.php (100%) rename {Library => src}/Statements/Let/ObjectPropertyArrayIndex.php (100%) rename {Library => src}/Statements/Let/ObjectPropertyArrayIndexAppend.php (100%) rename {Library => src}/Statements/Let/ObjectPropertyDecr.php (100%) rename {Library => src}/Statements/Let/ObjectPropertyIncr.php (100%) rename {Library => src}/Statements/Let/StaticProperty.php (100%) rename {Library => src}/Statements/Let/StaticPropertyAdd.php (100%) rename {Library => src}/Statements/Let/StaticPropertyAppend.php (100%) rename {Library => src}/Statements/Let/StaticPropertyArrayIndex.php (100%) rename {Library => src}/Statements/Let/StaticPropertyArrayIndexAppend.php (100%) rename {Library => src}/Statements/Let/StaticPropertySub.php (100%) rename {Library => src}/Statements/Let/Variable.php (100%) rename {Library => src}/Statements/Let/VariableAppend.php (100%) rename {Library => src}/Statements/LetStatement.php (100%) rename {Library => src}/Statements/LoopStatement.php (100%) rename {Library => src}/Statements/RequireOnceStatement.php (100%) rename {Library => src}/Statements/RequireStatement.php (100%) rename {Library => src}/Statements/ReturnStatement.php (100%) rename {Library => src}/Statements/StatementAbstract.php (100%) rename {Library => src}/Statements/SwitchStatement.php (100%) rename {Library => src}/Statements/ThrowStatement.php (100%) rename {Library => src}/Statements/TryCatchStatement.php (100%) rename {Library => src}/Statements/UnsetStatement.php (100%) rename {Library => src}/Statements/WhileStatement.php (100%) rename {Library => src}/StatementsBlock.php (100%) rename {Library => src}/StaticCall.php (100%) rename {Library => src}/StringsManager.php (100%) rename {Library => src}/Stubs/DocBlock.php (100%) rename {Library => src}/Stubs/Generator.php (100%) rename {Library => src}/Stubs/MethodDocBlock.php (100%) rename {Library => src}/SymbolTable.php (100%) rename {Library => src}/TypeAwareInterface.php (100%) rename {Library => src}/Types/AbstractType.php (100%) rename {Library => src}/Types/ArrayType.php (100%) rename {Library => src}/Types/CharType.php (100%) rename {Library => src}/Types/DoubleType.php (100%) rename {Library => src}/Types/IntType.php (100%) rename {Library => src}/Types/IstringType.php (100%) rename {Library => src}/Types/StringType.php (100%) rename {Library => src}/Types/Types.php (100%) rename {Library => src}/Variable/Globals.php (100%) rename {Library => src}/Variable/Variable.php (100%) rename {Library => src}/Zephir.php (100%) rename {Library => src}/functions.php (100%) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 53e460990f..ea5c16a65a 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -2,7 +2,7 @@ declare(strict_types=1); -/* +/** * This file is part of the Zephir. * * (c) Phalcon Team @@ -11,7 +11,7 @@ * the LICENSE file that was distributed with this source code. */ -if (!file_exists(__DIR__.'/Library')) { +if (!file_exists(__DIR__ . '/src')) { exit(0); } diff --git a/box.json.dist b/box.json.dist index 7696ef76a0..918925ab2c 100644 --- a/box.json.dist +++ b/box.json.dist @@ -9,7 +9,7 @@ ], "directories": [ "kernels", - "Library", + "src", "prototypes", "templates", "vendor" @@ -32,7 +32,7 @@ "name": "*.*" }, { - "in": "Library", + "in": "src", "name": "*.*" }, { diff --git a/composer.json b/composer.json index 9c796720a8..16ad00ac6f 100644 --- a/composer.json +++ b/composer.json @@ -49,10 +49,10 @@ }, "autoload": { "psr-4": { - "Zephir\\": "Library" + "Zephir\\": "src/" }, "files": [ - "Library/functions.php" + "src/functions.php" ] }, "autoload-dev": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c237e93b78..e70f4be573 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -38,7 +38,7 @@ Note that specifying any file or directory path on the command line will ignore all file tags. --> - Library + src diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 22bdcbfddf..54dd01cab6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,7 @@ > - Library + src diff --git a/Library/AliasManager.php b/src/AliasManager.php similarity index 100% rename from Library/AliasManager.php rename to src/AliasManager.php diff --git a/Library/Backend/Backend.php b/src/Backend/Backend.php similarity index 100% rename from Library/Backend/Backend.php rename to src/Backend/Backend.php diff --git a/Library/Backend/FcallManager.php b/src/Backend/FcallManager.php similarity index 100% rename from Library/Backend/FcallManager.php rename to src/Backend/FcallManager.php diff --git a/Library/Backend/FcallManagerInterface.php b/src/Backend/FcallManagerInterface.php similarity index 100% rename from Library/Backend/FcallManagerInterface.php rename to src/Backend/FcallManagerInterface.php diff --git a/Library/Backend/StringsManager.php b/src/Backend/StringsManager.php similarity index 100% rename from Library/Backend/StringsManager.php rename to src/Backend/StringsManager.php diff --git a/Library/Backend/VariablesManager.php b/src/Backend/VariablesManager.php similarity index 100% rename from Library/Backend/VariablesManager.php rename to src/Backend/VariablesManager.php diff --git a/Library/Branch.php b/src/Branch.php similarity index 100% rename from Library/Branch.php rename to src/Branch.php diff --git a/Library/BranchManager.php b/src/BranchManager.php similarity index 100% rename from Library/BranchManager.php rename to src/BranchManager.php diff --git a/Library/Builder/FunctionCallBuilder.php b/src/Builder/FunctionCallBuilder.php similarity index 100% rename from Library/Builder/FunctionCallBuilder.php rename to src/Builder/FunctionCallBuilder.php diff --git a/Library/Builder/Operators/AbstractOperatorBuilder.php b/src/Builder/Operators/AbstractOperatorBuilder.php similarity index 100% rename from Library/Builder/Operators/AbstractOperatorBuilder.php rename to src/Builder/Operators/AbstractOperatorBuilder.php diff --git a/Library/Builder/Operators/CastOperatorBuilder.php b/src/Builder/Operators/CastOperatorBuilder.php similarity index 100% rename from Library/Builder/Operators/CastOperatorBuilder.php rename to src/Builder/Operators/CastOperatorBuilder.php diff --git a/Library/Builder/Operators/UnaryOperatorBuilder.php b/src/Builder/Operators/UnaryOperatorBuilder.php similarity index 100% rename from Library/Builder/Operators/UnaryOperatorBuilder.php rename to src/Builder/Operators/UnaryOperatorBuilder.php diff --git a/Library/Builder/Statements/AbstractStatementBuilder.php b/src/Builder/Statements/AbstractStatementBuilder.php similarity index 100% rename from Library/Builder/Statements/AbstractStatementBuilder.php rename to src/Builder/Statements/AbstractStatementBuilder.php diff --git a/Library/Builder/Statements/IfStatementBuilder.php b/src/Builder/Statements/IfStatementBuilder.php similarity index 100% rename from Library/Builder/Statements/IfStatementBuilder.php rename to src/Builder/Statements/IfStatementBuilder.php diff --git a/Library/Builder/Statements/LetStatementBuilder.php b/src/Builder/Statements/LetStatementBuilder.php similarity index 100% rename from Library/Builder/Statements/LetStatementBuilder.php rename to src/Builder/Statements/LetStatementBuilder.php diff --git a/Library/Builder/StatementsBlockBuilder.php b/src/Builder/StatementsBlockBuilder.php similarity index 100% rename from Library/Builder/StatementsBlockBuilder.php rename to src/Builder/StatementsBlockBuilder.php diff --git a/Library/Cache/ClassEntryCache.php b/src/Cache/ClassEntryCache.php similarity index 100% rename from Library/Cache/ClassEntryCache.php rename to src/Cache/ClassEntryCache.php diff --git a/Library/Cache/FunctionCache.php b/src/Cache/FunctionCache.php similarity index 100% rename from Library/Cache/FunctionCache.php rename to src/Cache/FunctionCache.php diff --git a/Library/Cache/Manager.php b/src/Cache/Manager.php similarity index 100% rename from Library/Cache/Manager.php rename to src/Cache/Manager.php diff --git a/Library/Cache/MethodCache.php b/src/Cache/MethodCache.php similarity index 100% rename from Library/Cache/MethodCache.php rename to src/Cache/MethodCache.php diff --git a/Library/Cache/SlotsCache.php b/src/Cache/SlotsCache.php similarity index 100% rename from Library/Cache/SlotsCache.php rename to src/Cache/SlotsCache.php diff --git a/Library/Cache/StaticMethodCache.php b/src/Cache/StaticMethodCache.php similarity index 100% rename from Library/Cache/StaticMethodCache.php rename to src/Cache/StaticMethodCache.php diff --git a/Library/Call.php b/src/Call.php similarity index 100% rename from Library/Call.php rename to src/Call.php diff --git a/Library/Class/Constant.php b/src/Class/Constant.php similarity index 100% rename from Library/Class/Constant.php rename to src/Class/Constant.php diff --git a/Library/Class/Definition/AbstractDefinition.php b/src/Class/Definition/AbstractDefinition.php similarity index 100% rename from Library/Class/Definition/AbstractDefinition.php rename to src/Class/Definition/AbstractDefinition.php diff --git a/Library/Class/Definition/Definition.php b/src/Class/Definition/Definition.php similarity index 100% rename from Library/Class/Definition/Definition.php rename to src/Class/Definition/Definition.php diff --git a/Library/Class/Definition/DefinitionRuntime.php b/src/Class/Definition/DefinitionRuntime.php similarity index 100% rename from Library/Class/Definition/DefinitionRuntime.php rename to src/Class/Definition/DefinitionRuntime.php diff --git a/Library/Class/Entry.php b/src/Class/Entry.php similarity index 100% rename from Library/Class/Entry.php rename to src/Class/Entry.php diff --git a/Library/Class/Method/Method.php b/src/Class/Method/Method.php similarity index 100% rename from Library/Class/Method/Method.php rename to src/Class/Method/Method.php diff --git a/Library/Class/Method/Parameters.php b/src/Class/Method/Parameters.php similarity index 100% rename from Library/Class/Method/Parameters.php rename to src/Class/Method/Parameters.php diff --git a/Library/Class/Property.php b/src/Class/Property.php similarity index 100% rename from Library/Class/Property.php rename to src/Class/Property.php diff --git a/Library/Code/ArgInfoDefinition.php b/src/Code/ArgInfoDefinition.php similarity index 100% rename from Library/Code/ArgInfoDefinition.php rename to src/Code/ArgInfoDefinition.php diff --git a/Library/Code/Builder/Struct.php b/src/Code/Builder/Struct.php similarity index 100% rename from Library/Code/Builder/Struct.php rename to src/Code/Builder/Struct.php diff --git a/Library/Code/Printer.php b/src/Code/Printer.php similarity index 100% rename from Library/Code/Printer.php rename to src/Code/Printer.php diff --git a/Library/CompilationContext.php b/src/CompilationContext.php similarity index 100% rename from Library/CompilationContext.php rename to src/CompilationContext.php diff --git a/Library/CompiledExpression.php b/src/CompiledExpression.php similarity index 100% rename from Library/CompiledExpression.php rename to src/CompiledExpression.php diff --git a/Library/Compiler.php b/src/Compiler.php similarity index 100% rename from Library/Compiler.php rename to src/Compiler.php diff --git a/Library/Compiler/CompilerFileFactory.php b/src/Compiler/CompilerFileFactory.php similarity index 100% rename from Library/Compiler/CompilerFileFactory.php rename to src/Compiler/CompilerFileFactory.php diff --git a/Library/Compiler/FileInterface.php b/src/Compiler/FileInterface.php similarity index 100% rename from Library/Compiler/FileInterface.php rename to src/Compiler/FileInterface.php diff --git a/Library/CompilerFile.php b/src/CompilerFile.php similarity index 100% rename from Library/CompilerFile.php rename to src/CompilerFile.php diff --git a/Library/CompilerFileAnonymous.php b/src/CompilerFileAnonymous.php similarity index 100% rename from Library/CompilerFileAnonymous.php rename to src/CompilerFileAnonymous.php diff --git a/Library/Config.php b/src/Config.php similarity index 100% rename from Library/Config.php rename to src/Config.php diff --git a/Library/ConfigException.php b/src/ConfigException.php similarity index 100% rename from Library/ConfigException.php rename to src/ConfigException.php diff --git a/Library/Console/Application.php b/src/Console/Application.php similarity index 100% rename from Library/Console/Application.php rename to src/Console/Application.php diff --git a/Library/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php similarity index 100% rename from Library/Console/Command/AbstractCommand.php rename to src/Console/Command/AbstractCommand.php diff --git a/Library/Console/Command/ApiCommand.php b/src/Console/Command/ApiCommand.php similarity index 100% rename from Library/Console/Command/ApiCommand.php rename to src/Console/Command/ApiCommand.php diff --git a/Library/Console/Command/BuildCommand.php b/src/Console/Command/BuildCommand.php similarity index 100% rename from Library/Console/Command/BuildCommand.php rename to src/Console/Command/BuildCommand.php diff --git a/Library/Console/Command/CleanCommand.php b/src/Console/Command/CleanCommand.php similarity index 100% rename from Library/Console/Command/CleanCommand.php rename to src/Console/Command/CleanCommand.php diff --git a/Library/Console/Command/CompileCommand.php b/src/Console/Command/CompileCommand.php similarity index 100% rename from Library/Console/Command/CompileCommand.php rename to src/Console/Command/CompileCommand.php diff --git a/Library/Console/Command/DevelopmentModeAwareTrait.php b/src/Console/Command/DevelopmentModeAwareTrait.php similarity index 100% rename from Library/Console/Command/DevelopmentModeAwareTrait.php rename to src/Console/Command/DevelopmentModeAwareTrait.php diff --git a/Library/Console/Command/FullCleanCommand.php b/src/Console/Command/FullCleanCommand.php similarity index 100% rename from Library/Console/Command/FullCleanCommand.php rename to src/Console/Command/FullCleanCommand.php diff --git a/Library/Console/Command/GenerateCommand.php b/src/Console/Command/GenerateCommand.php similarity index 100% rename from Library/Console/Command/GenerateCommand.php rename to src/Console/Command/GenerateCommand.php diff --git a/Library/Console/Command/InitCommand.php b/src/Console/Command/InitCommand.php similarity index 100% rename from Library/Console/Command/InitCommand.php rename to src/Console/Command/InitCommand.php diff --git a/Library/Console/Command/InstallCommand.php b/src/Console/Command/InstallCommand.php similarity index 100% rename from Library/Console/Command/InstallCommand.php rename to src/Console/Command/InstallCommand.php diff --git a/Library/Console/Command/ListCommand.php b/src/Console/Command/ListCommand.php similarity index 100% rename from Library/Console/Command/ListCommand.php rename to src/Console/Command/ListCommand.php diff --git a/Library/Console/Command/RemoveOptionsTrait.php b/src/Console/Command/RemoveOptionsTrait.php similarity index 100% rename from Library/Console/Command/RemoveOptionsTrait.php rename to src/Console/Command/RemoveOptionsTrait.php diff --git a/Library/Console/Command/StubsCommand.php b/src/Console/Command/StubsCommand.php similarity index 100% rename from Library/Console/Command/StubsCommand.php rename to src/Console/Command/StubsCommand.php diff --git a/Library/Console/Command/ZflagsAwareTrait.php b/src/Console/Command/ZflagsAwareTrait.php similarity index 100% rename from Library/Console/Command/ZflagsAwareTrait.php rename to src/Console/Command/ZflagsAwareTrait.php diff --git a/Library/Console/ErrorListener.php b/src/Console/ErrorListener.php similarity index 100% rename from Library/Console/ErrorListener.php rename to src/Console/ErrorListener.php diff --git a/Library/Detectors/ForValueUseDetector.php b/src/Detectors/ForValueUseDetector.php similarity index 100% rename from Library/Detectors/ForValueUseDetector.php rename to src/Detectors/ForValueUseDetector.php diff --git a/Library/Detectors/ReadDetector.php b/src/Detectors/ReadDetector.php similarity index 100% rename from Library/Detectors/ReadDetector.php rename to src/Detectors/ReadDetector.php diff --git a/Library/Detectors/WriteDetector.php b/src/Detectors/WriteDetector.php similarity index 100% rename from Library/Detectors/WriteDetector.php rename to src/Detectors/WriteDetector.php diff --git a/Library/Documentation.php b/src/Documentation.php similarity index 100% rename from Library/Documentation.php rename to src/Documentation.php diff --git a/Library/Documentation/Annotation.php b/src/Documentation/Annotation.php similarity index 100% rename from Library/Documentation/Annotation.php rename to src/Documentation/Annotation.php diff --git a/Library/Documentation/Annotation/Link.php b/src/Documentation/Annotation/Link.php similarity index 100% rename from Library/Documentation/Annotation/Link.php rename to src/Documentation/Annotation/Link.php diff --git a/Library/Documentation/Annotation/ReturnAnnotation.php b/src/Documentation/Annotation/ReturnAnnotation.php similarity index 100% rename from Library/Documentation/Annotation/ReturnAnnotation.php rename to src/Documentation/Annotation/ReturnAnnotation.php diff --git a/Library/Documentation/Annotation/See.php b/src/Documentation/Annotation/See.php similarity index 100% rename from Library/Documentation/Annotation/See.php rename to src/Documentation/Annotation/See.php diff --git a/Library/Documentation/Docblock.php b/src/Documentation/Docblock.php similarity index 100% rename from Library/Documentation/Docblock.php rename to src/Documentation/Docblock.php diff --git a/Library/Documentation/DocblockParser.php b/src/Documentation/DocblockParser.php similarity index 100% rename from Library/Documentation/DocblockParser.php rename to src/Documentation/DocblockParser.php diff --git a/Library/Documentation/File/ClassFile.php b/src/Documentation/File/ClassFile.php similarity index 100% rename from Library/Documentation/File/ClassFile.php rename to src/Documentation/File/ClassFile.php diff --git a/Library/Documentation/File/ClassesFile.php b/src/Documentation/File/ClassesFile.php similarity index 100% rename from Library/Documentation/File/ClassesFile.php rename to src/Documentation/File/ClassesFile.php diff --git a/Library/Documentation/File/IndexFile.php b/src/Documentation/File/IndexFile.php similarity index 100% rename from Library/Documentation/File/IndexFile.php rename to src/Documentation/File/IndexFile.php diff --git a/Library/Documentation/File/NamespaceFile.php b/src/Documentation/File/NamespaceFile.php similarity index 100% rename from Library/Documentation/File/NamespaceFile.php rename to src/Documentation/File/NamespaceFile.php diff --git a/Library/Documentation/File/NamespacesFile.php b/src/Documentation/File/NamespacesFile.php similarity index 100% rename from Library/Documentation/File/NamespacesFile.php rename to src/Documentation/File/NamespacesFile.php diff --git a/Library/Documentation/File/Sitemap.php b/src/Documentation/File/Sitemap.php similarity index 100% rename from Library/Documentation/File/Sitemap.php rename to src/Documentation/File/Sitemap.php diff --git a/Library/Documentation/File/SourceFile.php b/src/Documentation/File/SourceFile.php similarity index 100% rename from Library/Documentation/File/SourceFile.php rename to src/Documentation/File/SourceFile.php diff --git a/Library/Documentation/FileInterface.php b/src/Documentation/FileInterface.php similarity index 100% rename from Library/Documentation/FileInterface.php rename to src/Documentation/FileInterface.php diff --git a/Library/Documentation/NamespaceAccessor.php b/src/Documentation/NamespaceAccessor.php similarity index 100% rename from Library/Documentation/NamespaceAccessor.php rename to src/Documentation/NamespaceAccessor.php diff --git a/Library/Documentation/NamespaceHelper.php b/src/Documentation/NamespaceHelper.php similarity index 100% rename from Library/Documentation/NamespaceHelper.php rename to src/Documentation/NamespaceHelper.php diff --git a/Library/Documentation/Template.php b/src/Documentation/Template.php similarity index 100% rename from Library/Documentation/Template.php rename to src/Documentation/Template.php diff --git a/Library/Documentation/Theme.php b/src/Documentation/Theme.php similarity index 100% rename from Library/Documentation/Theme.php rename to src/Documentation/Theme.php diff --git a/Library/Exception.php b/src/Exception.php similarity index 100% rename from Library/Exception.php rename to src/Exception.php diff --git a/Library/Exception/CompilerException.php b/src/Exception/CompilerException.php similarity index 100% rename from Library/Exception/CompilerException.php rename to src/Exception/CompilerException.php diff --git a/Library/Exception/ExceptionExtraAwareTrait.php b/src/Exception/ExceptionExtraAwareTrait.php similarity index 100% rename from Library/Exception/ExceptionExtraAwareTrait.php rename to src/Exception/ExceptionExtraAwareTrait.php diff --git a/Library/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php similarity index 100% rename from Library/Exception/ExceptionInterface.php rename to src/Exception/ExceptionInterface.php diff --git a/Library/Exception/FileSystemException.php b/src/Exception/FileSystemException.php similarity index 100% rename from Library/Exception/FileSystemException.php rename to src/Exception/FileSystemException.php diff --git a/Library/Exception/IllegalOperationException.php b/src/Exception/IllegalOperationException.php similarity index 100% rename from Library/Exception/IllegalOperationException.php rename to src/Exception/IllegalOperationException.php diff --git a/Library/Exception/IllegalStateException.php b/src/Exception/IllegalStateException.php similarity index 100% rename from Library/Exception/IllegalStateException.php rename to src/Exception/IllegalStateException.php diff --git a/Library/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php similarity index 100% rename from Library/Exception/InvalidArgumentException.php rename to src/Exception/InvalidArgumentException.php diff --git a/Library/Exception/InvalidTypeException.php b/src/Exception/InvalidTypeException.php similarity index 100% rename from Library/Exception/InvalidTypeException.php rename to src/Exception/InvalidTypeException.php diff --git a/Library/Exception/LogicException.php b/src/Exception/LogicException.php similarity index 100% rename from Library/Exception/LogicException.php rename to src/Exception/LogicException.php diff --git a/Library/Exception/NotImplementedException.php b/src/Exception/NotImplementedException.php similarity index 100% rename from Library/Exception/NotImplementedException.php rename to src/Exception/NotImplementedException.php diff --git a/Library/Exception/ParseException.php b/src/Exception/ParseException.php similarity index 100% rename from Library/Exception/ParseException.php rename to src/Exception/ParseException.php diff --git a/Library/Exception/RuntimeException.php b/src/Exception/RuntimeException.php similarity index 100% rename from Library/Exception/RuntimeException.php rename to src/Exception/RuntimeException.php diff --git a/Library/Expression.php b/src/Expression.php similarity index 100% rename from Library/Expression.php rename to src/Expression.php diff --git a/Library/Expression/Builder/AbstractBuilder.php b/src/Expression/Builder/AbstractBuilder.php similarity index 100% rename from Library/Expression/Builder/AbstractBuilder.php rename to src/Expression/Builder/AbstractBuilder.php diff --git a/Library/Expression/Builder/BuilderFactory.php b/src/Expression/Builder/BuilderFactory.php similarity index 100% rename from Library/Expression/Builder/BuilderFactory.php rename to src/Expression/Builder/BuilderFactory.php diff --git a/Library/Expression/Builder/Factory/OperatorsFactory.php b/src/Expression/Builder/Factory/OperatorsFactory.php similarity index 100% rename from Library/Expression/Builder/Factory/OperatorsFactory.php rename to src/Expression/Builder/Factory/OperatorsFactory.php diff --git a/Library/Expression/Builder/Factory/StatementsFactory.php b/src/Expression/Builder/Factory/StatementsFactory.php similarity index 100% rename from Library/Expression/Builder/Factory/StatementsFactory.php rename to src/Expression/Builder/Factory/StatementsFactory.php diff --git a/Library/Expression/Builder/Operators/AbstractOperator.php b/src/Expression/Builder/Operators/AbstractOperator.php similarity index 100% rename from Library/Expression/Builder/Operators/AbstractOperator.php rename to src/Expression/Builder/Operators/AbstractOperator.php diff --git a/Library/Expression/Builder/Operators/AssignPropertyOperator.php b/src/Expression/Builder/Operators/AssignPropertyOperator.php similarity index 100% rename from Library/Expression/Builder/Operators/AssignPropertyOperator.php rename to src/Expression/Builder/Operators/AssignPropertyOperator.php diff --git a/Library/Expression/Builder/Operators/AssignVariableOperator.php b/src/Expression/Builder/Operators/AssignVariableOperator.php similarity index 100% rename from Library/Expression/Builder/Operators/AssignVariableOperator.php rename to src/Expression/Builder/Operators/AssignVariableOperator.php diff --git a/Library/Expression/Builder/Operators/BinaryOperator.php b/src/Expression/Builder/Operators/BinaryOperator.php similarity index 100% rename from Library/Expression/Builder/Operators/BinaryOperator.php rename to src/Expression/Builder/Operators/BinaryOperator.php diff --git a/Library/Expression/Builder/Operators/RawOperator.php b/src/Expression/Builder/Operators/RawOperator.php similarity index 100% rename from Library/Expression/Builder/Operators/RawOperator.php rename to src/Expression/Builder/Operators/RawOperator.php diff --git a/Library/Expression/Builder/Operators/UnaryOperator.php b/src/Expression/Builder/Operators/UnaryOperator.php similarity index 100% rename from Library/Expression/Builder/Operators/UnaryOperator.php rename to src/Expression/Builder/Operators/UnaryOperator.php diff --git a/Library/Expression/Builder/RawExpression.php b/src/Expression/Builder/RawExpression.php similarity index 100% rename from Library/Expression/Builder/RawExpression.php rename to src/Expression/Builder/RawExpression.php diff --git a/Library/Expression/Builder/Statements/AbstractStatement.php b/src/Expression/Builder/Statements/AbstractStatement.php similarity index 100% rename from Library/Expression/Builder/Statements/AbstractStatement.php rename to src/Expression/Builder/Statements/AbstractStatement.php diff --git a/Library/Expression/Builder/Statements/CallFunctionStatement.php b/src/Expression/Builder/Statements/CallFunctionStatement.php similarity index 100% rename from Library/Expression/Builder/Statements/CallFunctionStatement.php rename to src/Expression/Builder/Statements/CallFunctionStatement.php diff --git a/Library/Expression/Builder/Statements/CallMethodStatement.php b/src/Expression/Builder/Statements/CallMethodStatement.php similarity index 100% rename from Library/Expression/Builder/Statements/CallMethodStatement.php rename to src/Expression/Builder/Statements/CallMethodStatement.php diff --git a/Library/Expression/Builder/Statements/CallStaticStatement.php b/src/Expression/Builder/Statements/CallStaticStatement.php similarity index 100% rename from Library/Expression/Builder/Statements/CallStaticStatement.php rename to src/Expression/Builder/Statements/CallStaticStatement.php diff --git a/Library/Expression/Builder/Statements/IfStatement.php b/src/Expression/Builder/Statements/IfStatement.php similarity index 100% rename from Library/Expression/Builder/Statements/IfStatement.php rename to src/Expression/Builder/Statements/IfStatement.php diff --git a/Library/Expression/Builder/Statements/LetStatement.php b/src/Expression/Builder/Statements/LetStatement.php similarity index 100% rename from Library/Expression/Builder/Statements/LetStatement.php rename to src/Expression/Builder/Statements/LetStatement.php diff --git a/Library/Expression/Builder/Statements/RawStatement.php b/src/Expression/Builder/Statements/RawStatement.php similarity index 100% rename from Library/Expression/Builder/Statements/RawStatement.php rename to src/Expression/Builder/Statements/RawStatement.php diff --git a/Library/Expression/Builder/Statements/StatementsBlock.php b/src/Expression/Builder/Statements/StatementsBlock.php similarity index 100% rename from Library/Expression/Builder/Statements/StatementsBlock.php rename to src/Expression/Builder/Statements/StatementsBlock.php diff --git a/Library/Expression/Closure.php b/src/Expression/Closure.php similarity index 100% rename from Library/Expression/Closure.php rename to src/Expression/Closure.php diff --git a/Library/Expression/ClosureArrow.php b/src/Expression/ClosureArrow.php similarity index 100% rename from Library/Expression/ClosureArrow.php rename to src/Expression/ClosureArrow.php diff --git a/Library/Expression/Constants.php b/src/Expression/Constants.php similarity index 100% rename from Library/Expression/Constants.php rename to src/Expression/Constants.php diff --git a/Library/Expression/NativeArray.php b/src/Expression/NativeArray.php similarity index 100% rename from Library/Expression/NativeArray.php rename to src/Expression/NativeArray.php diff --git a/Library/Expression/NativeArrayAccess.php b/src/Expression/NativeArrayAccess.php similarity index 100% rename from Library/Expression/NativeArrayAccess.php rename to src/Expression/NativeArrayAccess.php diff --git a/Library/Expression/PropertyAccess.php b/src/Expression/PropertyAccess.php similarity index 100% rename from Library/Expression/PropertyAccess.php rename to src/Expression/PropertyAccess.php diff --git a/Library/Expression/PropertyDynamicAccess.php b/src/Expression/PropertyDynamicAccess.php similarity index 100% rename from Library/Expression/PropertyDynamicAccess.php rename to src/Expression/PropertyDynamicAccess.php diff --git a/Library/Expression/Reference.php b/src/Expression/Reference.php similarity index 100% rename from Library/Expression/Reference.php rename to src/Expression/Reference.php diff --git a/Library/Expression/StaticConstantAccess.php b/src/Expression/StaticConstantAccess.php similarity index 100% rename from Library/Expression/StaticConstantAccess.php rename to src/Expression/StaticConstantAccess.php diff --git a/Library/Expression/StaticPropertyAccess.php b/src/Expression/StaticPropertyAccess.php similarity index 100% rename from Library/Expression/StaticPropertyAccess.php rename to src/Expression/StaticPropertyAccess.php diff --git a/Library/FileSystem/FileSystemInterface.php b/src/FileSystem/FileSystemInterface.php similarity index 100% rename from Library/FileSystem/FileSystemInterface.php rename to src/FileSystem/FileSystemInterface.php diff --git a/Library/FileSystem/HardDisk.php b/src/FileSystem/HardDisk.php similarity index 100% rename from Library/FileSystem/HardDisk.php rename to src/FileSystem/HardDisk.php diff --git a/Library/FunctionCall.php b/src/FunctionCall.php similarity index 100% rename from Library/FunctionCall.php rename to src/FunctionCall.php diff --git a/Library/FunctionDefinition.php b/src/FunctionDefinition.php similarity index 100% rename from Library/FunctionDefinition.php rename to src/FunctionDefinition.php diff --git a/Library/GlobalConstant.php b/src/GlobalConstant.php similarity index 100% rename from Library/GlobalConstant.php rename to src/GlobalConstant.php diff --git a/Library/HeadersManager.php b/src/HeadersManager.php similarity index 100% rename from Library/HeadersManager.php rename to src/HeadersManager.php diff --git a/Library/LiteralCompiledExpression.php b/src/LiteralCompiledExpression.php similarity index 100% rename from Library/LiteralCompiledExpression.php rename to src/LiteralCompiledExpression.php diff --git a/Library/Logger/Formatter/CompilerFormatter.php b/src/Logger/Formatter/CompilerFormatter.php similarity index 100% rename from Library/Logger/Formatter/CompilerFormatter.php rename to src/Logger/Formatter/CompilerFormatter.php diff --git a/Library/MethodCall.php b/src/MethodCall.php similarity index 100% rename from Library/MethodCall.php rename to src/MethodCall.php diff --git a/Library/Operators/AbstractOperator.php b/src/Operators/AbstractOperator.php similarity index 100% rename from Library/Operators/AbstractOperator.php rename to src/Operators/AbstractOperator.php diff --git a/Library/Operators/Arithmetical/AddOperator.php b/src/Operators/Arithmetical/AddOperator.php similarity index 100% rename from Library/Operators/Arithmetical/AddOperator.php rename to src/Operators/Arithmetical/AddOperator.php diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/src/Operators/Arithmetical/ArithmeticalBaseOperator.php similarity index 100% rename from Library/Operators/Arithmetical/ArithmeticalBaseOperator.php rename to src/Operators/Arithmetical/ArithmeticalBaseOperator.php diff --git a/Library/Operators/Arithmetical/DivOperator.php b/src/Operators/Arithmetical/DivOperator.php similarity index 100% rename from Library/Operators/Arithmetical/DivOperator.php rename to src/Operators/Arithmetical/DivOperator.php diff --git a/Library/Operators/Arithmetical/ModOperator.php b/src/Operators/Arithmetical/ModOperator.php similarity index 100% rename from Library/Operators/Arithmetical/ModOperator.php rename to src/Operators/Arithmetical/ModOperator.php diff --git a/Library/Operators/Arithmetical/MulOperator.php b/src/Operators/Arithmetical/MulOperator.php similarity index 100% rename from Library/Operators/Arithmetical/MulOperator.php rename to src/Operators/Arithmetical/MulOperator.php diff --git a/Library/Operators/Arithmetical/SubOperator.php b/src/Operators/Arithmetical/SubOperator.php similarity index 100% rename from Library/Operators/Arithmetical/SubOperator.php rename to src/Operators/Arithmetical/SubOperator.php diff --git a/Library/Operators/Bitwise/BitwiseAndOperator.php b/src/Operators/Bitwise/BitwiseAndOperator.php similarity index 100% rename from Library/Operators/Bitwise/BitwiseAndOperator.php rename to src/Operators/Bitwise/BitwiseAndOperator.php diff --git a/Library/Operators/Bitwise/BitwiseBaseOperator.php b/src/Operators/Bitwise/BitwiseBaseOperator.php similarity index 100% rename from Library/Operators/Bitwise/BitwiseBaseOperator.php rename to src/Operators/Bitwise/BitwiseBaseOperator.php diff --git a/Library/Operators/Bitwise/BitwiseNotOperator.php b/src/Operators/Bitwise/BitwiseNotOperator.php similarity index 100% rename from Library/Operators/Bitwise/BitwiseNotOperator.php rename to src/Operators/Bitwise/BitwiseNotOperator.php diff --git a/Library/Operators/Bitwise/BitwiseOrOperator.php b/src/Operators/Bitwise/BitwiseOrOperator.php similarity index 100% rename from Library/Operators/Bitwise/BitwiseOrOperator.php rename to src/Operators/Bitwise/BitwiseOrOperator.php diff --git a/Library/Operators/Bitwise/BitwiseXorOperator.php b/src/Operators/Bitwise/BitwiseXorOperator.php similarity index 100% rename from Library/Operators/Bitwise/BitwiseXorOperator.php rename to src/Operators/Bitwise/BitwiseXorOperator.php diff --git a/Library/Operators/Bitwise/ShiftLeftOperator.php b/src/Operators/Bitwise/ShiftLeftOperator.php similarity index 100% rename from Library/Operators/Bitwise/ShiftLeftOperator.php rename to src/Operators/Bitwise/ShiftLeftOperator.php diff --git a/Library/Operators/Bitwise/ShiftRightOperator.php b/src/Operators/Bitwise/ShiftRightOperator.php similarity index 100% rename from Library/Operators/Bitwise/ShiftRightOperator.php rename to src/Operators/Bitwise/ShiftRightOperator.php diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/src/Operators/Comparison/ComparisonBaseOperator.php similarity index 100% rename from Library/Operators/Comparison/ComparisonBaseOperator.php rename to src/Operators/Comparison/ComparisonBaseOperator.php diff --git a/Library/Operators/Comparison/EqualsOperator.php b/src/Operators/Comparison/EqualsOperator.php similarity index 100% rename from Library/Operators/Comparison/EqualsOperator.php rename to src/Operators/Comparison/EqualsOperator.php diff --git a/Library/Operators/Comparison/GreaterEqualOperator.php b/src/Operators/Comparison/GreaterEqualOperator.php similarity index 100% rename from Library/Operators/Comparison/GreaterEqualOperator.php rename to src/Operators/Comparison/GreaterEqualOperator.php diff --git a/Library/Operators/Comparison/GreaterOperator.php b/src/Operators/Comparison/GreaterOperator.php similarity index 100% rename from Library/Operators/Comparison/GreaterOperator.php rename to src/Operators/Comparison/GreaterOperator.php diff --git a/Library/Operators/Comparison/IdenticalOperator.php b/src/Operators/Comparison/IdenticalOperator.php similarity index 100% rename from Library/Operators/Comparison/IdenticalOperator.php rename to src/Operators/Comparison/IdenticalOperator.php diff --git a/Library/Operators/Comparison/LessEqualOperator.php b/src/Operators/Comparison/LessEqualOperator.php similarity index 100% rename from Library/Operators/Comparison/LessEqualOperator.php rename to src/Operators/Comparison/LessEqualOperator.php diff --git a/Library/Operators/Comparison/LessOperator.php b/src/Operators/Comparison/LessOperator.php similarity index 100% rename from Library/Operators/Comparison/LessOperator.php rename to src/Operators/Comparison/LessOperator.php diff --git a/Library/Operators/Comparison/NotEqualsOperator.php b/src/Operators/Comparison/NotEqualsOperator.php similarity index 100% rename from Library/Operators/Comparison/NotEqualsOperator.php rename to src/Operators/Comparison/NotEqualsOperator.php diff --git a/Library/Operators/Comparison/NotIdenticalOperator.php b/src/Operators/Comparison/NotIdenticalOperator.php similarity index 100% rename from Library/Operators/Comparison/NotIdenticalOperator.php rename to src/Operators/Comparison/NotIdenticalOperator.php diff --git a/Library/Operators/Logical/AndOperator.php b/src/Operators/Logical/AndOperator.php similarity index 100% rename from Library/Operators/Logical/AndOperator.php rename to src/Operators/Logical/AndOperator.php diff --git a/Library/Operators/Logical/LogicalBaseOperator.php b/src/Operators/Logical/LogicalBaseOperator.php similarity index 100% rename from Library/Operators/Logical/LogicalBaseOperator.php rename to src/Operators/Logical/LogicalBaseOperator.php diff --git a/Library/Operators/Logical/OrOperator.php b/src/Operators/Logical/OrOperator.php similarity index 100% rename from Library/Operators/Logical/OrOperator.php rename to src/Operators/Logical/OrOperator.php diff --git a/Library/Operators/Other/CastOperator.php b/src/Operators/Other/CastOperator.php similarity index 100% rename from Library/Operators/Other/CastOperator.php rename to src/Operators/Other/CastOperator.php diff --git a/Library/Operators/Other/CloneOperator.php b/src/Operators/Other/CloneOperator.php similarity index 100% rename from Library/Operators/Other/CloneOperator.php rename to src/Operators/Other/CloneOperator.php diff --git a/Library/Operators/Other/ConcatOperator.php b/src/Operators/Other/ConcatOperator.php similarity index 100% rename from Library/Operators/Other/ConcatOperator.php rename to src/Operators/Other/ConcatOperator.php diff --git a/Library/Operators/Other/EmptyOperator.php b/src/Operators/Other/EmptyOperator.php similarity index 100% rename from Library/Operators/Other/EmptyOperator.php rename to src/Operators/Other/EmptyOperator.php diff --git a/Library/Operators/Other/FetchOperator.php b/src/Operators/Other/FetchOperator.php similarity index 100% rename from Library/Operators/Other/FetchOperator.php rename to src/Operators/Other/FetchOperator.php diff --git a/Library/Operators/Other/InstanceOfOperator.php b/src/Operators/Other/InstanceOfOperator.php similarity index 100% rename from Library/Operators/Other/InstanceOfOperator.php rename to src/Operators/Other/InstanceOfOperator.php diff --git a/Library/Operators/Other/IssetOperator.php b/src/Operators/Other/IssetOperator.php similarity index 100% rename from Library/Operators/Other/IssetOperator.php rename to src/Operators/Other/IssetOperator.php diff --git a/Library/Operators/Other/LikelyOperator.php b/src/Operators/Other/LikelyOperator.php similarity index 100% rename from Library/Operators/Other/LikelyOperator.php rename to src/Operators/Other/LikelyOperator.php diff --git a/Library/Operators/Other/NewInstanceOperator.php b/src/Operators/Other/NewInstanceOperator.php similarity index 100% rename from Library/Operators/Other/NewInstanceOperator.php rename to src/Operators/Other/NewInstanceOperator.php diff --git a/Library/Operators/Other/NewInstanceTypeOperator.php b/src/Operators/Other/NewInstanceTypeOperator.php similarity index 100% rename from Library/Operators/Other/NewInstanceTypeOperator.php rename to src/Operators/Other/NewInstanceTypeOperator.php diff --git a/Library/Operators/Other/RangeExclusiveOperator.php b/src/Operators/Other/RangeExclusiveOperator.php similarity index 100% rename from Library/Operators/Other/RangeExclusiveOperator.php rename to src/Operators/Other/RangeExclusiveOperator.php diff --git a/Library/Operators/Other/RangeInclusiveOperator.php b/src/Operators/Other/RangeInclusiveOperator.php similarity index 100% rename from Library/Operators/Other/RangeInclusiveOperator.php rename to src/Operators/Other/RangeInclusiveOperator.php diff --git a/Library/Operators/Other/RequireOnceOperator.php b/src/Operators/Other/RequireOnceOperator.php similarity index 100% rename from Library/Operators/Other/RequireOnceOperator.php rename to src/Operators/Other/RequireOnceOperator.php diff --git a/Library/Operators/Other/RequireOperator.php b/src/Operators/Other/RequireOperator.php similarity index 100% rename from Library/Operators/Other/RequireOperator.php rename to src/Operators/Other/RequireOperator.php diff --git a/Library/Operators/Other/ShortTernaryOperator.php b/src/Operators/Other/ShortTernaryOperator.php similarity index 100% rename from Library/Operators/Other/ShortTernaryOperator.php rename to src/Operators/Other/ShortTernaryOperator.php diff --git a/Library/Operators/Other/TernaryOperator.php b/src/Operators/Other/TernaryOperator.php similarity index 100% rename from Library/Operators/Other/TernaryOperator.php rename to src/Operators/Other/TernaryOperator.php diff --git a/Library/Operators/Other/TypeHintOperator.php b/src/Operators/Other/TypeHintOperator.php similarity index 100% rename from Library/Operators/Other/TypeHintOperator.php rename to src/Operators/Other/TypeHintOperator.php diff --git a/Library/Operators/Other/TypeOfOperator.php b/src/Operators/Other/TypeOfOperator.php similarity index 100% rename from Library/Operators/Other/TypeOfOperator.php rename to src/Operators/Other/TypeOfOperator.php diff --git a/Library/Operators/Other/UnlikelyOperator.php b/src/Operators/Other/UnlikelyOperator.php similarity index 100% rename from Library/Operators/Other/UnlikelyOperator.php rename to src/Operators/Other/UnlikelyOperator.php diff --git a/Library/Operators/Unary/MinusOperator.php b/src/Operators/Unary/MinusOperator.php similarity index 100% rename from Library/Operators/Unary/MinusOperator.php rename to src/Operators/Unary/MinusOperator.php diff --git a/Library/Operators/Unary/NotOperator.php b/src/Operators/Unary/NotOperator.php similarity index 100% rename from Library/Operators/Unary/NotOperator.php rename to src/Operators/Unary/NotOperator.php diff --git a/Library/Optimizers/EvalExpression.php b/src/Optimizers/EvalExpression.php similarity index 100% rename from Library/Optimizers/EvalExpression.php rename to src/Optimizers/EvalExpression.php diff --git a/Library/Optimizers/FunctionCall/ACosOptimizer.php b/src/Optimizers/FunctionCall/ACosOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ACosOptimizer.php rename to src/Optimizers/FunctionCall/ACosOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ASinOptimizer.php b/src/Optimizers/FunctionCall/ASinOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ASinOptimizer.php rename to src/Optimizers/FunctionCall/ASinOptimizer.php diff --git a/Library/Optimizers/FunctionCall/AddslashesOptimizer.php b/src/Optimizers/FunctionCall/AddslashesOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/AddslashesOptimizer.php rename to src/Optimizers/FunctionCall/AddslashesOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php b/src/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php rename to src/Optimizers/FunctionCall/ArrayKeyExistsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php b/src/Optimizers/FunctionCall/ArrayKeysOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ArrayKeysOptimizer.php rename to src/Optimizers/FunctionCall/ArrayKeysOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php b/src/Optimizers/FunctionCall/ArrayMergeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ArrayMergeOptimizer.php rename to src/Optimizers/FunctionCall/ArrayMergeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/BasenameOptimizer.php b/src/Optimizers/FunctionCall/BasenameOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/BasenameOptimizer.php rename to src/Optimizers/FunctionCall/BasenameOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php b/src/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php rename to src/Optimizers/FunctionCall/CallUserFuncArrayOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CallUserFuncOptimizer.php b/src/Optimizers/FunctionCall/CallUserFuncOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CallUserFuncOptimizer.php rename to src/Optimizers/FunctionCall/CallUserFuncOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CamelizeOptimizer.php b/src/Optimizers/FunctionCall/CamelizeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CamelizeOptimizer.php rename to src/Optimizers/FunctionCall/CamelizeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CeilOptimizer.php b/src/Optimizers/FunctionCall/CeilOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CeilOptimizer.php rename to src/Optimizers/FunctionCall/CeilOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ClassExistsOptimizer.php b/src/Optimizers/FunctionCall/ClassExistsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ClassExistsOptimizer.php rename to src/Optimizers/FunctionCall/ClassExistsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php b/src/Optimizers/FunctionCall/CompareMtimeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CompareMtimeOptimizer.php rename to src/Optimizers/FunctionCall/CompareMtimeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CosOptimizer.php b/src/Optimizers/FunctionCall/CosOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CosOptimizer.php rename to src/Optimizers/FunctionCall/CosOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CountOptimizer.php b/src/Optimizers/FunctionCall/CountOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CountOptimizer.php rename to src/Optimizers/FunctionCall/CountOptimizer.php diff --git a/Library/Optimizers/FunctionCall/Crc32Optimizer.php b/src/Optimizers/FunctionCall/Crc32Optimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/Crc32Optimizer.php rename to src/Optimizers/FunctionCall/Crc32Optimizer.php diff --git a/Library/Optimizers/FunctionCall/CreateArrayOptimizer.php b/src/Optimizers/FunctionCall/CreateArrayOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CreateArrayOptimizer.php rename to src/Optimizers/FunctionCall/CreateArrayOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php b/src/Optimizers/FunctionCall/CreateInstanceOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CreateInstanceOptimizer.php rename to src/Optimizers/FunctionCall/CreateInstanceOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php b/src/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php rename to src/Optimizers/FunctionCall/CreateInstanceParamsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php b/src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php rename to src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php diff --git a/Library/Optimizers/FunctionCall/DieOptimizer.php b/src/Optimizers/FunctionCall/DieOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/DieOptimizer.php rename to src/Optimizers/FunctionCall/DieOptimizer.php diff --git a/Library/Optimizers/FunctionCall/DoublevalOptimizer.php b/src/Optimizers/FunctionCall/DoublevalOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/DoublevalOptimizer.php rename to src/Optimizers/FunctionCall/DoublevalOptimizer.php diff --git a/Library/Optimizers/FunctionCall/EndsWithOptimizer.php b/src/Optimizers/FunctionCall/EndsWithOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/EndsWithOptimizer.php rename to src/Optimizers/FunctionCall/EndsWithOptimizer.php diff --git a/Library/Optimizers/FunctionCall/EvalOptimizer.php b/src/Optimizers/FunctionCall/EvalOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/EvalOptimizer.php rename to src/Optimizers/FunctionCall/EvalOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ExitOptimizer.php b/src/Optimizers/FunctionCall/ExitOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ExitOptimizer.php rename to src/Optimizers/FunctionCall/ExitOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ExplodeOptimizer.php b/src/Optimizers/FunctionCall/ExplodeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ExplodeOptimizer.php rename to src/Optimizers/FunctionCall/ExplodeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FcloseOptimizer.php b/src/Optimizers/FunctionCall/FcloseOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FcloseOptimizer.php rename to src/Optimizers/FunctionCall/FcloseOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FeofOptimizer.php b/src/Optimizers/FunctionCall/FeofOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FeofOptimizer.php rename to src/Optimizers/FunctionCall/FeofOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FileExistsOptimizer.php b/src/Optimizers/FunctionCall/FileExistsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FileExistsOptimizer.php rename to src/Optimizers/FunctionCall/FileExistsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php b/src/Optimizers/FunctionCall/FileGetContentsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FileGetContentsOptimizer.php rename to src/Optimizers/FunctionCall/FileGetContentsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php b/src/Optimizers/FunctionCall/FilePutContentsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FilePutContentsOptimizer.php rename to src/Optimizers/FunctionCall/FilePutContentsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FilemtimeOptimizer.php b/src/Optimizers/FunctionCall/FilemtimeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FilemtimeOptimizer.php rename to src/Optimizers/FunctionCall/FilemtimeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FloorOptimizer.php b/src/Optimizers/FunctionCall/FloorOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FloorOptimizer.php rename to src/Optimizers/FunctionCall/FloorOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php b/src/Optimizers/FunctionCall/FuncGetArgOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FuncGetArgOptimizer.php rename to src/Optimizers/FunctionCall/FuncGetArgOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php b/src/Optimizers/FunctionCall/FuncGetArgsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FuncGetArgsOptimizer.php rename to src/Optimizers/FunctionCall/FuncGetArgsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FuncNumArgsOptimizer.php b/src/Optimizers/FunctionCall/FuncNumArgsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FuncNumArgsOptimizer.php rename to src/Optimizers/FunctionCall/FuncNumArgsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php b/src/Optimizers/FunctionCall/FunctionExistsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FunctionExistsOptimizer.php rename to src/Optimizers/FunctionCall/FunctionExistsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/FwriteOptimizer.php b/src/Optimizers/FunctionCall/FwriteOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/FwriteOptimizer.php rename to src/Optimizers/FunctionCall/FwriteOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php b/src/Optimizers/FunctionCall/GetCalledClassOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GetCalledClassOptimizer.php rename to src/Optimizers/FunctionCall/GetCalledClassOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php b/src/Optimizers/FunctionCall/GetClassLowerOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GetClassLowerOptimizer.php rename to src/Optimizers/FunctionCall/GetClassLowerOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GetClassNsOptimizer.php b/src/Optimizers/FunctionCall/GetClassNsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GetClassNsOptimizer.php rename to src/Optimizers/FunctionCall/GetClassNsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GetClassOptimizer.php b/src/Optimizers/FunctionCall/GetClassOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GetClassOptimizer.php rename to src/Optimizers/FunctionCall/GetClassOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php b/src/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php rename to src/Optimizers/FunctionCall/GetDefinedVarsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GetNsClassOptimizer.php b/src/Optimizers/FunctionCall/GetNsClassOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GetNsClassOptimizer.php rename to src/Optimizers/FunctionCall/GetNsClassOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GettypeOptimizer.php b/src/Optimizers/FunctionCall/GettypeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GettypeOptimizer.php rename to src/Optimizers/FunctionCall/GettypeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php b/src/Optimizers/FunctionCall/GlobalsGetOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GlobalsGetOptimizer.php rename to src/Optimizers/FunctionCall/GlobalsGetOptimizer.php diff --git a/Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php b/src/Optimizers/FunctionCall/GlobalsSetOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/GlobalsSetOptimizer.php rename to src/Optimizers/FunctionCall/GlobalsSetOptimizer.php diff --git a/Library/Optimizers/FunctionCall/HashEqualsOptimizer.php b/src/Optimizers/FunctionCall/HashEqualsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/HashEqualsOptimizer.php rename to src/Optimizers/FunctionCall/HashEqualsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ImplodeOptimizer.php b/src/Optimizers/FunctionCall/ImplodeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ImplodeOptimizer.php rename to src/Optimizers/FunctionCall/ImplodeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/InArrayOptimizer.php b/src/Optimizers/FunctionCall/InArrayOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/InArrayOptimizer.php rename to src/Optimizers/FunctionCall/InArrayOptimizer.php diff --git a/Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php b/src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/InterfaceExistsOptimizer.php rename to src/Optimizers/FunctionCall/InterfaceExistsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IntvalOptimizer.php b/src/Optimizers/FunctionCall/IntvalOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IntvalOptimizer.php rename to src/Optimizers/FunctionCall/IntvalOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsArrayOptimizer.php b/src/Optimizers/FunctionCall/IsArrayOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsArrayOptimizer.php rename to src/Optimizers/FunctionCall/IsArrayOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsBoolOptimizer.php b/src/Optimizers/FunctionCall/IsBoolOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsBoolOptimizer.php rename to src/Optimizers/FunctionCall/IsBoolOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsCallableOptimizer.php b/src/Optimizers/FunctionCall/IsCallableOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsCallableOptimizer.php rename to src/Optimizers/FunctionCall/IsCallableOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsIntOptimizer.php b/src/Optimizers/FunctionCall/IsIntOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsIntOptimizer.php rename to src/Optimizers/FunctionCall/IsIntOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsNullOptimizer.php b/src/Optimizers/FunctionCall/IsNullOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsNullOptimizer.php rename to src/Optimizers/FunctionCall/IsNullOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsNumericOptimizer.php b/src/Optimizers/FunctionCall/IsNumericOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsNumericOptimizer.php rename to src/Optimizers/FunctionCall/IsNumericOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsObjectOptimizer.php b/src/Optimizers/FunctionCall/IsObjectOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsObjectOptimizer.php rename to src/Optimizers/FunctionCall/IsObjectOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsPhpVersionOptimizer.php b/src/Optimizers/FunctionCall/IsPhpVersionOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsPhpVersionOptimizer.php rename to src/Optimizers/FunctionCall/IsPhpVersionOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php b/src/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php rename to src/Optimizers/FunctionCall/IsPrivatePropertyOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsResourceOptimizer.php b/src/Optimizers/FunctionCall/IsResourceOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsResourceOptimizer.php rename to src/Optimizers/FunctionCall/IsResourceOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsScalarOptimizer.php b/src/Optimizers/FunctionCall/IsScalarOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsScalarOptimizer.php rename to src/Optimizers/FunctionCall/IsScalarOptimizer.php diff --git a/Library/Optimizers/FunctionCall/IsStringOptimizer.php b/src/Optimizers/FunctionCall/IsStringOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/IsStringOptimizer.php rename to src/Optimizers/FunctionCall/IsStringOptimizer.php diff --git a/Library/Optimizers/FunctionCall/JoinOptimizer.php b/src/Optimizers/FunctionCall/JoinOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/JoinOptimizer.php rename to src/Optimizers/FunctionCall/JoinOptimizer.php diff --git a/Library/Optimizers/FunctionCall/JsonDecodeOptimizer.php b/src/Optimizers/FunctionCall/JsonDecodeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/JsonDecodeOptimizer.php rename to src/Optimizers/FunctionCall/JsonDecodeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/JsonEncodeOptimizer.php b/src/Optimizers/FunctionCall/JsonEncodeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/JsonEncodeOptimizer.php rename to src/Optimizers/FunctionCall/JsonEncodeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/LdexpOptimizer.php b/src/Optimizers/FunctionCall/LdexpOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/LdexpOptimizer.php rename to src/Optimizers/FunctionCall/LdexpOptimizer.php diff --git a/Library/Optimizers/FunctionCall/LtrimOptimizer.php b/src/Optimizers/FunctionCall/LtrimOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/LtrimOptimizer.php rename to src/Optimizers/FunctionCall/LtrimOptimizer.php diff --git a/Library/Optimizers/FunctionCall/Md5Optimizer.php b/src/Optimizers/FunctionCall/Md5Optimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/Md5Optimizer.php rename to src/Optimizers/FunctionCall/Md5Optimizer.php diff --git a/Library/Optimizers/FunctionCall/MemstrOptimizer.php b/src/Optimizers/FunctionCall/MemstrOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/MemstrOptimizer.php rename to src/Optimizers/FunctionCall/MemstrOptimizer.php diff --git a/Library/Optimizers/FunctionCall/MergeAppendOptimizer.php b/src/Optimizers/FunctionCall/MergeAppendOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/MergeAppendOptimizer.php rename to src/Optimizers/FunctionCall/MergeAppendOptimizer.php diff --git a/Library/Optimizers/FunctionCall/MethodExistsOptimizer.php b/src/Optimizers/FunctionCall/MethodExistsOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/MethodExistsOptimizer.php rename to src/Optimizers/FunctionCall/MethodExistsOptimizer.php diff --git a/Library/Optimizers/FunctionCall/MicrotimeOptimizer.php b/src/Optimizers/FunctionCall/MicrotimeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/MicrotimeOptimizer.php rename to src/Optimizers/FunctionCall/MicrotimeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/PowOptimizer.php b/src/Optimizers/FunctionCall/PowOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/PowOptimizer.php rename to src/Optimizers/FunctionCall/PowOptimizer.php diff --git a/Library/Optimizers/FunctionCall/PregMatchAllOptimizer.php b/src/Optimizers/FunctionCall/PregMatchAllOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/PregMatchAllOptimizer.php rename to src/Optimizers/FunctionCall/PregMatchAllOptimizer.php diff --git a/Library/Optimizers/FunctionCall/PregMatchOptimizer.php b/src/Optimizers/FunctionCall/PregMatchOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/PregMatchOptimizer.php rename to src/Optimizers/FunctionCall/PregMatchOptimizer.php diff --git a/Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php b/src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php rename to src/Optimizers/FunctionCall/PrepareVirtualPathOptimizer.php diff --git a/Library/Optimizers/FunctionCall/RoundOptimizer.php b/src/Optimizers/FunctionCall/RoundOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/RoundOptimizer.php rename to src/Optimizers/FunctionCall/RoundOptimizer.php diff --git a/Library/Optimizers/FunctionCall/RtrimOptimizer.php b/src/Optimizers/FunctionCall/RtrimOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/RtrimOptimizer.php rename to src/Optimizers/FunctionCall/RtrimOptimizer.php diff --git a/Library/Optimizers/FunctionCall/SinOptimizer.php b/src/Optimizers/FunctionCall/SinOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/SinOptimizer.php rename to src/Optimizers/FunctionCall/SinOptimizer.php diff --git a/Library/Optimizers/FunctionCall/SqrtOptimizer.php b/src/Optimizers/FunctionCall/SqrtOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/SqrtOptimizer.php rename to src/Optimizers/FunctionCall/SqrtOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StartsWithOptimizer.php b/src/Optimizers/FunctionCall/StartsWithOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StartsWithOptimizer.php rename to src/Optimizers/FunctionCall/StartsWithOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StrReplaceOptimizer.php b/src/Optimizers/FunctionCall/StrReplaceOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StrReplaceOptimizer.php rename to src/Optimizers/FunctionCall/StrReplaceOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StripcslashesOptimizer.php b/src/Optimizers/FunctionCall/StripcslashesOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StripcslashesOptimizer.php rename to src/Optimizers/FunctionCall/StripcslashesOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StripslashesOptimizer.php b/src/Optimizers/FunctionCall/StripslashesOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StripslashesOptimizer.php rename to src/Optimizers/FunctionCall/StripslashesOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StrlenOptimizer.php b/src/Optimizers/FunctionCall/StrlenOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StrlenOptimizer.php rename to src/Optimizers/FunctionCall/StrlenOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StrposOptimizer.php b/src/Optimizers/FunctionCall/StrposOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StrposOptimizer.php rename to src/Optimizers/FunctionCall/StrposOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StrtokOptimizer.php b/src/Optimizers/FunctionCall/StrtokOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StrtokOptimizer.php rename to src/Optimizers/FunctionCall/StrtokOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StrtolowerOptimizer.php b/src/Optimizers/FunctionCall/StrtolowerOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StrtolowerOptimizer.php rename to src/Optimizers/FunctionCall/StrtolowerOptimizer.php diff --git a/Library/Optimizers/FunctionCall/StrtoupperOptimizer.php b/src/Optimizers/FunctionCall/StrtoupperOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/StrtoupperOptimizer.php rename to src/Optimizers/FunctionCall/StrtoupperOptimizer.php diff --git a/Library/Optimizers/FunctionCall/SubstrOptimizer.php b/src/Optimizers/FunctionCall/SubstrOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/SubstrOptimizer.php rename to src/Optimizers/FunctionCall/SubstrOptimizer.php diff --git a/Library/Optimizers/FunctionCall/TanOptimizer.php b/src/Optimizers/FunctionCall/TanOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/TanOptimizer.php rename to src/Optimizers/FunctionCall/TanOptimizer.php diff --git a/Library/Optimizers/FunctionCall/TimeOptimizer.php b/src/Optimizers/FunctionCall/TimeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/TimeOptimizer.php rename to src/Optimizers/FunctionCall/TimeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/TrimOptimizer.php b/src/Optimizers/FunctionCall/TrimOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/TrimOptimizer.php rename to src/Optimizers/FunctionCall/TrimOptimizer.php diff --git a/Library/Optimizers/FunctionCall/UcfirstOptimizer.php b/src/Optimizers/FunctionCall/UcfirstOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/UcfirstOptimizer.php rename to src/Optimizers/FunctionCall/UcfirstOptimizer.php diff --git a/Library/Optimizers/FunctionCall/UncamelizeOptimizer.php b/src/Optimizers/FunctionCall/UncamelizeOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/UncamelizeOptimizer.php rename to src/Optimizers/FunctionCall/UncamelizeOptimizer.php diff --git a/Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php b/src/Optimizers/FunctionCall/UniqueKeyOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/UniqueKeyOptimizer.php rename to src/Optimizers/FunctionCall/UniqueKeyOptimizer.php diff --git a/Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php b/src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/UniquePathKeyOptimizer.php rename to src/Optimizers/FunctionCall/UniquePathKeyOptimizer.php diff --git a/Library/Optimizers/FunctionCall/VarDumpOptimizer.php b/src/Optimizers/FunctionCall/VarDumpOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/VarDumpOptimizer.php rename to src/Optimizers/FunctionCall/VarDumpOptimizer.php diff --git a/Library/Optimizers/FunctionCall/VarExportOptimizer.php b/src/Optimizers/FunctionCall/VarExportOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/VarExportOptimizer.php rename to src/Optimizers/FunctionCall/VarExportOptimizer.php diff --git a/Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php b/src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php similarity index 100% rename from Library/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php rename to src/Optimizers/FunctionCall/ZephirStringToHexOptimizer.php diff --git a/Library/Optimizers/IsTypeOptimizerAbstract.php b/src/Optimizers/IsTypeOptimizerAbstract.php similarity index 100% rename from Library/Optimizers/IsTypeOptimizerAbstract.php rename to src/Optimizers/IsTypeOptimizerAbstract.php diff --git a/Library/Optimizers/MathOptimizer.php b/src/Optimizers/MathOptimizer.php similarity index 100% rename from Library/Optimizers/MathOptimizer.php rename to src/Optimizers/MathOptimizer.php diff --git a/Library/Optimizers/OptimizerAbstract.php b/src/Optimizers/OptimizerAbstract.php similarity index 100% rename from Library/Optimizers/OptimizerAbstract.php rename to src/Optimizers/OptimizerAbstract.php diff --git a/Library/Parser/Manager.php b/src/Parser/Manager.php similarity index 100% rename from Library/Parser/Manager.php rename to src/Parser/Manager.php diff --git a/Library/Parser/Parser.php b/src/Parser/Parser.php similarity index 100% rename from Library/Parser/Parser.php rename to src/Parser/Parser.php diff --git a/Library/Passes/CallGathererPass.php b/src/Passes/CallGathererPass.php similarity index 100% rename from Library/Passes/CallGathererPass.php rename to src/Passes/CallGathererPass.php diff --git a/Library/Passes/LocalContextPass.php b/src/Passes/LocalContextPass.php similarity index 100% rename from Library/Passes/LocalContextPass.php rename to src/Passes/LocalContextPass.php diff --git a/Library/Passes/LoopBreakPass.php b/src/Passes/LoopBreakPass.php similarity index 100% rename from Library/Passes/LoopBreakPass.php rename to src/Passes/LoopBreakPass.php diff --git a/Library/Passes/MutateGathererPass.php b/src/Passes/MutateGathererPass.php similarity index 100% rename from Library/Passes/MutateGathererPass.php rename to src/Passes/MutateGathererPass.php diff --git a/Library/Passes/SkipVariantInit.php b/src/Passes/SkipVariantInit.php similarity index 100% rename from Library/Passes/SkipVariantInit.php rename to src/Passes/SkipVariantInit.php diff --git a/Library/Passes/StaticTypeInference.php b/src/Passes/StaticTypeInference.php similarity index 100% rename from Library/Passes/StaticTypeInference.php rename to src/Passes/StaticTypeInference.php diff --git a/Library/Statements/BreakStatement.php b/src/Statements/BreakStatement.php similarity index 100% rename from Library/Statements/BreakStatement.php rename to src/Statements/BreakStatement.php diff --git a/Library/Statements/ContinueStatement.php b/src/Statements/ContinueStatement.php similarity index 100% rename from Library/Statements/ContinueStatement.php rename to src/Statements/ContinueStatement.php diff --git a/Library/Statements/DeclareStatement.php b/src/Statements/DeclareStatement.php similarity index 100% rename from Library/Statements/DeclareStatement.php rename to src/Statements/DeclareStatement.php diff --git a/Library/Statements/DoWhileStatement.php b/src/Statements/DoWhileStatement.php similarity index 100% rename from Library/Statements/DoWhileStatement.php rename to src/Statements/DoWhileStatement.php diff --git a/Library/Statements/EchoStatement.php b/src/Statements/EchoStatement.php similarity index 100% rename from Library/Statements/EchoStatement.php rename to src/Statements/EchoStatement.php diff --git a/Library/Statements/ForStatement.php b/src/Statements/ForStatement.php similarity index 100% rename from Library/Statements/ForStatement.php rename to src/Statements/ForStatement.php diff --git a/Library/Statements/IfStatement.php b/src/Statements/IfStatement.php similarity index 100% rename from Library/Statements/IfStatement.php rename to src/Statements/IfStatement.php diff --git a/Library/Statements/Let/ArrayIndex.php b/src/Statements/Let/ArrayIndex.php similarity index 100% rename from Library/Statements/Let/ArrayIndex.php rename to src/Statements/Let/ArrayIndex.php diff --git a/Library/Statements/Let/ArrayIndexAppend.php b/src/Statements/Let/ArrayIndexAppend.php similarity index 100% rename from Library/Statements/Let/ArrayIndexAppend.php rename to src/Statements/Let/ArrayIndexAppend.php diff --git a/Library/Statements/Let/Decr.php b/src/Statements/Let/Decr.php similarity index 100% rename from Library/Statements/Let/Decr.php rename to src/Statements/Let/Decr.php diff --git a/Library/Statements/Let/ExportSymbol.php b/src/Statements/Let/ExportSymbol.php similarity index 100% rename from Library/Statements/Let/ExportSymbol.php rename to src/Statements/Let/ExportSymbol.php diff --git a/Library/Statements/Let/ExportSymbolString.php b/src/Statements/Let/ExportSymbolString.php similarity index 100% rename from Library/Statements/Let/ExportSymbolString.php rename to src/Statements/Let/ExportSymbolString.php diff --git a/Library/Statements/Let/Incr.php b/src/Statements/Let/Incr.php similarity index 100% rename from Library/Statements/Let/Incr.php rename to src/Statements/Let/Incr.php diff --git a/Library/Statements/Let/ObjectDynamicProperty.php b/src/Statements/Let/ObjectDynamicProperty.php similarity index 100% rename from Library/Statements/Let/ObjectDynamicProperty.php rename to src/Statements/Let/ObjectDynamicProperty.php diff --git a/Library/Statements/Let/ObjectDynamicStringProperty.php b/src/Statements/Let/ObjectDynamicStringProperty.php similarity index 100% rename from Library/Statements/Let/ObjectDynamicStringProperty.php rename to src/Statements/Let/ObjectDynamicStringProperty.php diff --git a/Library/Statements/Let/ObjectProperty.php b/src/Statements/Let/ObjectProperty.php similarity index 100% rename from Library/Statements/Let/ObjectProperty.php rename to src/Statements/Let/ObjectProperty.php diff --git a/Library/Statements/Let/ObjectPropertyAppend.php b/src/Statements/Let/ObjectPropertyAppend.php similarity index 100% rename from Library/Statements/Let/ObjectPropertyAppend.php rename to src/Statements/Let/ObjectPropertyAppend.php diff --git a/Library/Statements/Let/ObjectPropertyArrayIndex.php b/src/Statements/Let/ObjectPropertyArrayIndex.php similarity index 100% rename from Library/Statements/Let/ObjectPropertyArrayIndex.php rename to src/Statements/Let/ObjectPropertyArrayIndex.php diff --git a/Library/Statements/Let/ObjectPropertyArrayIndexAppend.php b/src/Statements/Let/ObjectPropertyArrayIndexAppend.php similarity index 100% rename from Library/Statements/Let/ObjectPropertyArrayIndexAppend.php rename to src/Statements/Let/ObjectPropertyArrayIndexAppend.php diff --git a/Library/Statements/Let/ObjectPropertyDecr.php b/src/Statements/Let/ObjectPropertyDecr.php similarity index 100% rename from Library/Statements/Let/ObjectPropertyDecr.php rename to src/Statements/Let/ObjectPropertyDecr.php diff --git a/Library/Statements/Let/ObjectPropertyIncr.php b/src/Statements/Let/ObjectPropertyIncr.php similarity index 100% rename from Library/Statements/Let/ObjectPropertyIncr.php rename to src/Statements/Let/ObjectPropertyIncr.php diff --git a/Library/Statements/Let/StaticProperty.php b/src/Statements/Let/StaticProperty.php similarity index 100% rename from Library/Statements/Let/StaticProperty.php rename to src/Statements/Let/StaticProperty.php diff --git a/Library/Statements/Let/StaticPropertyAdd.php b/src/Statements/Let/StaticPropertyAdd.php similarity index 100% rename from Library/Statements/Let/StaticPropertyAdd.php rename to src/Statements/Let/StaticPropertyAdd.php diff --git a/Library/Statements/Let/StaticPropertyAppend.php b/src/Statements/Let/StaticPropertyAppend.php similarity index 100% rename from Library/Statements/Let/StaticPropertyAppend.php rename to src/Statements/Let/StaticPropertyAppend.php diff --git a/Library/Statements/Let/StaticPropertyArrayIndex.php b/src/Statements/Let/StaticPropertyArrayIndex.php similarity index 100% rename from Library/Statements/Let/StaticPropertyArrayIndex.php rename to src/Statements/Let/StaticPropertyArrayIndex.php diff --git a/Library/Statements/Let/StaticPropertyArrayIndexAppend.php b/src/Statements/Let/StaticPropertyArrayIndexAppend.php similarity index 100% rename from Library/Statements/Let/StaticPropertyArrayIndexAppend.php rename to src/Statements/Let/StaticPropertyArrayIndexAppend.php diff --git a/Library/Statements/Let/StaticPropertySub.php b/src/Statements/Let/StaticPropertySub.php similarity index 100% rename from Library/Statements/Let/StaticPropertySub.php rename to src/Statements/Let/StaticPropertySub.php diff --git a/Library/Statements/Let/Variable.php b/src/Statements/Let/Variable.php similarity index 100% rename from Library/Statements/Let/Variable.php rename to src/Statements/Let/Variable.php diff --git a/Library/Statements/Let/VariableAppend.php b/src/Statements/Let/VariableAppend.php similarity index 100% rename from Library/Statements/Let/VariableAppend.php rename to src/Statements/Let/VariableAppend.php diff --git a/Library/Statements/LetStatement.php b/src/Statements/LetStatement.php similarity index 100% rename from Library/Statements/LetStatement.php rename to src/Statements/LetStatement.php diff --git a/Library/Statements/LoopStatement.php b/src/Statements/LoopStatement.php similarity index 100% rename from Library/Statements/LoopStatement.php rename to src/Statements/LoopStatement.php diff --git a/Library/Statements/RequireOnceStatement.php b/src/Statements/RequireOnceStatement.php similarity index 100% rename from Library/Statements/RequireOnceStatement.php rename to src/Statements/RequireOnceStatement.php diff --git a/Library/Statements/RequireStatement.php b/src/Statements/RequireStatement.php similarity index 100% rename from Library/Statements/RequireStatement.php rename to src/Statements/RequireStatement.php diff --git a/Library/Statements/ReturnStatement.php b/src/Statements/ReturnStatement.php similarity index 100% rename from Library/Statements/ReturnStatement.php rename to src/Statements/ReturnStatement.php diff --git a/Library/Statements/StatementAbstract.php b/src/Statements/StatementAbstract.php similarity index 100% rename from Library/Statements/StatementAbstract.php rename to src/Statements/StatementAbstract.php diff --git a/Library/Statements/SwitchStatement.php b/src/Statements/SwitchStatement.php similarity index 100% rename from Library/Statements/SwitchStatement.php rename to src/Statements/SwitchStatement.php diff --git a/Library/Statements/ThrowStatement.php b/src/Statements/ThrowStatement.php similarity index 100% rename from Library/Statements/ThrowStatement.php rename to src/Statements/ThrowStatement.php diff --git a/Library/Statements/TryCatchStatement.php b/src/Statements/TryCatchStatement.php similarity index 100% rename from Library/Statements/TryCatchStatement.php rename to src/Statements/TryCatchStatement.php diff --git a/Library/Statements/UnsetStatement.php b/src/Statements/UnsetStatement.php similarity index 100% rename from Library/Statements/UnsetStatement.php rename to src/Statements/UnsetStatement.php diff --git a/Library/Statements/WhileStatement.php b/src/Statements/WhileStatement.php similarity index 100% rename from Library/Statements/WhileStatement.php rename to src/Statements/WhileStatement.php diff --git a/Library/StatementsBlock.php b/src/StatementsBlock.php similarity index 100% rename from Library/StatementsBlock.php rename to src/StatementsBlock.php diff --git a/Library/StaticCall.php b/src/StaticCall.php similarity index 100% rename from Library/StaticCall.php rename to src/StaticCall.php diff --git a/Library/StringsManager.php b/src/StringsManager.php similarity index 100% rename from Library/StringsManager.php rename to src/StringsManager.php diff --git a/Library/Stubs/DocBlock.php b/src/Stubs/DocBlock.php similarity index 100% rename from Library/Stubs/DocBlock.php rename to src/Stubs/DocBlock.php diff --git a/Library/Stubs/Generator.php b/src/Stubs/Generator.php similarity index 100% rename from Library/Stubs/Generator.php rename to src/Stubs/Generator.php diff --git a/Library/Stubs/MethodDocBlock.php b/src/Stubs/MethodDocBlock.php similarity index 100% rename from Library/Stubs/MethodDocBlock.php rename to src/Stubs/MethodDocBlock.php diff --git a/Library/SymbolTable.php b/src/SymbolTable.php similarity index 100% rename from Library/SymbolTable.php rename to src/SymbolTable.php diff --git a/Library/TypeAwareInterface.php b/src/TypeAwareInterface.php similarity index 100% rename from Library/TypeAwareInterface.php rename to src/TypeAwareInterface.php diff --git a/Library/Types/AbstractType.php b/src/Types/AbstractType.php similarity index 100% rename from Library/Types/AbstractType.php rename to src/Types/AbstractType.php diff --git a/Library/Types/ArrayType.php b/src/Types/ArrayType.php similarity index 100% rename from Library/Types/ArrayType.php rename to src/Types/ArrayType.php diff --git a/Library/Types/CharType.php b/src/Types/CharType.php similarity index 100% rename from Library/Types/CharType.php rename to src/Types/CharType.php diff --git a/Library/Types/DoubleType.php b/src/Types/DoubleType.php similarity index 100% rename from Library/Types/DoubleType.php rename to src/Types/DoubleType.php diff --git a/Library/Types/IntType.php b/src/Types/IntType.php similarity index 100% rename from Library/Types/IntType.php rename to src/Types/IntType.php diff --git a/Library/Types/IstringType.php b/src/Types/IstringType.php similarity index 100% rename from Library/Types/IstringType.php rename to src/Types/IstringType.php diff --git a/Library/Types/StringType.php b/src/Types/StringType.php similarity index 100% rename from Library/Types/StringType.php rename to src/Types/StringType.php diff --git a/Library/Types/Types.php b/src/Types/Types.php similarity index 100% rename from Library/Types/Types.php rename to src/Types/Types.php diff --git a/Library/Variable/Globals.php b/src/Variable/Globals.php similarity index 100% rename from Library/Variable/Globals.php rename to src/Variable/Globals.php diff --git a/Library/Variable/Variable.php b/src/Variable/Variable.php similarity index 100% rename from Library/Variable/Variable.php rename to src/Variable/Variable.php diff --git a/Library/Zephir.php b/src/Zephir.php similarity index 100% rename from Library/Zephir.php rename to src/Zephir.php diff --git a/Library/functions.php b/src/functions.php similarity index 100% rename from Library/functions.php rename to src/functions.php diff --git a/zephir b/zephir index 76e90909f4..8928747d67 100755 --- a/zephir +++ b/zephir @@ -111,7 +111,7 @@ $backend = new Backend($config, $rootPath.'/kernel', $rootPath.'/templates'); $compiler = new Compiler($config, $backend, new Manager($parser), $disk, $compilerFactory); $compiler->setPrototypesPath($rootPath.'/prototypes'); -$compiler->setOptimizersPath($rootPath.'/Library/Optimizers'); +$compiler->setOptimizersPath($rootPath.'/src/Optimizers'); $compiler->setTemplatesPath($rootPath.'/templates'); $compiler->setLogger($logger); From 322080ba90a2172a27b341a898d595374111529d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 21:11:55 +0000 Subject: [PATCH 101/375] Replace switch to match --- src/Code/Builder/Struct.php | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/Code/Builder/Struct.php b/src/Code/Builder/Struct.php index a5e6ff1fc8..ce00f3041c 100644 --- a/src/Code/Builder/Struct.php +++ b/src/Code/Builder/Struct.php @@ -160,27 +160,12 @@ public function getInitEntry(string $name, array $global, string $namespace): st */ protected function convertToCType(string $type): string { - switch ($type) { - case 'boolean': - case 'bool': - return 'zend_bool'; - - case 'hash': - return 'HashTable* '; - - case 'string': - return 'zend_string* '; - - case 'int': - case 'uint': - case 'long': - case 'char': - case 'uchar': - case 'double': - return $type; - - default: - throw new InvalidArgumentException('Unknown global type: '.$type); - } + return match ($type) { + 'boolean', 'bool' => 'zend_bool', + 'hash' => 'HashTable* ', + 'string' => 'zend_string* ', + 'int', 'uint', 'long', 'char', 'uchar', 'double' => $type, + default => throw new InvalidArgumentException('Unknown global type: '.$type), + }; } } From 1a3081e24a7f38ae640b8582bb4c81ae0397da18 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 29 Oct 2023 21:13:30 +0000 Subject: [PATCH 102/375] Fix CS --- .php-cs-fixer.dist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index ea5c16a65a..a489e5bb55 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -11,7 +11,7 @@ * the LICENSE file that was distributed with this source code. */ -if (!file_exists(__DIR__ . '/src')) { +if (!file_exists(__DIR__.'/src')) { exit(0); } From 5ec843cc372f908718a0effddb515278766ebcc2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 30 Oct 2023 11:02:17 +0000 Subject: [PATCH 103/375] Adjust position of license --- .php-cs-fixer.dist.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index a489e5bb55..824a5efce3 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,7 +1,5 @@ Date: Sun, 5 Nov 2023 19:31:07 +0000 Subject: [PATCH 104/375] Migrate functions into methods --- src/Compiler.php | 45 +++++++++++++++++++++++++++++++++++++++- src/functions.php | 53 ----------------------------------------------- 2 files changed, 44 insertions(+), 54 deletions(-) diff --git a/src/Compiler.php b/src/Compiler.php index a97056c84c..8092433209 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -734,7 +734,7 @@ public function compile(bool $development = false, int $jobs = null): void // TODO(klay): Make this better. Looks like it is non standard Env. Var exec('cd ext && %PHP_DEVPACK%\\phpize --clean', $output, $exit); - $releaseFolder = windows_release_dir(); + $releaseFolder = $this->getWindowsReleaseDir(); if (file_exists($releaseFolder)) { exec('rd /s /q '.$releaseFolder, $output, $exit); } @@ -2160,4 +2160,47 @@ static function (string $path): string { $paths ); } + + private function isZts(): bool + { + if (\defined('PHP_ZTS') && \PHP_ZTS === 1) { + return true; + } + + ob_start(); + phpinfo(\INFO_GENERAL); + + return (bool) preg_match('/Thread\s*Safety\s*enabled/i', strip_tags(ob_get_clean())); + } + + private function getWindowsReleaseDir(): string + { + if ($this->isZts()) { + if (\PHP_INT_SIZE === 4) { + // 32-bit version of PHP + return 'ext\\Release_TS'; + } + + if (\PHP_INT_SIZE === 8) { + // 64-bit version of PHP + return 'ext\\x64\\Release_TS'; + } + + // fallback + return 'ext\\Release_TS'; + } + + if (\PHP_INT_SIZE === 4) { + // 32-bit version of PHP + return 'ext\\Release'; + } + + if (\PHP_INT_SIZE === 8) { + // 64-bit version of PHP + return 'ext\\x64\\Release'; + } + + // fallback + return 'ext\\Release'; + } } diff --git a/src/functions.php b/src/functions.php index 9c9990428b..5968d0b8e7 100644 --- a/src/functions.php +++ b/src/functions.php @@ -165,56 +165,3 @@ function is_windows() { return 0 === stripos(\PHP_OS, 'WIN'); } - -/** - * Checks if current PHP is thread safe. - * - * @return bool - */ -function is_zts() -{ - if (\defined('PHP_ZTS') && \PHP_ZTS === 1) { - return true; - } - - ob_start(); - phpinfo(\INFO_GENERAL); - - return (bool) preg_match('/Thread\s*Safety\s*enabled/i', strip_tags(ob_get_clean())); -} - -/** - * Resolves Windows release folder. - * - * @return string - */ -function windows_release_dir() -{ - if (is_zts()) { - if (\PHP_INT_SIZE === 4) { - // 32-bit version of PHP - return 'ext\\Release_TS'; - } - - if (\PHP_INT_SIZE === 8) { - // 64-bit version of PHP - return 'ext\\x64\\Release_TS'; - } - - // fallback - return 'ext\\Release_TS'; - } - - if (\PHP_INT_SIZE === 4) { - // 32-bit version of PHP - return 'ext\\Release'; - } - - if (\PHP_INT_SIZE === 8) { - // 64-bit version of PHP - return 'ext\\x64\\Release'; - } - - // fallback - return 'ext\\Release'; -} From 7a347d1ac4057c32ab26dc1eac38ee22670e1831 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 5 Nov 2023 19:38:55 +0000 Subject: [PATCH 105/375] Remove redundant docblock --- src/CompilationContext.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/CompilationContext.php b/src/CompilationContext.php index c2522a6db1..857f1b0c12 100644 --- a/src/CompilationContext.php +++ b/src/CompilationContext.php @@ -144,10 +144,6 @@ class CompilationContext /** * Transform class/interface name to FQN format. - * - * @param string $className - * - * @return string */ public function getFullName(string $className): string { From f5889778cd8b4c00e13dbe546d43eaa6244d4d8c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 5 Nov 2023 19:44:52 +0000 Subject: [PATCH 106/375] Move `file_put_contents_ex()` function into `HardDisk` class --- src/Backend/FcallManager.php | 5 ++--- src/Backend/StringsManager.php | 7 +++---- src/Compiler.php | 21 +++++++++++---------- src/FileSystem/HardDisk.php | 16 ++++++++++++++++ src/functions.php | 24 ------------------------ 5 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/Backend/FcallManager.php b/src/Backend/FcallManager.php index 04c3ca61ea..9ba5c97c41 100644 --- a/src/Backend/FcallManager.php +++ b/src/Backend/FcallManager.php @@ -14,8 +14,7 @@ namespace Zephir\Backend; use Zephir\Code\Printer; - -use function Zephir\file_put_contents_ex; +use Zephir\FileSystem\HardDisk; class FcallManager implements FcallManagerInterface { @@ -156,6 +155,6 @@ public function genFcallCode(): void } $codePrinter->output('#endif'); - file_put_contents_ex($codePrinter->getOutput(), 'ext/kernel/fcall_internal.h'); + HardDisk::persistByHash($codePrinter->getOutput(), 'ext/kernel/fcall_internal.h'); } } diff --git a/src/Backend/StringsManager.php b/src/Backend/StringsManager.php index d90559deb8..e2713cb6a3 100644 --- a/src/Backend/StringsManager.php +++ b/src/Backend/StringsManager.php @@ -13,10 +13,9 @@ namespace Zephir\Backend; +use Zephir\FileSystem\HardDisk; use Zephir\StringsManager as BaseStringsManager; -use function Zephir\file_put_contents_ex; - /** * Manages the concatenation keys for the extension and the interned strings */ @@ -189,7 +188,7 @@ public function genConcatCode(): void #endif /* ZEPHIR_KERNEL_CONCAT_H */ '; $contents = $pcodeh.implode(PHP_EOL, $macros).PHP_EOL.PHP_EOL.$codeh; - file_put_contents_ex($contents, 'ext/kernel/concat.h'); - file_put_contents_ex($code, 'ext/kernel/concat.c'); + HardDisk::persistByHash($contents, 'ext/kernel/concat.h'); + HardDisk::persistByHash($code, 'ext/kernel/concat.c'); } } diff --git a/src/Compiler.php b/src/Compiler.php index 8092433209..e3068c0503 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -31,6 +31,7 @@ use Zephir\Exception\ParseException; use Zephir\Exception\RuntimeException; use Zephir\FileSystem\FileSystemInterface; +use Zephir\FileSystem\HardDisk; use Zephir\Parser\Manager; final class Compiler @@ -994,7 +995,7 @@ public function createConfigFiles(string $project): bool $contentM4 = str_replace($mark, $replace, $contentM4); } - file_put_contents_ex($contentM4, 'ext/config.m4'); + HardDisk::persistByHash($contentM4, 'ext/config.m4'); /** * Generate config.w32. @@ -1017,7 +1018,7 @@ public function createConfigFiles(string $project): bool $contentW32 = str_replace($mark, $replace, $contentW32); } - $needConfigure = file_put_contents_ex($contentW32, 'ext/config.w32'); + $needConfigure = HardDisk::persistByHash($contentW32, 'ext/config.w32'); /** * php_ext.h. @@ -1035,7 +1036,7 @@ public function createConfigFiles(string $project): bool $content = str_replace($mark, $replace, $content); } - file_put_contents_ex($content, 'ext/php_ext.h'); + HardDisk::persistByHash($content, 'ext/php_ext.h'); /** * ext.h. @@ -1053,7 +1054,7 @@ public function createConfigFiles(string $project): bool $content = str_replace($mark, $replace, $content); } - file_put_contents_ex($content, 'ext/ext.h'); + HardDisk::persistByHash($content, 'ext/ext.h'); /** * ext_config.h. @@ -1071,7 +1072,7 @@ public function createConfigFiles(string $project): bool $content = str_replace($mark, $replace, $content); } - file_put_contents_ex($content, 'ext/ext_config.h'); + HardDisk::persistByHash($content, 'ext/ext_config.h'); /** * ext_clean. @@ -1081,7 +1082,7 @@ public function createConfigFiles(string $project): bool throw new Exception("Clean file doesn't exist"); } - if (file_put_contents_ex($content, 'ext/clean')) { + if (HardDisk::persistByHash($content, 'ext/clean')) { chmod('ext/clean', 0755); } @@ -1101,7 +1102,7 @@ public function createConfigFiles(string $project): bool $content = str_replace($mark, $replace, $content); } - if (file_put_contents_ex($content, 'ext/install')) { + if (HardDisk::persistByHash($content, 'ext/install')) { chmod('ext/install', 0755); } @@ -1596,7 +1597,7 @@ public function createProjectFiles(string $project): bool /** * Round 5. Generate and place the entry point of the project */ - file_put_contents_ex($content, 'ext/'.$safeProject.'.c'); + HardDisk::persistByHash($content, 'ext/'.$safeProject.'.c'); unset($content); /** @@ -1637,7 +1638,7 @@ public function createProjectFiles(string $project): bool $content = str_replace($mark, $replace, $content); } - file_put_contents_ex($content, 'ext/'.$safeProject.'.h'); + HardDisk::persistByHash($content, 'ext/'.$safeProject.'.h'); unset($content); /** @@ -1666,7 +1667,7 @@ public function createProjectFiles(string $project): bool $content = str_replace($mark, $replace, $content); } - file_put_contents_ex($content, 'ext/php_'.$safeProject.'.h'); + HardDisk::persistByHash($content, 'ext/php_'.$safeProject.'.h'); unset($content); return $needConfigure; diff --git a/src/FileSystem/HardDisk.php b/src/FileSystem/HardDisk.php index 9a5010b0b6..7b0d001861 100644 --- a/src/FileSystem/HardDisk.php +++ b/src/FileSystem/HardDisk.php @@ -225,6 +225,22 @@ public function normalizePath(string $path): string return str_replace(['\\', ':', '/'], '_', $path); } + /** + * Checks if the content of the file on the disk is the same as the content. + */ + public static function persistByHash(string $data, string $path): int|bool + { + if (!file_exists($path)) { + return file_put_contents($path, $data); + } + + if (md5($data) !== md5_file($path)) { + return file_put_contents($path, $data); + } + + return false; + } + protected function deleteFileInfoObject(\SplFileInfo $file): bool { switch ($file->getType()) { diff --git a/src/functions.php b/src/functions.php index 5968d0b8e7..2f4450bf93 100644 --- a/src/functions.php +++ b/src/functions.php @@ -132,30 +132,6 @@ function fqcn($className, $currentNamespace, AliasManager $aliasManager = null) return $className; } -/** - * Checks if the content of the file on the disk is the same as the content. - * - * @param string $content - * @param string $path - * - * @return int|bool - */ -function file_put_contents_ex($content, $path) -{ - if (file_exists($path)) { - $contentMd5 = md5($content); - $existingMd5 = md5_file($path); - - if ($contentMd5 !== $existingMd5) { - return file_put_contents($path, $content); - } - } else { - return file_put_contents($path, $content); - } - - return false; -} - /** * Checks if currently running under MS Windows. * From 27e62f2f8b5ad51feff05185fe6d07e38f52f1f3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 5 Nov 2023 19:53:28 +0000 Subject: [PATCH 107/375] Move `is_windows()` function into `Os` class --- src/Compiler.php | 12 ++++----- src/Console/Command/CleanCommand.php | 5 ++-- src/Console/Command/FullCleanCommand.php | 5 ++-- src/Os.php | 27 +++++++++++++++++++ src/functions.php | 10 ------- tests/Extension/Integral/RegexDNATest.php | 5 ++-- tests/Extension/StringTest.php | 5 ++-- tests/Zephir/ConfigTest.php | 7 +++-- .../Documentation/DocblockParserTest.php | 5 ++-- .../Formatter/CompilerFormatterTest.php | 5 ++-- tests/Zephir/Stubs/DocBlockTest.php | 17 ++++++------ tests/Zephir/Stubs/GeneratorTest.php | 11 ++++---- 12 files changed, 61 insertions(+), 53 deletions(-) create mode 100644 src/Os.php diff --git a/src/Compiler.php b/src/Compiler.php index e3068c0503..e42448f579 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -374,7 +374,7 @@ public function getExtensionGlobal(string $name): array */ public function getGccFlags(bool $development = false): string { - if (is_windows()) { + if (Os::isWindows()) { // TODO return ''; } @@ -412,7 +412,7 @@ public function getPhpIncludeDirs(): string */ public function preCompileHeaders(): void { - if (is_windows()) { + if (Os::isWindows()) { // TODO: Add Windows support return; } @@ -731,7 +731,7 @@ public function compile(bool $development = false, int $jobs = null): void unlink("$currentDir/ext/modules/{$namespace}.so"); } - if (is_windows()) { + if (Os::isWindows()) { // TODO(klay): Make this better. Looks like it is non standard Env. Var exec('cd ext && %PHP_DEVPACK%\\phpize --clean', $output, $exit); @@ -796,7 +796,7 @@ public function compile(bool $development = false, int $jobs = null): void $currentDir = getcwd(); $this->logger->info('Compiling...'); - if (is_windows()) { + if (Os::isWindows()) { exec( 'cd ext && nmake 2>'.$currentDir.'\compile-errors.log 1>'. $currentDir.'\compile.log', @@ -884,7 +884,7 @@ public function install(bool $development = false): void $namespace = str_replace('\\', '_', $this->checkDirectory()); $currentDir = getcwd(); - if (is_windows()) { + if (Os::isWindows()) { throw new NotImplementedException('Installation is not implemented for Windows yet. Aborting.'); } @@ -2132,7 +2132,7 @@ private function checkDirectory(): string */ private function getGccVersion(): string { - if (is_windows()) { + if (Os::isWindows()) { return '0.0.0'; } diff --git a/src/Console/Command/CleanCommand.php b/src/Console/Command/CleanCommand.php index 8a9a4bec26..fd432bcd15 100644 --- a/src/Console/Command/CleanCommand.php +++ b/src/Console/Command/CleanCommand.php @@ -18,8 +18,7 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Zephir\Exception\FileSystemException; use Zephir\FileSystem\FileSystemInterface; - -use function Zephir\is_windows; +use Zephir\Os; /** * Cleans any object files created by the extension. @@ -56,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->filesystem->clean(); // TODO(klay): Do nothing if there is no Makefile - if (is_windows()) { + if (Os::isWindows()) { // TODO(klay): Is there an analogue for "> /dev/null" ? system('cd ext && nmake clean-all'); } else { diff --git a/src/Console/Command/FullCleanCommand.php b/src/Console/Command/FullCleanCommand.php index 27effaaf3d..8431826300 100644 --- a/src/Console/Command/FullCleanCommand.php +++ b/src/Console/Command/FullCleanCommand.php @@ -18,8 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zephir\Exception\FileSystemException; - -use function Zephir\is_windows; +use Zephir\Os; /** * Full Clean Command @@ -49,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output) */ try { if (0 === $command->run(new ArrayInput($arguments), $output)) { - if (is_windows()) { + if (Os::isWindows()) { system('cd ext && phpize --clean'); } else { system('cd ext && phpize --clean > /dev/null'); diff --git a/src/Os.php b/src/Os.php new file mode 100644 index 0000000000..558c3e3679 --- /dev/null +++ b/src/Os.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir; + +use const PHP_OS; + +class Os +{ + /** + * Checks if currently running under MS Windows. + */ + public static function isWindows(): bool + { + return 0 === stripos(PHP_OS, 'WIN'); + } +} diff --git a/src/functions.php b/src/functions.php index 2f4450bf93..8181b470b8 100644 --- a/src/functions.php +++ b/src/functions.php @@ -131,13 +131,3 @@ function fqcn($className, $currentNamespace, AliasManager $aliasManager = null) return $className; } - -/** - * Checks if currently running under MS Windows. - * - * @return bool - */ -function is_windows() -{ - return 0 === stripos(\PHP_OS, 'WIN'); -} diff --git a/tests/Extension/Integral/RegexDNATest.php b/tests/Extension/Integral/RegexDNATest.php index d2f09717a0..9b0d505f46 100644 --- a/tests/Extension/Integral/RegexDNATest.php +++ b/tests/Extension/Integral/RegexDNATest.php @@ -15,14 +15,13 @@ use PHPUnit\Framework\TestCase; use Stub\RegexDNA; - -use function Zephir\is_windows; +use Zephir\Os; final class RegexDNATest extends TestCase { public function testProcess(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Different strlen() in Windows.'); } diff --git a/tests/Extension/StringTest.php b/tests/Extension/StringTest.php index c5ae82f92a..ecff820a28 100644 --- a/tests/Extension/StringTest.php +++ b/tests/Extension/StringTest.php @@ -15,8 +15,7 @@ use PHPUnit\Framework\TestCase; use Stub\Strings; - -use function Zephir\is_windows; +use Zephir\Os; final class StringTest extends TestCase { @@ -259,7 +258,7 @@ public function testStripcslashes(): void public function testMultilineStrings(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('String will contain different line endings.'); } diff --git a/tests/Zephir/ConfigTest.php b/tests/Zephir/ConfigTest.php index a434673bb1..265f8da8d4 100644 --- a/tests/Zephir/ConfigTest.php +++ b/tests/Zephir/ConfigTest.php @@ -15,8 +15,7 @@ use PHPUnit\Framework\TestCase; use Zephir\Config; - -use function Zephir\is_windows; +use Zephir\Os; final class ConfigTest extends TestCase { @@ -170,7 +169,7 @@ public function defaultConfigProvider(): array */ public function testShouldGetDefaultConfigParams($namespace, string $key, $expected) { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -230,7 +229,7 @@ public function testShouldUnsetConfigParams(): void public function testShouldGetBannerFromConfig(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } diff --git a/tests/Zephir/Documentation/DocblockParserTest.php b/tests/Zephir/Documentation/DocblockParserTest.php index c827b6619e..ba6998550b 100644 --- a/tests/Zephir/Documentation/DocblockParserTest.php +++ b/tests/Zephir/Documentation/DocblockParserTest.php @@ -20,14 +20,13 @@ use Zephir\Documentation\Annotation\See; use Zephir\Documentation\Docblock; use Zephir\Documentation\DocblockParser; - -use function Zephir\is_windows; +use Zephir\Os; final class DocblockParserTest extends TestCase { public function testShouldParseDocblockFromString(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } diff --git a/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php b/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php index 15def00c33..3a3fc11d09 100644 --- a/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php +++ b/tests/Zephir/Logger/Formatter/CompilerFormatterTest.php @@ -16,8 +16,7 @@ use PHPUnit\Framework\TestCase; use Zephir\Config; use Zephir\Logger\Formatter\CompilerFormatter; - -use function Zephir\is_windows; +use Zephir\Os; final class CompilerFormatterTest extends TestCase { @@ -73,7 +72,7 @@ public function testShouldBeQuietForDisabledWarning(): void public function testShouldFormatWarningForCategory(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } diff --git a/tests/Zephir/Stubs/DocBlockTest.php b/tests/Zephir/Stubs/DocBlockTest.php index ac94554824..8fda3d585d 100644 --- a/tests/Zephir/Stubs/DocBlockTest.php +++ b/tests/Zephir/Stubs/DocBlockTest.php @@ -14,10 +14,9 @@ namespace Zephir\Test\Stubs; use PHPUnit\Framework\TestCase; +use Zephir\Os; use Zephir\Stubs\DocBlock; -use function Zephir\is_windows; - final class DocBlockTest extends TestCase { public function testInitialState(): void @@ -29,7 +28,7 @@ public function testInitialState(): void public function testDescription(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -53,7 +52,7 @@ public function testDescription(): void public function testPhpDocs(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -76,7 +75,7 @@ public function testPhpDocs(): void public function testPhpDocWithDescription(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -101,7 +100,7 @@ public function testPhpDocWithDescription(): void public function testPhpDocWithCodeBloc(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -152,7 +151,7 @@ public function testPhpDocWithCodeBloc(): void public function testPhpDocWithScalarParams(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -210,7 +209,7 @@ public function testPhpDocWithScalarParams(): void public function testPhpDocWithVariousDocBlockTags(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -253,7 +252,7 @@ public function testPhpDocWithVariousDocBlockTags(): void public function testPhpDocWithDoubleDollarSymbols(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index efd88defe2..4f11177886 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -20,10 +20,9 @@ use Zephir\Class\Method\Method; use Zephir\Class\Method\Parameters; use Zephir\Class\Property; +use Zephir\Os; use Zephir\Stubs\Generator; -use function Zephir\is_windows; - class GeneratorTest extends TestCase { /** @@ -59,7 +58,7 @@ private function getMethod(string $name) public function testShouldBuildClass(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -250,7 +249,7 @@ public function propertyProvider(): array */ public function testShouldBuildProperty(array $visibility, string $type, $value, string $expected): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -338,7 +337,7 @@ public function constantProvider(): array */ public function testShouldBuildConstant(string $type, $value, string $expected): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } @@ -383,7 +382,7 @@ public function testShouldBuildConstant(string $type, $value, string $expected): public function testShouldBuildMethod(): void { - if (is_windows()) { + if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); } From 7c404568172e041eff26274cd88418336fc9c5fb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 17:56:45 +0000 Subject: [PATCH 108/375] Bump docker image to `php:8.3.0RC6-fpm` --- .docker/8.3/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/8.3/Dockerfile b/.docker/8.3/Dockerfile index 1e1d267118..743d3b7f70 100644 --- a/.docker/8.3/Dockerfile +++ b/.docker/8.3/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest AS composer -FROM php:8.3.0RC5-fpm +FROM php:8.3.0RC6-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" From 17a20ffbd0c812fc5a8fedfc0aaac310ffefa525 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 17:56:51 +0000 Subject: [PATCH 109/375] Update composer.lock --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 1151b80e0d..a42e55c631 100644 --- a/composer.lock +++ b/composer.lock @@ -263,16 +263,16 @@ }, { "name": "symfony/console", - "version": "v5.4.28", + "version": "v5.4.31", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827" + "reference": "11ac5f154e0e5c4c77af83ad11ead9165280b92a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827", + "url": "https://api.github.com/repos/symfony/console/zipball/11ac5f154e0e5c4c77af83ad11ead9165280b92a", + "reference": "11ac5f154e0e5c4c77af83ad11ead9165280b92a", "shasum": "" }, "require": { @@ -342,7 +342,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.28" + "source": "https://github.com/symfony/console/tree/v5.4.31" }, "funding": [ { @@ -358,7 +358,7 @@ "type": "tidelift" } ], - "time": "2023-08-07T06:12:30+00:00" + "time": "2023-10-31T07:58:33+00:00" }, { "name": "symfony/deprecation-contracts", From b57bc417060f5ed25a1f25aa1dc27a38c8025ac1 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 17:57:25 +0000 Subject: [PATCH 110/375] Migrate `camelize()` function into `Name` class --- src/CompilerFile.php | 4 ++-- src/FunctionCall.php | 2 +- src/Name.php | 22 ++++++++++++++++++++++ src/functions.php | 12 ------------ tests/Zephir/HelpersTest.php | 10 ---------- tests/Zephir/NameTest.php | 26 ++++++++++++++++++++++++++ 6 files changed, 51 insertions(+), 25 deletions(-) create mode 100644 src/Name.php create mode 100644 tests/Zephir/NameTest.php diff --git a/src/CompilerFile.php b/src/CompilerFile.php index 03c4042f06..ae7260acc9 100644 --- a/src/CompilerFile.php +++ b/src/CompilerFile.php @@ -987,7 +987,7 @@ protected function processShortcuts(array $property, Definition $classDefinition $classDefinition->addMethod(new Method( $classDefinition, ['public'], - 'get'.camelize($name), + 'get'.Name::camelize($name), null, new StatementsBlock([ [ @@ -1015,7 +1015,7 @@ protected function processShortcuts(array $property, Definition $classDefinition $classDefinition->addMethod(new Method( $classDefinition, ['public'], - 'set'.camelize($name), + 'set'.Name::camelize($name), new Parameters([ [ 'type' => 'parameter', diff --git a/src/FunctionCall.php b/src/FunctionCall.php index 5047b87258..0e2b675f60 100644 --- a/src/FunctionCall.php +++ b/src/FunctionCall.php @@ -320,7 +320,7 @@ protected function optimize($funcName, array $expression, Call $call, Compilatio * Check if the optimizer is already cached */ if (!isset(self::$optimizers[$funcName])) { - $camelizeFunctionName = camelize($funcName); + $camelizeFunctionName = Name::camelize($funcName); /* * Check every optimizer directory for an optimizer diff --git a/src/Name.php b/src/Name.php new file mode 100644 index 0000000000..54ff268119 --- /dev/null +++ b/src/Name.php @@ -0,0 +1,22 @@ + + * + * 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; + +final class Name +{ + public static function camelize(string $string): string + { + return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); + } +} diff --git a/src/functions.php b/src/functions.php index 8181b470b8..e8d7984bfb 100644 --- a/src/functions.php +++ b/src/functions.php @@ -13,18 +13,6 @@ use Zephir\Exception\InvalidArgumentException; -/** - * Camelize a string. - * - * @param string $string - * - * @return string - */ -function camelize($string) -{ - return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); -} - /** * Prepares a string to be used as a C-string. * diff --git a/tests/Zephir/HelpersTest.php b/tests/Zephir/HelpersTest.php index c21db61d84..da278aa1d4 100644 --- a/tests/Zephir/HelpersTest.php +++ b/tests/Zephir/HelpersTest.php @@ -16,19 +16,9 @@ use PHPUnit\Framework\TestCase; use function Zephir\add_slashes; -use function Zephir\camelize; final class HelpersTest extends TestCase { - public function testShouldCamelizeClassName(): void - { - $name = 'foo_Bar_Foo_bar'; - $this->assertSame( - camelize($name), - 'FooBarFooBar' - ); - } - public function cStringProvider(): array { return [ diff --git a/tests/Zephir/NameTest.php b/tests/Zephir/NameTest.php new file mode 100644 index 0000000000..b60103de4a --- /dev/null +++ b/tests/Zephir/NameTest.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Zephir\Test; + +use PHPUnit\Framework\TestCase; +use Zephir\Name; + +final class NameTest extends TestCase +{ + public function testCamelize(): void + { + $name = 'foo_Bar_Foo_bar'; + $this->assertSame(Name::camelize($name), 'FooBarFooBar'); + } +} From 54f06fd0d0020235f823cabad35bd50b9bc4aadd Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 18:06:09 +0000 Subject: [PATCH 111/375] Migrate `fqcn()` function into `Name` class --- src/CompilationContext.php | 2 +- src/CompilerFile.php | 11 +-------- src/Name.php | 33 ++++++++++++++++++++++++++ src/Statements/ThrowStatement.php | 4 ++-- src/functions.php | 39 ------------------------------- 5 files changed, 37 insertions(+), 52 deletions(-) diff --git a/src/CompilationContext.php b/src/CompilationContext.php index 857f1b0c12..7e2a63e4a9 100644 --- a/src/CompilationContext.php +++ b/src/CompilationContext.php @@ -150,7 +150,7 @@ public function getFullName(string $className): string $isFunction = $this->currentMethod instanceof FunctionDefinition; $namespace = $isFunction ? $this->currentMethod->getNamespace() : $this->classDefinition->getNamespace(); - return fqcn($className, $namespace, $this->aliasManager); + return Name::fetchFQN($className, $namespace, $this->aliasManager); } /** diff --git a/src/CompilerFile.php b/src/CompilerFile.php index ae7260acc9..77e14612fc 100644 --- a/src/CompilerFile.php +++ b/src/CompilerFile.php @@ -1101,23 +1101,14 @@ protected function processShortcuts(array $property, Definition $classDefinition /** * Transform class/interface name to FQN format. - * - * @param string $name - * - * @return string */ protected function getFullName(string $name): string { - return fqcn($name, $this->namespace, $this->aliasManager); + return Name::fetchFQN($name, $this->namespace, $this->aliasManager); } /** * Create returns type list. - * - * @param array $types - * @param bool $annotated - * - * @return array */ protected function createReturnsType(array $types, bool $annotated = false): ?array { diff --git a/src/Name.php b/src/Name.php index 54ff268119..c05d1280a5 100644 --- a/src/Name.php +++ b/src/Name.php @@ -19,4 +19,37 @@ public static function camelize(string $string): string { return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); } + + /** + * Transform class/interface name to + * Fully qualified path name (FQN) format. + */ + public static function fetchFQN( + string $class, + ?string $namespace = null, + ?AliasManager $aliasManager = null + ): string { + /** + * Absolute class/interface name + */ + if ('\\' === $class[0]) { + return substr($class, 1); + } + + /** + * If class/interface name not begin with \ + * maybe an alias or a sub-namespace + */ + $firstSepPos = strpos($class, '\\'); + if (false !== $firstSepPos) { + $baseName = substr($class, 0, $firstSepPos); + if ($aliasManager && $aliasManager->isAlias($baseName)) { + return $aliasManager->getAlias($baseName).'\\'.substr($class, $firstSepPos + 1); + } + } elseif ($aliasManager && $aliasManager->isAlias($class)) { + return $aliasManager->getAlias($class); + } + + return $namespace ? $namespace.'\\'.$class : $class; + } } diff --git a/src/Statements/ThrowStatement.php b/src/Statements/ThrowStatement.php index 701cc7b69b..51e6babd06 100644 --- a/src/Statements/ThrowStatement.php +++ b/src/Statements/ThrowStatement.php @@ -20,9 +20,9 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; +use Zephir\Name; use function Zephir\add_slashes; -use function Zephir\fqcn; /** * Throws exceptions @@ -52,7 +52,7 @@ public function compile(CompilationContext $compilationContext): void && 1 == \count($expr['parameters']) && 'string' == $expr['parameters'][0]['parameter']['type'] ) { - $className = fqcn( + $className = Name::fetchFQN( $expr['class'], $compilationContext->classDefinition->getNamespace(), $compilationContext->aliasManager diff --git a/src/functions.php b/src/functions.php index e8d7984bfb..e20dc74382 100644 --- a/src/functions.php +++ b/src/functions.php @@ -80,42 +80,3 @@ function add_slashes(string $string): string return $newstr; } - -/** - * Transform class/interface name to FQN format. - * - * @param string $className - * @param string $currentNamespace - * @param AliasManager $aliasManager - * - * @return string - */ -function fqcn($className, $currentNamespace, AliasManager $aliasManager = null) -{ - if (!\is_string($className)) { - throw new InvalidArgumentException('Class name must be a string, got '.\gettype($className)); - } - - // Absolute class/interface name - if ('\\' === $className[0]) { - return substr($className, 1); - } - - // If class/interface name not begin with \ maybe a alias or a sub-namespace - $firstSepPos = strpos($className, '\\'); - if (false !== $firstSepPos) { - $baseName = substr($className, 0, $firstSepPos); - if ($aliasManager && $aliasManager->isAlias($baseName)) { - return $aliasManager->getAlias($baseName).'\\'.substr($className, $firstSepPos + 1); - } - } elseif ($aliasManager && $aliasManager->isAlias($className)) { - return $aliasManager->getAlias($className); - } - - // Relative class/interface name - if ($currentNamespace) { - return $currentNamespace.'\\'.$className; - } - - return $className; -} From 61eace1f6db775981e168346081948b9bc697ac0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 18:19:59 +0000 Subject: [PATCH 112/375] Migrate `add_slashes()` function into `Name` class --- composer.json | 5 +- src/Backend/Backend.php | 5 +- src/Call.php | 4 +- src/Class/Method/Method.php | 7 +- src/Class/Property.php | 5 +- src/Expression/Constants.php | 30 ++----- src/Expression/PropertyDynamicAccess.php | 5 +- src/Name.php | 62 ++++++++++++++ src/Operators/Other/ConcatOperator.php | 5 +- .../FunctionCall/ExplodeOptimizer.php | 7 +- .../FunctionCall/FunctionExistsOptimizer.php | 9 +- .../FunctionCall/ImplodeOptimizer.php | 7 +- .../FunctionCall/MemstrOptimizer.php | 5 +- .../FunctionCall/MethodExistsOptimizer.php | 7 +- src/Statements/EchoStatement.php | 5 +- src/Statements/ForStatement.php | 5 +- src/Statements/Let/Variable.php | 5 +- src/Statements/ReturnStatement.php | 5 +- src/Statements/ThrowStatement.php | 4 +- src/functions.php | 82 ------------------- tests/Zephir/HelpersTest.php | 61 -------------- tests/Zephir/NameTest.php | 37 +++++++++ 22 files changed, 139 insertions(+), 228 deletions(-) delete mode 100644 src/functions.php delete mode 100644 tests/Zephir/HelpersTest.php diff --git a/composer.json b/composer.json index 16ad00ac6f..3cf66e6670 100644 --- a/composer.json +++ b/composer.json @@ -50,10 +50,7 @@ "autoload": { "psr-4": { "Zephir\\": "src/" - }, - "files": [ - "src/functions.php" - ] + } }, "autoload-dev": { "psr-4": { diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index c37867a6d5..02a2d536a4 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -24,11 +24,10 @@ use Zephir\Exception\CompilerException; use Zephir\FunctionDefinition; use Zephir\GlobalConstant; +use Zephir\Name; use Zephir\Variable\Globals; use Zephir\Variable\Variable; -use function Zephir\add_slashes; - class Backend { protected FcallManagerInterface $fcallManager; @@ -442,7 +441,7 @@ public function declareConstant($type, $name, $value, CompilationContext $contex case 'string': case 'char': if ('string' == $type || 'char' == $type) { - $value = '"'.add_slashes($value).'"'; + $value = '"'.Name::addSlashes($value).'"'; } $dType = 'string'; break; diff --git a/src/Call.php b/src/Call.php index 24aac202cc..ab2e6fa66d 100644 --- a/src/Call.php +++ b/src/Call.php @@ -359,7 +359,7 @@ public function getResolvedParams(array $parameters, CompilationContext $compila $compilationContext->backend->assignString( $parameterVariable, - add_slashes($compiledExpression->getCode()), + Name::addSlashes($compiledExpression->getCode()), $compilationContext ); @@ -510,7 +510,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext $compilationContext->backend->assignString( $parameterVariable, - add_slashes($compiledExpression->getCode()), + Name::addSlashes($compiledExpression->getCode()), $compilationContext ); diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 00bfe9cd69..406abcb015 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -26,6 +26,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; +use Zephir\Name; use Zephir\Passes\CallGathererPass; use Zephir\Passes\LocalContextPass; use Zephir\Passes\StaticTypeInference; @@ -33,8 +34,6 @@ use Zephir\SymbolTable; use Zephir\Variable\Variable; -use function Zephir\add_slashes; - /** * Represents a class method */ @@ -1048,7 +1047,7 @@ public function assignDefaultValue(array $parameter, CompilationContext $compila $compilationContext->backend->initVar($paramVariable, $compilationContext); $compilationContext->backend->assignString( $paramVariable, - add_slashes($parameter['default']['value']), + Name::addSlashes($parameter['default']['value']), $compilationContext ); break; @@ -1126,7 +1125,7 @@ public function assignDefaultValue(array $parameter, CompilationContext $compila $compilationContext->backend->initVar($symbolVariable, $compilationContext); $compilationContext->backend->assignString( $paramVariable, - add_slashes($parameter['default']['value']), + Name::addSlashes($parameter['default']['value']), $compilationContext ); break; diff --git a/src/Class/Property.php b/src/Class/Property.php index 051f2d9214..0571103cf7 100644 --- a/src/Class/Property.php +++ b/src/Class/Property.php @@ -20,11 +20,10 @@ use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\Expression\Builder\Operators\BinaryOperator; +use Zephir\Name; use Zephir\StatementsBlock; use Zephir\Types\Types; -use function Zephir\add_slashes; - /** * Represents a property class */ @@ -355,7 +354,7 @@ protected function declareProperty(CompilationContext $compilationContext, $type 'zend_declare_property_string(%s, SL("%s"), "%s", %s);', $classEntry, $this->getName(), - add_slashes($value), + Name::addSlashes($value), $this->getVisibilityAccessor() ), false diff --git a/src/Expression/Constants.php b/src/Expression/Constants.php index 079c525851..d2cbd1163d 100644 --- a/src/Expression/Constants.php +++ b/src/Expression/Constants.php @@ -15,37 +15,24 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\LiteralCompiledExpression; +use Zephir\Name; use Zephir\Variable\Variable; -use function constant; -use function Zephir\add_slashes; - /** * Resolves PHP or Zephir constants into C-Code */ class Constants { - /** - * @var bool - */ protected bool $expecting = true; - /** - * @var bool - */ protected bool $readOnly = false; - /** - * @var Variable|null - */ protected ?Variable $expectingVariable = null; /** * Reserved ENV Constants. * * @see https://www.php.net/manual/ru/reserved.constants.php - * - * @var array */ protected array $envConstants = [ 'PHP_VERSION', @@ -72,8 +59,6 @@ class Constants * Magic constants. * * @see https://php.net/manual/en/language.constants.predefined.php - * - * @var array */ protected array $magicConstants = [ '__LINE__', @@ -95,11 +80,8 @@ class Constants /** * Sets if the variable must be resolved into a direct variable symbol * create a temporary value or ignore the return value. - * - * @param bool $expecting - * @param Variable|null $expectingVariable */ - public function setExpectReturn(bool $expecting, Variable $expectingVariable = null) + public function setExpectReturn(bool $expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -107,8 +89,6 @@ public function setExpectReturn(bool $expecting, Variable $expectingVariable = n /** * Sets if the result of the evaluated expression is read only. - * - * @param bool $readOnly */ public function setReadOnly(bool $readOnly): void { @@ -164,7 +144,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new LiteralCompiledExpression('double', $constantName, $expression); case 'string': - return new LiteralCompiledExpression('string', add_slashes($constantName), $expression); + return new LiteralCompiledExpression('string', Name::addSlashes($constantName), $expression); case 'object': throw new CompilerException('?'); @@ -178,13 +158,13 @@ public function compile(array $expression, CompilationContext $compilationContex case '__CLASS__': return new CompiledExpression( 'string', - add_slashes($compilationContext->classDefinition->getCompleteName()), + Name::addSlashes($compilationContext->classDefinition->getCompleteName()), $expression ); case '__NAMESPACE__': return new CompiledExpression( 'string', - add_slashes($compilationContext->classDefinition->getNamespace()), + Name::addSlashes($compilationContext->classDefinition->getNamespace()), $expression ); case '__METHOD__': diff --git a/src/Expression/PropertyDynamicAccess.php b/src/Expression/PropertyDynamicAccess.php index eac8b2f048..d7b0dd305d 100644 --- a/src/Expression/PropertyDynamicAccess.php +++ b/src/Expression/PropertyDynamicAccess.php @@ -15,10 +15,9 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; +use Zephir\Name; use Zephir\Variable\Variable; -use function Zephir\add_slashes; - /** * Resolves expressions that read properties with a dynamic variable as property */ @@ -135,7 +134,7 @@ public function compile($expression, CompilationContext $compilationContext) $compilationContext->headersManager->add('kernel/object'); - $property = $propertyVariable ?: add_slashes($expression['right']['value']); + $property = $propertyVariable ?: Name::addSlashes($expression['right']['value']); $compilationContext->backend->fetchProperty($symbolVariable, $variableVariable, $property, false, $compilationContext); return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); diff --git a/src/Name.php b/src/Name.php index c05d1280a5..42e6f39ca8 100644 --- a/src/Name.php +++ b/src/Name.php @@ -13,6 +13,9 @@ namespace Zephir; +use function in_array; +use function strlen; + final class Name { public static function camelize(string $string): string @@ -52,4 +55,63 @@ public static function fetchFQN( return $namespace ? $namespace.'\\'.$class : $class; } + + /** + * Prepares a string to be used as a C-string. + * + * Should NOT escape next `escape sequences`: + * Escape sequence | ASCII hex value | Char represented + * --------------- | --------------- | ---------------- + * \a | 07 | Audible bell (Alert, Beep) + * \b | 08 | Backspace + * \e | 1B | Escape character + * \f | 0C | Formed page brake + * \n | 0A | Newline (Line Feed) + * \r | 0D | Carriage Return + * \t | 09 | Horizontal Tab + * \v | 0B | Vertical Tab + * \\ | 5C | Backslash + * \' | 27 | Apostrophe or single quotation mark + * \" | 22 | Double quotation mark + * \? | 3F | Question mark (used to avoid trigraphs) + * \nnn | any | The byte whose numerical value is given by nnn interpreted as an octal number + * \xhh… | any | The byte whose numerical value is given by hh… interpreted as a hexadecimal number + */ + public static function addSlashes(string $string): string + { + $escape = '\\'; + $controlChar = [ + 'a', 'b', 'e', 'f', 'n', 'r', 't', 'v', '\\', '\'', '"', '?', 'x', + ]; + + $new = ''; + $last = strlen($string) - 1; + + for ($i = 0, $next = 1; $i <= $last; ++$i, ++$next) { + $ch = $string[$i]; + $after = $i !== $last ? $string[$next] : null; + + if ($ch === $escape) { + if (in_array($after, $controlChar, true) || is_numeric($after)) { + // should not escape native C control chars + $new .= $ch.$after; + ++$i; + ++$next; + continue; + } + + $new .= $escape.$ch; + continue; + } + + if ('"' === $ch) { + $new .= $escape.$ch; + continue; + } + + $new .= $ch; + } + + return $new; + } } diff --git a/src/Operators/Other/ConcatOperator.php b/src/Operators/Other/ConcatOperator.php index 5701ea8521..7a34d072a7 100644 --- a/src/Operators/Other/ConcatOperator.php +++ b/src/Operators/Other/ConcatOperator.php @@ -18,10 +18,9 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; +use Zephir\Name; use Zephir\Operators\AbstractOperator; -use function Zephir\add_slashes; - /** * Perform concatenations and optimizations */ @@ -207,7 +206,7 @@ private function _getOptimizedConcat(array $expression, CompilationContext $comp case 'string': $key .= 's'; - $concatParts[] = '"'.add_slashes($compiledExpr->getCode()).'"'; + $concatParts[] = '"'.Name::addSlashes($compiledExpr->getCode()).'"'; break; case 'int': diff --git a/src/Optimizers/FunctionCall/ExplodeOptimizer.php b/src/Optimizers/FunctionCall/ExplodeOptimizer.php index 73f766a62e..89021e7b2a 100644 --- a/src/Optimizers/FunctionCall/ExplodeOptimizer.php +++ b/src/Optimizers/FunctionCall/ExplodeOptimizer.php @@ -15,13 +15,10 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; - /** - * ExplodeOptimizer. - * * Optimizes calls to 'explode' using internal function */ class ExplodeOptimizer extends OptimizerAbstract @@ -65,7 +62,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } if ('string' == $expression['parameters'][0]['parameter']['type']) { - $str = add_slashes($expression['parameters'][0]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][0]['parameter']['value']); unset($expression['parameters'][0]); if (2 == \count($expression['parameters'])) { $limitOffset = 1; diff --git a/src/Optimizers/FunctionCall/FunctionExistsOptimizer.php b/src/Optimizers/FunctionCall/FunctionExistsOptimizer.php index 66a5c7e64f..ff3dec2ad9 100644 --- a/src/Optimizers/FunctionCall/FunctionExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/FunctionExistsOptimizer.php @@ -9,18 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Optimizers\FunctionCall; use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; - /** - * FunctionExistsOptimizer. - * * Optimizes calls to 'function_exists' using internal function */ class FunctionExistsOptimizer extends OptimizerAbstract @@ -39,7 +38,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } if ('string' === $expression['parameters'][0]['parameter']['type']) { - $str = add_slashes($expression['parameters'][0]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][0]['parameter']['value']); unset($expression['parameters'][0]); } diff --git a/src/Optimizers/FunctionCall/ImplodeOptimizer.php b/src/Optimizers/FunctionCall/ImplodeOptimizer.php index fb4744f81d..86ee6d8078 100644 --- a/src/Optimizers/FunctionCall/ImplodeOptimizer.php +++ b/src/Optimizers/FunctionCall/ImplodeOptimizer.php @@ -15,13 +15,10 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; - /** - * ImplodeOptimizer. - * * Optimizes calls to 'implode' using internal function */ class ImplodeOptimizer extends OptimizerAbstract @@ -56,7 +53,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } if ('string' == $expression['parameters'][0]['parameter']['type']) { - $str = add_slashes($expression['parameters'][0]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][0]['parameter']['value']); unset($expression['parameters'][0]); } diff --git a/src/Optimizers/FunctionCall/MemstrOptimizer.php b/src/Optimizers/FunctionCall/MemstrOptimizer.php index e15e454e52..e26175e389 100644 --- a/src/Optimizers/FunctionCall/MemstrOptimizer.php +++ b/src/Optimizers/FunctionCall/MemstrOptimizer.php @@ -15,10 +15,9 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Compiler; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; - /** * MemnstrOptimizer. * @@ -44,7 +43,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } if ('string' == $expression['parameters'][1]['parameter']['type']) { - $str = add_slashes($expression['parameters'][1]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']); unset($expression['parameters'][1]); } diff --git a/src/Optimizers/FunctionCall/MethodExistsOptimizer.php b/src/Optimizers/FunctionCall/MethodExistsOptimizer.php index 362a22596d..732ae91eb3 100644 --- a/src/Optimizers/FunctionCall/MethodExistsOptimizer.php +++ b/src/Optimizers/FunctionCall/MethodExistsOptimizer.php @@ -14,13 +14,10 @@ use Zephir\Call; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Name; use Zephir\Optimizers\OptimizerAbstract; -use function Zephir\add_slashes; - /** - * MethodExistsOptimizer. - * * Optimizes calls to 'method_exists' using internal function */ class MethodExistsOptimizer extends OptimizerAbstract @@ -43,7 +40,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } if ('string' == $expression['parameters'][1]['parameter']['type']) { - $str = add_slashes($expression['parameters'][1]['parameter']['value']); + $str = Name::addSlashes($expression['parameters'][1]['parameter']['value']); unset($expression['parameters'][1]); } diff --git a/src/Statements/EchoStatement.php b/src/Statements/EchoStatement.php index d640aaf9e9..b7ca49bd84 100644 --- a/src/Statements/EchoStatement.php +++ b/src/Statements/EchoStatement.php @@ -15,8 +15,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; - -use function Zephir\add_slashes; +use Zephir\Name; /** * Produce output according to the type @@ -60,7 +59,7 @@ public function compile(CompilationContext $compilationContext): void case 'string': $compilationContext->codePrinter->output( - 'php_printf("%s", "'.add_slashes($resolvedExpr->getCode()).'");' + 'php_printf("%s", "'.Name::addSlashes($resolvedExpr->getCode()).'");' ); break; diff --git a/src/Statements/ForStatement.php b/src/Statements/ForStatement.php index 63a0561da6..1c93e8efa9 100644 --- a/src/Statements/ForStatement.php +++ b/src/Statements/ForStatement.php @@ -18,12 +18,11 @@ use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; use Zephir\FunctionCall; +use Zephir\Name; use Zephir\Optimizers\EvalExpression; use Zephir\StatementsBlock; use Zephir\Variable\Variable; -use function Zephir\add_slashes; - class ForStatement extends StatementAbstract { /** @@ -595,7 +594,7 @@ public function compileStringTraverse($expression, CompilationContext $compilati $compilationContext->backend->assignString( $constantVariable, - add_slashes($expression->getCode()), + Name::addSlashes($expression->getCode()), $compilationContext, true ); diff --git a/src/Statements/Let/Variable.php b/src/Statements/Let/Variable.php index 0387e5fa06..7e16cc661c 100644 --- a/src/Statements/Let/Variable.php +++ b/src/Statements/Let/Variable.php @@ -17,10 +17,9 @@ use Zephir\Detectors\ReadDetector; use Zephir\Exception\CompilerException; use Zephir\Exception\IllegalOperationException; +use Zephir\Name; use Zephir\Variable\Variable as ZephirVariable; -use function Zephir\add_slashes; - /** * Zephir\Statements\Let\Variable. * @@ -1085,7 +1084,7 @@ private function doVariableAssignment( case 'assign': $symbolVariable->initVariant($compilationContext); $symbolVariable->setDynamicTypes('string'); - $compilationContext->backend->assignString($symbolVariable, add_slashes($resolvedExpr->getCode()), $compilationContext); + $compilationContext->backend->assignString($symbolVariable, Name::addSlashes($resolvedExpr->getCode()), $compilationContext); break; case 'concat-assign': diff --git a/src/Statements/ReturnStatement.php b/src/Statements/ReturnStatement.php index 4104c0476a..236afc195d 100644 --- a/src/Statements/ReturnStatement.php +++ b/src/Statements/ReturnStatement.php @@ -16,10 +16,9 @@ use Zephir\Exception\CompilerException; use Zephir\Exception\InvalidTypeException; use Zephir\Expression; +use Zephir\Name; use Zephir\Types\Types; -use function Zephir\add_slashes; - /** * Return statement is used to assign variables */ @@ -212,7 +211,7 @@ public function compile(CompilationContext $compilationContext): void case Types::T_STRING: case Types::T_ISTRING: $compilationContext->backend->returnString( - add_slashes($resolvedExpr->getCode()), + Name::addSlashes($resolvedExpr->getCode()), $compilationContext ); break; diff --git a/src/Statements/ThrowStatement.php b/src/Statements/ThrowStatement.php index 51e6babd06..69bd0c7187 100644 --- a/src/Statements/ThrowStatement.php +++ b/src/Statements/ThrowStatement.php @@ -22,8 +22,6 @@ use Zephir\Expression; use Zephir\Name; -use function Zephir\add_slashes; - /** * Throws exceptions */ @@ -147,7 +145,7 @@ public function compile(CompilationContext $compilationContext): void */ private function throwStringException(Printer $printer, string $class, string $message, array $expression): void { - $message = add_slashes($message); + $message = Name::addSlashes($message); $path = Compiler::getShortUserPath($expression['file']); $printer->output( sprintf( diff --git a/src/functions.php b/src/functions.php deleted file mode 100644 index e20dc74382..0000000000 --- a/src/functions.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -use Zephir\Exception\InvalidArgumentException; - -/** - * Prepares a string to be used as a C-string. - * - * Should NOT escape next `escape sequences`: - * Escape sequence | ASCII hex value | Char represented - * --------------- | --------------- | ---------------- - * \a | 07 | Audible bell (Alert, Beep) - * \b | 08 | Backspace - * \e | 1B | Escape character - * \f | 0C | Formed page brake - * \n | 0A | Newline (Line Feed) - * \r | 0D | Carriage Return - * \t | 09 | Horizontal Tab - * \v | 0B | Vertical Tab - * \\ | 5C | Backslash - * \' | 27 | Apostrophe or single quotation mark - * \" | 22 | Double quotation mark - * \? | 3F | Question mark (used to avoid trigraphs) - * \nnn | any | The byte whose numerical value is given by nnn interpreted as an octal number - * \xhh… | any | The byte whose numerical value is given by hh… interpreted as a hexadecimal number - * - * @param string $string - * - * @return string - */ -function add_slashes(string $string): string -{ - $escape = '\\'; - $controlChar = [ - 'a', 'b', 'e', 'f', 'n', 'r', 't', 'v', '\\', '\'', '"', '?', 'x', - ]; - - $newstr = ''; - $after = null; - $last = \strlen($string) - 1; - - for ($i = 0, $next = 1; $i <= $last; ++$i, ++$next) { - $ch = $string[$i]; - - if ($i !== $last) { - $after = $string[$next]; - } else { - $after = null; - } - - if ($ch === $escape) { - if (\in_array($after, $controlChar, true) || is_numeric($after)) { - // should not escape native C control chars - $newstr .= $ch.$after; - ++$i; - ++$next; - continue; - } - $newstr .= $escape.$ch; - continue; - } - - if ('"' === $ch) { - $newstr .= $escape.$ch; - continue; - } - - $newstr .= $ch; - } - - return $newstr; -} diff --git a/tests/Zephir/HelpersTest.php b/tests/Zephir/HelpersTest.php deleted file mode 100644 index da278aa1d4..0000000000 --- a/tests/Zephir/HelpersTest.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Test; - -use PHPUnit\Framework\TestCase; - -use function Zephir\add_slashes; - -final class HelpersTest extends TestCase -{ - public function cStringProvider(): array - { - return [ - // 'test name' => [ 'test string', 'expected result'] - 'with empty char' => ['', ''], - 'with space char' => [' ', ' '], - 'with double quotation mark' => ['\"', '\"'], - 'with single quotation mark' => ['\'', '\''], - 'with questions mark' => ['\?', '\?'], - 'with alert char' => ['\a', '\a'], - 'with backspace char' => ['\b', '\b'], - 'with escape char' => ['\e', '\e'], - 'with form feed page brake char' => ['\f', '\f'], - 'with line feed char' => ['\n', '\n'], - 'with carriage return char' => ['\r', '\r'], - 'with horizontal tab char' => ['\t', '\t'], - 'with vertical tab char' => ['\v', '\v'], - 'with backslash char' => ['\\', '\\\\'], - 'with hexadecimal numerals' => ['\x12', '\x12'], - 'with octal numerals' => ['\123', '\123'], - 'with escaped parenthesis' => ['\(\)', '\\\\(\\\\)'], - 'with C printf format' => ['\033[10;10h%d\n', '\033[10;10h%d\n'], - 'with C \0' => ['\0', '\0'], - 'with regexp 1' => ['/(\w+)\s*=\s*(\[[^\]]*\]|\"[^\"]*\"|[^,)]*)\s*(?:,|$)/', '/(\\\\w+)\\\\s*=\\\\s*(\\\\[[^\\\\]]*\\\\]|\"[^\"]*\"|[^,)]*)\\\\s*(?:,|$)/'], - 'with regexp 2' => ['/@(\w+)(?:\s*(?:\(\s*)?(.*?)(?:\s*\))?)??\s*(?:\n|\*\/)/', '/@(\\\\w+)(?:\\\\s*(?:\\\(\\\\s*)?(.*?)(?:\\\\s*\\\\))?)??\\\\s*(?:\n|\\\\*\\\\/)/'], - 'with regexp 3' => ['/(\w+)\s*=\s*(\[[^\]]*\]|"[^"]*"|[^,)]*)\s*(?:,|$)/', '/(\\\\w+)\\\\s*=\\\\s*(\\\\[[^\\\\]]*\\\\]|\"[^\"]*\"|[^,)]*)\\\\s*(?:,|$)/'], - ]; - } - - /** - * @dataProvider cStringProvider - * - * @param string $testString - * @param string $expected - */ - public function testShouldPrepareStringAsCString(string $testString, string $expected): void - { - $this->assertSame($expected, add_slashes($testString)); - } -} diff --git a/tests/Zephir/NameTest.php b/tests/Zephir/NameTest.php index b60103de4a..9a7b072533 100644 --- a/tests/Zephir/NameTest.php +++ b/tests/Zephir/NameTest.php @@ -23,4 +23,41 @@ public function testCamelize(): void $name = 'foo_Bar_Foo_bar'; $this->assertSame(Name::camelize($name), 'FooBarFooBar'); } + + public function cStringProvider(): array + { + return [ + // 'test name' => [ 'test string', 'expected result'] + 'with empty char' => ['', ''], + 'with space char' => [' ', ' '], + 'with double quotation mark' => ['\"', '\"'], + 'with single quotation mark' => ['\'', '\''], + 'with questions mark' => ['\?', '\?'], + 'with alert char' => ['\a', '\a'], + 'with backspace char' => ['\b', '\b'], + 'with escape char' => ['\e', '\e'], + 'with form feed page brake char' => ['\f', '\f'], + 'with line feed char' => ['\n', '\n'], + 'with carriage return char' => ['\r', '\r'], + 'with horizontal tab char' => ['\t', '\t'], + 'with vertical tab char' => ['\v', '\v'], + 'with backslash char' => ['\\', '\\\\'], + 'with hexadecimal numerals' => ['\x12', '\x12'], + 'with octal numerals' => ['\123', '\123'], + 'with escaped parenthesis' => ['\(\)', '\\\\(\\\\)'], + 'with C printf format' => ['\033[10;10h%d\n', '\033[10;10h%d\n'], + 'with C \0' => ['\0', '\0'], + 'with regexp 1' => ['/(\w+)\s*=\s*(\[[^\]]*\]|\"[^\"]*\"|[^,)]*)\s*(?:,|$)/', '/(\\\\w+)\\\\s*=\\\\s*(\\\\[[^\\\\]]*\\\\]|\"[^\"]*\"|[^,)]*)\\\\s*(?:,|$)/'], + 'with regexp 2' => ['/@(\w+)(?:\s*(?:\(\s*)?(.*?)(?:\s*\))?)??\s*(?:\n|\*\/)/', '/@(\\\\w+)(?:\\\\s*(?:\\\(\\\\s*)?(.*?)(?:\\\\s*\\\\))?)??\\\\s*(?:\n|\\\\*\\\\/)/'], + 'with regexp 3' => ['/(\w+)\s*=\s*(\[[^\]]*\]|"[^"]*"|[^,)]*)\s*(?:,|$)/', '/(\\\\w+)\\\\s*=\\\\s*(\\\\[[^\\\\]]*\\\\]|\"[^\"]*\"|[^,)]*)\\\\s*(?:,|$)/'], + ]; + } + + /** + * @dataProvider cStringProvider + */ + public function testAddSlashes(string $testString, string $expected): void + { + $this->assertSame($expected, Name::addSlashes($testString)); + } } From 6d1b7c69b37b6edd85e9ad33cdce2b7b12a1f282 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 18:21:23 +0000 Subject: [PATCH 113/375] Remove redundant character escape --- src/FunctionCall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FunctionCall.php b/src/FunctionCall.php index 0e2b675f60..bfa2e4d5e6 100644 --- a/src/FunctionCall.php +++ b/src/FunctionCall.php @@ -277,7 +277,7 @@ protected function markReferences( $parameters[$n - 1] = substr($parameters[$n - 1], 1); } - if (!preg_match('/^[a-zA-Z0-9$\_]+$/', $parameters[$n - 1])) { + if (!preg_match('/^[a-zA-Z0-9$_]+$/', $parameters[$n - 1])) { $compilationContext->logger->warning( 'Cannot mark complex expression as reference', ['invalid-reference', $expression] From f67286ad1fa3e2e42da1975bf111c4818502cc3e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 18:28:06 +0000 Subject: [PATCH 114/375] Adjust return type --- src/Backend/Backend.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index 02a2d536a4..8f9c4ca5f6 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -588,7 +588,7 @@ public function createClosure(Variable $variable, $classDefinition, CompilationC ); } - public function addArrayEntry(Variable $variable, $key, $value, CompilationContext $context, $statement = null, $useCodePrinter = true) + public function addArrayEntry(Variable $variable, $key, $value, CompilationContext $context, $statement = null, $useCodePrinter = true): void { $type = null; $keyType = 'assoc'; @@ -673,8 +673,6 @@ public function addArrayEntry(Variable $variable, $key, $value, CompilationConte if ($useCodePrinter) { $context->codePrinter->output($output); } - - return $output; } public function arrayIsset(Variable $var, $resolvedExpr, $expression, CompilationContext $context) From 8629ed8033d1acf8aae111c2932c7bfa8a0e042a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 18:28:39 +0000 Subject: [PATCH 115/375] Reformat code and adjust argument types --- src/Statements/ForStatement.php | 56 ++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/Statements/ForStatement.php b/src/Statements/ForStatement.php index 1c93e8efa9..2a06125d33 100644 --- a/src/Statements/ForStatement.php +++ b/src/Statements/ForStatement.php @@ -11,7 +11,9 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; +use Zephir\CompiledExpression; use Zephir\Detectors\ForValueUseDetector; use Zephir\Exception; use Zephir\Exception\CompilerException; @@ -23,6 +25,8 @@ use Zephir\StatementsBlock; use Zephir\Variable\Variable; +use function count; + class ForStatement extends StatementAbstract { /** @@ -33,23 +37,23 @@ class ForStatement extends StatementAbstract * * @return bool * - * @throws \ReflectionException + * @throws ReflectionException * @throws Exception */ public function compileRange(array $exprRaw, CompilationContext $compilationContext): bool { - if (!\count($exprRaw['parameters'])) { + if (!count($exprRaw['parameters'])) { return false; } - if (\count($exprRaw['parameters']) > 3) { + if (count($exprRaw['parameters']) > 3) { return false; } $functionCall = new FunctionCall(); $parameters = $functionCall->getResolvedParamsAsExpr($exprRaw['parameters'], $compilationContext, $exprRaw); - if (2 != \count($parameters) && 3 != \count($parameters)) { + if (2 != count($parameters) && 3 != count($parameters)) { throw new CompilerException('Wrong number of parameters', $this->statement['expr']); } @@ -400,7 +404,7 @@ public function compileRange(array $exprRaw, CompilationContext $compilationCont * @return void * * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException */ public function compileIterator(array $exprRaw, CompilationContext $compilationContext): void { @@ -521,18 +525,17 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC * - Every key must be an integer or compatible * - Every value must be a char/integer or compatible. * - * @param array $expression - * @param CompilationContext $compilationContext - * @param Variable $exprVariable - * * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException */ - public function compileStringTraverse($expression, CompilationContext $compilationContext, $exprVariable) - { + public function compileStringTraverse( + CompiledExpression $expression, + CompilationContext $compilationContext, + ?Variable $exprVariable = null, + ): void { $codePrinter = $compilationContext->codePrinter; - /* + /** * Initialize 'key' variable */ if (isset($this->statement['key'])) { @@ -558,7 +561,7 @@ public function compileStringTraverse($expression, CompilationContext $compilati $keyVariable->setIsInitialized(true, $compilationContext); } - /* + /** * Initialize 'value' variable */ if (isset($this->statement['value'])) { @@ -586,7 +589,7 @@ public function compileStringTraverse($expression, CompilationContext $compilati $tempVariable = $compilationContext->symbolTable->addTemp('long', $compilationContext); - /* + /** * Create a temporary value to store the constant string */ if ('string' == $expression->getType()) { @@ -596,7 +599,6 @@ public function compileStringTraverse($expression, CompilationContext $compilati $constantVariable, Name::addSlashes($expression->getCode()), $compilationContext, - true ); $stringVariable = $constantVariable; @@ -747,7 +749,7 @@ public function compileHashTraverse(CompilationContext $compilationContext, Vari * @param CompilationContext $compilationContext * * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -756,15 +758,15 @@ public function compile(CompilationContext $compilationContext): void /* * TODO: implement optimizers here */ - if ('fcall' == $exprRaw['type']) { - if ('range' == $exprRaw['name']) { + if ('fcall' === $exprRaw['type']) { + if ('range' === $exprRaw['name']) { $status = $this->compileRange($exprRaw, $compilationContext); if (false !== $status) { return; } } - if ('iterator' == $exprRaw['name']) { + if ('iterator' === $exprRaw['name']) { $status = $this->compileIterator($exprRaw, $compilationContext); if (false !== $status) { return; @@ -776,20 +778,24 @@ public function compile(CompilationContext $compilationContext): void $expr->setReadOnly(true); $expression = $expr->compile($compilationContext); - /* + /** * Check for traversing a constant string */ - if ('string' == $expression->getType()) { - $this->compileStringTraverse($expression, $compilationContext, null); + if ('string' === $expression->getType()) { + $this->compileStringTraverse($expression, $compilationContext); return; } - if ('variable' != $expression->getType() && 'array' != $expression->getType()) { + if ('variable' !== $expression->getType() && 'array' !== $expression->getType()) { throw new CompilerException('Unknown type: '.$expression->getType(), $exprRaw); } - $exprVariable = $compilationContext->symbolTable->getVariableForRead($expression->getCode(), $compilationContext, $this->statement['expr']); + $exprVariable = $compilationContext->symbolTable->getVariableForRead( + $expression->getCode(), + $compilationContext, + $this->statement['expr'], + ); switch ($exprVariable->getType()) { case 'variable': case 'array': From 578ec023b4731b0210845b1cb02b7d9623f3efe9 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 18:42:04 +0000 Subject: [PATCH 116/375] Fix CS --- src/FileSystem/HardDisk.php | 2 +- src/Name.php | 11 ++++------- src/Os.php | 4 +--- src/Statements/ForStatement.php | 19 ++++++++----------- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/FileSystem/HardDisk.php b/src/FileSystem/HardDisk.php index 7b0d001861..5f78512dbd 100644 --- a/src/FileSystem/HardDisk.php +++ b/src/FileSystem/HardDisk.php @@ -228,7 +228,7 @@ public function normalizePath(string $path): string /** * Checks if the content of the file on the disk is the same as the content. */ - public static function persistByHash(string $data, string $path): int|bool + public static function persistByHash(string $data, string $path): int | bool { if (!file_exists($path)) { return file_put_contents($path, $data); diff --git a/src/Name.php b/src/Name.php index 42e6f39ca8..1838ee4601 100644 --- a/src/Name.php +++ b/src/Name.php @@ -13,9 +13,6 @@ namespace Zephir; -use function in_array; -use function strlen; - final class Name { public static function camelize(string $string): string @@ -29,8 +26,8 @@ public static function camelize(string $string): string */ public static function fetchFQN( string $class, - ?string $namespace = null, - ?AliasManager $aliasManager = null + string $namespace = null, + AliasManager $aliasManager = null ): string { /** * Absolute class/interface name @@ -85,14 +82,14 @@ public static function addSlashes(string $string): string ]; $new = ''; - $last = strlen($string) - 1; + $last = \strlen($string) - 1; for ($i = 0, $next = 1; $i <= $last; ++$i, ++$next) { $ch = $string[$i]; $after = $i !== $last ? $string[$next] : null; if ($ch === $escape) { - if (in_array($after, $controlChar, true) || is_numeric($after)) { + if (\in_array($after, $controlChar, true) || is_numeric($after)) { // should not escape native C control chars $new .= $ch.$after; ++$i; diff --git a/src/Os.php b/src/Os.php index 558c3e3679..40b3308333 100644 --- a/src/Os.php +++ b/src/Os.php @@ -13,8 +13,6 @@ namespace Zephir; -use const PHP_OS; - class Os { /** @@ -22,6 +20,6 @@ class Os */ public static function isWindows(): bool { - return 0 === stripos(PHP_OS, 'WIN'); + return 0 === stripos(\PHP_OS, 'WIN'); } } diff --git a/src/Statements/ForStatement.php b/src/Statements/ForStatement.php index 2a06125d33..b2485c1a32 100644 --- a/src/Statements/ForStatement.php +++ b/src/Statements/ForStatement.php @@ -11,7 +11,6 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Detectors\ForValueUseDetector; @@ -25,8 +24,6 @@ use Zephir\StatementsBlock; use Zephir\Variable\Variable; -use function count; - class ForStatement extends StatementAbstract { /** @@ -37,23 +34,23 @@ class ForStatement extends StatementAbstract * * @return bool * - * @throws ReflectionException + * @throws \ReflectionException * @throws Exception */ public function compileRange(array $exprRaw, CompilationContext $compilationContext): bool { - if (!count($exprRaw['parameters'])) { + if (!\count($exprRaw['parameters'])) { return false; } - if (count($exprRaw['parameters']) > 3) { + if (\count($exprRaw['parameters']) > 3) { return false; } $functionCall = new FunctionCall(); $parameters = $functionCall->getResolvedParamsAsExpr($exprRaw['parameters'], $compilationContext, $exprRaw); - if (2 != count($parameters) && 3 != count($parameters)) { + if (2 != \count($parameters) && 3 != \count($parameters)) { throw new CompilerException('Wrong number of parameters', $this->statement['expr']); } @@ -404,7 +401,7 @@ public function compileRange(array $exprRaw, CompilationContext $compilationCont * @return void * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compileIterator(array $exprRaw, CompilationContext $compilationContext): void { @@ -526,12 +523,12 @@ public function compileIterator(array $exprRaw, CompilationContext $compilationC * - Every value must be a char/integer or compatible. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compileStringTraverse( CompiledExpression $expression, CompilationContext $compilationContext, - ?Variable $exprVariable = null, + Variable $exprVariable = null, ): void { $codePrinter = $compilationContext->codePrinter; @@ -749,7 +746,7 @@ public function compileHashTraverse(CompilationContext $compilationContext, Vari * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { From 3cc9e401a9002493c95c506c210d47832774c3e0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 11 Nov 2023 19:12:41 +0000 Subject: [PATCH 117/375] Reformat code --- src/Config.php | 18 +++--------------- src/ConfigException.php | 2 ++ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/Config.php b/src/Config.php index 46ae923e6b..fa2f2b6dde 100644 --- a/src/Config.php +++ b/src/Config.php @@ -20,17 +20,13 @@ class Config implements \ArrayAccess, \JsonSerializable { /** * Is config changed? - * - * @var bool */ - protected $changed = false; + protected bool $changed = false; /** * Default configuration for project. - * - * @var array */ - private $container = [ + private array $container = [ 'stubs' => [ 'path' => 'ide/%version%/%namespace%/', 'stubs-run-after-generate' => false, @@ -101,8 +97,6 @@ class Config implements \ArrayAccess, \JsonSerializable ]; /** - * Config constructor. - * * @throws Exception */ public function __construct() @@ -112,8 +106,6 @@ public function __construct() /** * Returns JSON representation of the project config. - * - * @return string */ public function __toString() { @@ -122,8 +114,6 @@ public function __toString() /** * Factory method to create a Config instance from the $_SERVER['argv']. - * - * @return Config */ public static function fromServer(): self { @@ -312,15 +302,13 @@ public function set($key, $value, $namespace = null) /** * Writes the configuration if it has been changed. */ - public function dumpToFile() + public function dumpToFile(): void { file_put_contents('config.json', $this); } /** * Specify data which should be serialized to JSON. - * - * @return array */ public function jsonSerialize(): array { diff --git a/src/ConfigException.php b/src/ConfigException.php index 845c8bf98a..b65139b77a 100644 --- a/src/ConfigException.php +++ b/src/ConfigException.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; class ConfigException extends \Exception From 4eba409cf5e664b1cc68a543bfc46cfac34fd6eb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 12 Nov 2023 20:39:18 +0000 Subject: [PATCH 118/375] Remove redundant docblock --- src/CompiledExpression.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/CompiledExpression.php b/src/CompiledExpression.php index ec5fc2df58..9861b5ae5c 100644 --- a/src/CompiledExpression.php +++ b/src/CompiledExpression.php @@ -25,8 +25,6 @@ public function __construct(protected string $type, protected mixed $code, prote /** * Returns the type of the compiled expression. - * - * @return string */ public function getType(): string { @@ -35,8 +33,6 @@ public function getType(): string /** * Returns the code produced by the compiled expression. - * - * @return mixed */ public function getCode(): mixed { @@ -45,8 +41,6 @@ public function getCode(): mixed /** * Original AST code that produced the code. - * - * @return array|null */ public function getOriginal(): ?array { @@ -55,8 +49,6 @@ public function getOriginal(): ?array /** * Returns a C representation for a boolean constant. - * - * @return string */ public function getBooleanCode(): string { @@ -73,8 +65,6 @@ public function getBooleanCode(): string /** * Checks if the compiled expression is an integer or compatible type. - * - * @return bool */ public function isIntCompatibleType(): bool { @@ -87,11 +77,6 @@ public function isIntCompatibleType(): bool * Some code cannot be directly pushed into the generated source * because it's missing some bound parts, this method resolves the missing parts * returning the generated code. - * - * @param string|null $result - * @param CompilationContext $compilationContext - * - * @return string */ public function resolve(?string $result, CompilationContext $compilationContext): string { From 4e883599b8348a120efdbf4f462ea495057b823d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 12 Nov 2023 21:03:59 +0000 Subject: [PATCH 119/375] Reformat constructor to PHP8 format --- src/Console/Command/ApiCommand.php | 8 +---- .../Builder/Factory/OperatorsFactory.php | 8 +---- .../Operators/AssignPropertyOperator.php | 27 ++------------ .../Operators/AssignVariableOperator.php | 35 ++++++++----------- 4 files changed, 18 insertions(+), 60 deletions(-) diff --git a/src/Console/Command/ApiCommand.php b/src/Console/Command/ApiCommand.php index c6e5e5533d..c496639acb 100644 --- a/src/Console/Command/ApiCommand.php +++ b/src/Console/Command/ApiCommand.php @@ -28,14 +28,8 @@ final class ApiCommand extends AbstractCommand { use ZflagsAwareTrait; - private Compiler $compiler; - private Config $config; - - public function __construct(Compiler $compiler, Config $config) + public function __construct(private Compiler $compiler, private Config $config) { - $this->compiler = $compiler; - $this->config = $config; - parent::__construct(); } diff --git a/src/Expression/Builder/Factory/OperatorsFactory.php b/src/Expression/Builder/Factory/OperatorsFactory.php index 946126eff4..79028fc380 100644 --- a/src/Expression/Builder/Factory/OperatorsFactory.php +++ b/src/Expression/Builder/Factory/OperatorsFactory.php @@ -23,14 +23,8 @@ class OperatorsFactory { - protected BuilderFactory $factory; - - /** - * @param BuilderFactory $factory - */ - public function __construct(BuilderFactory $factory) + public function __construct(protected BuilderFactory $factory) { - $this->factory = $factory; } /** diff --git a/src/Expression/Builder/Operators/AssignPropertyOperator.php b/src/Expression/Builder/Operators/AssignPropertyOperator.php index 20c77bb247..4ac26dafce 100644 --- a/src/Expression/Builder/Operators/AssignPropertyOperator.php +++ b/src/Expression/Builder/Operators/AssignPropertyOperator.php @@ -20,16 +20,9 @@ class AssignPropertyOperator extends AssignVariableOperator // a :: property = expr public const TYPE_ASSIGN_STATIC_PROPERTY = 'static-property'; + private string $type = self::TYPE_ASSIGN_OBJECT_PROPERTY; - private $property; - private $type = self::TYPE_ASSIGN_OBJECT_PROPERTY; - - /** - * @param null $variable - * @param null $property - * @param AbstractBuilder|null $expression - */ - public function __construct($variable = null, $property = null, AbstractBuilder $expression = null) + public function __construct($variable = null, private $property = null, AbstractBuilder $expression = null) { parent::__construct($variable, $expression); @@ -38,19 +31,11 @@ public function __construct($variable = null, $property = null, AbstractBuilder } } - /** - * @return string - */ public function getProperty(): string { return $this->property; } - /** - * @param string $property - * - * @return $this - */ public function setProperty(string $property): static { $this->property = $property; @@ -58,19 +43,11 @@ public function setProperty(string $property): static return $this; } - /** - * @return string - */ public function getType(): string { return $this->type; } - /** - * @param string $type - * - * @return AssignPropertyOperator - */ public function setType(string $type): static { $this->type = $type; diff --git a/src/Expression/Builder/Operators/AssignVariableOperator.php b/src/Expression/Builder/Operators/AssignVariableOperator.php index a054158c18..e284c3d8be 100644 --- a/src/Expression/Builder/Operators/AssignVariableOperator.php +++ b/src/Expression/Builder/Operators/AssignVariableOperator.php @@ -16,50 +16,43 @@ class AssignVariableOperator extends AbstractOperator { // = - const OPERATOR_ASSIGN = 'assign'; + public const OPERATOR_ASSIGN = 'assign'; // += - const OPERATOR_ADD = 'add-assign'; + public const OPERATOR_ADD = 'add-assign'; // -= - const OPERATOR_SUB = 'sub-assign'; + public const OPERATOR_SUB = 'sub-assign'; // *= - const OPERATOR_MUL = 'mul-assign'; + public const OPERATOR_MUL = 'mul-assign'; // /= - const OPERATOR_DIV = 'div-assign'; + public const OPERATOR_DIV = 'div-assign'; // .= - const OPERATOR_CONCAT = 'concat-assign'; + public const OPERATOR_CONCAT = 'concat-assign'; // %= - const OPERATOR_MOD = 'mod-assign'; + public const OPERATOR_MOD = 'mod-assign'; // &= - const OPERATOR_BITWISE_AND = 'bitwise-and-assign'; + public const OPERATOR_BITWISE_AND = 'bitwise-and-assign'; // |= - const OPERATOR_BITWISE_OR = 'bitwise-or-assign'; + public const OPERATOR_BITWISE_OR = 'bitwise-or-assign'; // ^= - const OPERATOR_BITWISE_XOR = 'bitwise-xor-assign'; + public const OPERATOR_BITWISE_XOR = 'bitwise-xor-assign'; // <<= - const OPERATOR_BITWISE_SHIFTLEFT = 'bitwise-shiftleft-assign'; + public const OPERATOR_BITWISE_SHIFTLEFT = 'bitwise-shiftleft-assign'; // >>= - const OPERATOR_BITWISE_SHIFTRIGHT = 'bitwise-shiftright-assign'; + public const OPERATOR_BITWISE_SHIFTRIGHT = 'bitwise-shiftright-assign'; + private string $operator = self::OPERATOR_ASSIGN; - private $variable; - private $operator = self::OPERATOR_ASSIGN; - private $expression; - - /** - * @param null $variable - * @param AbstractBuilder|null $expression - */ - public function __construct($variable = null, AbstractBuilder $expression = null) + public function __construct(private $variable = null, private ?AbstractBuilder $expression = null) { if (null !== $variable) { $this->setVariable($variable); From 8d8e410327f38a6261a8e4fb9816f0c5b9de9252 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 12 Nov 2023 21:06:06 +0000 Subject: [PATCH 120/375] Remove `phalcon-` prefix For faster type of container name and not colliding of Phalcon's containers. --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ef4d26b18f..4a5ce2fe56 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ version: '3' services: zephir-8.0: - container_name: phalcon-zephir-8.0 + container_name: zephir-8.0 hostname: zephir-80 build: .docker/8.0 working_dir: /srv @@ -14,7 +14,7 @@ services: - .:/srv zephir-8.1: - container_name: phalcon-zephir-8.1 + container_name: zephir-8.1 hostname: zephir-81 build: .docker/8.1 working_dir: /srv @@ -24,7 +24,7 @@ services: - .:/srv zephir-8.2: - container_name: phalcon-zephir-8.2 + container_name: zephir-8.2 hostname: zephir-82 build: .docker/8.2 working_dir: /srv @@ -34,7 +34,7 @@ services: - .:/srv zephir-8.3: - container_name: phalcon-zephir-8.3 + container_name: zephir-8.3 hostname: zephir-83 build: .docker/8.3 working_dir: /srv From 32f0a3ebd4fac797dc1927687be932b855f2d4ed Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 12 Nov 2023 21:06:45 +0000 Subject: [PATCH 121/375] Regenerate ext/ directory --- ext/kernel/memory.c | 11 ----- ext/kernel/memory.h | 1 - ext/kernel/operators.h | 4 ++ ext/stub.c | 2 +- ext/stub/13__closure.zep.c | 3 +- ext/stub/builtin/intmethods.zep.c | 32 +++++++----- ext/stub/builtin/stringmethods.zep.c | 24 ++++----- ext/stub/closures.zep.c | 2 +- ext/stub/exceptions.zep.c | 12 ++--- ext/stub/factorial.zep.c | 2 +- ext/stub/fcall.zep.c | 28 +++++------ ext/stub/fetchtest.zep.c | 28 +++++++---- ext/stub/fibonnaci.zep.c | 14 +++--- ext/stub/flow.zep.c | 8 +-- ext/stub/flow/switchflow.zep.c | 2 +- ext/stub/functions.zep.c | 4 +- ext/stub/globals/serverrequestfactory.zep.c | 10 ++-- ext/stub/instance.zep.c | 2 +- ext/stub/invoke.zep.c | 2 +- ext/stub/issue2165/issue.zep.c | 48 +++++++++--------- ext/stub/issue663.zep.c | 4 +- ext/stub/mcall.zep.c | 24 ++++----- ext/stub/mcall.zep.h | 2 +- ext/stub/mcallchained.zep.c | 2 +- ext/stub/mcalldynamic.zep.c | 13 +++-- ext/stub/nativearray.zep.c | 54 ++++++++++++--------- ext/stub/oo.zep.c | 23 ++++----- ext/stub/oo/concretestatic.zep.c | 3 +- ext/stub/oo/deprecatedmethods.zep.c | 2 +- ext/stub/oo/oodestruct.zep.c | 12 ++--- ext/stub/oo/oonativeimplements.zep.h | 9 +--- ext/stub/oo/propertyaccess.zep.c | 3 +- ext/stub/oo/scopes/privatescopetester.zep.c | 2 +- ext/stub/optimizers/acos.zep.c | 47 +++++++++++++----- ext/stub/optimizers/asin.zep.c | 47 +++++++++++++----- ext/stub/optimizers/strreplace.zep.c | 2 +- ext/stub/properties/app.zep.c | 3 +- ext/stub/properties/getobjectvars.zep.c | 2 +- ext/stub/properties/propertyarray.zep.c | 6 +-- ext/stub/quantum.zep.c | 6 +-- ext/stub/range.zep.c | 4 +- ext/stub/reflection.zep.c | 4 +- ext/stub/regexdna.zep.c | 4 +- ext/stub/requires.zep.c | 2 +- ext/stub/requires/external3.zep.c | 4 +- ext/stub/resourcetest.zep.c | 2 +- ext/stub/router.zep.c | 6 +-- ext/stub/scall.zep.c | 14 +++--- ext/stub/scallexternal.zep.c | 6 +-- ext/stub/scope.zep.c | 4 +- ext/stub/sort.zep.c | 6 +-- ext/stub/spectralnorm.zep.c | 32 ++++++------ ext/stub/spl.zep.c | 2 +- ext/stub/statements.zep.c | 16 +++--- ext/stub/strings.zep.c | 8 +-- ext/stub/trytest.zep.c | 28 +++++------ ext/stub/vars.zep.c | 4 +- 57 files changed, 351 insertions(+), 300 deletions(-) diff --git a/ext/kernel/memory.c b/ext/kernel/memory.c index ac1f012fd0..4fb7271bb2 100644 --- a/ext/kernel/memory.c +++ b/ext/kernel/memory.c @@ -306,17 +306,6 @@ int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key memcpy(&scope, &ZSTR_VAL(hash_key->key)[(len -1) - 2 * sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); -/* -#ifndef ZEPHIR_RELEASE - { - zend_class_entry *cls; - memcpy(&cls, &hash_key->arKey[len - sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); - - fprintf(stderr, "func: %s, cls: %s, scope: %s [%u]\n", (*entry)->f->common.function_name, (cls ? cls->name : "N/A"), (scope ? scope->name : "N/A"), (uint)(*entry)->times); - } -#endif -*/ - if ((*entry)->type != ZEND_INTERNAL_FUNCTION || (scope && scope->type != ZEND_INTERNAL_CLASS)) { return ZEND_HASH_APPLY_REMOVE; } diff --git a/ext/kernel/memory.h b/ext/kernel/memory.h index 269ed60920..76407bb5ae 100644 --- a/ext/kernel/memory.h +++ b/ext/kernel/memory.h @@ -175,7 +175,6 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); do { \ zval *orig_ptr = z; \ ZEPHIR_SEPARATE(orig_ptr); \ - /*zephir_memory_observe(orig_ptr);*/ \ } while (0) #endif diff --git a/ext/kernel/operators.h b/ext/kernel/operators.h index 059f0a0fe2..f481d7c3ea 100644 --- a/ext/kernel/operators.h +++ b/ext/kernel/operators.h @@ -146,7 +146,11 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define zephir_get_boolval(z) (Z_TYPE_P(z) == IS_TRUE ? 1 : (Z_TYPE_P(z) == IS_FALSE ? 0 : zephir_get_boolval_ex(z))) #define zephir_get_charval(z) (Z_TYPE_P(z) == IS_LONG ? Z_LVAL_P(z) : zephir_get_charval_ex(z)) +#if PHP_VERSION_ID >= 80300 +#define zephir_add_function(result, left, right) add_function(result, left, right) +#else #define zephir_add_function(result, left, right) fast_add_function(result, left, right) +#endif #define zephir_sub_function(result, left, right) sub_function(result, left, right) #define zephir_pow_function(result, op1, op2) pow_function(result, op1, op2) #define zephir_increment(var) increment_function(var) diff --git a/ext/stub.c b/ext/stub.c index 23752125f1..8af92d7614 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -586,7 +586,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/13__closure.zep.c b/ext/stub/13__closure.zep.c index 86eadb4885..ea84c015da 100644 --- a/ext/stub/13__closure.zep.c +++ b/ext/stub/13__closure.zep.c @@ -28,14 +28,13 @@ PHP_METHOD(stub_13__closure, __invoke) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_CE_STATIC(stub_mcall_caller_ce, "perform", &_0, 0); + ZEPHIR_RETURN_CALL_CE_STATIC(stub_mcall_caller_ce, "perform", NULL, 0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/builtin/intmethods.zep.c b/ext/stub/builtin/intmethods.zep.c index b573864dcd..d22227e3cc 100644 --- a/ext/stub/builtin/intmethods.zep.c +++ b/ext/stub/builtin/intmethods.zep.c @@ -311,11 +311,13 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getTan) PHP_METHOD(Stub_BuiltIn_IntMethods, getAsin) { - zval *num_param = NULL, _0; - zend_long num; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *num_param = NULL, _0, _1; + zend_long num, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -324,21 +326,26 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAsin) #endif - zephir_fetch_params_without_memory_grow(1, 0, &num_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &num_param); num = zephir_get_intval(num_param); ZVAL_LONG(&_0, num); - RETURN_DOUBLE(asin(num)); + ZEPHIR_CALL_FUNCTION(&_1, "asin", NULL, 13, &_0); + zephir_check_call_status(); + RETURN_CCTOR(&_1); } PHP_METHOD(Stub_BuiltIn_IntMethods, getAcos) { - zval *num_param = NULL, _0; - zend_long num; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *num_param = NULL, _0, _1; + zend_long num, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -347,12 +354,15 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAcos) #endif - zephir_fetch_params_without_memory_grow(1, 0, &num_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &num_param); num = zephir_get_intval(num_param); ZVAL_LONG(&_0, num); - RETURN_DOUBLE(acos(num)); + ZEPHIR_CALL_FUNCTION(&_1, "acos", NULL, 14, &_0); + zephir_check_call_status(); + RETURN_CCTOR(&_1); } PHP_METHOD(Stub_BuiltIn_IntMethods, getAtan) @@ -378,7 +388,7 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAtan) ZVAL_LONG(&_0, num); - ZEPHIR_CALL_FUNCTION(&_1, "atan", NULL, 13, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "atan", NULL, 15, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); } @@ -417,13 +427,13 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getLog) if (base == -1) { ZVAL_LONG(&_0$$3, num); - ZEPHIR_CALL_FUNCTION(&_1$$3, "log", NULL, 14, &_0$$3); + ZEPHIR_CALL_FUNCTION(&_1$$3, "log", NULL, 16, &_0$$3); zephir_check_call_status(); RETURN_CCTOR(&_1$$3); } ZVAL_LONG(&_2, num); ZVAL_LONG(&_3, base); - ZEPHIR_CALL_FUNCTION(&_4, "log", NULL, 14, &_2, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "log", NULL, 16, &_2, &_3); zephir_check_call_status(); RETURN_CCTOR(&_4); } diff --git a/ext/stub/builtin/stringmethods.zep.c b/ext/stub/builtin/stringmethods.zep.c index d8cd136fa0..03a27c46e5 100644 --- a/ext/stub/builtin/stringmethods.zep.c +++ b/ext/stub/builtin/stringmethods.zep.c @@ -438,7 +438,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLowerFirst) zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "lcfirst", NULL, 15, &str); + ZEPHIR_CALL_FUNCTION(&_0, "lcfirst", NULL, 17, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -496,7 +496,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getFormatted) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello %s!"); - ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 16, &_0, &str); + ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 18, &_0, &str); zephir_check_call_status(); RETURN_CCTOR(&_1); } @@ -551,7 +551,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getSha1) zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "sha1", NULL, 17, &str); + ZEPHIR_CALL_FUNCTION(&_0, "sha1", NULL, 19, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -579,7 +579,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getNl2br) zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "nl2br", NULL, 18, &str); + ZEPHIR_CALL_FUNCTION(&_0, "nl2br", NULL, 20, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -607,7 +607,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getParsedCsv) zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "str_getcsv", NULL, 19, &str); + ZEPHIR_CALL_FUNCTION(&_0, "str_getcsv", NULL, 21, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -676,7 +676,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getRepeatted) ZVAL_LONG(&_0, count); - ZEPHIR_CALL_FUNCTION(&_1, "str_repeat", NULL, 20, &str, &_0); + ZEPHIR_CALL_FUNCTION(&_1, "str_repeat", NULL, 22, &str, &_0); zephir_check_call_status(); RETURN_CCTOR(&_1); } @@ -704,7 +704,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getShuffled) zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "str_shuffle", NULL, 21, &str); + ZEPHIR_CALL_FUNCTION(&_0, "str_shuffle", NULL, 23, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -735,7 +735,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getSplited) zephir_get_strval(&del, del_param); - ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 22, &str, &del); + ZEPHIR_CALL_FUNCTION(&_0, "str_split", NULL, 24, &str, &del); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -766,7 +766,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getCompare) zephir_get_strval(&right, right_param); - ZEPHIR_CALL_FUNCTION(&_0, "strcmp", NULL, 23, &left, &right); + ZEPHIR_CALL_FUNCTION(&_0, "strcmp", NULL, 25, &left, &right); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -797,7 +797,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getCompareLocale) zephir_get_strval(&right, right_param); - ZEPHIR_CALL_FUNCTION(&_0, "strcoll", NULL, 24, &left, &right); + ZEPHIR_CALL_FUNCTION(&_0, "strcoll", NULL, 26, &left, &right); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -825,7 +825,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getReversed) zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "strrev", NULL, 25, &str); + ZEPHIR_CALL_FUNCTION(&_0, "strrev", NULL, 27, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } @@ -853,7 +853,7 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getHtmlSpecialChars) zephir_get_strval(&str, str_param); - ZEPHIR_CALL_FUNCTION(&_0, "htmlspecialchars", NULL, 26, &str); + ZEPHIR_CALL_FUNCTION(&_0, "htmlspecialchars", NULL, 28, &str); zephir_check_call_status(); RETURN_CCTOR(&_0); } diff --git a/ext/stub/closures.zep.c b/ext/stub/closures.zep.c index fd3274dbb1..ba175fc36d 100644 --- a/ext/stub/closures.zep.c +++ b/ext/stub/closures.zep.c @@ -231,7 +231,7 @@ PHP_METHOD(Stub_Closures, issue1036Call) zephir_read_property(&_0, this_ptr, ZEND_STRL("_function"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, ZEND_STRL("_argument"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 27, &_0, &_1); + ZEPHIR_RETURN_CALL_FUNCTION("call_user_func", NULL, 29, &_0, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/exceptions.zep.c b/ext/stub/exceptions.zep.c index bf6aea1eb3..1fa1612ada 100644 --- a/ext/stub/exceptions.zep.c +++ b/ext/stub/exceptions.zep.c @@ -66,7 +66,7 @@ PHP_METHOD(Stub_Exceptions, testException2) ZVAL_STRING(&msg, "hello2"); ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, stub_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 28, &msg); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 30, &msg); zephir_check_call_status(); zephir_throw_exception_debug(&_0, "stub/exceptions.zep", 23); ZEPHIR_MM_RESTORE(); @@ -90,7 +90,7 @@ PHP_METHOD(Stub_Exceptions, testException3) ZVAL_STRING(&msg, "hello3"); ZEPHIR_INIT_VAR(&ex); object_init_ex(&ex, stub_exception_ce); - ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 28, &msg); + ZEPHIR_CALL_METHOD(NULL, &ex, "__construct", NULL, 30, &msg); zephir_check_call_status(); zephir_throw_exception_debug(&ex, "stub/exceptions.zep", 31); ZEPHIR_MM_RESTORE(); @@ -112,7 +112,7 @@ PHP_METHOD(Stub_Exceptions, getException) object_init_ex(return_value, stub_exception_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello4"); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 28, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 30, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -153,7 +153,7 @@ PHP_METHOD(Stub_Exceptions, testException5) object_init_ex(&exception, stub_exception_ce); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "hello5"); - ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 28, &_0); + ZEPHIR_CALL_METHOD(NULL, &exception, "__construct", NULL, 30, &_0); zephir_check_call_status(); zephir_throw_exception_debug(&exception, "stub/exceptions.zep", 49); ZEPHIR_MM_RESTORE(); @@ -229,7 +229,7 @@ PHP_METHOD(Stub_Exceptions, testExceptionSprintf) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "Hello, %s"); - ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 16, &_0, &name); + ZEPHIR_CALL_FUNCTION(&_1, "sprintf", NULL, 18, &_0, &name); zephir_check_call_status(); zephir_throw_exception_debug(&_1, "stub/exceptions.zep", 68); ZEPHIR_MM_RESTORE(); @@ -442,7 +442,7 @@ PHP_METHOD(Stub_Exceptions, issue1325) /* try_start_1: */ - ZEPHIR_CALL_METHOD(&status, this_ptr, "donoopexception", NULL, 29); + ZEPHIR_CALL_METHOD(&status, this_ptr, "donoopexception", NULL, 31); zephir_check_call_status_or_jump(try_end_1); try_end_1: diff --git a/ext/stub/factorial.zep.c b/ext/stub/factorial.zep.c index 238f1ebb68..b75a05a82e 100644 --- a/ext/stub/factorial.zep.c +++ b/ext/stub/factorial.zep.c @@ -99,7 +99,7 @@ PHP_METHOD(Stub_Factorial, intRecursiveFactorial) ZVAL_LONG(&_0, 1); } else { ZVAL_LONG(&_3, (num - 1)); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "intrecursivefactorial", NULL, 30, &_3); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "intrecursivefactorial", NULL, 32, &_3); zephir_check_call_status(); ZVAL_LONG(&_0, (num * zephir_get_numberval(&_2))); } diff --git a/ext/stub/fcall.zep.c b/ext/stub/fcall.zep.c index 060bdcab57..f390605f66 100644 --- a/ext/stub/fcall.zep.c +++ b/ext/stub/fcall.zep.c @@ -74,7 +74,7 @@ PHP_METHOD(Stub_Fcall, testCall2) while (1) { ZVAL_LONG(&_0$$3, 0); ZVAL_LONG(&_1$$3, 100); - ZEPHIR_RETURN_CALL_FUNCTION("mt_rand", &_2, 31, &_0$$3, &_1$$3); + ZEPHIR_RETURN_CALL_FUNCTION("mt_rand", &_2, 33, &_0$$3, &_1$$3); zephir_check_call_status(); RETURN_MM(); } @@ -102,18 +102,18 @@ PHP_METHOD(Stub_Fcall, testCall3) ZVAL_STRING(&_0, "inputfile.txt"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "r"); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 34, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "outputfile.txt"); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 34, &_0, &_1); zephir_check_call_status(); if (zephir_is_true(&handle)) { while (1) { ZVAL_LONG(&_3$$4, 4096); - ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 33, &handle, &_3$$4); + ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 35, &handle, &_3$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&buffer)) { break; @@ -148,18 +148,18 @@ PHP_METHOD(Stub_Fcall, testCall4) ZVAL_STRING(&_0, "r"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "inputfile.txt"); - ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, 34, &_0, &_1); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "outputfile.txt"); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, 34, &_0, &_1); zephir_check_call_status(); if (zephir_is_true(&handle)) { while (1) { ZVAL_LONG(&_3$$4, 4096); - ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 33, &handle, &_3$$4); + ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_4, 35, &handle, &_3$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(&buffer)) { break; @@ -194,7 +194,7 @@ PHP_METHOD(Stub_Fcall, testCall5) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 20, a, b); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", NULL, 22, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -209,7 +209,7 @@ PHP_METHOD(Stub_Fcall, testCall6) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_FUNCTION("rand", NULL, 34); + ZEPHIR_RETURN_CALL_FUNCTION("rand", NULL, 36); zephir_check_call_status(); RETURN_MM(); } @@ -224,7 +224,7 @@ PHP_METHOD(Stub_Fcall, testCall7) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_FUNCTION(NULL, "memory_get_usage", NULL, 35); + ZEPHIR_CALL_FUNCTION(NULL, "memory_get_usage", NULL, 37); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -285,7 +285,7 @@ PHP_METHOD(Stub_Fcall, testCall8) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_CALL_FUNCTION(&x, "str_repeat", NULL, 20, a, b); + ZEPHIR_CALL_FUNCTION(&x, "str_repeat", NULL, 22, a, b); zephir_check_call_status(); RETURN_CCTOR(&x); } @@ -347,7 +347,7 @@ PHP_METHOD(Stub_Fcall, testStrtokVarBySlash) ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "/"); - ZEPHIR_RETURN_CALL_FUNCTION("strtok", NULL, 36, value, &_0); + ZEPHIR_RETURN_CALL_FUNCTION("strtok", NULL, 38, value, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -541,7 +541,7 @@ PHP_FUNCTION(g_stub_zephir_global_method_test) { zephir_check_call_status(); } - ZEPHIR_RETURN_CALL_METHOD(&_0, "teststrtokvarbyslash", NULL, 37, str); + ZEPHIR_RETURN_CALL_METHOD(&_0, "teststrtokvarbyslash", NULL, 39, str); zephir_check_call_status(); RETURN_MM(); } @@ -591,7 +591,7 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_test) { } ZVAL_LONG(&_1, 5); - ZEPHIR_RETURN_CALL_METHOD(&_0, "testcall5", NULL, 38, str, &_1); + ZEPHIR_RETURN_CALL_METHOD(&_0, "testcall5", NULL, 40, str, &_1); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/fetchtest.zep.c b/ext/stub/fetchtest.zep.c index ef3d2ad542..41b2d58dfa 100644 --- a/ext/stub/fetchtest.zep.c +++ b/ext/stub/fetchtest.zep.c @@ -61,6 +61,7 @@ PHP_METHOD(Stub_FetchTest, getValues) PHP_METHOD(Stub_FetchTest, testFetchArray1) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a, a_sub, *b, b_sub, c; zval *this_ptr = getThis(); @@ -76,10 +77,12 @@ PHP_METHOD(Stub_FetchTest, testFetchArray1) #endif - zephir_fetch_params_without_memory_grow(2, 0, &a, &b); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &a, &b); - RETURN_BOOL(zephir_array_isset_fetch(&c, a, b, 1)); + ZEPHIR_OBS_VAR(&c); + RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, b, 0)); } PHP_METHOD(Stub_FetchTest, testFetchArray2) @@ -110,6 +113,7 @@ PHP_METHOD(Stub_FetchTest, testFetchArray2) PHP_METHOD(Stub_FetchTest, testFetchArray3) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long b; zval *a, a_sub, *b_param = NULL, c; zval *this_ptr = getThis(); @@ -125,11 +129,13 @@ PHP_METHOD(Stub_FetchTest, testFetchArray3) #endif - zephir_fetch_params_without_memory_grow(2, 0, &a, &b_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &a, &b_param); b = zephir_get_intval(b_param); - RETURN_BOOL(zephir_array_isset_long_fetch(&c, a, b, 1)); + ZEPHIR_OBS_VAR(&c); + RETURN_MM_BOOL(zephir_array_isset_long_fetch(&c, a, b, 0)); } PHP_METHOD(Stub_FetchTest, testFetchArray4) @@ -183,7 +189,8 @@ PHP_METHOD(Stub_FetchTest, testFetchArray5) zephir_get_strval(&b, b_param); - RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, &b, 1)); + ZEPHIR_OBS_VAR(&c); + RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, &b, 0)); } PHP_METHOD(Stub_FetchTest, testFetchArray6) @@ -268,6 +275,7 @@ PHP_METHOD(Stub_FetchTest, testFetchObject2) PHP_METHOD(Stub_FetchTest, testFetchPost) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *b, b_sub, _POST, c; zval *this_ptr = getThis(); @@ -282,14 +290,16 @@ PHP_METHOD(Stub_FetchTest, testFetchPost) #endif + ZEPHIR_MM_GROW(); zephir_get_global(&_POST, SL("_POST")); - zephir_fetch_params_without_memory_grow(1, 0, &b); + zephir_fetch_params(1, 1, 0, &b); - if (!(zephir_array_isset_fetch(&c, &_POST, b, 1))) { - RETURN_BOOL(0); + ZEPHIR_OBS_VAR(&c); + if (!(zephir_array_isset_fetch(&c, &_POST, b, 0))) { + RETURN_MM_BOOL(0); } - RETURN_CTORW(&c); + RETURN_CCTOR(&c); } PHP_METHOD(Stub_FetchTest, hasValue) diff --git a/ext/stub/fibonnaci.zep.c b/ext/stub/fibonnaci.zep.c index b5d533012f..86f41df03d 100644 --- a/ext/stub/fibonnaci.zep.c +++ b/ext/stub/fibonnaci.zep.c @@ -104,8 +104,10 @@ PHP_METHOD(Stub_Fibonnaci, fibArray) } k = (i - 1); j = (i - 2); - zephir_array_fetch_long(&a, &fib, k, PH_NOISY | PH_READONLY, "stub/fibonnaci.zep", 51); - zephir_array_fetch_long(&b, &fib, j, PH_NOISY | PH_READONLY, "stub/fibonnaci.zep", 52); + ZEPHIR_OBS_NVAR(&a); + zephir_array_fetch_long(&a, &fib, k, PH_NOISY, "stub/fibonnaci.zep", 51); + ZEPHIR_OBS_NVAR(&b); + zephir_array_fetch_long(&b, &fib, j, PH_NOISY, "stub/fibonnaci.zep", 52); ZEPHIR_INIT_NVAR(&c); zephir_add_function(&c, &a, &b); zephir_array_update_long(&fib, i, &c, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); @@ -185,10 +187,10 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciRecursive) RETURN_MM_LONG(1); } else { ZVAL_LONG(&_1$$6, (n - 1)); - ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccirecursive", &_2, 39, &_1$$6); + ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccirecursive", &_2, 41, &_1$$6); zephir_check_call_status(); ZVAL_LONG(&_1$$6, (n - 2)); - ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccirecursive", &_2, 39, &_1$$6); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccirecursive", &_2, 41, &_1$$6); zephir_check_call_status(); zephir_add_function(return_value, &_0$$6, &_3$$6); RETURN_MM(); @@ -227,10 +229,10 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciFinalRecursive) RETURN_MM_LONG(1); } else { ZVAL_LONG(&_1$$6, (n - 1)); - ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccifinalrecursive", &_2, 40, &_1$$6); + ZEPHIR_CALL_METHOD(&_0$$6, this_ptr, "fibonaccifinalrecursive", &_2, 42, &_1$$6); zephir_check_call_status(); ZVAL_LONG(&_1$$6, (n - 2)); - ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccifinalrecursive", &_2, 40, &_1$$6); + ZEPHIR_CALL_METHOD(&_3$$6, this_ptr, "fibonaccifinalrecursive", &_2, 42, &_1$$6); zephir_check_call_status(); zephir_add_function(return_value, &_0$$6, &_3$$6); RETURN_MM(); diff --git a/ext/stub/flow.zep.c b/ext/stub/flow.zep.c index b9e63b7a86..2f968c657a 100644 --- a/ext/stub/flow.zep.c +++ b/ext/stub/flow.zep.c @@ -775,13 +775,13 @@ PHP_METHOD(Stub_Flow, testWhileNextTest) array_init(&returnValue); while (1) { ZEPHIR_MAKE_REF(variable); - ZEPHIR_CALL_FUNCTION(&_0, "next", &_1, 41, variable); + ZEPHIR_CALL_FUNCTION(&_0, "next", &_1, 43, variable); ZEPHIR_UNREF(variable); zephir_check_call_status(); if (!(zephir_is_true(&_0))) { break; } - ZEPHIR_CALL_FUNCTION(&_2$$3, "current", &_3, 42, variable); + ZEPHIR_CALL_FUNCTION(&_2$$3, "current", &_3, 44, variable); zephir_check_call_status(); zephir_array_append(&returnValue, &_2$$3, PH_SEPARATE, "stub/flow.zep", 420); } @@ -815,11 +815,11 @@ PHP_METHOD(Stub_Flow, testWhileDoNextTest) ZEPHIR_INIT_VAR(&returnValue); array_init(&returnValue); do { - ZEPHIR_CALL_FUNCTION(&_0$$3, "current", &_1, 42, variable); + ZEPHIR_CALL_FUNCTION(&_0$$3, "current", &_1, 44, variable); zephir_check_call_status(); zephir_array_append(&returnValue, &_0$$3, PH_SEPARATE, "stub/flow.zep", 430); ZEPHIR_MAKE_REF(variable); - ZEPHIR_CALL_FUNCTION(&_2, "next", &_3, 41, variable); + ZEPHIR_CALL_FUNCTION(&_2, "next", &_3, 43, variable); ZEPHIR_UNREF(variable); zephir_check_call_status(); } while (zephir_is_true(&_2)); diff --git a/ext/stub/flow/switchflow.zep.c b/ext/stub/flow/switchflow.zep.c index 64f686349f..45290bd554 100644 --- a/ext/stub/flow/switchflow.zep.c +++ b/ext/stub/flow/switchflow.zep.c @@ -292,7 +292,7 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch13) ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_FUNCTION(&_2, "mt_rand", NULL, 31, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "mt_rand", NULL, 33, &_0, &_1); zephir_check_call_status(); do { if (ZEPHIR_IS_LONG(&_2, 100)) { diff --git a/ext/stub/functions.zep.c b/ext/stub/functions.zep.c index 1d429d3c2b..e51740dbb8 100644 --- a/ext/stub/functions.zep.c +++ b/ext/stub/functions.zep.c @@ -47,7 +47,7 @@ PHP_METHOD(Stub_Functions, filterVar1) ZVAL_STRING(&ret, "0"); ZVAL_LONG(&_0, 259); ZVAL_LONG(&_1, 20480); - ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 43, &ret, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 45, &ret, &_0, &_1); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_FALSE_IDENTICAL(&_2)); } @@ -74,7 +74,7 @@ PHP_METHOD(Stub_Functions, filterVar2) ZVAL_STRING(&ret, "0"); ZVAL_LONG(&_0, 259); ZVAL_LONG(&_1, 20480); - ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 43, &ret, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "filter_var", NULL, 45, &ret, &_0, &_1); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_FALSE(&_2)); } diff --git a/ext/stub/globals/serverrequestfactory.zep.c b/ext/stub/globals/serverrequestfactory.zep.c index ad48f36a19..c68be91bed 100644 --- a/ext/stub/globals/serverrequestfactory.zep.c +++ b/ext/stub/globals/serverrequestfactory.zep.c @@ -130,19 +130,19 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) if (!(ZEPHIR_IS_EMPTY(&_SERVER))) { ZEPHIR_CPY_WRT(&globalServer, &_SERVER); } - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checknullarray", &_1, 44, &server, &globalServer); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "checknullarray", &_1, 46, &server, &globalServer); zephir_check_call_status(); ZEPHIR_CPY_WRT(&server, &_0); - ZEPHIR_CALL_METHOD(&_2, this_ptr, "checknullarray", &_1, 44, &files, &globalFiles); + ZEPHIR_CALL_METHOD(&_2, this_ptr, "checknullarray", &_1, 46, &files, &globalFiles); zephir_check_call_status(); ZEPHIR_CPY_WRT(&files, &_2); - ZEPHIR_CALL_METHOD(&_3, this_ptr, "checknullarray", &_1, 44, &cookies, &globalCookies); + ZEPHIR_CALL_METHOD(&_3, this_ptr, "checknullarray", &_1, 46, &cookies, &globalCookies); zephir_check_call_status(); ZEPHIR_CPY_WRT(&cookies, &_3); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "checknullarray", &_1, 44, &get, &globalGet); + ZEPHIR_CALL_METHOD(&_4, this_ptr, "checknullarray", &_1, 46, &get, &globalGet); zephir_check_call_status(); ZEPHIR_CPY_WRT(&get, &_4); - ZEPHIR_CALL_METHOD(&_5, this_ptr, "checknullarray", &_1, 44, &post, &globalPost); + ZEPHIR_CALL_METHOD(&_5, this_ptr, "checknullarray", &_1, 46, &post, &globalPost); zephir_check_call_status(); ZEPHIR_CPY_WRT(&post, &_5); zephir_create_array(return_value, 5, 0); diff --git a/ext/stub/instance.zep.c b/ext/stub/instance.zep.c index 2df0a1fbb5..325d9f59d9 100644 --- a/ext/stub/instance.zep.c +++ b/ext/stub/instance.zep.c @@ -93,7 +93,7 @@ PHP_METHOD(Stub_Instance, testIssue1339) zephir_array_fast_append(¶meters, &_0); ZEPHIR_INIT_NVAR(&_0); object_init_ex(&_0, stub_arrayobject_ce); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 45); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 47); zephir_check_call_status(); zephir_array_fast_append(¶meters, &_0); ZEPHIR_INIT_NVAR(&_0); diff --git a/ext/stub/invoke.zep.c b/ext/stub/invoke.zep.c index d9fc449852..3d833cb285 100644 --- a/ext/stub/invoke.zep.c +++ b/ext/stub/invoke.zep.c @@ -71,7 +71,7 @@ PHP_METHOD(Stub_Invoke, test) ZEPHIR_INIT_VAR(&func); object_init_ex(&func, stub_invoke_ce); - ZEPHIR_CALL_METHOD(NULL, &func, "__construct", NULL, 46); + ZEPHIR_CALL_METHOD(NULL, &func, "__construct", NULL, 48); zephir_check_call_status(); ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(&func, NULL, 0); zephir_check_call_status(); diff --git a/ext/stub/issue2165/issue.zep.c b/ext/stub/issue2165/issue.zep.c index fe042aa89b..161dc606e7 100644 --- a/ext/stub/issue2165/issue.zep.c +++ b/ext/stub/issue2165/issue.zep.c @@ -66,7 +66,7 @@ PHP_METHOD(Stub_Issue2165_Issue, build) object_init_ex(return_value, stub_issue2165_issue_ce); ZVAL_BOOL(&_0, 1); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 47, &a, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 49, &a, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -142,11 +142,11 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) m = zephir_fast_count_int(&a); - ZEPHIR_CALL_FUNCTION(&_0, "current", NULL, 42, &a); + ZEPHIR_CALL_FUNCTION(&_0, "current", NULL, 44, &a); zephir_check_call_status(); n = zephir_fast_count_int(&_0); if (validate) { - ZEPHIR_CALL_FUNCTION(&_1$$3, "array_values", &_2, 48, &a); + ZEPHIR_CALL_FUNCTION(&_1$$3, "array_values", &_2, 50, &a); zephir_check_call_status(); ZEPHIR_CPY_WRT(&a, &_1$$3); zephir_is_iterable(&a, 0, "stub/issue2165/issue.zep", 46); @@ -165,13 +165,13 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZEPHIR_INIT_NVAR(&_7$$5); object_init_ex(&_7$$5, spl_ce_InvalidArgumentException); ZVAL_LONG(&_8$$5, n); - ZEPHIR_CALL_FUNCTION(&_9$$5, "strval", &_10, 49, &_8$$5); + ZEPHIR_CALL_FUNCTION(&_9$$5, "strval", &_10, 51, &_8$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_11$$5); ZVAL_LONG(&_11$$5, zephir_fast_count_int(&rowA)); ZEPHIR_INIT_NVAR(&_12$$5); ZEPHIR_CONCAT_SSVSVSSVS(&_12$$5, "The number of columns", " must be equal for all rows, ", &_9$$5, " needed but ", &_11$$5, " given", " at row offset ", &i, "."); - ZEPHIR_CALL_METHOD(NULL, &_7$$5, "__construct", &_13, 50, &_12$$5); + ZEPHIR_CALL_METHOD(NULL, &_7$$5, "__construct", &_13, 52, &_12$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_7$$5, "stub/issue2165/issue.zep", 33); ZEPHIR_MM_RESTORE(); @@ -185,7 +185,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZVAL_COPY(&valueA, _14$$4); _16$$6 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_16$$6) { - ZEPHIR_CALL_FUNCTION(&_17$$6, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_17$$6, "is_float", &_18, 53, &valueA); zephir_check_call_status(); _16$$6 = !zephir_is_true(&_17$$6); } @@ -196,7 +196,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_20$$7, &valueA); ZEPHIR_INIT_NVAR(&_21$$7); ZEPHIR_CONCAT_SSVS(&_21$$7, "Matrix element must", " be an integer or floating point number, ", &_20$$7, " given."); - ZEPHIR_CALL_METHOD(NULL, &_19$$7, "__construct", &_13, 50, &_21$$7); + ZEPHIR_CALL_METHOD(NULL, &_19$$7, "__construct", &_13, 52, &_21$$7); zephir_check_call_status(); zephir_throw_exception_debug(&_19$$7, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -216,7 +216,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_check_call_status(); _22$$8 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_22$$8) { - ZEPHIR_CALL_FUNCTION(&_23$$8, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_23$$8, "is_float", &_18, 53, &valueA); zephir_check_call_status(); _22$$8 = !zephir_is_true(&_23$$8); } @@ -227,7 +227,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_25$$9, &valueA); ZEPHIR_INIT_NVAR(&_26$$9); ZEPHIR_CONCAT_SSVS(&_26$$9, "Matrix element must", " be an integer or floating point number, ", &_25$$9, " given."); - ZEPHIR_CALL_METHOD(NULL, &_24$$9, "__construct", &_13, 50, &_26$$9); + ZEPHIR_CALL_METHOD(NULL, &_24$$9, "__construct", &_13, 52, &_26$$9); zephir_check_call_status(); zephir_throw_exception_debug(&_24$$9, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -238,7 +238,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) } } ZEPHIR_INIT_NVAR(&valueA); - ZEPHIR_CALL_FUNCTION(&_27$$4, "array_values", &_2, 48, &rowA); + ZEPHIR_CALL_FUNCTION(&_27$$4, "array_values", &_2, 50, &rowA); zephir_check_call_status(); zephir_array_append(&rowA, &_27$$4, PH_SEPARATE, "stub/issue2165/issue.zep", 44); } ZEND_HASH_FOREACH_END(); @@ -259,13 +259,13 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZEPHIR_INIT_NVAR(&_28$$11); object_init_ex(&_28$$11, spl_ce_InvalidArgumentException); ZVAL_LONG(&_29$$11, n); - ZEPHIR_CALL_FUNCTION(&_30$$11, "strval", &_10, 49, &_29$$11); + ZEPHIR_CALL_FUNCTION(&_30$$11, "strval", &_10, 51, &_29$$11); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_31$$11); ZVAL_LONG(&_31$$11, zephir_fast_count_int(&rowA)); ZEPHIR_INIT_NVAR(&_32$$11); ZEPHIR_CONCAT_SSVSVSSVS(&_32$$11, "The number of columns", " must be equal for all rows, ", &_30$$11, " needed but ", &_31$$11, " given", " at row offset ", &i, "."); - ZEPHIR_CALL_METHOD(NULL, &_28$$11, "__construct", &_13, 50, &_32$$11); + ZEPHIR_CALL_METHOD(NULL, &_28$$11, "__construct", &_13, 52, &_32$$11); zephir_check_call_status(); zephir_throw_exception_debug(&_28$$11, "stub/issue2165/issue.zep", 33); ZEPHIR_MM_RESTORE(); @@ -279,7 +279,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZVAL_COPY(&valueA, _33$$10); _35$$12 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_35$$12) { - ZEPHIR_CALL_FUNCTION(&_36$$12, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_36$$12, "is_float", &_18, 53, &valueA); zephir_check_call_status(); _35$$12 = !zephir_is_true(&_36$$12); } @@ -290,7 +290,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_38$$13, &valueA); ZEPHIR_INIT_NVAR(&_39$$13); ZEPHIR_CONCAT_SSVS(&_39$$13, "Matrix element must", " be an integer or floating point number, ", &_38$$13, " given."); - ZEPHIR_CALL_METHOD(NULL, &_37$$13, "__construct", &_13, 50, &_39$$13); + ZEPHIR_CALL_METHOD(NULL, &_37$$13, "__construct", &_13, 52, &_39$$13); zephir_check_call_status(); zephir_throw_exception_debug(&_37$$13, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -310,7 +310,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_check_call_status(); _40$$14 = !(Z_TYPE_P(&valueA) == IS_LONG); if (_40$$14) { - ZEPHIR_CALL_FUNCTION(&_41$$14, "is_float", &_18, 51, &valueA); + ZEPHIR_CALL_FUNCTION(&_41$$14, "is_float", &_18, 53, &valueA); zephir_check_call_status(); _40$$14 = !zephir_is_true(&_41$$14); } @@ -321,7 +321,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) zephir_gettype(&_43$$15, &valueA); ZEPHIR_INIT_NVAR(&_44$$15); ZEPHIR_CONCAT_SSVS(&_44$$15, "Matrix element must", " be an integer or floating point number, ", &_43$$15, " given."); - ZEPHIR_CALL_METHOD(NULL, &_42$$15, "__construct", &_13, 50, &_44$$15); + ZEPHIR_CALL_METHOD(NULL, &_42$$15, "__construct", &_13, 52, &_44$$15); zephir_check_call_status(); zephir_throw_exception_debug(&_42$$15, "stub/issue2165/issue.zep", 40); ZEPHIR_MM_RESTORE(); @@ -332,7 +332,7 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) } } ZEPHIR_INIT_NVAR(&valueA); - ZEPHIR_CALL_FUNCTION(&_45$$10, "array_values", &_2, 48, &rowA); + ZEPHIR_CALL_FUNCTION(&_45$$10, "array_values", &_2, 50, &rowA); zephir_check_call_status(); zephir_array_append(&rowA, &_45$$10, PH_SEPARATE, "stub/issue2165/issue.zep", 44); ZEPHIR_CALL_METHOD(NULL, &a, "next", NULL, 0); @@ -383,7 +383,7 @@ PHP_METHOD(Stub_Issue2165_Issue, quick) object_init_ex(return_value, stub_issue2165_issue_ce); ZVAL_BOOL(&_0, 0); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 47, &a, &_0); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 49, &a, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -465,7 +465,7 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) _0 = !(Z_TYPE_P(value) == IS_LONG); if (_0) { - ZEPHIR_CALL_FUNCTION(&_1, "is_float", NULL, 51, value); + ZEPHIR_CALL_FUNCTION(&_1, "is_float", NULL, 53, value); zephir_check_call_status(); _0 = !zephir_is_true(&_1); } @@ -476,7 +476,7 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) zephir_gettype(&_3$$3, value); ZEPHIR_INIT_VAR(&_4$$3); ZEPHIR_CONCAT_SSVS(&_4$$3, "Value must be an", " integer or floating point number, ", &_3$$3, " given."); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 50, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", NULL, 52, &_4$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$3, "stub/issue2165/issue.zep", 68); ZEPHIR_MM_RESTORE(); @@ -486,11 +486,11 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) ZEPHIR_INIT_VAR(&_5$$4); object_init_ex(&_5$$4, spl_ce_InvalidArgumentException); ZVAL_LONG(&_6$$4, m); - ZEPHIR_CALL_FUNCTION(&_7$$4, "strval", &_8, 49, &_6$$4); + ZEPHIR_CALL_FUNCTION(&_7$$4, "strval", &_8, 51, &_6$$4); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9$$4); ZEPHIR_CONCAT_SSVS(&_9$$4, "M must be", " greater than 0, ", &_7$$4, " given."); - ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", NULL, 50, &_9$$4); + ZEPHIR_CALL_METHOD(NULL, &_5$$4, "__construct", NULL, 52, &_9$$4); zephir_check_call_status(); zephir_throw_exception_debug(&_5$$4, "stub/issue2165/issue.zep", 73); ZEPHIR_MM_RESTORE(); @@ -500,11 +500,11 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) ZEPHIR_INIT_VAR(&_10$$5); object_init_ex(&_10$$5, spl_ce_InvalidArgumentException); ZVAL_LONG(&_11$$5, n); - ZEPHIR_CALL_FUNCTION(&_12$$5, "strval", &_8, 49, &_11$$5); + ZEPHIR_CALL_FUNCTION(&_12$$5, "strval", &_8, 51, &_11$$5); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_13$$5); ZEPHIR_CONCAT_SSVS(&_13$$5, "N must be", " greater than 0, ", &_12$$5, " given."); - ZEPHIR_CALL_METHOD(NULL, &_10$$5, "__construct", NULL, 50, &_13$$5); + ZEPHIR_CALL_METHOD(NULL, &_10$$5, "__construct", NULL, 52, &_13$$5); zephir_check_call_status(); zephir_throw_exception_debug(&_10$$5, "stub/issue2165/issue.zep", 78); ZEPHIR_MM_RESTORE(); diff --git a/ext/stub/issue663.zep.c b/ext/stub/issue663.zep.c index d4862a44c6..434053e128 100644 --- a/ext/stub/issue663.zep.c +++ b/ext/stub/issue663.zep.c @@ -55,7 +55,7 @@ PHP_METHOD(Stub_Issue663, is_array_assoc) if (_0) { RETURN_MM_BOOL(0); } - ZEPHIR_RETURN_CALL_STATIC("is_array_assoc_internal", &_1, 52, arr); + ZEPHIR_RETURN_CALL_STATIC("is_array_assoc_internal", &_1, 54, arr); zephir_check_call_status(); RETURN_MM(); } @@ -136,7 +136,7 @@ PHP_METHOD(Stub_Issue663, is_array_indexed) if (_0) { RETURN_MM_BOOL(0); } - ZEPHIR_CALL_STATIC(&_1, "is_array_assoc_internal", &_2, 52, arr); + ZEPHIR_CALL_STATIC(&_1, "is_array_assoc_internal", &_2, 54, arr); zephir_check_call_status(); RETURN_MM_BOOL(!zephir_is_true(&_1)); } diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index 485b8b5164..c5d4670335 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -177,7 +177,7 @@ PHP_METHOD(Stub_Mcall, testCall3) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 53); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 55); zephir_check_call_status(); RETURN_MM(); } @@ -258,7 +258,7 @@ PHP_METHOD(Stub_Mcall, testCall6) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 54, a, b); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 56, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -353,7 +353,7 @@ PHP_METHOD(Stub_Mcall, testCall9) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod6", NULL, 54, a, b); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod6", NULL, 56, a, b); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, this_ptr, "testmethod5", NULL, 0, a, b); zephir_check_call_status(); @@ -401,7 +401,7 @@ PHP_METHOD(Stub_Mcall, testCall12) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 53); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod3", NULL, 55); zephir_check_call_status(); RETURN_MM(); } @@ -482,7 +482,7 @@ PHP_METHOD(Stub_Mcall, testCall15) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 54, a, b); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod6", NULL, 56, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -551,7 +551,7 @@ PHP_METHOD(Stub_Mcall, testCall18) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod7", NULL, 55); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "testmethod7", NULL, 57); zephir_check_call_status(); RETURN_MM(); } @@ -692,7 +692,7 @@ PHP_METHOD(Stub_Mcall, testCall22) _0 = 1; } i = _1; - ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "testmethod21", &_4, 56, p, p); + ZEPHIR_CALL_METHOD(&_3$$3, this_ptr, "testmethod21", &_4, 58, p, p); zephir_check_call_status(); j += zephir_get_numberval(&_3$$3); } @@ -1116,7 +1116,7 @@ PHP_METHOD(Stub_Mcall, testCallablePass) ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_NVAR(&_0); zephir_create_closure_ex(&_0, NULL, stub_12__closure_ce, SL("__invoke")); - ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 57, &_0); + ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 59, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -1149,7 +1149,7 @@ PHP_METHOD(Stub_Mcall, testCallableArrayThisMethodPass) ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "bb"); zephir_array_fast_append(&_0, &_1); - ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 57, &_0); + ZEPHIR_RETURN_CALL_METHOD(&a, "setcallable", NULL, 59, &_0); zephir_check_call_status(); RETURN_MM(); } @@ -1173,7 +1173,7 @@ PHP_METHOD(Stub_Mcall, aa) zephir_check_call_status(); } - ZEPHIR_RETURN_CALL_METHOD(&a, "bb", NULL, 58); + ZEPHIR_RETURN_CALL_METHOD(&a, "bb", NULL, 60); zephir_check_call_status(); RETURN_MM(); } @@ -1203,7 +1203,7 @@ PHP_METHOD(Stub_Mcall, issue1136) ZVAL_STRING(&_1, "8.0.0"); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, ">="); - ZEPHIR_CALL_FUNCTION(&_3, "version_compare", NULL, 59, &_0, &_1, &_2); + ZEPHIR_CALL_FUNCTION(&_3, "version_compare", NULL, 61, &_0, &_1, &_2); zephir_check_call_status(); if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); @@ -1211,7 +1211,7 @@ PHP_METHOD(Stub_Mcall, issue1136) ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); zephir_check_call_status(); } else { - ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 60); + ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 62); zephir_check_call_status(); } RETURN_CCTOR(&_finfo); diff --git a/ext/stub/mcall.zep.h b/ext/stub/mcall.zep.h index d3a376be10..cd90993017 100644 --- a/ext/stub/mcall.zep.h +++ b/ext/stub/mcall.zep.h @@ -233,7 +233,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparam, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testobjectparamcaststdclass, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, param, StdClass, 0) + ZEND_ARG_OBJ_INFO(0, param, stdClass, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testobjectparamcastooparam, 0, 0, 1) diff --git a/ext/stub/mcallchained.zep.c b/ext/stub/mcallchained.zep.c index 19b772a6e5..8a8abfa4a1 100644 --- a/ext/stub/mcallchained.zep.c +++ b/ext/stub/mcallchained.zep.c @@ -109,7 +109,7 @@ PHP_METHOD(Stub_McallChained, testChained3) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod3", NULL, 61); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "testmethod3", NULL, 63); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_1, &_0, "testmethod2", NULL, 0); zephir_check_call_status(); diff --git a/ext/stub/mcalldynamic.zep.c b/ext/stub/mcalldynamic.zep.c index 44fb317fe3..58a97970f9 100644 --- a/ext/stub/mcalldynamic.zep.c +++ b/ext/stub/mcalldynamic.zep.c @@ -94,22 +94,21 @@ PHP_METHOD(Stub_McallDynamic, __call) */ PHP_METHOD(Stub_McallDynamic, testCallAnonymousFunctionWithContext) { - zval result, _1; + zval result, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&result); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_INIT_NVAR(&_1); - zephir_create_closure_ex(&_1, NULL, stub_13__closure_ce, SL("__invoke")); - ZEPHIR_CALL_CE_STATIC(&result, stub_mcall_caller_ce, "start", &_0, 0, &_1); + ZEPHIR_INIT_VAR(&_0); + ZEPHIR_INIT_NVAR(&_0); + zephir_create_closure_ex(&_0, NULL, stub_13__closure_ce, SL("__invoke")); + ZEPHIR_CALL_CE_STATIC(&result, stub_mcall_caller_ce, "start", NULL, 0, &_0); zephir_check_call_status(); RETURN_CCTOR(&result); } diff --git a/ext/stub/nativearray.zep.c b/ext/stub/nativearray.zep.c index 5b2082a793..d3cd029e2f 100644 --- a/ext/stub/nativearray.zep.c +++ b/ext/stub/nativearray.zep.c @@ -773,8 +773,9 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess1) ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); - zephir_array_fetch_long(&b, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 245); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_long(&b, &a, 0, PH_NOISY, "stub/nativearray.zep", 245); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess2) @@ -794,8 +795,9 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess2) add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); - zephir_array_fetch_string(&b, &a, SL("a"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 255); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_string(&b, &a, SL("a"), PH_NOISY, "stub/nativearray.zep", 255); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess3) @@ -824,8 +826,9 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess3) ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); c = 0; - zephir_array_fetch_long(&b, &a, c, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 267); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_long(&b, &a, c, PH_NOISY, "stub/nativearray.zep", 267); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess4) @@ -849,8 +852,9 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess4) add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 279); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch(&b, &a, &c, PH_NOISY, "stub/nativearray.zep", 279); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess5) @@ -873,8 +877,9 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess5) add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - zephir_array_fetch(&b, &a, &c, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 290); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch(&b, &a, &c, PH_NOISY, "stub/nativearray.zep", 290); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayAccess6) @@ -926,8 +931,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess1) add_index_stringl(&_0, 1, SL("b")); zephir_array_update_long(&a, 0, &_0, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_fetch_long(&_1, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 310); - zephir_array_fetch_long(&b, &_1, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 310); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_long(&b, &_1, 0, PH_NOISY, "stub/nativearray.zep", 310); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess2) @@ -958,8 +964,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess2) zephir_array_fast_append(&_0, &_1); zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_2, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 320); - zephir_array_fetch_long(&b, &_2, 1, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 320); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_long(&b, &_2, 1, PH_NOISY, "stub/nativearray.zep", 320); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess3) @@ -996,8 +1003,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess3) zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); - zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_long(&b, &_4, 1, PH_NOISY, "stub/nativearray.zep", 330); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess4) @@ -1034,8 +1042,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess4) zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); - zephir_array_fetch_long(&b, &_4, 1, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_long(&b, &_4, 1, PH_NOISY, "stub/nativearray.zep", 340); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess5) @@ -1067,8 +1076,9 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess5) zephir_array_update_string(&a, SL("a"), &_0, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_2, &a, SL("a"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); zephir_array_fetch_string(&_3, &_2, SL("b"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); - zephir_array_fetch_string(&b, &_3, SL("c"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); - RETURN_CTOR(&b); + ZEPHIR_OBS_VAR(&b); + zephir_array_fetch_string(&b, &_3, SL("c"), PH_NOISY, "stub/nativearray.zep", 350); + RETURN_CCTOR(&b); } PHP_METHOD(Stub_NativeArray, testArrayUpdate1) @@ -1968,7 +1978,7 @@ PHP_METHOD(Stub_NativeArray, issue709) ZEPHIR_INIT_NVAR(&_3$$3); ZVAL_LONG(&_3$$3, 2); zephir_array_fast_append(&arr, &_3$$3); - ZEPHIR_CALL_FUNCTION(&_5$$3, "array_rand", &_6, 62, &arr); + ZEPHIR_CALL_FUNCTION(&_5$$3, "array_rand", &_6, 64, &arr); zephir_check_call_status(); zephir_array_fetch(&_4$$3, &arr, &_5$$3, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 626); ZEPHIR_CPY_WRT(&arr, &_4$$3); @@ -2022,7 +2032,7 @@ PHP_METHOD(Stub_NativeArray, Issue1140) zephir_read_property(&_2, this_ptr, ZEND_STRL("prefixes"), PH_NOISY_CC | PH_READONLY); zephir_array_fetch(&_3, &_2, &prefix, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 639); ZEPHIR_MAKE_REF(&_3); - ZEPHIR_CALL_FUNCTION(NULL, "array_push", NULL, 63, &_3, &baseDir); + ZEPHIR_CALL_FUNCTION(NULL, "array_push", NULL, 65, &_3, &baseDir); ZEPHIR_UNREF(&_3); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "prefixes"); diff --git a/ext/stub/oo.zep.c b/ext/stub/oo.zep.c index 73d5dc903f..3fbb1f81b5 100644 --- a/ext/stub/oo.zep.c +++ b/ext/stub/oo.zep.c @@ -59,7 +59,7 @@ PHP_METHOD(Stub_Oo, testInstance2) ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstruct_ce); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 64); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 66); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -106,7 +106,7 @@ PHP_METHOD(Stub_Oo, testInstance4) ZVAL_STRING(&b, "b"); ZEPHIR_INIT_VAR(&o); object_init_ex(&o, stub_oo_ooconstructparams_ce); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &a, &b); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 67, &a, &b); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -131,7 +131,7 @@ PHP_METHOD(Stub_Oo, testInstance5) ZVAL_STRING(&_0, "a"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "b"); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 67, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -154,7 +154,7 @@ PHP_METHOD(Stub_Oo, testInstance6) object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 67, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -177,7 +177,7 @@ PHP_METHOD(Stub_Oo, testInstance7) object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_BOOL(&_0, 0); ZVAL_BOOL(&_1, 1); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 67, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -200,7 +200,7 @@ PHP_METHOD(Stub_Oo, testInstance8) object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_DOUBLE(&_0, 1.2); ZVAL_DOUBLE(&_1, 7.30); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 67, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -210,7 +210,6 @@ PHP_METHOD(Stub_Oo, testInstance9) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&o); @@ -218,7 +217,7 @@ PHP_METHOD(Stub_Oo, testInstance9) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "getnew", &_0, 0); + ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "getnew", NULL, 0); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -228,7 +227,6 @@ PHP_METHOD(Stub_Oo, testInstance10) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&o); @@ -236,7 +234,7 @@ PHP_METHOD(Stub_Oo, testInstance10) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamicb_ce, "getnew", &_0, 0); + ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamicb_ce, "getnew", NULL, 0); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -259,7 +257,7 @@ PHP_METHOD(Stub_Oo, testInstance11) object_init_ex(&o, stub_oo_ooconstructparams_ce); ZVAL_LONG(&_0, 1); ZVAL_LONG(&_1, 2); - ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 65, &_0, &_1); + ZEPHIR_CALL_METHOD(NULL, &o, "__construct", NULL, 67, &_0, &_1); zephir_check_call_status(); RETURN_CCTOR(&o); } @@ -269,7 +267,6 @@ PHP_METHOD(Stub_Oo, testInstance12) zval o; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&o); @@ -277,7 +274,7 @@ PHP_METHOD(Stub_Oo, testInstance12) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "call1", &_0, 0); + ZEPHIR_CALL_CE_STATIC(&o, stub_oo_oodynamica_ce, "call1", NULL, 0); zephir_check_call_status(); RETURN_CCTOR(&o); } diff --git a/ext/stub/oo/concretestatic.zep.c b/ext/stub/oo/concretestatic.zep.c index dcd1700de9..4186d2923c 100644 --- a/ext/stub/oo/concretestatic.zep.c +++ b/ext/stub/oo/concretestatic.zep.c @@ -52,14 +52,13 @@ PHP_METHOD(Stub_Oo_ConcreteStatic, callParentFunction) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_PARENT(stub_oo_concretestatic_ce, getThis(), "getcalledclass", &_0, 0); + ZEPHIR_RETURN_CALL_PARENT(stub_oo_concretestatic_ce, getThis(), "getcalledclass", NULL, 0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/oo/deprecatedmethods.zep.c b/ext/stub/oo/deprecatedmethods.zep.c index a7213f1622..93189cf5ef 100644 --- a/ext/stub/oo/deprecatedmethods.zep.c +++ b/ext/stub/oo/deprecatedmethods.zep.c @@ -43,7 +43,7 @@ PHP_METHOD(Stub_Oo_DeprecatedMethods, normalMethod) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "privatedeprecated", NULL, 66); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "privatedeprecated", NULL, 68); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/oo/oodestruct.zep.c b/ext/stub/oo/oodestruct.zep.c index 6b1185966f..07905d7ce1 100644 --- a/ext/stub/oo/oodestruct.zep.c +++ b/ext/stub/oo/oodestruct.zep.c @@ -227,11 +227,11 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) zephir_read_property(&_1, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); if ((zephir_file_exists(&_1) == SUCCESS)) { zephir_read_property(&_2$$4, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_3$$4, "realpath", NULL, 67, &_2$$4); + ZEPHIR_CALL_FUNCTION(&_3$$4, "realpath", NULL, 69, &_2$$4); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("realpath"), &_3$$4); zephir_read_property(&_4$$4, this_ptr, ZEND_STRL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&imageinfo, "getimagesize", NULL, 68, &_4$$4); + ZEPHIR_CALL_FUNCTION(&imageinfo, "getimagesize", NULL, 70, &_4$$4); zephir_check_call_status(); if (zephir_is_true(&imageinfo)) { zephir_array_fetch_long(&_5$$5, &imageinfo, 0, PH_NOISY | PH_READONLY, "stub/oo/oodestruct.zep", 62); @@ -349,7 +349,7 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("image"), &_37$$13); zephir_read_property(&_35$$13, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 69, &_35$$13, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 71, &_35$$13, &__$true); zephir_check_call_status(); zephir_read_property(&_36$$13, this_ptr, ZEND_STRL("image"), PH_NOISY_CC | PH_READONLY); ZVAL_BOOL(&_38$$13, 1); @@ -446,7 +446,7 @@ PHP_METHOD(Stub_Oo_OoDestruct, check) ZVAL_STRING(&_4, "2.0.1"); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, ">="); - ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 59, &version, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 61, &version, &_4, &_5); zephir_check_call_status(); if (UNEXPECTED(!zephir_is_true(&_6))) { ZEPHIR_INIT_VAR(&_7$$5); @@ -514,13 +514,13 @@ PHP_METHOD(Stub_Oo_OoDestruct, getVersion) ZVAL_NULL(&version); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "GD_VERSION"); - ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 70, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 72, &_3); zephir_check_call_status(); if (zephir_is_true(&_4)) { ZEPHIR_INIT_NVAR(&version); ZEPHIR_GET_CONSTANT(&version, "GD_VERSION"); } else { - ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 71); + ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 73); zephir_check_call_status(); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); diff --git a/ext/stub/oo/oonativeimplements.zep.h b/ext/stub/oo/oonativeimplements.zep.h index bf1f69343a..eca407a308 100644 --- a/ext/stub/oo/oonativeimplements.zep.h +++ b/ext/stub/oo/oonativeimplements.zep.h @@ -86,15 +86,10 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) -ZEND_END_ARG_INFO() -#else ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, serialized) + + ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements___serialize, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/ext/stub/oo/propertyaccess.zep.c b/ext/stub/oo/propertyaccess.zep.c index acbbd1e0b0..80148c4d66 100644 --- a/ext/stub/oo/propertyaccess.zep.c +++ b/ext/stub/oo/propertyaccess.zep.c @@ -97,7 +97,8 @@ PHP_METHOD(Stub_Oo_PropertyAccess, __construct) zephir_read_property(&_9, this_ptr, ZEND_STRL("a"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_10, &_9, ZEND_STRL("test2"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("b"), &_10); - zephir_read_property(&test1, this_ptr, ZEND_STRL("a"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&test1); + zephir_read_property(&test1, this_ptr, ZEND_STRL("a"), PH_NOISY_CC); ZEPHIR_MM_RESTORE(); } diff --git a/ext/stub/oo/scopes/privatescopetester.zep.c b/ext/stub/oo/scopes/privatescopetester.zep.c index f442dc765f..4e535f3260 100644 --- a/ext/stub/oo/scopes/privatescopetester.zep.c +++ b/ext/stub/oo/scopes/privatescopetester.zep.c @@ -138,7 +138,7 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, getObjVars) zephir_fetch_params(1, 1, 0, &obj); - ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 72, obj); + ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 74, obj); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/optimizers/acos.zep.c b/ext/stub/optimizers/acos.zep.c index 5371416dea..c726af1373 100644 --- a/ext/stub/optimizers/acos.zep.c +++ b/ext/stub/optimizers/acos.zep.c @@ -12,11 +12,10 @@ #include #include "kernel/main.h" -#include "math.h" +#include "kernel/fcall.h" #include "kernel/object.h" -#include "kernel/operators.h" #include "kernel/memory.h" -#include "kernel/math.h" +#include "kernel/operators.h" ZEPHIR_INIT_CLASS(Stub_Optimizers_ACos) @@ -29,50 +28,64 @@ ZEPHIR_INIT_CLASS(Stub_Optimizers_ACos) PHP_METHOD(Stub_Optimizers_ACos, testInt) { zval _0; - zend_long a; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, a; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); a = 1; ZVAL_LONG(&_0, a); - RETURN_DOUBLE(acos(a)); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 14, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ACos, testVar) { zval _0; - zend_long a; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, a; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); a = 1; ZVAL_LONG(&_0, a); - RETURN_DOUBLE(acos(a)); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 14, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ACos, testIntValue1) { zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); ZVAL_LONG(&_0, 0); - RETURN_DOUBLE(acos(0)); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 14, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ACos, testIntParameter) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a_param = NULL, _0; - zend_long a; + zend_long a, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); @@ -84,16 +97,21 @@ PHP_METHOD(Stub_Optimizers_ACos, testIntParameter) #endif - zephir_fetch_params_without_memory_grow(1, 0, &a_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &a_param); a = zephir_get_intval(a_param); ZVAL_LONG(&_0, a); - RETURN_DOUBLE(acos(a)); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 14, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ACos, testVarParameter) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub; zval *this_ptr = getThis(); @@ -106,9 +124,12 @@ PHP_METHOD(Stub_Optimizers_ACos, testVarParameter) #endif - zephir_fetch_params_without_memory_grow(1, 0, &a); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &a); - RETURN_DOUBLE(zephir_acos(a)); + ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 14, a); + zephir_check_call_status(); + RETURN_MM(); } diff --git a/ext/stub/optimizers/asin.zep.c b/ext/stub/optimizers/asin.zep.c index fe81b5d609..c73f52c51d 100644 --- a/ext/stub/optimizers/asin.zep.c +++ b/ext/stub/optimizers/asin.zep.c @@ -12,11 +12,10 @@ #include #include "kernel/main.h" -#include "math.h" +#include "kernel/fcall.h" #include "kernel/object.h" -#include "kernel/operators.h" #include "kernel/memory.h" -#include "kernel/math.h" +#include "kernel/operators.h" ZEPHIR_INIT_CLASS(Stub_Optimizers_ASin) @@ -29,50 +28,64 @@ ZEPHIR_INIT_CLASS(Stub_Optimizers_ASin) PHP_METHOD(Stub_Optimizers_ASin, testInt) { zval _0; - zend_long a; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, a; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); a = 1; ZVAL_LONG(&_0, a); - RETURN_DOUBLE(asin(a)); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 13, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ASin, testVar) { zval _0; - zend_long a; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS, a; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); a = 1; ZVAL_LONG(&_0, a); - RETURN_DOUBLE(asin(a)); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 13, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ASin, testIntValue1) { zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); ZVAL_LONG(&_0, 0); - RETURN_DOUBLE(asin(0)); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 13, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ASin, testIntParameter) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *a_param = NULL, _0; - zend_long a; + zend_long a, ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); @@ -84,16 +97,21 @@ PHP_METHOD(Stub_Optimizers_ASin, testIntParameter) #endif - zephir_fetch_params_without_memory_grow(1, 0, &a_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &a_param); a = zephir_get_intval(a_param); ZVAL_LONG(&_0, a); - RETURN_DOUBLE(asin(a)); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 13, &_0); + zephir_check_call_status(); + RETURN_MM(); } PHP_METHOD(Stub_Optimizers_ASin, testVarParameter) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; zval *a, a_sub; zval *this_ptr = getThis(); @@ -106,9 +124,12 @@ PHP_METHOD(Stub_Optimizers_ASin, testVarParameter) #endif - zephir_fetch_params_without_memory_grow(1, 0, &a); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &a); - RETURN_DOUBLE(zephir_asin(a)); + ZEPHIR_RETURN_CALL_FUNCTION("asin", NULL, 13, a); + zephir_check_call_status(); + RETURN_MM(); } diff --git a/ext/stub/optimizers/strreplace.zep.c b/ext/stub/optimizers/strreplace.zep.c index 8ddc9bccdd..9ba0ee494a 100644 --- a/ext/stub/optimizers/strreplace.zep.c +++ b/ext/stub/optimizers/strreplace.zep.c @@ -209,7 +209,7 @@ PHP_METHOD(Stub_Optimizers_StrReplace, issue732B) zephir_array_fast_append(&replacements, &_0); ZEPHIR_INIT_VAR(&subject); ZVAL_STRING(&subject, "The quick brown fox jumped over the lazy dog."); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 73, &patterns, &replacements, &subject); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 75, &patterns, &replacements, &subject); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/properties/app.zep.c b/ext/stub/properties/app.zep.c index bb909926b8..9dc0f6e264 100644 --- a/ext/stub/properties/app.zep.c +++ b/ext/stub/properties/app.zep.c @@ -42,7 +42,6 @@ PHP_METHOD(Stub_Properties_App, __construct) zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_1 = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); @@ -50,7 +49,7 @@ PHP_METHOD(Stub_Properties_App, __construct) ZEPHIR_MM_GROW(); - ZEPHIR_CALL_CE_STATIC(&_0, stub_properties_staticprivateproperties_ce, "getinstance", &_1, 0); + ZEPHIR_CALL_CE_STATIC(&_0, stub_properties_staticprivateproperties_ce, "getinstance", NULL, 0); zephir_check_call_status(); zephir_update_property_zval(this_ptr, ZEND_STRL("instance"), &_0); ZEPHIR_MM_RESTORE(); diff --git a/ext/stub/properties/getobjectvars.zep.c b/ext/stub/properties/getobjectvars.zep.c index b37947bdf1..42fff779d9 100644 --- a/ext/stub/properties/getobjectvars.zep.c +++ b/ext/stub/properties/getobjectvars.zep.c @@ -40,7 +40,7 @@ PHP_METHOD(Stub_Properties_GetObjectVars, issue1245) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 72, this_ptr); + ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 74, this_ptr); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/properties/propertyarray.zep.c b/ext/stub/properties/propertyarray.zep.c index 9cef65335b..95ba68716a 100644 --- a/ext/stub/properties/propertyarray.zep.c +++ b/ext/stub/properties/propertyarray.zep.c @@ -146,12 +146,12 @@ PHP_METHOD(Stub_Properties_PropertyArray, testIssues1831) } zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_0$$3); - ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 74, &_0$$3); + ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 76, &_0$$3); ZEPHIR_UNREF(&_0$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRING(&_2$$3, "header"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 75, &info, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 77, &info, &_2$$3); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_3$$3)) { zephir_array_append(&headers, &info, PH_SEPARATE, "stub/properties/propertyarray.zep", 51); @@ -159,7 +159,7 @@ PHP_METHOD(Stub_Properties_PropertyArray, testIssues1831) } else { zephir_read_property(&_5$$5, this_ptr, ZEND_STRL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_5$$5); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 76, &_5$$5, &info); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 78, &_5$$5, &info); ZEPHIR_UNREF(&_5$$5); zephir_check_call_status(); break; diff --git a/ext/stub/quantum.zep.c b/ext/stub/quantum.zep.c index 945b36df41..4d8f1ffc25 100644 --- a/ext/stub/quantum.zep.c +++ b/ext/stub/quantum.zep.c @@ -140,7 +140,7 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_STRING(&_0, "harmos.txt"); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "w"); - ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 32, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 34, &_0, &_1); zephir_check_call_status(); if (!(zephir_is_true(&fp))) { RETURN_MM_LONG(1); @@ -345,13 +345,13 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_STRING(&_52$$9, "%16.8lf %16.8lf %16.8lf \n"); ZVAL_DOUBLE(&_53$$9, ((double) i * dx)); ZVAL_DOUBLE(&_54$$9, ((double) n * dt)); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 77, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 79, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); zephir_check_call_status(); i = (i + 10); } ZEPHIR_INIT_NVAR(&_56$$8); ZVAL_STRING(&_56$$8, "\n"); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 77, &fp, &_56$$8); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 79, &fp, &_56$$8); zephir_check_call_status(); } j = 1; diff --git a/ext/stub/range.zep.c b/ext/stub/range.zep.c index 09122154a1..989859e46c 100644 --- a/ext/stub/range.zep.c +++ b/ext/stub/range.zep.c @@ -46,7 +46,7 @@ PHP_METHOD(Stub_Range, inclusive1) ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 78, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 80, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); @@ -70,7 +70,7 @@ PHP_METHOD(Stub_Range, exclusive1) ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 78, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 80, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); diff --git a/ext/stub/reflection.zep.c b/ext/stub/reflection.zep.c index 2421e1f393..839790de5e 100644 --- a/ext/stub/reflection.zep.c +++ b/ext/stub/reflection.zep.c @@ -39,7 +39,7 @@ PHP_METHOD(Stub_Reflection, getReflectionClass) ZEPHIR_INIT_VAR(&r); object_init_ex(&r, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 79, this_ptr); + ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 81, this_ptr); zephir_check_call_status(); RETURN_CCTOR(&r); } @@ -61,7 +61,7 @@ PHP_METHOD(Stub_Reflection, getReflectionFunction) object_init_ex(&r, zephir_get_internal_ce(SL("reflectionfunction"))); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "abs"); - ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 80, &_0); + ZEPHIR_CALL_METHOD(NULL, &r, "__construct", NULL, 82, &_0); zephir_check_call_status(); RETURN_CCTOR(&r); } diff --git a/ext/stub/regexdna.zep.c b/ext/stub/regexdna.zep.c index 5b386f0a97..cb15a4461a 100644 --- a/ext/stub/regexdna.zep.c +++ b/ext/stub/regexdna.zep.c @@ -184,7 +184,7 @@ PHP_METHOD(Stub_RegexDNA, process) ZEPHIR_CONCAT_SVS(&_1, "/", &stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, ""); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 73, &_1, &_0, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 75, &_1, &_0, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); ZEPHIR_INIT_VAR(&codeLength); @@ -228,7 +228,7 @@ PHP_METHOD(Stub_RegexDNA, process) } } ZEPHIR_INIT_NVAR(®ex); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 73, &vIUB, &vIUBnew, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 75, &vIUB, &vIUBnew, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); php_printf("%c", '\n'); diff --git a/ext/stub/requires.zep.c b/ext/stub/requires.zep.c index 87549b16ad..2c38aebf4f 100644 --- a/ext/stub/requires.zep.c +++ b/ext/stub/requires.zep.c @@ -111,7 +111,7 @@ PHP_METHOD(Stub_Requires, requireExternal3) zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 81, path, this_ptr); + ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 83, path, this_ptr); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "content"); } diff --git a/ext/stub/requires/external3.zep.c b/ext/stub/requires/external3.zep.c index a3b08e842d..0d3ef34abe 100644 --- a/ext/stub/requires/external3.zep.c +++ b/ext/stub/requires/external3.zep.c @@ -52,12 +52,12 @@ PHP_METHOD(Stub_Requires_External3, req) zephir_fetch_params(1, 2, 0, &path, &requires); - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 82); + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 84); zephir_check_call_status(); if (zephir_require_zval(path) == FAILURE) { RETURN_MM_NULL(); } - ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 83); + ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 85); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, requires, "setcontent", NULL, 0, &_0); zephir_check_call_status(); diff --git a/ext/stub/resourcetest.zep.c b/ext/stub/resourcetest.zep.c index a224eef3b5..1f935fca59 100644 --- a/ext/stub/resourcetest.zep.c +++ b/ext/stub/resourcetest.zep.c @@ -123,7 +123,7 @@ PHP_METHOD(Stub_ResourceTest, testFunctionsForSTDIN) ZEPHIR_INIT_VAR(&a); ZEPHIR_GET_CONSTANT(&a, "STDIN"); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 84, &a, &_0); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 86, &a, &_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } diff --git a/ext/stub/router.zep.c b/ext/stub/router.zep.c index 9edea335b4..cbe15fa480 100644 --- a/ext/stub/router.zep.c +++ b/ext/stub/router.zep.c @@ -127,7 +127,7 @@ PHP_METHOD(Stub_Router, __construct) add_assoc_long_ex(&_1$$3, SL("controller"), 1); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "#^/([a-zA-Z0-9\\_\\-]+)[/]{0,1}$#"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 85, &_2$$3, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 87, &_2$$3, &_1$$3); zephir_check_call_status(); zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "stub/router.zep", 89); ZEPHIR_INIT_NVAR(&_2$$3); @@ -139,7 +139,7 @@ PHP_METHOD(Stub_Router, __construct) add_assoc_long_ex(&_4$$3, SL("params"), 3); ZEPHIR_INIT_VAR(&_5$$3); ZVAL_STRING(&_5$$3, "#^/([a-zA-Z0-9\\_\\-]+)/([a-zA-Z0-9\\.\\_]+)(/.*)*$#"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 85, &_5$$3, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 87, &_5$$3, &_4$$3); zephir_check_call_status(); zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "stub/router.zep", 95); } @@ -1083,7 +1083,7 @@ PHP_METHOD(Stub_Router, add) ZEPHIR_INIT_VAR(&route); object_init_ex(&route, stub_router_route_ce); - ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 85, pattern, paths, httpMethods); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 87, pattern, paths, httpMethods); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_routes"), &route); RETURN_CCTOR(&route); diff --git a/ext/stub/scall.zep.c b/ext/stub/scall.zep.c index 679703f473..51a6364b19 100644 --- a/ext/stub/scall.zep.c +++ b/ext/stub/scall.zep.c @@ -175,7 +175,7 @@ PHP_METHOD(Stub_Scall, testCall3) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 86); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 88); zephir_check_call_status(); RETURN_MM(); } @@ -257,7 +257,7 @@ PHP_METHOD(Stub_Scall, testCall6) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 87, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 89, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -303,7 +303,7 @@ PHP_METHOD(Stub_Scall, testCall9) ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 86); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 88); zephir_check_call_status(); RETURN_MM(); } @@ -385,7 +385,7 @@ PHP_METHOD(Stub_Scall, testCall12) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 87, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 89, a, b); zephir_check_call_status(); RETURN_MM(); } @@ -394,14 +394,13 @@ PHP_METHOD(Stub_Scall, testCall13) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod1", &_0, 0); + ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod1", NULL, 0); zephir_check_call_status(); RETURN_MM(); } @@ -410,14 +409,13 @@ PHP_METHOD(Stub_Scall, testCall14) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod2", &_0, 0); + ZEPHIR_RETURN_CALL_PARENT(stub_scall_ce, getThis(), "testmethod2", NULL, 0); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/scallexternal.zep.c b/ext/stub/scallexternal.zep.c index 1a4fb76a47..35913cf7e6 100644 --- a/ext/stub/scallexternal.zep.c +++ b/ext/stub/scallexternal.zep.c @@ -33,14 +33,13 @@ PHP_METHOD(Stub_ScallExternal, testCall1) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod1", &_0, 0); + ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod1", NULL, 0); zephir_check_call_status(); RETURN_MM(); } @@ -49,7 +48,6 @@ PHP_METHOD(Stub_ScallExternal, testCall2) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_0 = NULL; zval *a, a_sub, *b, b_sub; zval *this_ptr = getThis(); @@ -68,7 +66,7 @@ PHP_METHOD(Stub_ScallExternal, testCall2) zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod4", &_0, 0, a, b); + ZEPHIR_RETURN_CALL_CE_STATIC(stub_scall_ce, "testmethod4", NULL, 0, a, b); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/scope.zep.c b/ext/stub/scope.zep.c index f25467d03a..1cb63ee4b9 100644 --- a/ext/stub/scope.zep.c +++ b/ext/stub/scope.zep.c @@ -80,7 +80,7 @@ PHP_METHOD(Stub_Scope, test1) ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, ""); - ZEPHIR_CALL_SELF(&k, "getstr", &_0, 88); + ZEPHIR_CALL_SELF(&k, "getstr", &_0, 90); zephir_check_call_status(); r = 1; if (r == 1) { @@ -176,7 +176,7 @@ PHP_METHOD(Stub_Scope, test3) } ZEPHIR_INIT_NVAR(&c); ZVAL_LONG(&c, _1); - ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 89, &c); + ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 91, &c); zephir_check_call_status(); zephir_concat_self(&k, &str$$3); } diff --git a/ext/stub/sort.zep.c b/ext/stub/sort.zep.c index 993f4dffc0..8a3a658e3f 100644 --- a/ext/stub/sort.zep.c +++ b/ext/stub/sort.zep.c @@ -99,16 +99,16 @@ PHP_METHOD(Stub_Sort, quick) } } } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 90, &left); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 92, &left); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9); zephir_create_array(&_9, 1, 0); ZEPHIR_INIT_VAR(&_10); ZVAL_LONG(&_10, pivot); zephir_array_fast_append(&_9, &_10); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 90, &right); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 92, &right); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 91, &_7, &_9, &_11); + ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 93, &_7, &_9, &_11); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/spectralnorm.zep.c b/ext/stub/spectralnorm.zep.c index b9f902de3b..9378e0b718 100644 --- a/ext/stub/spectralnorm.zep.c +++ b/ext/stub/spectralnorm.zep.c @@ -126,7 +126,7 @@ PHP_METHOD(Stub_SpectralNorm, Au) j = _4$$3; ZVAL_LONG(&_7$$4, i); ZVAL_LONG(&_8$$4, j); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 92, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 94, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -209,7 +209,7 @@ PHP_METHOD(Stub_SpectralNorm, Atu) j = _4$$3; ZVAL_LONG(&_7$$4, j); ZVAL_LONG(&_8$$4, i); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 92, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 94, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -254,9 +254,9 @@ PHP_METHOD(Stub_SpectralNorm, AtAu) zephir_fetch_params(1, 4, 0, &n, &u, &v, &w); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 93, n, u, w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 95, n, u, w); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 94, n, w, v); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 96, n, w, v); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } @@ -300,17 +300,17 @@ PHP_METHOD(Stub_SpectralNorm, process) ZEPHIR_INIT_VAR(&u); object_init_ex(&u, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 95, &_0); + ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 97, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&v); object_init_ex(&v, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 95, &_0); + ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 97, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&w); object_init_ex(&w, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 95, &_0); + ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 97, &_0); zephir_check_call_status(); _3 = (n - 1); _2 = 0; @@ -328,15 +328,15 @@ PHP_METHOD(Stub_SpectralNorm, process) i = _2; ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 96, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 98, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 96, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 98, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 96, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 98, &_4$$3, &_5$$3); zephir_check_call_status(); } } @@ -355,10 +355,10 @@ PHP_METHOD(Stub_SpectralNorm, process) } i = _8; ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 97, &_10$$4, &u, &v, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 99, &_10$$4, &u, &v, &w); zephir_check_call_status(); ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 97, &_10$$4, &v, &u, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 99, &_10$$4, &v, &u, &w); zephir_check_call_status(); } } @@ -377,19 +377,19 @@ PHP_METHOD(Stub_SpectralNorm, process) } i = _13; ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 100, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 100, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_19$$5); mul_function(&_19$$5, &_15$$5, &_18$$5); vBv += zephir_get_numberval(&_19$$5); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 100, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 98, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 100, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_20$$5); mul_function(&_20$$5, &_15$$5, &_18$$5); diff --git a/ext/stub/spl.zep.c b/ext/stub/spl.zep.c index 070a9ca251..dd43f0df9b 100644 --- a/ext/stub/spl.zep.c +++ b/ext/stub/spl.zep.c @@ -52,7 +52,7 @@ PHP_METHOD(Stub_Spl, issue1212) object_init_ex(return_value, spl_ce_SplFileObject); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 99, &file); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 101, &file); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/statements.zep.c b/ext/stub/statements.zep.c index be99dc7bd9..f6677f6d4f 100644 --- a/ext/stub/statements.zep.c +++ b/ext/stub/statements.zep.c @@ -216,25 +216,25 @@ PHP_METHOD(Stub_Statements, test544Issue) unfilledWidth = (((zephir_get_numberval(&_4$$3) - 1)) - filledWidth); zephir_read_property(&_5$$3, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_6$$3, filledWidth); - ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 20, &_5$$3, &_6$$3); + ZEPHIR_CALL_FUNCTION(&_7$$3, "str_repeat", &_8, 22, &_5$$3, &_6$$3); zephir_check_call_status(); zephir_read_property(&_6$$3, this_ptr, ZEND_STRL("arrow"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_9$$3, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_10$$3, unfilledWidth); - ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 20, &_9$$3, &_10$$3); + ZEPHIR_CALL_FUNCTION(&_11$$3, "str_repeat", &_8, 22, &_9$$3, &_10$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &_7$$3, &_6$$3, &_11$$3); RETURN_MM(); } else if (ZEPHIR_IS_LONG_IDENTICAL(&_1, step)) { zephir_read_property(&_12$$4, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$4, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 20, &_12$$4, &_13$$4); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 22, &_12$$4, &_13$$4); zephir_check_call_status(); RETURN_MM(); } else { zephir_read_property(&_14$$5, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_15$$5, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 20, &_14$$5, &_15$$5); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 22, &_14$$5, &_15$$5); zephir_check_call_status(); RETURN_MM(); } @@ -287,25 +287,25 @@ PHP_METHOD(Stub_Statements, test544IssueWithVariable) unfilledWidth = (((zephir_get_numberval(&_2$$3) - 1)) - filledWidth); zephir_read_property(&_3$$3, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_4$$3, filledWidth); - ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 20, &_3$$3, &_4$$3); + ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 22, &_3$$3, &_4$$3); zephir_check_call_status(); zephir_read_property(&_4$$3, this_ptr, ZEND_STRL("arrow"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_7$$3, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); ZVAL_LONG(&_8$$3, unfilledWidth); - ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 20, &_7$$3, &_8$$3); + ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 22, &_7$$3, &_8$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, &_5$$3, &_4$$3, &_9$$3); RETURN_MM(); } else if (step == totalSteps) { zephir_read_property(&_10$$4, this_ptr, ZEND_STRL("filledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_11$$4, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 20, &_10$$4, &_11$$4); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 22, &_10$$4, &_11$$4); zephir_check_call_status(); RETURN_MM(); } else { zephir_read_property(&_12$$5, this_ptr, ZEND_STRL("unfilledChar"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_13$$5, this_ptr, ZEND_STRL("width"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 20, &_12$$5, &_13$$5); + ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 22, &_12$$5, &_13$$5); zephir_check_call_status(); RETURN_MM(); } diff --git a/ext/stub/strings.zep.c b/ext/stub/strings.zep.c index 456b5068b1..e7c8500331 100644 --- a/ext/stub/strings.zep.c +++ b/ext/stub/strings.zep.c @@ -679,7 +679,7 @@ PHP_METHOD(Stub_Strings, strToHex) _1$$3 = ZEPHIR_STRING_OFFSET(&value, i); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRINGL(&_2$$3, &_1$$3, 1); - ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 100, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 102, &_2$$3); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5$$3, "dechex", &_6, 11, &_3$$3); zephir_check_call_status(); @@ -737,17 +737,17 @@ PHP_METHOD(Stub_Strings, issue1267) zephir_fast_str_replace(&_0, &_1, &_2, value); ZEPHIR_CPY_WRT(value, &_0); ZVAL_LONG(&_3, 516); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 43, value, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 45, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); ZEPHIR_INIT_NVAR(&_0); - ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 101, value); + ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 103, value); zephir_check_call_status(); zephir_stripslashes(&_0, &_4); ZEPHIR_INIT_VAR(&x); zephir_fast_trim(&x, &_0, NULL , ZEPHIR_TRIM_BOTH); ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 101, value); + ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 103, value); zephir_check_call_status(); zephir_stripcslashes(&_6, &_7); zephir_fast_trim(return_value, &_6, NULL , ZEPHIR_TRIM_BOTH); diff --git a/ext/stub/trytest.zep.c b/ext/stub/trytest.zep.c index 0eed207df1..288621cec1 100644 --- a/ext/stub/trytest.zep.c +++ b/ext/stub/trytest.zep.c @@ -54,7 +54,7 @@ PHP_METHOD(Stub_TryTest, testThrow2) ZVAL_STRING(&message, "error"); ZEPHIR_INIT_VAR(&_0); object_init_ex(&_0, zend_ce_exception); - ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 28, &message); + ZEPHIR_CALL_METHOD(NULL, &_0, "__construct", NULL, 30, &message); zephir_check_call_status(); zephir_throw_exception_debug(&_0, "stub/trytest.zep", 16); ZEPHIR_MM_RESTORE(); @@ -96,7 +96,7 @@ PHP_METHOD(Stub_TryTest, testTry2) object_init_ex(&_0$$3, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 30, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "stub/trytest.zep", 27); goto try_end_1; @@ -129,7 +129,7 @@ PHP_METHOD(Stub_TryTest, testTry3) object_init_ex(&_0$$3, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 30, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "stub/trytest.zep", 34); goto try_end_1; @@ -187,7 +187,7 @@ PHP_METHOD(Stub_TryTest, testTry4) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 30, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 46); goto try_end_1; @@ -197,7 +197,7 @@ PHP_METHOD(Stub_TryTest, testTry4) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 104, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 48); goto try_end_1; @@ -262,7 +262,7 @@ PHP_METHOD(Stub_TryTest, testTry5) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 30, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 63); goto try_end_1; @@ -272,7 +272,7 @@ PHP_METHOD(Stub_TryTest, testTry5) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 104, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 65); goto try_end_1; @@ -336,7 +336,7 @@ PHP_METHOD(Stub_TryTest, testTry6) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 30, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 80); goto try_end_1; @@ -346,7 +346,7 @@ PHP_METHOD(Stub_TryTest, testTry6) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 104, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 82); goto try_end_1; @@ -409,7 +409,7 @@ PHP_METHOD(Stub_TryTest, testTry7) object_init_ex(&_0$$4, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 28, &_1$$4); + ZEPHIR_CALL_METHOD(NULL, &_0$$4, "__construct", NULL, 30, &_1$$4); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$4, "stub/trytest.zep", 99); goto try_end_1; @@ -419,7 +419,7 @@ PHP_METHOD(Stub_TryTest, testTry7) object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 102, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 104, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "stub/trytest.zep", 101); goto try_end_1; @@ -466,7 +466,7 @@ PHP_METHOD(Stub_TryTest, testTry8) object_init_ex(&_0$$3, zend_ce_exception); ZEPHIR_INIT_VAR(&_1$$3); ZVAL_STRING(&_1$$3, "error 1!"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 28, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 30, &_1$$3); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_0$$3, "stub/trytest.zep", 111); goto try_end_1; @@ -515,7 +515,7 @@ PHP_METHOD(Stub_TryTest, testTry9) /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 103); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 105); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); @@ -550,7 +550,7 @@ PHP_METHOD(Stub_TryTest, testTry10) /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 104); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 106); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); diff --git a/ext/stub/vars.zep.c b/ext/stub/vars.zep.c index d85b039d34..f8eb58f698 100644 --- a/ext/stub/vars.zep.c +++ b/ext/stub/vars.zep.c @@ -73,7 +73,7 @@ PHP_METHOD(Stub_Vars, testParam) } ZEPHIR_INIT_NVAR(&v); ZVAL_COPY(&v, _1); - ZEPHIR_CALL_FUNCTION(&_5$$3, "realpath", &_6, 67, &v); + ZEPHIR_CALL_FUNCTION(&_5$$3, "realpath", &_6, 69, &v); zephir_check_call_status(); zephir_array_update_multi(&config, &_5$$3, SL("sz"), 3, SL("dir"), &k); } ZEND_HASH_FOREACH_END(); @@ -90,7 +90,7 @@ PHP_METHOD(Stub_Vars, testParam) zephir_check_call_status(); ZEPHIR_CALL_METHOD(&v, &_0, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_7$$4, "realpath", &_6, 67, &v); + ZEPHIR_CALL_FUNCTION(&_7$$4, "realpath", &_6, 69, &v); zephir_check_call_status(); zephir_array_update_multi(&config, &_7$$4, SL("sz"), 3, SL("dir"), &k); ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); From 307eacaa8033c73a16bbde70f039fc4b0aaf15da Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 12 Nov 2023 21:25:16 +0000 Subject: [PATCH 122/375] Fix return type of `getBooleanCode()` method --- src/CompiledExpression.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CompiledExpression.php b/src/CompiledExpression.php index 9861b5ae5c..e7e07e9aef 100644 --- a/src/CompiledExpression.php +++ b/src/CompiledExpression.php @@ -50,7 +50,7 @@ public function getOriginal(): ?array /** * Returns a C representation for a boolean constant. */ - public function getBooleanCode(): string + public function getBooleanCode(): mixed { if ('true' === $this->code || true === $this->code) { return '1'; From 6b80cc2b956b1ff7940f7eb7f67880402b681d7a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 12 Nov 2023 22:47:18 +0000 Subject: [PATCH 123/375] Adjust condition Fix warning: comparison between pointer and integer --- kernel/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/main.c b/kernel/main.c index 1bbd149639..f8c90b7cbc 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -282,7 +282,7 @@ int zephir_fast_count_int(zval *value) */ int zephir_function_exists(const zval *function_name) { - if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) { + if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name))) { return SUCCESS; } From b10b1aeca136c206eb6f94d925fc792d729e1d54 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 19 Nov 2023 22:24:31 +0000 Subject: [PATCH 124/375] Optimize imports --- src/Class/Method/Method.php | 87 ++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 406abcb015..605a40b415 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -13,6 +13,7 @@ namespace Zephir\Class\Method; +use ReflectionException; use Zephir\Branch; use Zephir\BranchManager; use Zephir\Cache\Manager; @@ -34,6 +35,12 @@ use Zephir\SymbolTable; use Zephir\Variable\Variable; +use function array_key_exists; +use function count; +use function in_array; +use function is_array; +use function is_object; + /** * Represents a class method */ @@ -239,12 +246,12 @@ public function setReturnTypes(array $returnType = null): void } } - if (\count($castTypes) > 0) { + if (count($castTypes) > 0) { $types['object'] = []; $this->returnClassTypes = $castTypes; } - if (\count($types) > 0) { + if (count($types) > 0) { $this->returnTypes = $types; } } @@ -290,47 +297,47 @@ public function isEmpty(): bool */ public function checkVisibility(array $visibility, string $name, array $original = null): void { - if (\count($visibility) > 1) { - if (\in_array('public', $visibility) && \in_array('protected', $visibility)) { + if (count($visibility) > 1) { + if (in_array('public', $visibility) && in_array('protected', $visibility)) { throw new CompilerException("Method '$name' cannot be 'public' and 'protected' at the same time", $original); } - if (\in_array('public', $visibility) && \in_array('private', $visibility)) { + if (in_array('public', $visibility) && in_array('private', $visibility)) { throw new CompilerException("Method '$name' cannot be 'public' and 'private' at the same time", $original); } - if (\in_array('private', $visibility) && \in_array('protected', $visibility)) { + if (in_array('private', $visibility) && in_array('protected', $visibility)) { throw new CompilerException("Method '$name' cannot be 'protected' and 'private' at the same time", $original); } - if (\in_array('private', $visibility) && \in_array('internal', $visibility)) { + if (in_array('private', $visibility) && in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'private' at the same time", $original); } - if (\in_array('protected', $visibility) && \in_array('internal', $visibility)) { + if (in_array('protected', $visibility) && in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'protected' at the same time", $original); } - if (\in_array('public', $visibility) && \in_array('internal', $visibility)) { + if (in_array('public', $visibility) && in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'public' at the same time", $original); } } if ('__construct' === $name) { - if (\in_array('static', $visibility)) { + if (in_array('static', $visibility)) { throw new CompilerException("Constructors cannot be 'static'", $original); } } elseif ('__destruct' === $name) { - if (\in_array('static', $visibility)) { + if (in_array('static', $visibility)) { throw new CompilerException("Destructors cannot be 'static'", $original); } } - $this->isAbstract = \in_array('abstract', $visibility); - $this->isStatic = \in_array('static', $visibility); - $this->isFinal = \in_array('final', $visibility); - $this->isPublic = \in_array('public', $visibility); - $this->isInternal = \in_array('internal', $visibility); + $this->isAbstract = in_array('abstract', $visibility); + $this->isStatic = in_array('static', $visibility); + $this->isFinal = in_array('final', $visibility); + $this->isPublic = in_array('public', $visibility); + $this->isInternal = in_array('internal', $visibility); } /** @@ -496,7 +503,7 @@ public function getParameters(): ?Parameters */ public function hasReturnTypes(): bool { - return \count($this->returnTypes) || \count($this->returnClassTypes); + return count($this->returnTypes) || count($this->returnClassTypes); } /** @@ -515,7 +522,7 @@ public function areReturnTypesIntCompatible(): bool $types = ['int', 'uint', 'char', 'uchar', 'long', 'ulong']; foreach ($this->returnTypes as $returnType => $definition) { - if (\in_array($returnType, $types)) { + if (in_array($returnType, $types)) { return true; } } @@ -620,7 +627,7 @@ public function getNumberOfRequiredParameters(): int */ public function hasModifier(string $modifier): bool { - return \in_array($modifier, $this->visibility); + return in_array($modifier, $this->visibility); } /** @@ -633,7 +640,7 @@ public function getVisibility(): array public function isDeprecated(): bool { - return !empty($this->visibility) && \in_array('deprecated', $this->visibility, true); + return !empty($this->visibility) && in_array('deprecated', $this->visibility, true); } /** @@ -714,7 +721,7 @@ public function isMixed(): bool */ public function isPrivate(): bool { - return \in_array('private', $this->visibility); + return in_array('private', $this->visibility); } /** @@ -722,7 +729,7 @@ public function isPrivate(): bool */ public function isProtected(): bool { - return \in_array('protected', $this->visibility); + return in_array('protected', $this->visibility); } /** @@ -855,7 +862,7 @@ public function removeMemoryStackReferences(SymbolTable $symbolTable, string $co * Assigns a default value. * * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException */ public function assignDefaultValue(array $parameter, CompilationContext $compilationContext): string { @@ -1215,7 +1222,7 @@ public function assignZvalValue(array $parameter, CompilationContext $compilatio { $dataType = $this->getParamDataType($parameter); - if (\in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { + if (in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { return ''; } @@ -1267,7 +1274,7 @@ public function preCompile(CompilationContext $compilationContext): void $typeInference = null; $callGathererPass = null; - if (\is_object($this->statements)) { + if (is_object($this->statements)) { $compilationContext->currentMethod = $this; /** @@ -1311,7 +1318,7 @@ public function preCompile(CompilationContext $compilationContext): void * Compiles the method. * * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -1446,12 +1453,12 @@ public function compile(CompilationContext $compilationContext): void */ if (!empty($parameter['const'])) { $symbol->setReadOnly(true); - if (\is_object($symbolParam)) { + if (is_object($symbolParam)) { $symbolParam->setReadOnly(true); } } - if (\is_object($symbolParam)) { + if (is_object($symbolParam)) { /** * Parameters are marked as 'external' */ @@ -1521,7 +1528,7 @@ public function compile(CompilationContext $compilationContext): void /** * Compile the block of statements if any */ - if (\is_object($this->statements)) { + if (is_object($this->statements)) { $compilationContext->staticContext = $this->hasModifier('static'); /** @@ -1560,7 +1567,7 @@ public function compile(CompilationContext $compilationContext): void * variable is modified so as do the proper separation. */ $parametersToSeparate = []; - if (\is_object($this->statements)) { + if (is_object($this->statements)) { if (!$this->localContext instanceof LocalContextPass) { $writeDetector = new WriteDetector(); } @@ -1778,7 +1785,7 @@ public function compile(CompilationContext $compilationContext): void if (!$variable->isUsed()) { $node = $variable->getLastUsedNode(); - if (\is_array($node)) { + if (is_array($node)) { $expression = $node['expr'] ?? $node; $compilationContext->logger->warning( 'Variable "'.$variable->getName().'" assigned but not used in '.$completeName.'::'.$this->getName(), @@ -1793,7 +1800,7 @@ public function compile(CompilationContext $compilationContext): void } } - if (\count($usedVariables)) { + if (count($usedVariables)) { $codePrinter->preOutputBlankLine(); } @@ -1848,7 +1855,7 @@ public function compile(CompilationContext $compilationContext): void /** * Finalize the method compilation */ - if (\is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { + if (is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { /** * If the last statement is not a 'return' or 'throw' we need to * restore the memory stack if needed. @@ -1898,7 +1905,7 @@ public function compile(CompilationContext $compilationContext): void */ public function hasChildReturnStatementType(array $statement): bool { - if (!isset($statement['statements']) || !\is_array($statement['statements'])) { + if (!isset($statement['statements']) || !is_array($statement['statements'])) { return false; } @@ -1984,7 +1991,7 @@ public function isReturnTypesHintDetermined(): bool return true; } - if (0 === \count($this->returnTypes)) { + if (0 === count($this->returnTypes)) { return false; } @@ -2004,7 +2011,7 @@ public function isReturnTypesHintDetermined(): bool || $this->areReturnTypesStringCompatible() || $this->areReturnTypesFalseCompatible() || $this->areReturnTypesObjectCompatible() - || \array_key_exists('array', $this->getReturnTypes()) + || array_key_exists('array', $this->getReturnTypes()) ) { continue; } @@ -2026,7 +2033,7 @@ public function isReturnTypesHintDetermined(): bool */ public function isReturnTypeNullableObject(): bool { - return \count($this->returnTypes) === 2 + return count($this->returnTypes) === 2 && isset($this->returnTypes['object']) && isset($this->returnTypes['null']); } @@ -2036,7 +2043,7 @@ public function isReturnTypeNullableObject(): bool */ public function isReturnTypeObject(): bool { - return \count($this->returnTypes) === 1 && isset($this->returnTypes['object']); + return count($this->returnTypes) === 1 && isset($this->returnTypes['object']); } /** @@ -2049,12 +2056,12 @@ public function areReturnTypesCompatible(): bool return true; } - $totalTypes = \count($this->returnTypes); + $totalTypes = count($this->returnTypes); // union types if ($totalTypes > 1) { $diff = array_diff(array_keys($this->returnTypes), array_keys($this->mayBeArgTypes)); - if (\count($diff) === 0) { + if (count($diff) === 0) { return true; } } From f37bfa696f91988db1f432dee281e45e3d21432a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 21:18:50 +0000 Subject: [PATCH 125/375] Update header --- prototypes/apache.php | 2 +- prototypes/apc.php | 6 +++--- prototypes/fpm.php | 6 +++--- prototypes/gd.php | 2 +- prototypes/iconv.php | 6 +++--- prototypes/igbinary.php | 6 +++--- prototypes/imagick.php | 6 +++--- prototypes/mcrypt.php | 6 +++--- prototypes/memcache.php | 6 +++--- prototypes/memcached.php | 6 +++--- prototypes/mongo.php | 2 +- prototypes/mongodb.php | 2 +- prototypes/msgpack.php | 6 +++--- prototypes/phalcon.php | 6 +++--- prototypes/redis.php | 2 +- prototypes/xcache.php | 6 +++--- prototypes/yaml.php | 6 +++--- 17 files changed, 41 insertions(+), 41 deletions(-) diff --git a/prototypes/apache.php b/prototypes/apache.php index 0ebdc52fd8..0cc5b90b54 100644 --- a/prototypes/apache.php +++ b/prototypes/apache.php @@ -1,6 +1,6 @@ diff --git a/prototypes/apc.php b/prototypes/apc.php index b378522b47..71593b5234 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ if (!class_exists('APCIterator', false)) { diff --git a/prototypes/fpm.php b/prototypes/fpm.php index 14da00a719..55ea6ef1fd 100644 --- a/prototypes/fpm.php +++ b/prototypes/fpm.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ if (function_exists('fastcgi_finish_request')) { diff --git a/prototypes/gd.php b/prototypes/gd.php index 0492995137..a23b531cb4 100644 --- a/prototypes/gd.php +++ b/prototypes/gd.php @@ -1,6 +1,6 @@ diff --git a/prototypes/iconv.php b/prototypes/iconv.php index bf120f1638..8f472161b9 100644 --- a/prototypes/iconv.php +++ b/prototypes/iconv.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ function iconv($in_charset, $out_charset, $str) diff --git a/prototypes/igbinary.php b/prototypes/igbinary.php index 25191d9b3d..2d401055ee 100644 --- a/prototypes/igbinary.php +++ b/prototypes/igbinary.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ function igbinary_serialize($data) diff --git a/prototypes/imagick.php b/prototypes/imagick.php index 2f2507aa33..8ca7573c0d 100644 --- a/prototypes/imagick.php +++ b/prototypes/imagick.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ class Imagick diff --git a/prototypes/mcrypt.php b/prototypes/mcrypt.php index 4b1a67fc4f..c8f973b65d 100644 --- a/prototypes/mcrypt.php +++ b/prototypes/mcrypt.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ function mcrypt_list_algorithms() diff --git a/prototypes/memcache.php b/prototypes/memcache.php index ad0dae9ea9..ff110c767a 100644 --- a/prototypes/memcache.php +++ b/prototypes/memcache.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ define('MEMCACHE_HAVE_SESSION', 1); diff --git a/prototypes/memcached.php b/prototypes/memcached.php index a46c5dbe9f..b0734977dc 100644 --- a/prototypes/memcached.php +++ b/prototypes/memcached.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ class Memcached diff --git a/prototypes/mongo.php b/prototypes/mongo.php index 1420f26fb6..2722d7f840 100644 --- a/prototypes/mongo.php +++ b/prototypes/mongo.php @@ -1,6 +1,6 @@ diff --git a/prototypes/mongodb.php b/prototypes/mongodb.php index d7d428be4f..e51725d179 100644 --- a/prototypes/mongodb.php +++ b/prototypes/mongodb.php @@ -2,7 +2,7 @@ // @codingStandardsIgnoreStart -/* +/** * This file is part of the Zephir. * * (c) Phalcon Team diff --git a/prototypes/msgpack.php b/prototypes/msgpack.php index e6dcdd9326..97959bfa5e 100644 --- a/prototypes/msgpack.php +++ b/prototypes/msgpack.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ define('MSGPACK_CLASS_OPT_PHPONLY', -1001); diff --git a/prototypes/phalcon.php b/prototypes/phalcon.php index edbd4daa0d..bf062afde4 100644 --- a/prototypes/phalcon.php +++ b/prototypes/phalcon.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ namespace Phalcon { diff --git a/prototypes/redis.php b/prototypes/redis.php index a9b1bf6fc4..1797fac189 100644 --- a/prototypes/redis.php +++ b/prototypes/redis.php @@ -1,6 +1,6 @@ diff --git a/prototypes/xcache.php b/prototypes/xcache.php index db4dae4c37..7a09b2d4c3 100644 --- a/prototypes/xcache.php +++ b/prototypes/xcache.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ function xcache_get($name) diff --git a/prototypes/yaml.php b/prototypes/yaml.php index b9fd1d95b9..bbb597f1bd 100644 --- a/prototypes/yaml.php +++ b/prototypes/yaml.php @@ -1,12 +1,12 @@ * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ function yaml_parse_file($filename, $pos = 0, &$ndocs = 0, $callbacks = null) From c5b2705cf588aa5dbdd84e40a110d54716f90bad Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:01:17 +0000 Subject: [PATCH 126/375] Remove dead code --- kernel/memory.h | 6 ++---- src/Variable/Variable.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 76407bb5ae..14897d1c0a 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -119,8 +119,6 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ zephir_ptr_dtor(d); \ } \ - } else { \ - /*TODO: as above */ \ } \ ZVAL_DUP(d, v); @@ -133,8 +131,8 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); } #define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ - ZEPHIR_OBS_VAR_ONCE(z); \ - ZVAL_COPY(z, v); + ZEPHIR_OBS_VAR_ONCE(z); \ + ZVAL_COPY(z, v); #define ZEPHIR_HASH_COPY(z, v) \ if (Z_TYPE_P(z) == IS_ARRAY && Z_TYPE_P(v) == IS_ARRAY) { \ diff --git a/src/Variable/Variable.php b/src/Variable/Variable.php index 8924fe6b71..bed4abdeb9 100644 --- a/src/Variable/Variable.php +++ b/src/Variable/Variable.php @@ -931,7 +931,7 @@ public function observeVariant(CompilationContext $compilationContext): void $this->mustInitNull = true; $compilationContext->codePrinter->output('ZEPHIR_OBS_NVAR('.$symbol.');'); } else { - $compilationContext->codePrinter->output('ZEPHIR_OBS_VAR('.$symbol.');'); + $compilationContext->codePrinter->output('zephir_memory_observe('.$symbol.');'); } ++$this->variantInits; From 56bd4fb2876ca94c56a0128599900e3e97beb112 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:01:42 +0000 Subject: [PATCH 127/375] Remove `ZEPHIR_OBS_VAR()` macro to use directly the function --- kernel/memory.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 14897d1c0a..762be8a03c 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -122,9 +122,6 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); } \ ZVAL_DUP(d, v); -#define ZEPHIR_OBS_VAR(z) \ - zephir_memory_observe(z) - #define ZEPHIR_OBS_VAR_ONCE(z) \ if (Z_TYPE_P(z) == IS_UNDEF) { \ zephir_memory_observe(z); \ From 2945eaf5c7752644385f650535f99a2eceeaed1a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:06:31 +0000 Subject: [PATCH 128/375] Remove redundant condition --- kernel/array.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/array.h b/kernel/array.h index 11d19b6f77..1c98ca2cc0 100644 --- a/kernel/array.h +++ b/kernel/array.h @@ -9,8 +9,6 @@ * following url: https://docs.zephir-lang.com/en/latest/license */ -#ifndef ZEPHIR_KERNEL_ARRAY_H -#define ZEPHIR_KERNEL_ARRAY_H #define ZEPHIR_MAX_ARRAY_LEVELS 16 #include @@ -73,5 +71,3 @@ int zephir_fast_in_array(zval *needle, zval *haystack); Z_TRY_ADDREF_P(value); \ zend_hash_next_index_insert(Z_ARRVAL_P(arr), value); \ } while (0) - -#endif /* ZEPHIR_KERNEL_ARRAY_H */ From 6efbe35b52c5dd6976f598bcc2655e7ab9940242 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:26:41 +0000 Subject: [PATCH 129/375] Mass remove of `#if PHP_VERSION_ID >= 80000` condition --- kernel/exception.c | 11 ----- kernel/fcall.c | 55 +++------------------ kernel/fcall.h | 34 ------------- kernel/main.c | 45 ----------------- kernel/object.c | 34 ------------- src/Class/Definition/Definition.php | 26 +--------- src/Class/Method/Method.php | 14 +++--- src/Code/ArgInfoDefinition.php | 76 +---------------------------- 8 files changed, 17 insertions(+), 278 deletions(-) diff --git a/kernel/exception.c b/kernel/exception.c index 6d0a50ba3c..2d81541f32 100644 --- a/kernel/exception.c +++ b/kernel/exception.c @@ -54,14 +54,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) zephir_check_call_status(); if (ZEPHIR_IS_LONG(&curline, 0)) { default_exception_ce = zend_exception_get_default(); - -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ_P(object), SL("file"), file); zend_update_property_long(default_exception_ce, Z_OBJ_P(object), SL("line"), line); -#else - zend_update_property_string(default_exception_ce, object, SL("file"), file); - zend_update_property_long(default_exception_ce, object, SL("line"), line); -#endif } } @@ -88,13 +82,8 @@ void zephir_throw_exception_string_debug(zend_class_entry *ce, const char *messa if (line > 0) { default_exception_ce = zend_exception_get_default(); -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ(object), "file", sizeof("file")-1, file); zend_update_property_long(default_exception_ce, Z_OBJ(object), "line", sizeof("line")-1, line); -#else - zend_update_property_string(default_exception_ce, &object, "file", sizeof("file")-1, file); - zend_update_property_long(default_exception_ce, &object, "line", sizeof("line")-1, line); -#endif } if (ZEPHIR_LAST_CALL_STATUS != FAILURE) { diff --git a/kernel/fcall.c b/kernel/fcall.c index d017ec4db3..e065629004 100644 --- a/kernel/fcall.c +++ b/kernel/fcall.c @@ -211,21 +211,12 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } fcic->called_scope = called_scope; - -#if PHP_VERSION_ID >= 80000 calling_scope = zend_get_called_scope(EG(current_execute_data)); -#else - calling_scope = zend_get_executed_scope(); -#endif - fcic->object = this_ptr ? Z_OBJ_P(this_ptr) : NULL; switch (type) { case zephir_fcall_parent: - -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->parent->function_table, Z_STR_P(func)); - fcic->calling_scope = ce->parent; } else if (EXPECTED(calling_scope && calling_scope->parent)) { if (Z_TYPE_P(func) == IS_STRING) { @@ -235,7 +226,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } else { return; } -#endif + if (UNEXPECTED(!calling_scope || !calling_scope->parent)) { return; } @@ -244,7 +235,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze break; case zephir_fcall_static: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -252,17 +242,10 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = called_scope; } -#else - fcic->calling_scope = called_scope; - if (UNEXPECTED(!calling_scope)) { - return; - } -#endif break; case zephir_fcall_self: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -273,13 +256,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze //fcic->called_scope = zend_get_called_scope(EG(current_execute_data)); fcic->calling_scope = calling_scope; } -#else - fcic->calling_scope = calling_scope; -#endif break; case zephir_fcall_ce: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); @@ -288,7 +267,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = calling_scope; } -#endif // TODO: Check for PHP 7.4 and PHP 8.0, as it rewrite from above fcic->calling_scope = ce; fcic->called_scope = ce; @@ -297,11 +275,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze case zephir_fcall_function: case zephir_fcall_method: if (Z_TYPE_P(func) == IS_OBJECT) { -#if PHP_VERSION_ID >= 80000 if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(Z_OBJ_P(func), &fcic->calling_scope, &fcic->function_handler, &fcic->object, 0) == SUCCESS) { -#else - if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(func, &fcic->calling_scope, &fcic->function_handler, &fcic->object) == SUCCESS) { -#endif fcic->called_scope = fcic->calling_scope; break; } @@ -309,11 +283,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze return; } -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); } -#endif fcic->calling_scope = this_ptr ? Z_OBJCE_P(this_ptr) : NULL; fcic->called_scope = fcic->calling_scope; break; @@ -402,22 +374,18 @@ int zephir_call_user_function( /* The caller is interested in caching OR we have the call cache enabled */ resolve_callable(&callable, type, (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P(object_pp) : obj_ce), object_pp, function_name); -#if PHP_VERSION_ID >= 80000 - char *is_callable_error = NULL; - zend_execute_data *frame = EG(current_execute_data); + char *is_callable_error = NULL; + zend_execute_data *frame = EG(current_execute_data); if (obj_ce || !zend_is_callable_at_frame(&callable, fci.object, frame, 0, &fcic, &is_callable_error)) { - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); + if (is_callable_error) { + zend_error(E_WARNING, "%s", is_callable_error); + efree(is_callable_error); - return FAILURE; - } + return FAILURE; + } populate_fcic(&fcic, type, obj_ce, object_pp, function_name, called_scope); } -#else - zend_is_callable_ex(&callable, fci.object, IS_CALLABLE_CHECK_SILENT, NULL, &fcic, NULL); -#endif } #ifdef _MSC_VER @@ -432,12 +400,9 @@ int zephir_call_user_function( } fci.params = p; - -#if PHP_VERSION_ID >= 80000 if (!fcic.function_handler) { ZVAL_COPY_VALUE(&fci.function_name, &callable); } -#endif status = zend_call_function(&fci, &fcic); @@ -696,11 +661,7 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context) #if PHP_VERSION_ID >= 80200 new_op_array = zend_compile_string(Z_STR_P(str), context, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG); #else -#if PHP_VERSION_ID >= 80000 new_op_array = zend_compile_string(Z_STR_P(str), context); -#else - new_op_array = zend_compile_string(str, context); -#endif #endif CG(compiler_options) = original_compiler_options; diff --git a/kernel/fcall.h b/kernel/fcall.h index 2581360756..4754bf4626 100644 --- a/kernel/fcall.h +++ b/kernel/fcall.h @@ -167,19 +167,11 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_RETURN_CALL_PARENT(class_entry, this_ptr, method, cache, cache_slot, ...) \ do { \ @@ -187,51 +179,25 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_CALL_CE_STATIC(return_value_ptr, class_entry, method, cache, cache_slot, ...) \ do { \ diff --git a/kernel/main.c b/kernel/main.c index f8c90b7cbc..8aeedda44e 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -137,26 +137,17 @@ void zephir_fast_count(zval *result, zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { ZVAL_LONG(result, 1); -#if PHP_VERSION_ID >= 80000 if (SUCCESS == Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &Z_LVAL_P(result))) { -#else - if (SUCCESS == Z_OBJ_HT(*value)->count_elements(value, &Z_LVAL_P(result))) { -#endif return; } } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); ZVAL_LONG(result, Z_LVAL(retval)); @@ -189,24 +180,15 @@ int zephir_fast_count_ev(zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count > 0; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -241,20 +223,12 @@ int zephir_fast_count_int(zval *value) zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -406,7 +380,6 @@ zend_class_entry* zephir_get_internal_ce(const char *class_name, unsigned int cl /* Declare constants */ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value) { -#if PHP_VERSION_ID >= 80000 zend_string *key; if (ce->type == ZEND_INTERNAL_CLASS) { @@ -422,24 +395,6 @@ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t } return SUCCESS; -#else - int ret; - zend_string *key; - - if (ce->type == ZEND_INTERNAL_CLASS) { - key = zend_string_init_interned(name, name_length, 1); - } else { - key = zend_string_init(name, name_length, 0); - } - - ret = zend_declare_class_constant_ex(ce, key, value, ZEND_ACC_PUBLIC, NULL); - - if (ce->type != ZEND_INTERNAL_CLASS) { - zend_string_release(key); - } - - return ret; -#endif } int zephir_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length) diff --git a/kernel/object.c b/kernel/object.c index 3fb2e006c6..d461e45c19 100644 --- a/kernel/object.c +++ b/kernel/object.c @@ -338,11 +338,7 @@ int zephir_clone(zval *destination, zval *obj) status = FAILURE; } else { if (!EG(exception)) { -#if PHP_VERSION_ID >= 80000 ZVAL_OBJ(destination, clone_call(Z_OBJ_P(obj))); -#else - ZVAL_OBJ(destination, clone_call(obj)); -#endif if (EG(exception)) { zval_ptr_dtor(destination); } @@ -363,19 +359,11 @@ int zephir_isset_property(zval *object, const char *property_name, unsigned int return 1; } -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), property_name, property_length ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - property_name, - property_length - ); -#endif } return 0; @@ -391,19 +379,11 @@ int zephir_isset_property_zval(zval *object, const zval *property) if (EXPECTED(zend_hash_str_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(property), Z_STRLEN_P(property)))) { return 1; } else { -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), Z_STRVAL_P(property), Z_STRLEN_P(property) ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - Z_STRVAL_P(property), - Z_STRLEN_P(property) - ); -#endif } } } @@ -523,15 +503,9 @@ int zephir_read_property( } ZVAL_STRINGL(&property, property_name, property_length); -#if PHP_VERSION_ID >= 80000 res = Z_OBJ_HT_P(object)->read_property(Z_OBJ_P(object), Z_STR(property), flags ? BP_VAR_IS : BP_VAR_R, NULL, &tmp); -#else - res = Z_OBJ_HT_P(object)->read_property(object, &property, - flags ? BP_VAR_IS : BP_VAR_R, - NULL, &tmp); -#endif if ((flags & PH_READONLY) == PH_READONLY) { ZVAL_COPY_VALUE(result, res); @@ -674,11 +648,7 @@ int zephir_update_property_zval( /* write_property will add 1 to refcount, so no Z_TRY_ADDREF_P(value) is necessary */ -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), Z_STR(property), &sep_value, 0); -#else - Z_OBJ_HT_P(object)->write_property(object, &property, &sep_value, 0); -#endif zval_ptr_dtor(&property); @@ -943,11 +913,7 @@ int zephir_unset_property(zval* object, const char* name) /* Use caller's scope */ zephir_set_scope(Z_OBJCE_P(object)); -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->unset_property(Z_OBJ_P(object), Z_STR(member), 0); -#else - Z_OBJ_HT_P(object)->unset_property(object, &member, 0); -#endif /* Restore original scope */ zephir_set_scope(scope); diff --git a/src/Class/Definition/Definition.php b/src/Class/Definition/Definition.php index 5fb1eb30b3..4834b4c7b5 100644 --- a/src/Class/Definition/Definition.php +++ b/src/Class/Definition/Definition.php @@ -1147,11 +1147,10 @@ public function compile(CompilationContext $compilationContext): void ) ); } else { - $codePrinter->output('#if PHP_VERSION_ID >= 80000'); $codePrinter->output( sprintf( // TODO: Rename to ZEND_ME - "\tPHP_ME(%s_%s, %s, %s, %s)", + "PHP_ME(%s_%s, %s, %s, %s)", $this->getCNamespace(), $this->getName(), $method->getName(), @@ -1159,18 +1158,6 @@ public function compile(CompilationContext $compilationContext): void $method->getModifiers() ) ); - $codePrinter->output('#else'); - $codePrinter->output( - sprintf( - // TODO: Rename to ZEND_ME - "\tPHP_ME(%s_%s, %s, NULL, %s)", - $this->getCNamespace(), - $this->getName(), - $method->getName(), - $method->getModifiers() - ) - ); - $codePrinter->output('#endif'); } } } else { @@ -1186,22 +1173,13 @@ public function compile(CompilationContext $compilationContext): void ) ); } else { - $codePrinter->output('#if PHP_VERSION_ID >= 80000'); $codePrinter->output( sprintf( - "\tZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", + "ZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", $method->getName(), $method->getArgInfoName($this) ) ); - $codePrinter->output('#else'); - $codePrinter->output( - sprintf( - "\tZEND_FENTRY(%s, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", - $method->getName() - ) - ); - $codePrinter->output('#endif'); } } else { $isInterface = $method->getClassDefinition()->isInterface(); diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 605a40b415..f731ef54cd 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1809,29 +1809,27 @@ public function compile(CompilationContext $compilationContext): void */ $tempCodePrinter = new Printer(); if ($this->parameters instanceof Parameters && $this->parameters->count() > 0) { - $tempCodePrinter->output('#if PHP_VERSION_ID >= 80000'); - $tempCodePrinter->output("\t".'bool is_null_true = 1;'); + $tempCodePrinter->output('bool is_null_true = 1;'); $tempCodePrinter->output(sprintf( - "\t".'ZEND_PARSE_PARAMETERS_START(%d, %d)', + 'ZEND_PARSE_PARAMETERS_START(%d, %d)', $this->parameters->countRequiredParameters(), $this->parameters->count() )); foreach ($requiredParams as $requiredParam) { - $tempCodePrinter->output("\t\t".$this->detectParam($requiredParam, $compilationContext)); + $tempCodePrinter->output("\t".$this->detectParam($requiredParam, $compilationContext)); } if (!empty($optionalParams)) { - $tempCodePrinter->output("\t\t".'Z_PARAM_OPTIONAL'); + $tempCodePrinter->output("\t".'Z_PARAM_OPTIONAL'); foreach ($optionalParams as $optionalParam) { - $tempCodePrinter->output("\t\t".$this->detectParam($optionalParam, $compilationContext)); + $tempCodePrinter->output("\t".$this->detectParam($optionalParam, $compilationContext)); } } - $tempCodePrinter->output("\t".'ZEND_PARSE_PARAMETERS_END();'); - $tempCodePrinter->output('#endif'); + $tempCodePrinter->output('ZEND_PARSE_PARAMETERS_END();'); } $codePrinter->preOutput($tempCodePrinter->getOutput()); diff --git a/src/Code/ArgInfoDefinition.php b/src/Code/ArgInfoDefinition.php index 029bc97791..b93ca5d439 100644 --- a/src/Code/ArgInfoDefinition.php +++ b/src/Code/ArgInfoDefinition.php @@ -81,7 +81,6 @@ public function render(): void ); } else { if ($this->functionLike->getName() === '__toString') { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, IS_STRING, %d)', @@ -91,17 +90,6 @@ public function render(): void (int) $this->functionLike->areReturnTypesNullCompatible() ) ); - - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters() - ) - ); - $this->codePrinter->output('#endif'); } else { $this->codePrinter->output( sprintf('ZEND_BEGIN_ARG_INFO_EX(%s, 0, 0, 0)', $this->name) @@ -162,7 +150,6 @@ private function richRenderStart(): void } if ($this->functionLike->isMixed()) { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, IS_MIXED, %d)', @@ -172,22 +159,11 @@ private function richRenderStart(): void (int) $this->functionLike->areReturnTypesNullCompatible() ) ); - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - ) - ); - $this->codePrinter->output('#endif'); return; } if ($this->functionLike->isReturnTypeNullableObject()) { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', @@ -197,24 +173,11 @@ private function richRenderStart(): void 'MAY_BE_NULL|MAY_BE_OBJECT', ) ); - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - 'IS_OBJECT', - 1, - ) - ); - $this->codePrinter->output('#endif'); return; } if ($this->functionLike->isReturnTypeObject()) { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', @@ -224,18 +187,6 @@ private function richRenderStart(): void 'MAY_BE_OBJECT', ) ); - $this->codePrinter->output('#else'); - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - 'IS_OBJECT', - 0, - ) - ); - $this->codePrinter->output('#endif'); return; } @@ -252,7 +203,6 @@ private function richRenderStart(): void } 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)', @@ -262,18 +212,6 @@ private function richRenderStart(): void 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; } @@ -309,27 +247,15 @@ private function renderEnd(): void ) ); } else { - $this->codePrinter->output('#if PHP_VERSION_ID >= 80000'); $this->codePrinter->output( sprintf( - "\tZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)", + "ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)", $this->passByReference($parameter), $parameter['name'], (int) $this->allowNull($parameter), $this->defaultArrayValue($parameter), ) ); - $this->codePrinter->output('#else'); - // `ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE` does not exist in PHP 7.4 - $this->codePrinter->output( - sprintf( - "\tZEND_ARG_ARRAY_INFO(%d, %s, %d)", - $this->passByReference($parameter), - $parameter['name'], - (int) $this->allowNull($parameter) - ) - ); - $this->codePrinter->output('#endif'); } break; case '0:variable': From 5d00a3aaa6158dd5ba7171f6c319c77f75acc5a8 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:27:27 +0000 Subject: [PATCH 130/375] Add extra tab --- src/Class/Method/Method.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index f731ef54cd..15a24989e0 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1809,27 +1809,27 @@ public function compile(CompilationContext $compilationContext): void */ $tempCodePrinter = new Printer(); if ($this->parameters instanceof Parameters && $this->parameters->count() > 0) { - $tempCodePrinter->output('bool is_null_true = 1;'); + $tempCodePrinter->output("\t".'bool is_null_true = 1;'); $tempCodePrinter->output(sprintf( - 'ZEND_PARSE_PARAMETERS_START(%d, %d)', + "\t".'ZEND_PARSE_PARAMETERS_START(%d, %d)', $this->parameters->countRequiredParameters(), $this->parameters->count() )); foreach ($requiredParams as $requiredParam) { - $tempCodePrinter->output("\t".$this->detectParam($requiredParam, $compilationContext)); + $tempCodePrinter->output("\t\t".$this->detectParam($requiredParam, $compilationContext)); } if (!empty($optionalParams)) { - $tempCodePrinter->output("\t".'Z_PARAM_OPTIONAL'); + $tempCodePrinter->output("\t\t".'Z_PARAM_OPTIONAL'); foreach ($optionalParams as $optionalParam) { - $tempCodePrinter->output("\t".$this->detectParam($optionalParam, $compilationContext)); + $tempCodePrinter->output("\t\t".$this->detectParam($optionalParam, $compilationContext)); } } - $tempCodePrinter->output('ZEND_PARSE_PARAMETERS_END();'); + $tempCodePrinter->output("\t".'ZEND_PARSE_PARAMETERS_END();'); } $codePrinter->preOutput($tempCodePrinter->getOutput()); From 4401690c14231fcbab67108ab53e190cb320f803 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:34:21 +0000 Subject: [PATCH 131/375] Mass remove `#if PHP_VERSION_ID < 80000` condition --- kernel/fcall.c | 29 ----------------------------- kernel/object.c | 13 +++---------- kernel/string.c | 5 +---- 3 files changed, 4 insertions(+), 43 deletions(-) diff --git a/kernel/fcall.c b/kernel/fcall.c index e065629004..cfcc025bed 100644 --- a/kernel/fcall.c +++ b/kernel/fcall.c @@ -355,12 +355,7 @@ int zephir_call_user_function( ZVAL_COPY_VALUE(&fci.function_name, function_name); fci.retval = retval_ptr ? retval_ptr : &local_retval_ptr; fci.param_count = param_count; - -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else fci.named_params = NULL; -#endif if (cache_entry && *cache_entry) { /* We have a cache record, initialize scope */ @@ -595,29 +590,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa return FAILURE; } -#if PHP_VERSION_ID < 80000 - zend_fcall_info_init(handler, 0, &fci, &fci_cache, NULL, &is_callable_error); - - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); - } else { - status = SUCCESS; - } - - if (status == SUCCESS) { - zend_fcall_info_args(&fci, params); - - fci.retval = return_value; - zend_call_function(&fci, &fci_cache); - - zend_fcall_info_args_clear(&fci, 1); - } - - if (EG(exception)) { - status = SUCCESS; - } -#else zend_execute_data *frame = EG(current_execute_data); if (!zend_is_callable_at_frame(handler, NULL, frame, 0, &fci_cache, &is_callable_error)) { if (is_callable_error) { @@ -639,7 +611,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa zend_fcall_info_args(&fci, params); status = zend_call_function(&fci, &fci_cache); zend_fcall_info_args_clear(&fci, 1); -#endif return status; } diff --git a/kernel/object.c b/kernel/object.c index d461e45c19..62b03d79c7 100644 --- a/kernel/object.c +++ b/kernel/object.c @@ -1262,11 +1262,7 @@ int zephir_create_instance(zval *return_value, const zval *class_name) fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; ZVAL_NULL(&fci.function_name); @@ -1324,11 +1320,8 @@ int zephir_create_instance_params(zval *return_value, const zval *class_name, zv fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; + ZVAL_NULL(&fci.function_name); fcc.object = obj; diff --git a/kernel/string.c b/kernel/string.c index dd5ba9d432..96a49a4254 100644 --- a/kernel/string.c +++ b/kernel/string.c @@ -461,11 +461,8 @@ void zephir_fast_join(zval *result, zval *glue, zval *pieces) zend_error(E_WARNING, "Invalid arguments supplied for join()"); return; } -#if PHP_VERSION_ID < 80000 - php_implode(Z_STR_P(glue), pieces, result); -#else + php_implode(Z_STR_P(glue), Z_ARRVAL_P(pieces), result); -#endif } /** From 121e79377d071b469d5bb0c52ec4d67b4b7afa52 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:43:58 +0000 Subject: [PATCH 132/375] Implement `Parameters:hasNullableParameters()` method --- src/Class/Method/Method.php | 5 ++++- src/Class/Method/Parameters.php | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 15a24989e0..87c4aef02c 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1809,7 +1809,10 @@ public function compile(CompilationContext $compilationContext): void */ $tempCodePrinter = new Printer(); if ($this->parameters instanceof Parameters && $this->parameters->count() > 0) { - $tempCodePrinter->output("\t".'bool is_null_true = 1;'); + // Do not declare variable when it is not needed. + if ($this->parameters->hasNullableParameters()) { + $tempCodePrinter->output("\t".'bool is_null_true = 1;'); + } $tempCodePrinter->output(sprintf( "\t".'ZEND_PARSE_PARAMETERS_START(%d, %d)', diff --git a/src/Class/Method/Parameters.php b/src/Class/Method/Parameters.php index 16b24a8037..9263a02313 100644 --- a/src/Class/Method/Parameters.php +++ b/src/Class/Method/Parameters.php @@ -76,6 +76,17 @@ public function countOptionalParameters(): int return \count($this->optionalParameters); } + public function hasNullableParameters(): bool + { + foreach ($this->optionalParameters as $parameter) { + if (isset($parameter['default']['type']) && $parameter['default']['type'] === 'null') { + return true; + } + } + + return false; + } + public function fetchParameters(bool $isMethodInternal): array { $parameters = []; From d94c82234b1d8afe225759020b8f7984a737ce33 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Mon, 20 Nov 2023 22:46:07 +0000 Subject: [PATCH 133/375] Regenerate ext/ directory --- ext/kernel/array.h | 4 - ext/kernel/exception.c | 11 - ext/kernel/fcall.c | 84 +- ext/kernel/fcall.h | 34 - ext/kernel/main.c | 47 +- ext/kernel/memory.h | 9 +- ext/kernel/object.c | 47 +- ext/kernel/string.c | 5 +- ext/stub/0__closure.zep.c | 3 - ext/stub/10__closure.zep.c | 3 - ext/stub/11__closure.zep.c | 3 - ext/stub/12__closure.zep.h | 6 +- ext/stub/13__closure.zep.h | 6 +- ext/stub/1__closure.zep.h | 6 +- ext/stub/2__closure.zep.h | 6 +- ext/stub/3__closure.zep.c | 3 - ext/stub/4__closure.zep.c | 3 - ext/stub/5__closure.zep.c | 3 - ext/stub/6__closure.zep.c | 3 - ext/stub/7__closure.zep.c | 3 - ext/stub/8__closure.zep.h | 6 +- ext/stub/9__closure.zep.h | 6 +- ext/stub/arithmetic.zep.c | 36 - ext/stub/arithmetic.zep.h | 918 +++--------------- ext/stub/arrayaccessarr.zep.c | 12 - ext/stub/arrayaccessarr.zep.h | 10 +- ext/stub/arrayaccessobj.zep.c | 20 +- ext/stub/arrayaccessobj.zep.h | 10 +- ext/stub/arrayaccesstest.zep.c | 20 +- ext/stub/arrayaccesstest.zep.h | 30 +- ext/stub/arrayiterator.zep.c | 2 +- ext/stub/arrayiterator.zep.h | 14 +- ext/stub/arrayiteratortest.zep.h | 6 +- ext/stub/arraysearch.zep.c | 3 - ext/stub/arraysearch.zep.h | 6 +- ext/stub/assign.zep.c | 68 +- ext/stub/assign.zep.h | 210 +--- ext/stub/bench/foo.zep.c | 48 - ext/stub/bench/foo.zep.h | 6 +- ext/stub/bitwise.zep.c | 9 - ext/stub/bitwise.zep.h | 576 ++--------- ext/stub/branchprediction.zep.c | 6 - ext/stub/branchprediction.zep.h | 12 +- ext/stub/builtin/arraymethods.zep.h | 18 +- ext/stub/builtin/charmethods.zep.c | 3 - ext/stub/builtin/charmethods.zep.h | 6 +- ext/stub/builtin/intmethods.zep.c | 42 - ext/stub/builtin/intmethods.zep.h | 6 +- ext/stub/builtin/stringmethods.zep.c | 76 -- ext/stub/builtin/stringmethods.zep.h | 24 +- ext/stub/cast.zep.c | 6 - ext/stub/cast.zep.h | 54 +- ext/stub/cblock.zep.h | 12 +- ext/stub/chars.zep.c | 6 - ext/stub/closures.zep.c | 9 - ext/stub/closures.zep.h | 60 +- ext/stub/compare.zep.c | 24 - ext/stub/compare.zep.h | 18 +- ext/stub/concat.zep.c | 9 - ext/stub/constants.zep.h | 150 +-- ext/stub/constantsinterface.zep.h | 72 +- ext/stub/constantsinterfacea.zep.h | 36 +- ext/stub/constantsinterfaceb.zep.h | 36 +- ext/stub/constructors/issue1803.zep.h | 6 +- ext/stub/declaretest.zep.h | 108 +-- ext/stub/echoes.zep.h | 30 +- ext/stub/emptytest.zep.c | 3 - ext/stub/emptytest.zep.h | 24 +- ext/stub/evaltest.zep.c | 3 - ext/stub/exception.zep.c | 3 - ext/stub/exceptions.zep.c | 16 +- ext/stub/exceptions.zep.h | 60 +- ext/stub/exists.zep.c | 12 - ext/stub/exitdie.zep.c | 4 - ext/stub/factorial.zep.c | 6 - ext/stub/fannkuch.zep.c | 3 - ext/stub/fasta.zep.c | 6 - ext/stub/fasta.zep.h | 6 +- ext/stub/fcall.zep.c | 35 - ext/stub/fcall.zep.h | 24 +- ext/stub/fetchtest.zep.c | 48 +- ext/stub/fetchtest.zep.h | 6 +- ext/stub/fibonnaci.zep.c | 6 - ext/stub/fibonnaci.zep.h | 24 +- ext/stub/flow.zep.c | 35 - ext/stub/flow.zep.h | 384 ++------ ext/stub/flow/switchflow.zep.c | 9 - ext/stub/flow/switchflow.zep.h | 6 +- ext/stub/functional.zep.c | 6 - ext/stub/functionexists.zep.c | 3 - ext/stub/geometry.zep.c | 9 - ext/stub/globals.zep.c | 21 - ext/stub/globals.zep.h | 60 +- ext/stub/globals/env.zep.c | 3 - ext/stub/globals/post.zep.c | 3 - ext/stub/globals/server.zep.h | 6 +- ext/stub/globals/serverrequestfactory.zep.c | 5 - ext/stub/globals/serverrequestfactory.zep.h | 30 +- ext/stub/globals/session/base.zep.c | 12 - ext/stub/globals/session/base.zep.h | 6 +- ext/stub/globals/session/child.zep.h | 6 +- ext/stub/instance.zep.c | 6 - ext/stub/instanceoff.zep.c | 15 - ext/stub/interfaces/implementint.zep.c | 3 - ext/stub/interfaces/implementinterface.zep.c | 6 - .../interfaces/interfacestaticmethod.zep.h | 6 +- ext/stub/internalclasses.zep.h | 12 +- ext/stub/invoke.zep.h | 6 +- ext/stub/invokes/abstractinvoker.zep.h | 10 +- ext/stub/invokes/abstractinvokercomplex.zep.h | 10 +- ext/stub/invokes/abstractprotected.zep.c | 12 - ext/stub/invokes/invokeprotected.zep.c | 3 - ext/stub/invokes/invokeprotectedcomplex.zep.c | 3 - ext/stub/issettest.zep.c | 31 +- ext/stub/issettest.zep.h | 6 +- ext/stub/issue1134.zep.c | 6 - ext/stub/issue1134.zep.h | 12 +- ext/stub/issue1521.zep.h | 6 +- ext/stub/issue2165/issue.zep.c | 18 - ext/stub/issue2165/issue.zep.h | 12 +- ext/stub/issue663.zep.c | 9 - ext/stub/issue887.zep.c | 5 +- ext/stub/issue887.zep.h | 18 +- ext/stub/issue914.zep.h | 6 +- ext/stub/issues.zep.c | 6 - ext/stub/issues.zep.h | 6 +- ext/stub/json.zep.h | 36 +- ext/stub/logical.zep.c | 9 - ext/stub/logical.zep.h | 48 +- ext/stub/mcall.zep.c | 94 -- ext/stub/mcall.zep.h | 102 +- ext/stub/mcall/caller.zep.c | 3 - ext/stub/mcallchained.zep.h | 42 +- ext/stub/mcalldynamic.zep.c | 3 - ext/stub/mcalldynamic.zep.h | 18 +- ext/stub/mcallinternal.zep.c | 9 - ext/stub/mcallinternal.zep.h | 24 +- ext/stub/methodabstract.zep.h | 6 +- ext/stub/methodargs.zep.c | 30 - ext/stub/namespaces/classentry.zep.c | 6 - ext/stub/nativearray.zep.c | 41 +- ext/stub/nativearray.zep.h | 6 +- ext/stub/oo.zep.h | 72 +- ext/stub/oo/abstractclass.zep.h | 12 +- ext/stub/oo/concretestatic.zep.h | 12 +- ext/stub/oo/constantsinterface.zep.h | 36 +- ext/stub/oo/deprecatedmethods.zep.h | 18 +- ext/stub/oo/dynamicprop.zep.c | 36 - ext/stub/oo/dynamicprop.zep.h | 12 +- ext/stub/oo/extendpdoclass.zep.c | 2 - ext/stub/oo/ooconstruct.zep.h | 6 +- ext/stub/oo/ooconstructparams.zep.c | 3 - ext/stub/oo/ooconstructparams.zep.h | 12 +- ext/stub/oo/oodestruct.zep.c | 2 - ext/stub/oo/oodestruct.zep.h | 18 +- ext/stub/oo/oodynamica.zep.h | 30 +- ext/stub/oo/oodynamicb.zep.h | 12 +- ext/stub/oo/oonativeimplements.zep.c | 21 - ext/stub/oo/oonativeimplements.zep.h | 8 - ext/stub/oo/ooparams.zep.c | 63 -- ext/stub/oo/ooparams.zep.h | 24 +- ext/stub/oo/propertyaccess.zep.c | 7 +- ext/stub/oo/propertyaccess.zep.h | 12 +- ext/stub/oo/scopes/abstractclass.zep.c | 3 - ext/stub/oo/scopes/abstractclass.zep.h | 12 +- ext/stub/oo/scopes/abstractclassmagic.zep.c | 8 +- ext/stub/oo/scopes/privatescopetester.zep.c | 14 +- ext/stub/operator.zep.c | 18 - ext/stub/optimizers/acos.zep.c | 6 - ext/stub/optimizers/acos.zep.h | 18 +- ext/stub/optimizers/arraymerge.zep.c | 3 - ext/stub/optimizers/asin.zep.c | 6 - ext/stub/optimizers/asin.zep.h | 18 +- ext/stub/optimizers/cos.zep.c | 6 - ext/stub/optimizers/cos.zep.h | 24 +- ext/stub/optimizers/createarray.zep.c | 3 - ext/stub/optimizers/createarray.zep.h | 6 +- ext/stub/optimizers/isscalar.zep.c | 3 - ext/stub/optimizers/ldexp.zep.c | 6 - ext/stub/optimizers/ldexp.zep.h | 30 +- ext/stub/optimizers/sin.zep.c | 6 - ext/stub/optimizers/sin.zep.h | 24 +- ext/stub/optimizers/sqrt.zep.c | 6 - ext/stub/optimizers/sqrt.zep.h | 24 +- ext/stub/optimizers/strreplace.zep.h | 24 +- ext/stub/optimizers/substr.zep.c | 6 - ext/stub/optimizers/tan.zep.c | 6 - ext/stub/optimizers/tan.zep.h | 30 +- ext/stub/pregmatch.zep.c | 18 - ext/stub/pregmatch.zep.h | 36 +- ext/stub/properties/app.zep.h | 12 +- ext/stub/properties/privateproperties.zep.h | 42 +- ext/stub/properties/propertyarray.zep.c | 6 - ext/stub/properties/propertyarray.zep.h | 18 +- ext/stub/properties/propertyupdate.zep.h | 6 +- ext/stub/properties/protectedproperties.zep.c | 9 - ext/stub/properties/protectedproperties.zep.h | 48 +- ext/stub/properties/publicproperties.zep.c | 5 +- ext/stub/properties/publicproperties.zep.h | 12 +- .../properties/staticprivateproperties.zep.c | 2 +- .../staticprotectedproperties.zep.c | 8 +- .../staticprotectedproperties.zep.h | 48 +- .../properties/staticpublicproperties.zep.c | 3 - .../properties/staticpublicproperties.zep.h | 30 +- ext/stub/quantum.zep.c | 3 - ext/stub/range.zep.h | 12 +- ext/stub/references.zep.h | 6 +- ext/stub/reflection.zep.c | 3 - ext/stub/regexdna.zep.c | 3 - ext/stub/requires.zep.c | 18 - ext/stub/requires/external3.zep.c | 3 - ext/stub/resourcetest.zep.h | 36 +- ext/stub/returns.zep.c | 3 - ext/stub/returns.zep.h | 6 +- ext/stub/router.zep.c | 76 +- ext/stub/router.zep.h | 72 +- ext/stub/router/route.zep.c | 30 +- ext/stub/router/route.zep.h | 60 +- ext/stub/scall.zep.c | 36 - ext/stub/scall.zep.h | 54 +- ext/stub/scalldynamic.zep.c | 3 - ext/stub/scallexternal.zep.c | 6 - ext/stub/scallexternal.zep.h | 6 +- ext/stub/scalllateconstruct.zep.h | 12 +- ext/stub/scope.zep.c | 3 - ext/stub/scope.zep.h | 24 +- ext/stub/sort.zep.c | 5 +- ext/stub/spectralnorm.zep.c | 15 - ext/stub/spl.zep.c | 3 - ext/stub/spropertyaccess.zep.c | 8 +- ext/stub/spropertyaccess.zep.h | 6 +- ext/stub/statements.zep.c | 15 - ext/stub/statements.zep.h | 6 +- ext/stub/strings.zep.c | 90 -- ext/stub/strings.zep.h | 36 +- ext/stub/stubs.zep.c | 6 - ext/stub/stubs.zep.h | 18 +- ext/stub/ternary.zep.c | 18 - ext/stub/ternary.zep.h | 18 +- ext/stub/trytest.zep.c | 12 - ext/stub/trytest.zep.h | 66 +- ext/stub/typehinting/testabstract.zep.h | 12 +- ext/stub/typeinstances.zep.h | 18 +- ext/stub/typeoff.zep.c | 8 +- ext/stub/typeoff.zep.h | 66 +- ext/stub/types/maybe.zep.c | 3 - ext/stub/types/maybe.zep.h | 8 - ext/stub/types/mixedtype.zep.c | 42 - ext/stub/types/mixedtype.zep.h | 74 +- ext/stub/types/obj.zep.h | 12 - ext/stub/unsettest.zep.c | 18 - ext/stub/unsettest.zep.h | 18 +- ext/stub/usetest.zep.h | 24 +- ext/stub/vars.zep.c | 23 - ext/stub/vars.zep.h | 42 +- 255 files changed, 873 insertions(+), 6060 deletions(-) diff --git a/ext/kernel/array.h b/ext/kernel/array.h index 11d19b6f77..1c98ca2cc0 100644 --- a/ext/kernel/array.h +++ b/ext/kernel/array.h @@ -9,8 +9,6 @@ * following url: https://docs.zephir-lang.com/en/latest/license */ -#ifndef ZEPHIR_KERNEL_ARRAY_H -#define ZEPHIR_KERNEL_ARRAY_H #define ZEPHIR_MAX_ARRAY_LEVELS 16 #include @@ -73,5 +71,3 @@ int zephir_fast_in_array(zval *needle, zval *haystack); Z_TRY_ADDREF_P(value); \ zend_hash_next_index_insert(Z_ARRVAL_P(arr), value); \ } while (0) - -#endif /* ZEPHIR_KERNEL_ARRAY_H */ diff --git a/ext/kernel/exception.c b/ext/kernel/exception.c index 6d0a50ba3c..2d81541f32 100644 --- a/ext/kernel/exception.c +++ b/ext/kernel/exception.c @@ -54,14 +54,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) zephir_check_call_status(); if (ZEPHIR_IS_LONG(&curline, 0)) { default_exception_ce = zend_exception_get_default(); - -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ_P(object), SL("file"), file); zend_update_property_long(default_exception_ce, Z_OBJ_P(object), SL("line"), line); -#else - zend_update_property_string(default_exception_ce, object, SL("file"), file); - zend_update_property_long(default_exception_ce, object, SL("line"), line); -#endif } } @@ -88,13 +82,8 @@ void zephir_throw_exception_string_debug(zend_class_entry *ce, const char *messa if (line > 0) { default_exception_ce = zend_exception_get_default(); -#if PHP_VERSION_ID >= 80000 zend_update_property_string(default_exception_ce, Z_OBJ(object), "file", sizeof("file")-1, file); zend_update_property_long(default_exception_ce, Z_OBJ(object), "line", sizeof("line")-1, line); -#else - zend_update_property_string(default_exception_ce, &object, "file", sizeof("file")-1, file); - zend_update_property_long(default_exception_ce, &object, "line", sizeof("line")-1, line); -#endif } if (ZEPHIR_LAST_CALL_STATUS != FAILURE) { diff --git a/ext/kernel/fcall.c b/ext/kernel/fcall.c index d017ec4db3..cfcc025bed 100644 --- a/ext/kernel/fcall.c +++ b/ext/kernel/fcall.c @@ -211,21 +211,12 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } fcic->called_scope = called_scope; - -#if PHP_VERSION_ID >= 80000 calling_scope = zend_get_called_scope(EG(current_execute_data)); -#else - calling_scope = zend_get_executed_scope(); -#endif - fcic->object = this_ptr ? Z_OBJ_P(this_ptr) : NULL; switch (type) { case zephir_fcall_parent: - -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->parent->function_table, Z_STR_P(func)); - fcic->calling_scope = ce->parent; } else if (EXPECTED(calling_scope && calling_scope->parent)) { if (Z_TYPE_P(func) == IS_STRING) { @@ -235,7 +226,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze } else { return; } -#endif + if (UNEXPECTED(!calling_scope || !calling_scope->parent)) { return; } @@ -244,7 +235,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze break; case zephir_fcall_static: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -252,17 +242,10 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = called_scope; } -#else - fcic->calling_scope = called_scope; - if (UNEXPECTED(!calling_scope)) { - return; - } -#endif break; case zephir_fcall_self: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); fcic->calling_scope = ce; @@ -273,13 +256,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze //fcic->called_scope = zend_get_called_scope(EG(current_execute_data)); fcic->calling_scope = calling_scope; } -#else - fcic->calling_scope = calling_scope; -#endif break; case zephir_fcall_ce: -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); @@ -288,7 +267,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func)); fcic->calling_scope = calling_scope; } -#endif // TODO: Check for PHP 7.4 and PHP 8.0, as it rewrite from above fcic->calling_scope = ce; fcic->called_scope = ce; @@ -297,11 +275,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze case zephir_fcall_function: case zephir_fcall_method: if (Z_TYPE_P(func) == IS_OBJECT) { -#if PHP_VERSION_ID >= 80000 if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(Z_OBJ_P(func), &fcic->calling_scope, &fcic->function_handler, &fcic->object, 0) == SUCCESS) { -#else - if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(func, &fcic->calling_scope, &fcic->function_handler, &fcic->object) == SUCCESS) { -#endif fcic->called_scope = fcic->calling_scope; break; } @@ -309,11 +283,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze return; } -#if PHP_VERSION_ID >= 80000 if (ce && Z_TYPE_P(func) == IS_STRING) { fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func)); } -#endif fcic->calling_scope = this_ptr ? Z_OBJCE_P(this_ptr) : NULL; fcic->called_scope = fcic->calling_scope; break; @@ -383,12 +355,7 @@ int zephir_call_user_function( ZVAL_COPY_VALUE(&fci.function_name, function_name); fci.retval = retval_ptr ? retval_ptr : &local_retval_ptr; fci.param_count = param_count; - -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else fci.named_params = NULL; -#endif if (cache_entry && *cache_entry) { /* We have a cache record, initialize scope */ @@ -402,22 +369,18 @@ int zephir_call_user_function( /* The caller is interested in caching OR we have the call cache enabled */ resolve_callable(&callable, type, (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P(object_pp) : obj_ce), object_pp, function_name); -#if PHP_VERSION_ID >= 80000 - char *is_callable_error = NULL; - zend_execute_data *frame = EG(current_execute_data); + char *is_callable_error = NULL; + zend_execute_data *frame = EG(current_execute_data); if (obj_ce || !zend_is_callable_at_frame(&callable, fci.object, frame, 0, &fcic, &is_callable_error)) { - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); + if (is_callable_error) { + zend_error(E_WARNING, "%s", is_callable_error); + efree(is_callable_error); - return FAILURE; - } + return FAILURE; + } populate_fcic(&fcic, type, obj_ce, object_pp, function_name, called_scope); } -#else - zend_is_callable_ex(&callable, fci.object, IS_CALLABLE_CHECK_SILENT, NULL, &fcic, NULL); -#endif } #ifdef _MSC_VER @@ -432,12 +395,9 @@ int zephir_call_user_function( } fci.params = p; - -#if PHP_VERSION_ID >= 80000 if (!fcic.function_handler) { ZVAL_COPY_VALUE(&fci.function_name, &callable); } -#endif status = zend_call_function(&fci, &fcic); @@ -630,29 +590,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa return FAILURE; } -#if PHP_VERSION_ID < 80000 - zend_fcall_info_init(handler, 0, &fci, &fci_cache, NULL, &is_callable_error); - - if (is_callable_error) { - zend_error(E_WARNING, "%s", is_callable_error); - efree(is_callable_error); - } else { - status = SUCCESS; - } - - if (status == SUCCESS) { - zend_fcall_info_args(&fci, params); - - fci.retval = return_value; - zend_call_function(&fci, &fci_cache); - - zend_fcall_info_args_clear(&fci, 1); - } - - if (EG(exception)) { - status = SUCCESS; - } -#else zend_execute_data *frame = EG(current_execute_data); if (!zend_is_callable_at_frame(handler, NULL, frame, 0, &fci_cache, &is_callable_error)) { if (is_callable_error) { @@ -674,7 +611,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa zend_fcall_info_args(&fci, params); status = zend_call_function(&fci, &fci_cache); zend_fcall_info_args_clear(&fci, 1); -#endif return status; } @@ -696,11 +632,7 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context) #if PHP_VERSION_ID >= 80200 new_op_array = zend_compile_string(Z_STR_P(str), context, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG); #else -#if PHP_VERSION_ID >= 80000 new_op_array = zend_compile_string(Z_STR_P(str), context); -#else - new_op_array = zend_compile_string(str, context); -#endif #endif CG(compiler_options) = original_compiler_options; diff --git a/ext/kernel/fcall.h b/ext/kernel/fcall.h index 2581360756..4754bf4626 100644 --- a/ext/kernel/fcall.h +++ b/ext/kernel/fcall.h @@ -167,19 +167,11 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_RETURN_CALL_PARENT(class_entry, this_ptr, method, cache, cache_slot, ...) \ do { \ @@ -187,51 +179,25 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif -#if PHP_VERSION_ID >= 80000 #define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ do { \ zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ } while (0) -#else -#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \ - do { \ - zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \ - ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \ - ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \ - } while (0) -#endif #define ZEPHIR_CALL_CE_STATIC(return_value_ptr, class_entry, method, cache, cache_slot, ...) \ do { \ diff --git a/ext/kernel/main.c b/ext/kernel/main.c index 1bbd149639..8aeedda44e 100644 --- a/ext/kernel/main.c +++ b/ext/kernel/main.c @@ -137,26 +137,17 @@ void zephir_fast_count(zval *result, zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { ZVAL_LONG(result, 1); -#if PHP_VERSION_ID >= 80000 if (SUCCESS == Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &Z_LVAL_P(result))) { -#else - if (SUCCESS == Z_OBJ_HT(*value)->count_elements(value, &Z_LVAL_P(result))) { -#endif return; } } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); ZVAL_LONG(result, Z_LVAL(retval)); @@ -189,24 +180,15 @@ int zephir_fast_count_ev(zval *value) } if (Z_TYPE_P(value) == IS_OBJECT) { - zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count > 0; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -241,20 +223,12 @@ int zephir_fast_count_int(zval *value) zval retval; if (Z_OBJ_HT_P(value)->count_elements) { -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT(*value)->count_elements(Z_OBJ_P(value), &count); -#else - Z_OBJ_HT(*value)->count_elements(value, &count); -#endif return (int) count; } if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { -#if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); -#else - zend_call_method_with_0_params(value, NULL, NULL, "count", &retval); -#endif if (Z_TYPE(retval) != IS_UNDEF) { convert_to_long_ex(&retval); count = Z_LVAL(retval); @@ -282,7 +256,7 @@ int zephir_fast_count_int(zval *value) */ int zephir_function_exists(const zval *function_name) { - if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) { + if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name))) { return SUCCESS; } @@ -406,7 +380,6 @@ zend_class_entry* zephir_get_internal_ce(const char *class_name, unsigned int cl /* Declare constants */ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value) { -#if PHP_VERSION_ID >= 80000 zend_string *key; if (ce->type == ZEND_INTERNAL_CLASS) { @@ -422,24 +395,6 @@ int zephir_declare_class_constant(zend_class_entry *ce, const char *name, size_t } return SUCCESS; -#else - int ret; - zend_string *key; - - if (ce->type == ZEND_INTERNAL_CLASS) { - key = zend_string_init_interned(name, name_length, 1); - } else { - key = zend_string_init(name, name_length, 0); - } - - ret = zend_declare_class_constant_ex(ce, key, value, ZEND_ACC_PUBLIC, NULL); - - if (ce->type != ZEND_INTERNAL_CLASS) { - zend_string_release(key); - } - - return ret; -#endif } int zephir_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length) diff --git a/ext/kernel/memory.h b/ext/kernel/memory.h index 76407bb5ae..762be8a03c 100644 --- a/ext/kernel/memory.h +++ b/ext/kernel/memory.h @@ -119,22 +119,17 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ zephir_ptr_dtor(d); \ } \ - } else { \ - /*TODO: as above */ \ } \ ZVAL_DUP(d, v); -#define ZEPHIR_OBS_VAR(z) \ - zephir_memory_observe(z) - #define ZEPHIR_OBS_VAR_ONCE(z) \ if (Z_TYPE_P(z) == IS_UNDEF) { \ zephir_memory_observe(z); \ } #define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ - ZEPHIR_OBS_VAR_ONCE(z); \ - ZVAL_COPY(z, v); + ZEPHIR_OBS_VAR_ONCE(z); \ + ZVAL_COPY(z, v); #define ZEPHIR_HASH_COPY(z, v) \ if (Z_TYPE_P(z) == IS_ARRAY && Z_TYPE_P(v) == IS_ARRAY) { \ diff --git a/ext/kernel/object.c b/ext/kernel/object.c index 3fb2e006c6..62b03d79c7 100644 --- a/ext/kernel/object.c +++ b/ext/kernel/object.c @@ -338,11 +338,7 @@ int zephir_clone(zval *destination, zval *obj) status = FAILURE; } else { if (!EG(exception)) { -#if PHP_VERSION_ID >= 80000 ZVAL_OBJ(destination, clone_call(Z_OBJ_P(obj))); -#else - ZVAL_OBJ(destination, clone_call(obj)); -#endif if (EG(exception)) { zval_ptr_dtor(destination); } @@ -363,19 +359,11 @@ int zephir_isset_property(zval *object, const char *property_name, unsigned int return 1; } -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), property_name, property_length ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - property_name, - property_length - ); -#endif } return 0; @@ -391,19 +379,11 @@ int zephir_isset_property_zval(zval *object, const zval *property) if (EXPECTED(zend_hash_str_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(property), Z_STRLEN_P(property)))) { return 1; } else { -#if PHP_VERSION_ID >= 80000 return zend_hash_str_exists( Z_OBJ_HT_P(object)->get_properties(Z_OBJ_P(object)), Z_STRVAL_P(property), Z_STRLEN_P(property) ); -#else - return zend_hash_str_exists( - Z_OBJ_HT_P(object)->get_properties(object), - Z_STRVAL_P(property), - Z_STRLEN_P(property) - ); -#endif } } } @@ -523,15 +503,9 @@ int zephir_read_property( } ZVAL_STRINGL(&property, property_name, property_length); -#if PHP_VERSION_ID >= 80000 res = Z_OBJ_HT_P(object)->read_property(Z_OBJ_P(object), Z_STR(property), flags ? BP_VAR_IS : BP_VAR_R, NULL, &tmp); -#else - res = Z_OBJ_HT_P(object)->read_property(object, &property, - flags ? BP_VAR_IS : BP_VAR_R, - NULL, &tmp); -#endif if ((flags & PH_READONLY) == PH_READONLY) { ZVAL_COPY_VALUE(result, res); @@ -674,11 +648,7 @@ int zephir_update_property_zval( /* write_property will add 1 to refcount, so no Z_TRY_ADDREF_P(value) is necessary */ -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), Z_STR(property), &sep_value, 0); -#else - Z_OBJ_HT_P(object)->write_property(object, &property, &sep_value, 0); -#endif zval_ptr_dtor(&property); @@ -943,11 +913,7 @@ int zephir_unset_property(zval* object, const char* name) /* Use caller's scope */ zephir_set_scope(Z_OBJCE_P(object)); -#if PHP_VERSION_ID >= 80000 Z_OBJ_HT_P(object)->unset_property(Z_OBJ_P(object), Z_STR(member), 0); -#else - Z_OBJ_HT_P(object)->unset_property(object, &member, 0); -#endif /* Restore original scope */ zephir_set_scope(scope); @@ -1296,11 +1262,7 @@ int zephir_create_instance(zval *return_value, const zval *class_name) fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; ZVAL_NULL(&fci.function_name); @@ -1358,11 +1320,8 @@ int zephir_create_instance_params(zval *return_value, const zval *class_name, zv fci.retval = 0; fci.param_count = 0; fci.params = 0; -#if PHP_VERSION_ID < 80000 - fci.no_separation = 1; -#else - fci.named_params = NULL; -#endif + fci.named_params = NULL; + ZVAL_NULL(&fci.function_name); fcc.object = obj; diff --git a/ext/kernel/string.c b/ext/kernel/string.c index dd5ba9d432..96a49a4254 100644 --- a/ext/kernel/string.c +++ b/ext/kernel/string.c @@ -461,11 +461,8 @@ void zephir_fast_join(zval *result, zval *glue, zval *pieces) zend_error(E_WARNING, "Invalid arguments supplied for join()"); return; } -#if PHP_VERSION_ID < 80000 - php_implode(Z_STR_P(glue), pieces, result); -#else + php_implode(Z_STR_P(glue), Z_ARRVAL_P(pieces), result); -#endif } /** diff --git a/ext/stub/0__closure.zep.c b/ext/stub/0__closure.zep.c index 9cbbd80596..bf61b8eab1 100644 --- a/ext/stub/0__closure.zep.c +++ b/ext/stub/0__closure.zep.c @@ -30,12 +30,9 @@ PHP_METHOD(stub_0__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &x); diff --git a/ext/stub/10__closure.zep.c b/ext/stub/10__closure.zep.c index 46af198cac..c17742a26e 100644 --- a/ext/stub/10__closure.zep.c +++ b/ext/stub/10__closure.zep.c @@ -29,12 +29,9 @@ PHP_METHOD(stub_10__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(&config_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(config) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &config); diff --git a/ext/stub/11__closure.zep.c b/ext/stub/11__closure.zep.c index b1f5df9d74..4f89d8999f 100644 --- a/ext/stub/11__closure.zep.c +++ b/ext/stub/11__closure.zep.c @@ -30,12 +30,9 @@ PHP_METHOD(stub_11__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &x); diff --git a/ext/stub/12__closure.zep.h b/ext/stub/12__closure.zep.h index e55860734b..f1d4463d87 100644 --- a/ext/stub/12__closure.zep.h +++ b/ext/stub/12__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_12__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_12__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_12__closure, __invoke, arginfo_stub_12__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_12__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_12__closure, __invoke, arginfo_stub_12__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/13__closure.zep.h b/ext/stub/13__closure.zep.h index b4d5d38647..1e69eecb70 100644 --- a/ext/stub/13__closure.zep.h +++ b/ext/stub/13__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_13__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_13__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_13__closure, __invoke, arginfo_stub_13__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_13__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_13__closure, __invoke, arginfo_stub_13__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/1__closure.zep.h b/ext/stub/1__closure.zep.h index b0da61413e..30d25ce92f 100644 --- a/ext/stub/1__closure.zep.h +++ b/ext/stub/1__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_1__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_1__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_1__closure, __invoke, arginfo_stub_1__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_1__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_1__closure, __invoke, arginfo_stub_1__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/2__closure.zep.h b/ext/stub/2__closure.zep.h index 13f7c95086..afe190da9d 100644 --- a/ext/stub/2__closure.zep.h +++ b/ext/stub/2__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_2__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_2__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_2__closure, __invoke, arginfo_stub_2__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_2__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_2__closure, __invoke, arginfo_stub_2__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/3__closure.zep.c b/ext/stub/3__closure.zep.c index 6d3ea9ab04..23070f1ed1 100644 --- a/ext/stub/3__closure.zep.c +++ b/ext/stub/3__closure.zep.c @@ -29,12 +29,9 @@ PHP_METHOD(stub_3__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m1); diff --git a/ext/stub/4__closure.zep.c b/ext/stub/4__closure.zep.c index 0c3188b1c9..abca7ef8ab 100644 --- a/ext/stub/4__closure.zep.c +++ b/ext/stub/4__closure.zep.c @@ -29,12 +29,9 @@ PHP_METHOD(stub_4__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m1); diff --git a/ext/stub/5__closure.zep.c b/ext/stub/5__closure.zep.c index 9f39cfc5a4..0d5e844e74 100644 --- a/ext/stub/5__closure.zep.c +++ b/ext/stub/5__closure.zep.c @@ -29,12 +29,9 @@ PHP_METHOD(stub_5__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m1_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m1); diff --git a/ext/stub/6__closure.zep.c b/ext/stub/6__closure.zep.c index dc65c493de..e0d9e10796 100644 --- a/ext/stub/6__closure.zep.c +++ b/ext/stub/6__closure.zep.c @@ -30,12 +30,9 @@ PHP_METHOD(stub_6__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &x); diff --git a/ext/stub/7__closure.zep.c b/ext/stub/7__closure.zep.c index 11aa31e130..6bc91c44bb 100644 --- a/ext/stub/7__closure.zep.c +++ b/ext/stub/7__closure.zep.c @@ -30,12 +30,9 @@ PHP_METHOD(stub_7__closure, __invoke) zval *this_ptr = getThis(); ZVAL_UNDEF(&x_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &x); diff --git a/ext/stub/8__closure.zep.h b/ext/stub/8__closure.zep.h index a6584a11da..759675c67e 100644 --- a/ext/stub/8__closure.zep.h +++ b/ext/stub/8__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_8__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_8__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_8__closure, __invoke, arginfo_stub_8__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_8__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_8__closure, __invoke, arginfo_stub_8__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/9__closure.zep.h b/ext/stub/9__closure.zep.h index 32f88976fc..7542dd891f 100644 --- a/ext/stub/9__closure.zep.h +++ b/ext/stub/9__closure.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_9__closure___invoke, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_9__closure_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(stub_9__closure, __invoke, arginfo_stub_9__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#else - PHP_ME(stub_9__closure, __invoke, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif +PHP_ME(stub_9__closure, __invoke, arginfo_stub_9__closure___invoke, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_FE_END }; diff --git a/ext/stub/arithmetic.zep.c b/ext/stub/arithmetic.zep.c index 1f33c47d31..94f34bc11c 100644 --- a/ext/stub/arithmetic.zep.c +++ b/ext/stub/arithmetic.zep.c @@ -1090,12 +1090,9 @@ PHP_METHOD(Stub_Arithmetic, addSum24) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2135,12 +2132,9 @@ PHP_METHOD(Stub_Arithmetic, sub24) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2176,12 +2170,9 @@ PHP_METHOD(Stub_Arithmetic, mul2) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2241,12 +2232,9 @@ PHP_METHOD(Stub_Arithmetic, less3) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -2261,12 +2249,9 @@ PHP_METHOD(Stub_Arithmetic, less4) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -2307,12 +2292,9 @@ PHP_METHOD(Stub_Arithmetic, greater3) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -2327,12 +2309,9 @@ PHP_METHOD(Stub_Arithmetic, greater4) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -2375,12 +2354,9 @@ PHP_METHOD(Stub_Arithmetic, letStatementBoolMinus) zval *this_ptr = getThis(); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &b); @@ -2399,12 +2375,9 @@ PHP_METHOD(Stub_Arithmetic, letStatementVarMinus) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2450,12 +2423,9 @@ PHP_METHOD(Stub_Arithmetic, absParam) zend_ulong val; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &val_param); @@ -2475,12 +2445,9 @@ PHP_METHOD(Stub_Arithmetic, negativeInt) zend_long val; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &val_param); @@ -2496,12 +2463,9 @@ PHP_METHOD(Stub_Arithmetic, negativeLong) long val; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &val_param); diff --git a/ext/stub/arithmetic.zep.h b/ext/stub/arithmetic.zep.h index de9a0bf616..8ee0c806c1 100644 --- a/ext/stub/arithmetic.zep.h +++ b/ext/stub/arithmetic.zep.h @@ -677,780 +677,168 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arithmetic_negativelong, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arithmetic_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSum, arginfo_stub_arithmetic_intsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, int2Sum, arginfo_stub_arithmetic_int2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, int2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSumSimple, arginfo_stub_arithmetic_intsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSum, arginfo_stub_arithmetic_boolsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool2Sum, arginfo_stub_arithmetic_bool2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool3Sum, arginfo_stub_arithmetic_bool3sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool3Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSumSimple, arginfo_stub_arithmetic_boolsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSumExpression, arginfo_stub_arithmetic_boolsumexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSumExpression, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSum, arginfo_stub_arithmetic_doublesum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, double2Sum, arginfo_stub_arithmetic_double2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, double2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSumSimple, arginfo_stub_arithmetic_doublesumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSum2Simple, arginfo_stub_arithmetic_doublesum2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSum2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSumExpression, arginfo_stub_arithmetic_doublesumexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSumExpression, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSumVarExpression, arginfo_stub_arithmetic_doublesumvarexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSumVarExpression, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSum, arginfo_stub_arithmetic_varsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSumSimple, arginfo_stub_arithmetic_varsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSum, arginfo_stub_arithmetic_intdoublesum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSumSimple, arginfo_stub_arithmetic_intdoublesumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSum, arginfo_stub_arithmetic_doubleintsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSumSimple, arginfo_stub_arithmetic_doubleintsumsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSumSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varIntSum, arginfo_stub_arithmetic_varintsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varIntSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarSum, arginfo_stub_arithmetic_intvarsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCastSum, arginfo_stub_arithmetic_intvarimplicitcastsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCastSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sum, arginfo_stub_arithmetic_intvarimplicitcast2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complexSum, arginfo_stub_arithmetic_complexsum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complexSum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex2Sum, arginfo_stub_arithmetic_complex2sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex2Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex3Sum, arginfo_stub_arithmetic_complex3sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex3Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex4Sum, arginfo_stub_arithmetic_complex4sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex4Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex5Sum, arginfo_stub_arithmetic_complex5sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex5Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex6Sum, arginfo_stub_arithmetic_complex6sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex6Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex7Sum, arginfo_stub_arithmetic_complex7sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex7Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex9Sum, arginfo_stub_arithmetic_complex9sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex9Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex10Sum, arginfo_stub_arithmetic_complex10sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex10Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex11Sum, arginfo_stub_arithmetic_complex11sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex11Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex12Sum, arginfo_stub_arithmetic_complex12sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex12Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex13Sum, arginfo_stub_arithmetic_complex13sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex13Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex14Sum, arginfo_stub_arithmetic_complex14sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex14Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex15Sum, arginfo_stub_arithmetic_complex15sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex15Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex16Sum, arginfo_stub_arithmetic_complex16sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex16Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex17Sum, arginfo_stub_arithmetic_complex17sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex17Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex18Sum, arginfo_stub_arithmetic_complex18sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex18Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex19Sum, arginfo_stub_arithmetic_complex19sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex19Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex20Sum, arginfo_stub_arithmetic_complex20sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex20Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex21Sum, arginfo_stub_arithmetic_complex21sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex21Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex22Sum, arginfo_stub_arithmetic_complex22sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex22Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex23Sum, arginfo_stub_arithmetic_complex23sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex23Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex24Sum, arginfo_stub_arithmetic_complex24sum, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex24Sum, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum1, arginfo_stub_arithmetic_addsum1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum2, arginfo_stub_arithmetic_addsum2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum2b, arginfo_stub_arithmetic_addsum2b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum2b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum3, arginfo_stub_arithmetic_addsum3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum4, arginfo_stub_arithmetic_addsum4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum5, arginfo_stub_arithmetic_addsum5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum6, arginfo_stub_arithmetic_addsum6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum7, arginfo_stub_arithmetic_addsum7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum8, arginfo_stub_arithmetic_addsum8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum8b, arginfo_stub_arithmetic_addsum8b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum8b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum9, arginfo_stub_arithmetic_addsum9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum10, arginfo_stub_arithmetic_addsum10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum11, arginfo_stub_arithmetic_addsum11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum12, arginfo_stub_arithmetic_addsum12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum13, arginfo_stub_arithmetic_addsum13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum14, arginfo_stub_arithmetic_addsum14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum15, arginfo_stub_arithmetic_addsum15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum15, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum16, arginfo_stub_arithmetic_addsum16, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum16, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum17, arginfo_stub_arithmetic_addsum17, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum17, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum18, arginfo_stub_arithmetic_addsum18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum18, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum19, arginfo_stub_arithmetic_addsum19, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum19, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum20, arginfo_stub_arithmetic_addsum20, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum20, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum21, arginfo_stub_arithmetic_addsum21, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum21, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum22, arginfo_stub_arithmetic_addsum22, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum22, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, addSum23, arginfo_stub_arithmetic_addsum23, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, addSum23, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, intSum, arginfo_stub_arithmetic_intsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, int2Sum, arginfo_stub_arithmetic_int2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intSumSimple, arginfo_stub_arithmetic_intsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSum, arginfo_stub_arithmetic_boolsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool2Sum, arginfo_stub_arithmetic_bool2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool3Sum, arginfo_stub_arithmetic_bool3sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSumSimple, arginfo_stub_arithmetic_boolsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSumExpression, arginfo_stub_arithmetic_boolsumexpression, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSum, arginfo_stub_arithmetic_doublesum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, double2Sum, arginfo_stub_arithmetic_double2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSumSimple, arginfo_stub_arithmetic_doublesumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSum2Simple, arginfo_stub_arithmetic_doublesum2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSumExpression, arginfo_stub_arithmetic_doublesumexpression, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSumVarExpression, arginfo_stub_arithmetic_doublesumvarexpression, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSum, arginfo_stub_arithmetic_varsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSumSimple, arginfo_stub_arithmetic_varsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSum, arginfo_stub_arithmetic_intdoublesum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSumSimple, arginfo_stub_arithmetic_intdoublesumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSum, arginfo_stub_arithmetic_doubleintsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSumSimple, arginfo_stub_arithmetic_doubleintsumsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varIntSum, arginfo_stub_arithmetic_varintsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarSum, arginfo_stub_arithmetic_intvarsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCastSum, arginfo_stub_arithmetic_intvarimplicitcastsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sum, arginfo_stub_arithmetic_intvarimplicitcast2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complexSum, arginfo_stub_arithmetic_complexsum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex2Sum, arginfo_stub_arithmetic_complex2sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex3Sum, arginfo_stub_arithmetic_complex3sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex4Sum, arginfo_stub_arithmetic_complex4sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex5Sum, arginfo_stub_arithmetic_complex5sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex6Sum, arginfo_stub_arithmetic_complex6sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex7Sum, arginfo_stub_arithmetic_complex7sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex9Sum, arginfo_stub_arithmetic_complex9sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex10Sum, arginfo_stub_arithmetic_complex10sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex11Sum, arginfo_stub_arithmetic_complex11sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex12Sum, arginfo_stub_arithmetic_complex12sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex13Sum, arginfo_stub_arithmetic_complex13sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex14Sum, arginfo_stub_arithmetic_complex14sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex15Sum, arginfo_stub_arithmetic_complex15sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex16Sum, arginfo_stub_arithmetic_complex16sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex17Sum, arginfo_stub_arithmetic_complex17sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex18Sum, arginfo_stub_arithmetic_complex18sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex19Sum, arginfo_stub_arithmetic_complex19sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex20Sum, arginfo_stub_arithmetic_complex20sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex21Sum, arginfo_stub_arithmetic_complex21sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex22Sum, arginfo_stub_arithmetic_complex22sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex23Sum, arginfo_stub_arithmetic_complex23sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex24Sum, arginfo_stub_arithmetic_complex24sum, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum1, arginfo_stub_arithmetic_addsum1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum2, arginfo_stub_arithmetic_addsum2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum2b, arginfo_stub_arithmetic_addsum2b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum3, arginfo_stub_arithmetic_addsum3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum4, arginfo_stub_arithmetic_addsum4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum5, arginfo_stub_arithmetic_addsum5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum6, arginfo_stub_arithmetic_addsum6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum7, arginfo_stub_arithmetic_addsum7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum8, arginfo_stub_arithmetic_addsum8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum8b, arginfo_stub_arithmetic_addsum8b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum9, arginfo_stub_arithmetic_addsum9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum10, arginfo_stub_arithmetic_addsum10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum11, arginfo_stub_arithmetic_addsum11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum12, arginfo_stub_arithmetic_addsum12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum13, arginfo_stub_arithmetic_addsum13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum14, arginfo_stub_arithmetic_addsum14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum15, arginfo_stub_arithmetic_addsum15, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum16, arginfo_stub_arithmetic_addsum16, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum17, arginfo_stub_arithmetic_addsum17, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum18, arginfo_stub_arithmetic_addsum18, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum19, arginfo_stub_arithmetic_addsum19, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum20, arginfo_stub_arithmetic_addsum20, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum21, arginfo_stub_arithmetic_addsum21, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum22, arginfo_stub_arithmetic_addsum22, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, addSum23, arginfo_stub_arithmetic_addsum23, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, addSum24, arginfo_stub_arithmetic_addsum24, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSub, arginfo_stub_arithmetic_intsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intLetSub, arginfo_stub_arithmetic_intletsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intLetSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSub2, arginfo_stub_arithmetic_intsub2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSub2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intSubSimple, arginfo_stub_arithmetic_intsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSub, arginfo_stub_arithmetic_boolsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool2Sub, arginfo_stub_arithmetic_bool2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool3Sub, arginfo_stub_arithmetic_bool3sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool3Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, bool4Sub, arginfo_stub_arithmetic_bool4sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, bool4Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, boolSubSimple, arginfo_stub_arithmetic_boolsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, boolSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSub, arginfo_stub_arithmetic_doublesub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, double2Sub, arginfo_stub_arithmetic_double2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, double2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSubSimple, arginfo_stub_arithmetic_doublesubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleSub2Simple, arginfo_stub_arithmetic_doublesub2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleSub2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSub, arginfo_stub_arithmetic_varsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varSubSimple, arginfo_stub_arithmetic_varsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSub, arginfo_stub_arithmetic_intdoublesub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intDoubleSubSimple, arginfo_stub_arithmetic_intdoublesubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intDoubleSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSub, arginfo_stub_arithmetic_doubleintsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, doubleIntSubSimple, arginfo_stub_arithmetic_doubleintsubsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, doubleIntSubSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, varIntSub, arginfo_stub_arithmetic_varintsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, varIntSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarSub, arginfo_stub_arithmetic_intvarsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCastSub, arginfo_stub_arithmetic_intvarimplicitcastsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCastSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sub, arginfo_stub_arithmetic_intvarimplicitcast2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complexSub, arginfo_stub_arithmetic_complexsub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complexSub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex2Sub, arginfo_stub_arithmetic_complex2sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex2Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex3Sub, arginfo_stub_arithmetic_complex3sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex3Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex4Sub, arginfo_stub_arithmetic_complex4sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex4Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex5Sub, arginfo_stub_arithmetic_complex5sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex5Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex6Sub, arginfo_stub_arithmetic_complex6sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex6Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex7Sub, arginfo_stub_arithmetic_complex7sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex7Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex9Sub, arginfo_stub_arithmetic_complex9sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex9Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex10Sub, arginfo_stub_arithmetic_complex10sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex10Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex11Sub, arginfo_stub_arithmetic_complex11sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex11Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex12Sub, arginfo_stub_arithmetic_complex12sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex12Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex13Sub, arginfo_stub_arithmetic_complex13sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex13Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex14Sub, arginfo_stub_arithmetic_complex14sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex14Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex15Sub, arginfo_stub_arithmetic_complex15sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex15Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex16Sub, arginfo_stub_arithmetic_complex16sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex16Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex17Sub, arginfo_stub_arithmetic_complex17sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex17Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex18Sub, arginfo_stub_arithmetic_complex18sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex18Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex19Sub, arginfo_stub_arithmetic_complex19sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex19Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex20Sub, arginfo_stub_arithmetic_complex20sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex20Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex21Sub, arginfo_stub_arithmetic_complex21sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex21Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex22Sub, arginfo_stub_arithmetic_complex22sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex22Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex23Sub, arginfo_stub_arithmetic_complex23sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex23Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, complex24Sub, arginfo_stub_arithmetic_complex24sub, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, complex24Sub, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub1, arginfo_stub_arithmetic_sub1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub2, arginfo_stub_arithmetic_sub2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub2b, arginfo_stub_arithmetic_sub2b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub2b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub3, arginfo_stub_arithmetic_sub3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub4, arginfo_stub_arithmetic_sub4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub5, arginfo_stub_arithmetic_sub5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub6, arginfo_stub_arithmetic_sub6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub7, arginfo_stub_arithmetic_sub7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub8, arginfo_stub_arithmetic_sub8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub8b, arginfo_stub_arithmetic_sub8b, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub8b, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub9, arginfo_stub_arithmetic_sub9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub10, arginfo_stub_arithmetic_sub10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub11, arginfo_stub_arithmetic_sub11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub12, arginfo_stub_arithmetic_sub12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub13, arginfo_stub_arithmetic_sub13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub14, arginfo_stub_arithmetic_sub14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub15, arginfo_stub_arithmetic_sub15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub15, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub16, arginfo_stub_arithmetic_sub16, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub16, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub17, arginfo_stub_arithmetic_sub17, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub17, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub18, arginfo_stub_arithmetic_sub18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub18, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub19, arginfo_stub_arithmetic_sub19, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub19, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub20, arginfo_stub_arithmetic_sub20, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub20, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub21, arginfo_stub_arithmetic_sub21, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub21, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub22, arginfo_stub_arithmetic_sub22, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub22, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, sub23, arginfo_stub_arithmetic_sub23, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, sub23, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, intSub, arginfo_stub_arithmetic_intsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intLetSub, arginfo_stub_arithmetic_intletsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intSub2, arginfo_stub_arithmetic_intsub2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intSubSimple, arginfo_stub_arithmetic_intsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSub, arginfo_stub_arithmetic_boolsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool2Sub, arginfo_stub_arithmetic_bool2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool3Sub, arginfo_stub_arithmetic_bool3sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, bool4Sub, arginfo_stub_arithmetic_bool4sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, boolSubSimple, arginfo_stub_arithmetic_boolsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSub, arginfo_stub_arithmetic_doublesub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, double2Sub, arginfo_stub_arithmetic_double2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSubSimple, arginfo_stub_arithmetic_doublesubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleSub2Simple, arginfo_stub_arithmetic_doublesub2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSub, arginfo_stub_arithmetic_varsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varSubSimple, arginfo_stub_arithmetic_varsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSub, arginfo_stub_arithmetic_intdoublesub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intDoubleSubSimple, arginfo_stub_arithmetic_intdoublesubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSub, arginfo_stub_arithmetic_doubleintsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, doubleIntSubSimple, arginfo_stub_arithmetic_doubleintsubsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, varIntSub, arginfo_stub_arithmetic_varintsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarSub, arginfo_stub_arithmetic_intvarsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCastSub, arginfo_stub_arithmetic_intvarimplicitcastsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, intVarImplicitCast2Sub, arginfo_stub_arithmetic_intvarimplicitcast2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complexSub, arginfo_stub_arithmetic_complexsub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex2Sub, arginfo_stub_arithmetic_complex2sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex3Sub, arginfo_stub_arithmetic_complex3sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex4Sub, arginfo_stub_arithmetic_complex4sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex5Sub, arginfo_stub_arithmetic_complex5sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex6Sub, arginfo_stub_arithmetic_complex6sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex7Sub, arginfo_stub_arithmetic_complex7sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex9Sub, arginfo_stub_arithmetic_complex9sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex10Sub, arginfo_stub_arithmetic_complex10sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex11Sub, arginfo_stub_arithmetic_complex11sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex12Sub, arginfo_stub_arithmetic_complex12sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex13Sub, arginfo_stub_arithmetic_complex13sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex14Sub, arginfo_stub_arithmetic_complex14sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex15Sub, arginfo_stub_arithmetic_complex15sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex16Sub, arginfo_stub_arithmetic_complex16sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex17Sub, arginfo_stub_arithmetic_complex17sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex18Sub, arginfo_stub_arithmetic_complex18sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex19Sub, arginfo_stub_arithmetic_complex19sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex20Sub, arginfo_stub_arithmetic_complex20sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex21Sub, arginfo_stub_arithmetic_complex21sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex22Sub, arginfo_stub_arithmetic_complex22sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex23Sub, arginfo_stub_arithmetic_complex23sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, complex24Sub, arginfo_stub_arithmetic_complex24sub, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub1, arginfo_stub_arithmetic_sub1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub2, arginfo_stub_arithmetic_sub2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub2b, arginfo_stub_arithmetic_sub2b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub3, arginfo_stub_arithmetic_sub3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub4, arginfo_stub_arithmetic_sub4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub5, arginfo_stub_arithmetic_sub5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub6, arginfo_stub_arithmetic_sub6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub7, arginfo_stub_arithmetic_sub7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub8, arginfo_stub_arithmetic_sub8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub8b, arginfo_stub_arithmetic_sub8b, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub9, arginfo_stub_arithmetic_sub9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub10, arginfo_stub_arithmetic_sub10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub11, arginfo_stub_arithmetic_sub11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub12, arginfo_stub_arithmetic_sub12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub13, arginfo_stub_arithmetic_sub13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub14, arginfo_stub_arithmetic_sub14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub15, arginfo_stub_arithmetic_sub15, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub16, arginfo_stub_arithmetic_sub16, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub17, arginfo_stub_arithmetic_sub17, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub18, arginfo_stub_arithmetic_sub18, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub19, arginfo_stub_arithmetic_sub19, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub20, arginfo_stub_arithmetic_sub20, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub21, arginfo_stub_arithmetic_sub21, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub22, arginfo_stub_arithmetic_sub22, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, sub23, arginfo_stub_arithmetic_sub23, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, sub24, arginfo_stub_arithmetic_sub24, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, mul1, arginfo_stub_arithmetic_mul1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, mul1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, mul1, arginfo_stub_arithmetic_mul1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, mul2, arginfo_stub_arithmetic_mul2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, mul3, arginfo_stub_arithmetic_mul3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, mul3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, less1, arginfo_stub_arithmetic_less1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, less1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, less2, arginfo_stub_arithmetic_less2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, less2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, mul3, arginfo_stub_arithmetic_mul3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, less1, arginfo_stub_arithmetic_less1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, less2, arginfo_stub_arithmetic_less2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, less3, arginfo_stub_arithmetic_less3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, less4, arginfo_stub_arithmetic_less4, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, greater1, arginfo_stub_arithmetic_greater1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, greater1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, greater2, arginfo_stub_arithmetic_greater2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, greater2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, greater1, arginfo_stub_arithmetic_greater1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, greater2, arginfo_stub_arithmetic_greater2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, greater3, arginfo_stub_arithmetic_greater3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, greater4, arginfo_stub_arithmetic_greater4, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, letStatementIntMinus, arginfo_stub_arithmetic_letstatementintminus, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, letStatementIntMinus, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, declaredIntMinus, arginfo_stub_arithmetic_declaredintminus, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, declaredIntMinus, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, letStatementIntMinus, arginfo_stub_arithmetic_letstatementintminus, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, declaredIntMinus, arginfo_stub_arithmetic_declaredintminus, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, letStatementBoolMinus, arginfo_stub_arithmetic_letstatementboolminus, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, letStatementVarMinus, arginfo_stub_arithmetic_letstatementvarminus, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, div1, arginfo_stub_arithmetic_div1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, div1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Arithmetic, div2, arginfo_stub_arithmetic_div2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Arithmetic, div2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Arithmetic, div1, arginfo_stub_arithmetic_div1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Arithmetic, div2, arginfo_stub_arithmetic_div2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, absParam, arginfo_stub_arithmetic_absparam, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, negativeInt, arginfo_stub_arithmetic_negativeint, ZEND_ACC_PUBLIC) PHP_ME(Stub_Arithmetic, negativeLong, arginfo_stub_arithmetic_negativelong, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayaccessarr.zep.c b/ext/stub/arrayaccessarr.zep.c index e498d4e969..9e7a20078f 100644 --- a/ext/stub/arrayaccessarr.zep.c +++ b/ext/stub/arrayaccessarr.zep.c @@ -54,13 +54,10 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetSet) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(offset) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); @@ -81,12 +78,9 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetExists) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &offset); @@ -104,12 +98,9 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetUnset) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &offset); @@ -131,12 +122,9 @@ PHP_METHOD(Stub_ArrayAccessArr, offsetGet) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/arrayaccessarr.zep.h b/ext/stub/arrayaccessarr.zep.h index a57fea4256..aa15473bba 100644 --- a/ext/stub/arrayaccessarr.zep.h +++ b/ext/stub/arrayaccessarr.zep.h @@ -27,20 +27,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetunset, ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 0, 1) -#endif ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccessarr_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessArr, __construct, arginfo_stub_arrayaccessarr___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ArrayAccessArr, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ArrayAccessArr, __construct, arginfo_stub_arrayaccessarr___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ArrayAccessArr, offsetSet, arginfo_stub_arrayaccessarr_offsetset, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessArr, offsetExists, arginfo_stub_arrayaccessarr_offsetexists, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessArr, offsetUnset, arginfo_stub_arrayaccessarr_offsetunset, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayaccessobj.zep.c b/ext/stub/arrayaccessobj.zep.c index 5c7fa4dd25..923a9ab603 100644 --- a/ext/stub/arrayaccessobj.zep.c +++ b/ext/stub/arrayaccessobj.zep.c @@ -65,20 +65,17 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetSet) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&obj); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(offset) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &offset, &value); - ZEPHIR_OBS_VAR(&obj); + zephir_memory_observe(&obj); zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); if (!(Z_TYPE_P(offset) == IS_NULL)) { zephir_update_property_zval_zval(&obj, offset, value); @@ -96,19 +93,16 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetExists) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&obj); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &offset); - ZEPHIR_OBS_VAR(&obj); + zephir_memory_observe(&obj); zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); RETURN_MM_BOOL(zephir_isset_property_zval(&obj, offset)); } @@ -124,19 +118,16 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &offset); - ZEPHIR_OBS_VAR(&obj); + zephir_memory_observe(&obj); zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); zephir_get_arrval(&_0, &obj); ZEPHIR_CPY_WRT(&obj, &_0); @@ -157,12 +148,9 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetGet) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -172,7 +160,7 @@ 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_isset_property_zval(&_1, offset)) { - ZEPHIR_OBS_VAR(&_2); + zephir_memory_observe(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); zephir_read_property_zval(&_0, &_2, offset, PH_NOISY_CC); } else { diff --git a/ext/stub/arrayaccessobj.zep.h b/ext/stub/arrayaccessobj.zep.h index 590a96238b..6771b56479 100644 --- a/ext/stub/arrayaccessobj.zep.h +++ b/ext/stub/arrayaccessobj.zep.h @@ -27,20 +27,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetunset, ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 0, 1) -#endif ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccessobj_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessObj, __construct, arginfo_stub_arrayaccessobj___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ArrayAccessObj, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ArrayAccessObj, __construct, arginfo_stub_arrayaccessobj___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ArrayAccessObj, offsetSet, arginfo_stub_arrayaccessobj_offsetset, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessObj, offsetExists, arginfo_stub_arrayaccessobj_offsetexists, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessObj, offsetUnset, arginfo_stub_arrayaccessobj_offsetunset, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index c1df0c7072..087897b422 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -83,13 +83,10 @@ PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromArray) ZVAL_UNDEF(&key); ZVAL_UNDEF(&data); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(key) Z_PARAM_ARRAY(data) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -121,13 +118,10 @@ PHP_METHOD(Stub_ArrayAccessTest, unsetByKeyFromProperty) ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&dataFromProperty); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(key) Z_PARAM_ARRAY(dataFromProperty) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -169,7 +163,7 @@ PHP_METHOD(Stub_ArrayAccessTest, issue645) ZEPHIR_INIT_VAR(&_0); array_init(&_0); zephir_update_property_zval(this_ptr, ZEND_STRL("data"), &_0); - ZEPHIR_OBS_VAR(&_1); + zephir_memory_observe(&_1); zephir_read_property(&_1, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); RETURN_CCTOR(&_1); } @@ -216,13 +210,11 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test1) zval *this_ptr = getThis(); ZVAL_UNDEF(&items); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(items) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -246,13 +238,11 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test2) zval *this_ptr = getThis(); ZVAL_UNDEF(&items); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(items) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -277,13 +267,11 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1094Test3) zval *this_ptr = getThis(); ZVAL_UNDEF(&items); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(items) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -311,12 +299,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086Strict) ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -369,12 +354,9 @@ PHP_METHOD(Stub_ArrayAccessTest, issue1086NotStrictParams) ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(params) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/arrayaccesstest.zep.h b/ext/stub/arrayaccesstest.zep.h index 4a4542a78e..90389bfe7a 100644 --- a/ext/stub/arrayaccesstest.zep.h +++ b/ext/stub/arrayaccesstest.zep.h @@ -44,27 +44,15 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1155, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test1, 0, 0, _IS_BOOL, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, items, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test2, 0, 0, _IS_BOOL, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, items, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccesstest_issue1094test3, 0, 0, _IS_BOOL, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, items, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, items, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_issue1086strict, 0, 0, 1) @@ -94,16 +82,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccesstest_zephir_init_properties_stub_ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayaccesstest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessTest, exits, arginfo_stub_arrayaccesstest_exits, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_ArrayAccessTest, exits, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayAccessTest, get, arginfo_stub_arrayaccesstest_get, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_ArrayAccessTest, get, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_ArrayAccessTest, exits, arginfo_stub_arrayaccesstest_exits, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_ArrayAccessTest, get, arginfo_stub_arrayaccesstest_get, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_ArrayAccessTest, unsetByKeyFromArray, arginfo_stub_arrayaccesstest_unsetbykeyfromarray, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, unsetByKeyFromProperty, arginfo_stub_arrayaccesstest_unsetbykeyfromproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayAccessTest, issue645, arginfo_stub_arrayaccesstest_issue645, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayiterator.zep.c b/ext/stub/arrayiterator.zep.c index 6845cdb52f..17987551a2 100644 --- a/ext/stub/arrayiterator.zep.c +++ b/ext/stub/arrayiterator.zep.c @@ -87,7 +87,7 @@ PHP_METHOD(Stub_ArrayIterator, current) ZEPHIR_MM_GROW(); zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&_2); + zephir_memory_observe(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("position"), PH_NOISY_CC); zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "stub/arrayiterator.zep", 25); RETURN_CTOR(&_1); diff --git a/ext/stub/arrayiterator.zep.h b/ext/stub/arrayiterator.zep.h index f912b09eb7..6fe2566171 100644 --- a/ext/stub/arrayiterator.zep.h +++ b/ext/stub/arrayiterator.zep.h @@ -16,18 +16,10 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_next, 0, 0, IS_VOID, 0) @@ -37,11 +29,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_valid, 0, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayiterator_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayIterator, __construct, arginfo_stub_arrayiterator___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ArrayIterator, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ArrayIterator, __construct, arginfo_stub_arrayiterator___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ArrayIterator, rewind, arginfo_stub_arrayiterator_rewind, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayIterator, current, arginfo_stub_arrayiterator_current, ZEND_ACC_PUBLIC) PHP_ME(Stub_ArrayIterator, key, arginfo_stub_arrayiterator_key, ZEND_ACC_PUBLIC) diff --git a/ext/stub/arrayiteratortest.zep.h b/ext/stub/arrayiteratortest.zep.h index 033327a2d3..d458b8c7da 100644 --- a/ext/stub/arrayiteratortest.zep.h +++ b/ext/stub/arrayiteratortest.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiteratortest_test, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayiteratortest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArrayIteratorTest, test, arginfo_stub_arrayiteratortest_test, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_ArrayIteratorTest, test, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_ArrayIteratorTest, test, arginfo_stub_arrayiteratortest_test, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/arraysearch.zep.c b/ext/stub/arraysearch.zep.c index a988b1119e..091e2a7ecb 100644 --- a/ext/stub/arraysearch.zep.c +++ b/ext/stub/arraysearch.zep.c @@ -39,15 +39,12 @@ PHP_METHOD(Stub_ArraySearch, simpleSearch) ZVAL_UNDEF(&needle_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&haystack); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_ZVAL(needle) Z_PARAM_ARRAY(haystack) Z_PARAM_OPTIONAL Z_PARAM_BOOL(strict) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/arraysearch.zep.h b/ext/stub/arraysearch.zep.h index d34e1d8511..f71f0393f1 100644 --- a/ext/stub/arraysearch.zep.h +++ b/ext/stub/arraysearch.zep.h @@ -17,10 +17,6 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arraysearch_method_entry) { PHP_ME(Stub_ArraySearch, simpleSearch, arginfo_stub_arraysearch_simplesearch, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ArraySearch, searchUsingArrayInsideZephir, arginfo_stub_arraysearch_searchusingarrayinsidezephir, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArraySearch, searchUsingArrayInsideZephir, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ArraySearch, searchUsingArrayInsideZephir, arginfo_stub_arraysearch_searchusingarrayinsidezephir, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/assign.zep.c b/ext/stub/assign.zep.c index bb7cae62a4..768a96c410 100644 --- a/ext/stub/assign.zep.c +++ b/ext/stub/assign.zep.c @@ -576,12 +576,9 @@ PHP_METHOD(Stub_Assign, testAssign38) ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&arr); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -655,12 +652,9 @@ PHP_METHOD(Stub_Assign, testAssign41) zend_long num, a = 0; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -681,12 +675,9 @@ PHP_METHOD(Stub_Assign, testAssign42) zend_long num, a = 0; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -704,12 +695,9 @@ PHP_METHOD(Stub_Assign, testAssign43) zend_long num, a = 0; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -727,12 +715,9 @@ PHP_METHOD(Stub_Assign, testAssign44) zend_long num, a = 0; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -1217,12 +1202,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray4) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1266,12 +1248,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray5) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1390,12 +1369,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray8) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1438,12 +1414,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray9) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1488,12 +1461,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray10) ZVAL_BOOL(&__$true, 1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1540,12 +1510,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray11) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1593,12 +1560,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray12) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1614,9 +1578,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray12) zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$null, SL("zza"), 3, index, index); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$false, SL("zza"), 3, index, index); zephir_read_property(&_2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&temp1); + zephir_memory_observe(&temp1); zephir_array_fetch(&temp1, &_2, index, PH_NOISY, "stub/assign.zep", 657); - ZEPHIR_OBS_VAR(&temp2); + zephir_memory_observe(&temp2); zephir_read_property(&temp2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$true, SL("zza"), 3, index, index); ZEPHIR_INIT_VAR(&_3); @@ -1654,12 +1618,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray13) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1675,9 +1636,9 @@ PHP_METHOD(Stub_Assign, testPropertyArray13) zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$null, SL("za"), 2, index); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$false, SL("za"), 2, index); zephir_read_property(&_2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&temp1); + zephir_memory_observe(&temp1); zephir_array_fetch(&temp1, &_2, index, PH_NOISY, "stub/assign.zep", 674); - ZEPHIR_OBS_VAR(&temp2); + zephir_memory_observe(&temp2); zephir_read_property(&temp2, this_ptr, ZEND_STRL("myArray"), PH_NOISY_CC); zephir_update_property_array_multi(this_ptr, SL("myArray"), &__$true, SL("za"), 2, index); ZEPHIR_INIT_VAR(&_3); @@ -1942,12 +1903,9 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArray3) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2108,12 +2066,9 @@ PHP_METHOD(Stub_Assign, testStaticPropertyArrayMutli3) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2245,13 +2200,10 @@ PHP_METHOD(Stub_Assign, testArrayVarAssign1) ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2273,13 +2225,10 @@ PHP_METHOD(Stub_Assign, testArrayVarAssign2) ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2301,13 +2250,10 @@ PHP_METHOD(Stub_Assign, testArrayProperty) ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2331,13 +2277,10 @@ PHP_METHOD(Stub_Assign, testGlobalVarAssign) ZVAL_UNDEF(&index_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_get_global(&_POST, SL("_POST")); @@ -2421,13 +2364,10 @@ PHP_METHOD(Stub_Assign, testAssignBitwiseX) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/assign.zep.h b/ext/stub/assign.zep.h index 9a46eec1ef..f234b6b4e0 100644 --- a/ext/stub/assign.zep.h +++ b/ext/stub/assign.zep.h @@ -406,16 +406,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_assign_issue597, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_assign_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, getTestVar, arginfo_stub_assign_gettestvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, getTestVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, getMyArray, arginfo_stub_assign_getmyarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, getMyArray, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, getTestVar, arginfo_stub_assign_gettestvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, getMyArray, arginfo_stub_assign_getmyarray, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign1, arginfo_stub_assign_testassign1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign2, arginfo_stub_assign_testassign2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign3, arginfo_stub_assign_testassign3, ZEND_ACC_PUBLIC) @@ -460,185 +452,53 @@ ZEPHIR_INIT_FUNCS(stub_assign_method_entry) { PHP_ME(Stub_Assign, testAssign42, arginfo_stub_assign_testassign42, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign43, arginfo_stub_assign_testassign43, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssign44, arginfo_stub_assign_testassign44, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssign1, arginfo_stub_assign_testpropertyassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssign2, arginfo_stub_assign_testpropertyassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyIncr1, arginfo_stub_assign_testpropertyincr1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyIncr1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAddAssign1, arginfo_stub_assign_testpropertyaddassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAddAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAddAssign2, arginfo_stub_assign_testpropertyaddassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAddAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssignValuePlus1, arginfo_stub_assign_testpropertyassignvalueplus1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssignValuePlus1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyDecr, arginfo_stub_assign_testpropertydecr, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyDecr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertySubAssign1, arginfo_stub_assign_testpropertysubassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertySubAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertySubAssign2, arginfo_stub_assign_testpropertysubassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertySubAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyMulAssign1, arginfo_stub_assign_testpropertymulassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyMulAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyMulAssign2, arginfo_stub_assign_testpropertymulassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyMulAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyAssignStringConcat, arginfo_stub_assign_testpropertyassignstringconcat, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyAssignStringConcat, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray1, arginfo_stub_assign_testpropertyarray1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray2, arginfo_stub_assign_testpropertyarray2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray3, arginfo_stub_assign_testpropertyarray3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testPropertyAssign1, arginfo_stub_assign_testpropertyassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAssign2, arginfo_stub_assign_testpropertyassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyIncr1, arginfo_stub_assign_testpropertyincr1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAddAssign1, arginfo_stub_assign_testpropertyaddassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAddAssign2, arginfo_stub_assign_testpropertyaddassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAssignValuePlus1, arginfo_stub_assign_testpropertyassignvalueplus1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyDecr, arginfo_stub_assign_testpropertydecr, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertySubAssign1, arginfo_stub_assign_testpropertysubassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertySubAssign2, arginfo_stub_assign_testpropertysubassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyMulAssign1, arginfo_stub_assign_testpropertymulassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyMulAssign2, arginfo_stub_assign_testpropertymulassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyAssignStringConcat, arginfo_stub_assign_testpropertyassignstringconcat, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray1, arginfo_stub_assign_testpropertyarray1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray2, arginfo_stub_assign_testpropertyarray2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray3, arginfo_stub_assign_testpropertyarray3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray4, arginfo_stub_assign_testpropertyarray4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray5, arginfo_stub_assign_testpropertyarray5, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray6, arginfo_stub_assign_testpropertyarray6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray7, arginfo_stub_assign_testpropertyarray7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray7, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testPropertyArray6, arginfo_stub_assign_testpropertyarray6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testPropertyArray7, arginfo_stub_assign_testpropertyarray7, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray8, arginfo_stub_assign_testpropertyarray8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray9, arginfo_stub_assign_testpropertyarray9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray10, arginfo_stub_assign_testpropertyarray10, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray11, arginfo_stub_assign_testpropertyarray11, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray12, arginfo_stub_assign_testpropertyarray12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testPropertyArray13, arginfo_stub_assign_testpropertyarray13, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testPropertyArray14, arginfo_stub_assign_testpropertyarray14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testPropertyArray14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyAssign1, arginfo_stub_assign_teststaticpropertyassign1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyAssign1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyAssign2, arginfo_stub_assign_teststaticpropertyassign2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyAssign2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArray1, arginfo_stub_assign_teststaticpropertyarray1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArray1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArray2, arginfo_stub_assign_teststaticpropertyarray2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArray2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testPropertyArray14, arginfo_stub_assign_testpropertyarray14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyAssign1, arginfo_stub_assign_teststaticpropertyassign1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyAssign2, arginfo_stub_assign_teststaticpropertyassign2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArray1, arginfo_stub_assign_teststaticpropertyarray1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArray2, arginfo_stub_assign_teststaticpropertyarray2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testStaticPropertyArray3, arginfo_stub_assign_teststaticpropertyarray3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend, arginfo_stub_assign_teststaticpropertyarrayappend, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli1, arginfo_stub_assign_teststaticpropertyarraymutli1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli2, arginfo_stub_assign_teststaticpropertyarraymutli2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayMutli2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testStaticPropertyArrayAppend, arginfo_stub_assign_teststaticpropertyarrayappend, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArrayMutli1, arginfo_stub_assign_teststaticpropertyarraymutli1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArrayMutli2, arginfo_stub_assign_teststaticpropertyarraymutli2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testStaticPropertyArrayMutli3, arginfo_stub_assign_teststaticpropertyarraymutli3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayMulti4, arginfo_stub_assign_teststaticpropertyarraymulti4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayMulti4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend1, arginfo_stub_assign_teststaticpropertyarrayappend1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testStaticPropertyArrayAppend1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testStaticPropertyArrayMulti4, arginfo_stub_assign_teststaticpropertyarraymulti4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testStaticPropertyArrayAppend1, arginfo_stub_assign_teststaticpropertyarrayappend1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testArrayVarAssign1, arginfo_stub_assign_testarrayvarassign1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testArrayVarAssign2, arginfo_stub_assign_testarrayvarassign2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testArrayProperty, arginfo_stub_assign_testarrayproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testGlobalVarAssign, arginfo_stub_assign_testglobalvarassign, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testConstantKeyAssign, arginfo_stub_assign_testconstantkeyassign, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testConstantKeyAssign, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testArrayBoolExpressionAssign, arginfo_stub_assign_testarrayboolexpressionassign, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testArrayBoolExpressionAssign, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testConstantKeyAssign, arginfo_stub_assign_testconstantkeyassign, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testArrayBoolExpressionAssign, arginfo_stub_assign_testarrayboolexpressionassign, ZEND_ACC_PUBLIC) PHP_ME(Stub_Assign, testAssignBitwiseX, arginfo_stub_assign_testassignbitwisex, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testAssignSuperGlobals, arginfo_stub_assign_testassignsuperglobals, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testAssignSuperGlobals, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testAssignSuperGlobalsSERVER, arginfo_stub_assign_testassignsuperglobalsserver, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testAssignSuperGlobalsSERVER, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, arginfo_stub_assign_testassignsuperglobalsget, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Assign, issue597, arginfo_stub_assign_issue597, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Assign, issue597, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Assign, testAssignSuperGlobals, arginfo_stub_assign_testassignsuperglobals, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testAssignSuperGlobalsSERVER, arginfo_stub_assign_testassignsuperglobalsserver, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, testAssignSuperGlobalsGET, arginfo_stub_assign_testassignsuperglobalsget, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Assign, issue597, arginfo_stub_assign_issue597, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/bench/foo.zep.c b/ext/stub/bench/foo.zep.c index 4e3cc024fd..ae53455d0f 100644 --- a/ext/stub/bench/foo.zep.c +++ b/ext/stub/bench/foo.zep.c @@ -40,12 +40,9 @@ PHP_METHOD(Stub_Bench_Foo, emptyForInRange) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -84,12 +81,9 @@ PHP_METHOD(Stub_Bench_Foo, readStatic) ZVAL_UNDEF(&x); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -130,12 +124,9 @@ PHP_METHOD(Stub_Bench_Foo, writeStatic) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -176,12 +167,9 @@ PHP_METHOD(Stub_Bench_Foo, issetStatic) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -221,12 +209,9 @@ PHP_METHOD(Stub_Bench_Foo, emptyStatic) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -268,12 +253,9 @@ PHP_METHOD(Stub_Bench_Foo, readProp) ZVAL_UNDEF(&x); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -313,12 +295,9 @@ PHP_METHOD(Stub_Bench_Foo, writeProp) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -361,12 +340,9 @@ PHP_METHOD(Stub_Bench_Foo, assignAddProp) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -425,12 +401,9 @@ PHP_METHOD(Stub_Bench_Foo, postIncProp) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -469,12 +442,9 @@ PHP_METHOD(Stub_Bench_Foo, postDecProp) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -513,12 +483,9 @@ PHP_METHOD(Stub_Bench_Foo, issetProp) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -558,12 +525,9 @@ PHP_METHOD(Stub_Bench_Foo, emptyProp) ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -613,12 +577,9 @@ PHP_METHOD(Stub_Bench_Foo, call) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -676,12 +637,9 @@ PHP_METHOD(Stub_Bench_Foo, scall) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -722,12 +680,9 @@ PHP_METHOD(Stub_Bench_Foo, scallWithReturnTrue) ZVAL_UNDEF(&n_sub); ZVAL_UNDEF(&i); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -768,12 +723,9 @@ PHP_METHOD(Stub_Bench_Foo, readConst) ZVAL_UNDEF(&i); ZVAL_UNDEF(&x); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/bench/foo.zep.h b/ext/stub/bench/foo.zep.h index e138460b1d..a03af29b58 100644 --- a/ext/stub/bench/foo.zep.h +++ b/ext/stub/bench/foo.zep.h @@ -109,11 +109,7 @@ ZEPHIR_INIT_FUNCS(stub_bench_foo_method_entry) { PHP_ME(Stub_Bench_Foo, postDecProp, arginfo_stub_bench_foo_postdecprop, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, issetProp, arginfo_stub_bench_foo_issetprop, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, emptyProp, arginfo_stub_bench_foo_emptyprop, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bench_Foo, g, arginfo_stub_bench_foo_g, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bench_Foo, g, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Bench_Foo, g, arginfo_stub_bench_foo_g, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, call, arginfo_stub_bench_foo_call, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, staticMethod, arginfo_stub_bench_foo_staticmethod, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) PHP_ME(Stub_Bench_Foo, staticMethod1, arginfo_stub_bench_foo_staticmethod1, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) diff --git a/ext/stub/bitwise.zep.c b/ext/stub/bitwise.zep.c index 8e36c8a37f..52e268ff2d 100644 --- a/ext/stub/bitwise.zep.c +++ b/ext/stub/bitwise.zep.c @@ -1404,12 +1404,9 @@ PHP_METHOD(Stub_Bitwise, testBitwiseNot) zend_long a; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a_param); @@ -1425,13 +1422,10 @@ PHP_METHOD(Stub_Bitwise, testBitwiseAndNot) zend_long a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); @@ -1448,12 +1442,9 @@ PHP_METHOD(Stub_Bitwise, getInt) zend_long num; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); diff --git a/ext/stub/bitwise.zep.h b/ext/stub/bitwise.zep.h index cc94f5ccdc..7aebc38e11 100644 --- a/ext/stub/bitwise.zep.h +++ b/ext/stub/bitwise.zep.h @@ -405,488 +405,104 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_bitwise_testbitwisexor, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_bitwise_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intAnd, arginfo_stub_bitwise_intand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2And, arginfo_stub_bitwise_int2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intAndSimple, arginfo_stub_bitwise_intandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolAnd, arginfo_stub_bitwise_booland, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool2And, arginfo_stub_bitwise_bool2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool3And, arginfo_stub_bitwise_bool3and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool3And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolAndSimple, arginfo_stub_bitwise_boolandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleAnd, arginfo_stub_bitwise_doubleand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, double2And, arginfo_stub_bitwise_double2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, double2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleAndSimple, arginfo_stub_bitwise_doubleandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleAnd2Simple, arginfo_stub_bitwise_doubleand2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleAnd2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varAnd, arginfo_stub_bitwise_varand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varAndSimple, arginfo_stub_bitwise_varandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleAnd, arginfo_stub_bitwise_intdoubleand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleAndSimple, arginfo_stub_bitwise_intdoubleandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntAnd, arginfo_stub_bitwise_doubleintand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntAndSimple, arginfo_stub_bitwise_doubleintandsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntAndSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varIntAnd, arginfo_stub_bitwise_varintand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varIntAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarAnd, arginfo_stub_bitwise_intvarand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCastAnd, arginfo_stub_bitwise_intvarimplicitcastand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCastAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCast2And, arginfo_stub_bitwise_intvarimplicitcast2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCast2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complexAnd, arginfo_stub_bitwise_complexand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complexAnd, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex2And, arginfo_stub_bitwise_complex2and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex2And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex3And, arginfo_stub_bitwise_complex3and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex3And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex4And, arginfo_stub_bitwise_complex4and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex4And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex5And, arginfo_stub_bitwise_complex5and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex5And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex6And, arginfo_stub_bitwise_complex6and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex6And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex7And, arginfo_stub_bitwise_complex7and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex7And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex9And, arginfo_stub_bitwise_complex9and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex9And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex10And, arginfo_stub_bitwise_complex10and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex10And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex11And, arginfo_stub_bitwise_complex11and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex11And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex12And, arginfo_stub_bitwise_complex12and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex12And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex13And, arginfo_stub_bitwise_complex13and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex13And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex14And, arginfo_stub_bitwise_complex14and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex14And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex15And, arginfo_stub_bitwise_complex15and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex15And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex16And, arginfo_stub_bitwise_complex16and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex16And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex17And, arginfo_stub_bitwise_complex17and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex17And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex18And, arginfo_stub_bitwise_complex18and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex18And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex19And, arginfo_stub_bitwise_complex19and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex19And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex20And, arginfo_stub_bitwise_complex20and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex20And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex21And, arginfo_stub_bitwise_complex21and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex21And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex22And, arginfo_stub_bitwise_complex22and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex22And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex23And, arginfo_stub_bitwise_complex23and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex23And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex24And, arginfo_stub_bitwise_complex24and, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex24And, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intOr, arginfo_stub_bitwise_intor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2Or, arginfo_stub_bitwise_int2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intOrSimple, arginfo_stub_bitwise_intorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolOr, arginfo_stub_bitwise_boolor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool2Or, arginfo_stub_bitwise_bool2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool3Or, arginfo_stub_bitwise_bool3or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool3Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, bool4Or, arginfo_stub_bitwise_bool4or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, bool4Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, boolOrSimple, arginfo_stub_bitwise_boolorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, boolOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleOr, arginfo_stub_bitwise_doubleor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, double2Or, arginfo_stub_bitwise_double2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, double2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleOrSimple, arginfo_stub_bitwise_doubleorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleOr2Simple, arginfo_stub_bitwise_doubleor2simple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleOr2Simple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varOr, arginfo_stub_bitwise_varor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varOrSimple, arginfo_stub_bitwise_varorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleOr, arginfo_stub_bitwise_intdoubleor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intDoubleOrSimple, arginfo_stub_bitwise_intdoubleorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intDoubleOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntOr, arginfo_stub_bitwise_doubleintor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, doubleIntOrSimple, arginfo_stub_bitwise_doubleintorsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, doubleIntOrSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, varIntOr, arginfo_stub_bitwise_varintor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, varIntOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarOr, arginfo_stub_bitwise_intvaror, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCastOr, arginfo_stub_bitwise_intvarimplicitcastor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCastOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intVarImplicitCast2Or, arginfo_stub_bitwise_intvarimplicitcast2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intVarImplicitCast2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complexOr, arginfo_stub_bitwise_complexor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complexOr, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex2Or, arginfo_stub_bitwise_complex2or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex2Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex3Or, arginfo_stub_bitwise_complex3or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex3Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex4Or, arginfo_stub_bitwise_complex4or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex4Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex5Or, arginfo_stub_bitwise_complex5or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex5Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex6Or, arginfo_stub_bitwise_complex6or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex6Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex7Or, arginfo_stub_bitwise_complex7or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex7Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex9Or, arginfo_stub_bitwise_complex9or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex9Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex10Or, arginfo_stub_bitwise_complex10or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex10Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex11Or, arginfo_stub_bitwise_complex11or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex11Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex12Or, arginfo_stub_bitwise_complex12or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex12Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex13Or, arginfo_stub_bitwise_complex13or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex13Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex14Or, arginfo_stub_bitwise_complex14or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex14Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex15Or, arginfo_stub_bitwise_complex15or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex15Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex16Or, arginfo_stub_bitwise_complex16or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex16Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex17Or, arginfo_stub_bitwise_complex17or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex17Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex18Or, arginfo_stub_bitwise_complex18or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex18Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex19Or, arginfo_stub_bitwise_complex19or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex19Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex20Or, arginfo_stub_bitwise_complex20or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex20Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex21Or, arginfo_stub_bitwise_complex21or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex21Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex22Or, arginfo_stub_bitwise_complex22or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex22Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex23Or, arginfo_stub_bitwise_complex23or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex23Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, complex24Or, arginfo_stub_bitwise_complex24or, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, complex24Or, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftLeft, arginfo_stub_bitwise_intshiftleft, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftLeft, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2ShiftLeft, arginfo_stub_bitwise_int2shiftleft, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2ShiftLeft, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftLeftSimple, arginfo_stub_bitwise_intshiftleftsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftLeftSimple, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftRight, arginfo_stub_bitwise_intshiftright, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftRight, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, int2ShiftRight, arginfo_stub_bitwise_int2shiftright, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, int2ShiftRight, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, intShiftRightSimple, arginfo_stub_bitwise_intshiftrightsimple, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, intShiftRightSimple, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Bitwise, intAnd, arginfo_stub_bitwise_intand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2And, arginfo_stub_bitwise_int2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intAndSimple, arginfo_stub_bitwise_intandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolAnd, arginfo_stub_bitwise_booland, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool2And, arginfo_stub_bitwise_bool2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool3And, arginfo_stub_bitwise_bool3and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolAndSimple, arginfo_stub_bitwise_boolandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleAnd, arginfo_stub_bitwise_doubleand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, double2And, arginfo_stub_bitwise_double2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleAndSimple, arginfo_stub_bitwise_doubleandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleAnd2Simple, arginfo_stub_bitwise_doubleand2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varAnd, arginfo_stub_bitwise_varand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varAndSimple, arginfo_stub_bitwise_varandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleAnd, arginfo_stub_bitwise_intdoubleand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleAndSimple, arginfo_stub_bitwise_intdoubleandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntAnd, arginfo_stub_bitwise_doubleintand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntAndSimple, arginfo_stub_bitwise_doubleintandsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varIntAnd, arginfo_stub_bitwise_varintand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarAnd, arginfo_stub_bitwise_intvarand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCastAnd, arginfo_stub_bitwise_intvarimplicitcastand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCast2And, arginfo_stub_bitwise_intvarimplicitcast2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complexAnd, arginfo_stub_bitwise_complexand, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex2And, arginfo_stub_bitwise_complex2and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex3And, arginfo_stub_bitwise_complex3and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex4And, arginfo_stub_bitwise_complex4and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex5And, arginfo_stub_bitwise_complex5and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex6And, arginfo_stub_bitwise_complex6and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex7And, arginfo_stub_bitwise_complex7and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex9And, arginfo_stub_bitwise_complex9and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex10And, arginfo_stub_bitwise_complex10and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex11And, arginfo_stub_bitwise_complex11and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex12And, arginfo_stub_bitwise_complex12and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex13And, arginfo_stub_bitwise_complex13and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex14And, arginfo_stub_bitwise_complex14and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex15And, arginfo_stub_bitwise_complex15and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex16And, arginfo_stub_bitwise_complex16and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex17And, arginfo_stub_bitwise_complex17and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex18And, arginfo_stub_bitwise_complex18and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex19And, arginfo_stub_bitwise_complex19and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex20And, arginfo_stub_bitwise_complex20and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex21And, arginfo_stub_bitwise_complex21and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex22And, arginfo_stub_bitwise_complex22and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex23And, arginfo_stub_bitwise_complex23and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex24And, arginfo_stub_bitwise_complex24and, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intOr, arginfo_stub_bitwise_intor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2Or, arginfo_stub_bitwise_int2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intOrSimple, arginfo_stub_bitwise_intorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolOr, arginfo_stub_bitwise_boolor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool2Or, arginfo_stub_bitwise_bool2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool3Or, arginfo_stub_bitwise_bool3or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, bool4Or, arginfo_stub_bitwise_bool4or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, boolOrSimple, arginfo_stub_bitwise_boolorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleOr, arginfo_stub_bitwise_doubleor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, double2Or, arginfo_stub_bitwise_double2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleOrSimple, arginfo_stub_bitwise_doubleorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleOr2Simple, arginfo_stub_bitwise_doubleor2simple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varOr, arginfo_stub_bitwise_varor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varOrSimple, arginfo_stub_bitwise_varorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleOr, arginfo_stub_bitwise_intdoubleor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intDoubleOrSimple, arginfo_stub_bitwise_intdoubleorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntOr, arginfo_stub_bitwise_doubleintor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, doubleIntOrSimple, arginfo_stub_bitwise_doubleintorsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, varIntOr, arginfo_stub_bitwise_varintor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarOr, arginfo_stub_bitwise_intvaror, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCastOr, arginfo_stub_bitwise_intvarimplicitcastor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intVarImplicitCast2Or, arginfo_stub_bitwise_intvarimplicitcast2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complexOr, arginfo_stub_bitwise_complexor, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex2Or, arginfo_stub_bitwise_complex2or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex3Or, arginfo_stub_bitwise_complex3or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex4Or, arginfo_stub_bitwise_complex4or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex5Or, arginfo_stub_bitwise_complex5or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex6Or, arginfo_stub_bitwise_complex6or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex7Or, arginfo_stub_bitwise_complex7or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex9Or, arginfo_stub_bitwise_complex9or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex10Or, arginfo_stub_bitwise_complex10or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex11Or, arginfo_stub_bitwise_complex11or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex12Or, arginfo_stub_bitwise_complex12or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex13Or, arginfo_stub_bitwise_complex13or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex14Or, arginfo_stub_bitwise_complex14or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex15Or, arginfo_stub_bitwise_complex15or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex16Or, arginfo_stub_bitwise_complex16or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex17Or, arginfo_stub_bitwise_complex17or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex18Or, arginfo_stub_bitwise_complex18or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex19Or, arginfo_stub_bitwise_complex19or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex20Or, arginfo_stub_bitwise_complex20or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex21Or, arginfo_stub_bitwise_complex21or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex22Or, arginfo_stub_bitwise_complex22or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex23Or, arginfo_stub_bitwise_complex23or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, complex24Or, arginfo_stub_bitwise_complex24or, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftLeft, arginfo_stub_bitwise_intshiftleft, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2ShiftLeft, arginfo_stub_bitwise_int2shiftleft, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftLeftSimple, arginfo_stub_bitwise_intshiftleftsimple, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftRight, arginfo_stub_bitwise_intshiftright, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, int2ShiftRight, arginfo_stub_bitwise_int2shiftright, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Bitwise, intShiftRightSimple, arginfo_stub_bitwise_intshiftrightsimple, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bitwise, testBitwiseNot, arginfo_stub_bitwise_testbitwisenot, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bitwise, testBitwiseAndNot, arginfo_stub_bitwise_testbitwiseandnot, ZEND_ACC_PUBLIC) PHP_ME(Stub_Bitwise, getInt, arginfo_stub_bitwise_getint, ZEND_ACC_PROTECTED) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Bitwise, testbitwiseXor, arginfo_stub_bitwise_testbitwisexor, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Bitwise, testbitwiseXor, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Bitwise, testbitwiseXor, arginfo_stub_bitwise_testbitwisexor, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/branchprediction.zep.c b/ext/stub/branchprediction.zep.c index b0015f76f7..c70b759828 100644 --- a/ext/stub/branchprediction.zep.c +++ b/ext/stub/branchprediction.zep.c @@ -46,12 +46,9 @@ PHP_METHOD(Stub_BranchPrediction, testLikely2) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -83,12 +80,9 @@ PHP_METHOD(Stub_BranchPrediction, testUnlikely2) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/branchprediction.zep.h b/ext/stub/branchprediction.zep.h index 7ba6de0329..51baccee75 100644 --- a/ext/stub/branchprediction.zep.h +++ b/ext/stub/branchprediction.zep.h @@ -23,17 +23,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_branchprediction_testunlikely2, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_branchprediction_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BranchPrediction, testLikely1, arginfo_stub_branchprediction_testlikely1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BranchPrediction, testLikely1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BranchPrediction, testLikely1, arginfo_stub_branchprediction_testlikely1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BranchPrediction, testLikely2, arginfo_stub_branchprediction_testlikely2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BranchPrediction, testUnlikely1, arginfo_stub_branchprediction_testunlikely1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BranchPrediction, testUnlikely1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BranchPrediction, testUnlikely1, arginfo_stub_branchprediction_testunlikely1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BranchPrediction, testUnlikely2, arginfo_stub_branchprediction_testunlikely2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/builtin/arraymethods.zep.h b/ext/stub/builtin/arraymethods.zep.h index 1e49dcbfc5..74d59029af 100644 --- a/ext/stub/builtin/arraymethods.zep.h +++ b/ext/stub/builtin/arraymethods.zep.h @@ -17,20 +17,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_builtin_arraymethods_getmap1, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_arraymethods_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_ArrayMethods, getJoin1, arginfo_stub_builtin_arraymethods_getjoin1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_ArrayMethods, getJoin1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_ArrayMethods, getReversed1, arginfo_stub_builtin_arraymethods_getreversed1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_ArrayMethods, getReversed1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_ArrayMethods, getMap1, arginfo_stub_builtin_arraymethods_getmap1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_ArrayMethods, getMap1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_ArrayMethods, getJoin1, arginfo_stub_builtin_arraymethods_getjoin1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_ArrayMethods, getReversed1, arginfo_stub_builtin_arraymethods_getreversed1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_ArrayMethods, getMap1, arginfo_stub_builtin_arraymethods_getmap1, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/builtin/charmethods.zep.c b/ext/stub/builtin/charmethods.zep.c index 0b7ec11017..0b9f2f6e64 100644 --- a/ext/stub/builtin/charmethods.zep.c +++ b/ext/stub/builtin/charmethods.zep.c @@ -58,12 +58,9 @@ PHP_METHOD(Stub_BuiltIn_CharMethods, getHexForString) ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/builtin/charmethods.zep.h b/ext/stub/builtin/charmethods.zep.h index f3576f4dcb..5e2da73c06 100644 --- a/ext/stub/builtin/charmethods.zep.h +++ b/ext/stub/builtin/charmethods.zep.h @@ -14,11 +14,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_builtin_charmethods_gethexforstring, 0, 0, 1 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_charmethods_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_CharMethods, getHex, arginfo_stub_builtin_charmethods_gethex, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_CharMethods, getHex, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_CharMethods, getHex, arginfo_stub_builtin_charmethods_gethex, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_CharMethods, getHexForString, arginfo_stub_builtin_charmethods_gethexforstring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/builtin/intmethods.zep.c b/ext/stub/builtin/intmethods.zep.c index d22227e3cc..5e6aa78394 100644 --- a/ext/stub/builtin/intmethods.zep.c +++ b/ext/stub/builtin/intmethods.zep.c @@ -35,12 +35,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAbs) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -82,12 +79,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getBinary) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -110,12 +104,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getHex) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -138,12 +129,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getOctal) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -167,13 +155,10 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getPow) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(num) Z_PARAM_LONG(exp) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -196,12 +181,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getSqrt) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -221,12 +203,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getExp) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -247,12 +226,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getSin) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -270,12 +246,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getCos) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -293,12 +266,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getTan) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -318,12 +288,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAsin) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -346,12 +313,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAcos) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -374,12 +338,9 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getAtan) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -405,14 +366,11 @@ PHP_METHOD(Stub_BuiltIn_IntMethods, getLog) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_LONG(num) Z_PARAM_OPTIONAL Z_PARAM_LONG(base) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/builtin/intmethods.zep.h b/ext/stub/builtin/intmethods.zep.h index f73dae4ad3..d30f4ead49 100644 --- a/ext/stub/builtin/intmethods.zep.h +++ b/ext/stub/builtin/intmethods.zep.h @@ -82,11 +82,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_intmethods_method_entry) { PHP_ME(Stub_BuiltIn_IntMethods, getAbs, arginfo_stub_builtin_intmethods_getabs, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_IntMethods, getAbs1, arginfo_stub_builtin_intmethods_getabs1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_IntMethods, getAbs1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_IntMethods, getAbs1, arginfo_stub_builtin_intmethods_getabs1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_IntMethods, getBinary, arginfo_stub_builtin_intmethods_getbinary, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_IntMethods, getHex, arginfo_stub_builtin_intmethods_gethex, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_IntMethods, getOctal, arginfo_stub_builtin_intmethods_getoctal, ZEND_ACC_PUBLIC) diff --git a/ext/stub/builtin/stringmethods.zep.c b/ext/stub/builtin/stringmethods.zep.c index 03a27c46e5..ab365190ef 100644 --- a/ext/stub/builtin/stringmethods.zep.c +++ b/ext/stub/builtin/stringmethods.zep.c @@ -38,14 +38,12 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, camelize) ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -73,14 +71,12 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, uncamelize) ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -153,12 +149,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLength4) zval *this_ptr = getThis(); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -178,12 +171,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLength5) ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -206,13 +196,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getIndex) ZVAL_UNDEF(&str); ZVAL_UNDEF(&needle); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_STR(needle) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -238,14 +225,11 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getIndexWithPosition) ZVAL_UNDEF(&needle); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_STR(str) Z_PARAM_STR(needle) Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -289,12 +273,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getTrimmed1) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -316,12 +297,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLeftTrimmed) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -343,12 +321,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getRightTrimmed) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -370,12 +345,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLower) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -397,12 +369,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getUpper) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -425,12 +394,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getLowerFirst) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -452,12 +418,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getUpperFirst) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -481,12 +444,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getFormatted) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -510,12 +470,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getMd5) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -538,12 +495,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getSha1) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -566,12 +520,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getNl2br) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -594,12 +545,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getParsedCsv) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -623,14 +571,11 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getParsedJson) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_BOOL(assoc) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -660,13 +605,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getRepeatted) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_LONG(count) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -691,12 +633,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getShuffled) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -720,13 +659,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getSplited) ZVAL_UNDEF(&str); ZVAL_UNDEF(&del); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_STR(del) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -751,13 +687,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getCompare) ZVAL_UNDEF(&left); ZVAL_UNDEF(&right); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(left) Z_PARAM_STR(right) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -782,13 +715,10 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getCompareLocale) ZVAL_UNDEF(&left); ZVAL_UNDEF(&right); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(left) Z_PARAM_STR(right) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -812,12 +742,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getReversed) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -840,12 +767,9 @@ PHP_METHOD(Stub_BuiltIn_StringMethods, getHtmlSpecialChars) ZVAL_UNDEF(&str); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/builtin/stringmethods.zep.h b/ext/stub/builtin/stringmethods.zep.h index 22cc2eb3e8..016bbc4d18 100644 --- a/ext/stub/builtin/stringmethods.zep.h +++ b/ext/stub/builtin/stringmethods.zep.h @@ -163,30 +163,14 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_builtin_stringmethods_method_entry) { PHP_ME(Stub_BuiltIn_StringMethods, camelize, arginfo_stub_builtin_stringmethods_camelize, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, uncamelize, arginfo_stub_builtin_stringmethods_uncamelize, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getLength1, arginfo_stub_builtin_stringmethods_getlength1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getLength1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getLength2, arginfo_stub_builtin_stringmethods_getlength2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getLength2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getLength3, arginfo_stub_builtin_stringmethods_getlength3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getLength3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_StringMethods, getLength1, arginfo_stub_builtin_stringmethods_getlength1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_StringMethods, getLength2, arginfo_stub_builtin_stringmethods_getlength2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_BuiltIn_StringMethods, getLength3, arginfo_stub_builtin_stringmethods_getlength3, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getLength4, arginfo_stub_builtin_stringmethods_getlength4, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getLength5, arginfo_stub_builtin_stringmethods_getlength5, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getIndex, arginfo_stub_builtin_stringmethods_getindex, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getIndexWithPosition, arginfo_stub_builtin_stringmethods_getindexwithposition, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed, arginfo_stub_builtin_stringmethods_gettrimmed, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed, arginfo_stub_builtin_stringmethods_gettrimmed, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getTrimmed1, arginfo_stub_builtin_stringmethods_gettrimmed1, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getLeftTrimmed, arginfo_stub_builtin_stringmethods_getlefttrimmed, ZEND_ACC_PUBLIC) PHP_ME(Stub_BuiltIn_StringMethods, getRightTrimmed, arginfo_stub_builtin_stringmethods_getrighttrimmed, ZEND_ACC_PUBLIC) diff --git a/ext/stub/cast.zep.c b/ext/stub/cast.zep.c index 0b90c38123..2c9b52b18f 100644 --- a/ext/stub/cast.zep.c +++ b/ext/stub/cast.zep.c @@ -258,12 +258,9 @@ PHP_METHOD(Stub_Cast, testIntCastFromParameterString) zval *this_ptr = getThis(); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1028,12 +1025,9 @@ PHP_METHOD(Stub_Cast, testCastFileResourceToInteger) zval *this_ptr = getThis(); ZVAL_UNDEF(&fileName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(fileName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &fileName); diff --git a/ext/stub/cast.zep.h b/ext/stub/cast.zep.h index 349ab4b944..a87e6074f9 100644 --- a/ext/stub/cast.zep.h +++ b/ext/stub/cast.zep.h @@ -346,51 +346,15 @@ ZEPHIR_INIT_FUNCS(stub_cast_method_entry) { PHP_ME(Stub_Cast, testBooleanCastFromNull, arginfo_stub_cast_testbooleancastfromnull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testBooleanCastFromChar, arginfo_stub_cast_testbooleancastfromchar, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testBooleanCastFromVariableChar, arginfo_stub_cast_testbooleancastfromvariablechar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromInt, arginfo_stub_cast_testobjectcastfromint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromFloat, arginfo_stub_cast_testobjectcastfromfloat, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromFloat, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromFalse, arginfo_stub_cast_testobjectcastfromfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromTrue, arginfo_stub_cast_testobjectcastfromtrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromNull, arginfo_stub_cast_testobjectcastfromnull, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromNull, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromEmptyArray, arginfo_stub_cast_testobjectcastfromemptyarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromEmptyArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromArray, arginfo_stub_cast_testobjectcastfromarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromEmptyString, arginfo_stub_cast_testobjectcastfromemptystring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromEmptyString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cast, testObjectCastFromString, arginfo_stub_cast_testobjectcastfromstring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cast, testObjectCastFromString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Cast, testObjectCastFromInt, arginfo_stub_cast_testobjectcastfromint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromFloat, arginfo_stub_cast_testobjectcastfromfloat, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromFalse, arginfo_stub_cast_testobjectcastfromfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromTrue, arginfo_stub_cast_testobjectcastfromtrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromNull, arginfo_stub_cast_testobjectcastfromnull, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromEmptyArray, arginfo_stub_cast_testobjectcastfromemptyarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromArray, arginfo_stub_cast_testobjectcastfromarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromEmptyString, arginfo_stub_cast_testobjectcastfromemptystring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cast, testObjectCastFromString, arginfo_stub_cast_testobjectcastfromstring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testCastStdinToInteger, arginfo_stub_cast_testcaststdintointeger, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testCastStdoutToInteger, arginfo_stub_cast_testcaststdouttointeger, ZEND_ACC_PUBLIC) PHP_ME(Stub_Cast, testCastFileResourceToInteger, arginfo_stub_cast_testcastfileresourcetointeger, ZEND_ACC_PUBLIC) diff --git a/ext/stub/cblock.zep.h b/ext/stub/cblock.zep.h index 2787016396..4825236091 100644 --- a/ext/stub/cblock.zep.h +++ b/ext/stub/cblock.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_cblock_testcblock2, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_cblock_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cblock, testCblock1, arginfo_stub_cblock_testcblock1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cblock, testCblock1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Cblock, testCblock2, arginfo_stub_cblock_testcblock2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Cblock, testCblock2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Cblock, testCblock1, arginfo_stub_cblock_testcblock1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Cblock, testCblock2, arginfo_stub_cblock_testcblock2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/chars.zep.c b/ext/stub/chars.zep.c index be8513a91a..b93aa00964 100644 --- a/ext/stub/chars.zep.c +++ b/ext/stub/chars.zep.c @@ -46,12 +46,9 @@ PHP_METHOD(Stub_Chars, sumChars2) char ch, chlower = 0; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(ch) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &ch_param); @@ -81,12 +78,9 @@ PHP_METHOD(Stub_Chars, diffChars2) char ch, chlower = 0; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(ch) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &ch_param); diff --git a/ext/stub/closures.zep.c b/ext/stub/closures.zep.c index ba175fc36d..452096a1ef 100644 --- a/ext/stub/closures.zep.c +++ b/ext/stub/closures.zep.c @@ -125,12 +125,9 @@ PHP_METHOD(Stub_Closures, issue1860) zval *this_ptr = getThis(); ZVAL_UNDEF(&abc); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(abc) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -179,12 +176,9 @@ PHP_METHOD(Stub_Closures, issue1036SetArgument) zval *this_ptr = getThis(); ZVAL_UNDEF(&argument_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(argument) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &argument); @@ -199,12 +193,9 @@ PHP_METHOD(Stub_Closures, issue1036SetFunction) zval *this_ptr = getThis(); ZVAL_UNDEF(&func_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(func) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &func); diff --git a/ext/stub/closures.zep.h b/ext/stub/closures.zep.h index c26b65d745..1f61cacc8d 100644 --- a/ext/stub/closures.zep.h +++ b/ext/stub/closures.zep.h @@ -60,58 +60,18 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_closures_issue1036call, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_closures_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple1, arginfo_stub_closures_simple1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple2, arginfo_stub_closures_simple2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple3, arginfo_stub_closures_simple3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple4, arginfo_stub_closures_simple4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, simple5, arginfo_stub_closures_simple5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, simple5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, arrow1, arginfo_stub_closures_arrow1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, arrow1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, arrow2, arginfo_stub_closures_arrow2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, arrow2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, testUseCommand, arginfo_stub_closures_testusecommand, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, testUseCommand, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Closures, simple1, arginfo_stub_closures_simple1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple2, arginfo_stub_closures_simple2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple3, arginfo_stub_closures_simple3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple4, arginfo_stub_closures_simple4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, simple5, arginfo_stub_closures_simple5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, arrow1, arginfo_stub_closures_arrow1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, arrow2, arginfo_stub_closures_arrow2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Closures, testUseCommand, arginfo_stub_closures_testusecommand, ZEND_ACC_PUBLIC) PHP_ME(Stub_Closures, issue1860, arginfo_stub_closures_issue1860, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, issue642, arginfo_stub_closures_issue642, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, issue642, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Closures, issue642, arginfo_stub_closures_issue642, ZEND_ACC_PUBLIC) PHP_ME(Stub_Closures, issue1036SetArgument, arginfo_stub_closures_issue1036setargument, ZEND_ACC_PUBLIC) PHP_ME(Stub_Closures, issue1036SetFunction, arginfo_stub_closures_issue1036setfunction, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Closures, issue1036Call, arginfo_stub_closures_issue1036call, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Closures, issue1036Call, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Closures, issue1036Call, arginfo_stub_closures_issue1036call, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/compare.zep.c b/ext/stub/compare.zep.c index 60dacf8819..ad4adeab83 100644 --- a/ext/stub/compare.zep.c +++ b/ext/stub/compare.zep.c @@ -34,13 +34,10 @@ PHP_METHOD(Stub_Compare, isLessInt) zend_long a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); @@ -57,13 +54,10 @@ PHP_METHOD(Stub_Compare, isGreaterEqual) zend_long a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); @@ -80,13 +74,10 @@ PHP_METHOD(Stub_Compare, isLessDouble) double a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); @@ -103,12 +94,9 @@ PHP_METHOD(Stub_Compare, isLessThenPi) double a; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a_param); @@ -124,12 +112,9 @@ PHP_METHOD(Stub_Compare, isMoreThenPi) double a; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a_param); @@ -150,12 +135,9 @@ PHP_METHOD(Stub_Compare, testVarWithStringEquals) zval *this_ptr = getThis(); ZVAL_UNDEF(&str); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -197,12 +179,9 @@ PHP_METHOD(Stub_Compare, testVarEqualsNull) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -220,12 +199,9 @@ PHP_METHOD(Stub_Compare, testNullEqualsVar) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/compare.zep.h b/ext/stub/compare.zep.h index 71df3fed42..ae2266e855 100644 --- a/ext/stub/compare.zep.h +++ b/ext/stub/compare.zep.h @@ -68,20 +68,8 @@ ZEPHIR_INIT_FUNCS(stub_compare_method_entry) { PHP_ME(Stub_Compare, testVarWithStringEquals, arginfo_stub_compare_testvarwithstringequals, ZEND_ACC_PUBLIC) PHP_ME(Stub_Compare, testVarEqualsNull, arginfo_stub_compare_testvarequalsnull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Compare, testNullEqualsVar, arginfo_stub_compare_testnullequalsvar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Compare, testNotIdenticalZeroVar, arginfo_stub_compare_testnotidenticalzerovar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Compare, testNotIdenticalZeroVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Compare, testNotIdenticalZeroInt, arginfo_stub_compare_testnotidenticalzeroint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Compare, testNotIdenticalZeroInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Compare, testNotIdenticalZeroLong, arginfo_stub_compare_testnotidenticalzerolong, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Compare, testNotIdenticalZeroLong, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Compare, testNotIdenticalZeroVar, arginfo_stub_compare_testnotidenticalzerovar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Compare, testNotIdenticalZeroInt, arginfo_stub_compare_testnotidenticalzeroint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Compare, testNotIdenticalZeroLong, arginfo_stub_compare_testnotidenticalzerolong, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/concat.zep.c b/ext/stub/concat.zep.c index 24f1583fe5..d2e9997af9 100644 --- a/ext/stub/concat.zep.c +++ b/ext/stub/concat.zep.c @@ -48,12 +48,9 @@ PHP_METHOD(Stub_Concat, testConcatBySelfProperty) ZVAL_UNDEF(&title); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(title) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -157,12 +154,9 @@ PHP_METHOD(Stub_Concat, testConcat4) ZVAL_UNDEF(&query); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -199,12 +193,9 @@ PHP_METHOD(Stub_Concat, testConcat5) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&retval); ZVAL_UNDEF(&left); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(number) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/constants.zep.h b/ext/stub/constants.zep.h index 1c7f8c870d..d975c181ee 100644 --- a/ext/stub/constants.zep.h +++ b/ext/stub/constants.zep.h @@ -105,130 +105,30 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constants_teststringpropertywithvarsget, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constants_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropWsVarsGet, arginfo_stub_constants_getpropwsvarsget, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropWsVarsGet, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC1, arginfo_stub_constants_getpropertyc1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC2, arginfo_stub_constants_getpropertyc2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC3, arginfo_stub_constants_getpropertyc3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC4, arginfo_stub_constants_getpropertyc4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC5, arginfo_stub_constants_getpropertyc5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC6, arginfo_stub_constants_getpropertyc6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC7, arginfo_stub_constants_getpropertyc7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC8, arginfo_stub_constants_getpropertyc8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, getPropertyC9, arginfo_stub_constants_getpropertyc9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, getPropertyC9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadConstant, arginfo_stub_constants_testreadconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadClassConstant1, arginfo_stub_constants_testreadclassconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadClassConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadClassConstant2, arginfo_stub_constants_testreadclassconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadClassConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testReadClassConstant3, arginfo_stub_constants_testreadclassconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testReadClassConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testPHPVersionEnvConstant, arginfo_stub_constants_testphpversionenvconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testPHPVersionEnvConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testClassMagicConstant, arginfo_stub_constants_testclassmagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testClassMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testMethodMagicConstant, arginfo_stub_constants_testmethodmagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testMethodMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testFunctionMagicConstant, arginfo_stub_constants_testfunctionmagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testFunctionMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testNamespaceMagicConstant, arginfo_stub_constants_testnamespacemagicconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testNamespaceMagicConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testDirConstant, arginfo_stub_constants_testdirconstant, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testDirConstant, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testPHPVersionEnvConstantInExpValue, arginfo_stub_constants_testphpversionenvconstantinexpvalue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testPHPVersionEnvConstantInExpValue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringDelimiterConstantDoubleQuoted, arginfo_stub_constants_teststringdelimiterconstantdoublequoted, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringDelimiterConstantDoubleQuoted, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringConstantWithVars, arginfo_stub_constants_teststringconstantwithvars, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringConstantWithVars, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringPropertyWithVarsAssigned, arginfo_stub_constants_teststringpropertywithvarsassigned, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringPropertyWithVarsAssigned, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constants, testStringPropertyWithVarsGet, arginfo_stub_constants_teststringpropertywithvarsget, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constants, testStringPropertyWithVarsGet, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Constants, getPropWsVarsGet, arginfo_stub_constants_getpropwsvarsget, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC1, arginfo_stub_constants_getpropertyc1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC2, arginfo_stub_constants_getpropertyc2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC3, arginfo_stub_constants_getpropertyc3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC4, arginfo_stub_constants_getpropertyc4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC5, arginfo_stub_constants_getpropertyc5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC6, arginfo_stub_constants_getpropertyc6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC7, arginfo_stub_constants_getpropertyc7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC8, arginfo_stub_constants_getpropertyc8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, getPropertyC9, arginfo_stub_constants_getpropertyc9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadConstant, arginfo_stub_constants_testreadconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadClassConstant1, arginfo_stub_constants_testreadclassconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadClassConstant2, arginfo_stub_constants_testreadclassconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testReadClassConstant3, arginfo_stub_constants_testreadclassconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testPHPVersionEnvConstant, arginfo_stub_constants_testphpversionenvconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testClassMagicConstant, arginfo_stub_constants_testclassmagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testMethodMagicConstant, arginfo_stub_constants_testmethodmagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testFunctionMagicConstant, arginfo_stub_constants_testfunctionmagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testNamespaceMagicConstant, arginfo_stub_constants_testnamespacemagicconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testDirConstant, arginfo_stub_constants_testdirconstant, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testPHPVersionEnvConstantInExpValue, arginfo_stub_constants_testphpversionenvconstantinexpvalue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringDelimiterConstantDoubleQuoted, arginfo_stub_constants_teststringdelimiterconstantdoublequoted, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringConstantWithVars, arginfo_stub_constants_teststringconstantwithvars, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringPropertyWithVarsAssigned, arginfo_stub_constants_teststringpropertywithvarsassigned, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Constants, testStringPropertyWithVarsGet, arginfo_stub_constants_teststringpropertywithvarsget, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constantsinterface.zep.h b/ext/stub/constantsinterface.zep.h index e9a940d24a..5bd9aa3c65 100644 --- a/ext/stub/constantsinterface.zep.h +++ b/ext/stub/constantsinterface.zep.h @@ -53,65 +53,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constantsinterface_testreadinheritancefromin ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constantsinterface_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6, arginfo_stub_constantsinterface_testreadinheritancefrominterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constantsinterfacea.zep.h b/ext/stub/constantsinterfacea.zep.h index b332767b6a..95153a5bfd 100644 --- a/ext/stub/constantsinterfacea.zep.h +++ b/ext/stub/constantsinterfacea.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constantsinterfacea_testreadinterfaceconstan ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constantsinterfacea_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant1, arginfo_stub_constantsinterfacea_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant2, arginfo_stub_constantsinterfacea_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant3, arginfo_stub_constantsinterfacea_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant4, arginfo_stub_constantsinterfacea_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant5, arginfo_stub_constantsinterfacea_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant6, arginfo_stub_constantsinterfacea_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant1, arginfo_stub_constantsinterfacea_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant2, arginfo_stub_constantsinterfacea_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant3, arginfo_stub_constantsinterfacea_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant4, arginfo_stub_constantsinterfacea_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant5, arginfo_stub_constantsinterfacea_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceA, testReadInterfaceConstant6, arginfo_stub_constantsinterfacea_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constantsinterfaceb.zep.h b/ext/stub/constantsinterfaceb.zep.h index a643c4dc33..39c7850cb7 100644 --- a/ext/stub/constantsinterfaceb.zep.h +++ b/ext/stub/constantsinterfaceb.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constantsinterfaceb_testreadinterfaceconstan ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constantsinterfaceb_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant1, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant2, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant3, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant4, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant5, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant6, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant1, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant2, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant3, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant4, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant5, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ConstantsInterfaceB, testReadInterfaceConstant6, arginfo_stub_constantsinterfaceb_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/constructors/issue1803.zep.h b/ext/stub/constructors/issue1803.zep.h index 7b90bbfe28..0ce7ff2525 100644 --- a/ext/stub/constructors/issue1803.zep.h +++ b/ext/stub/constructors/issue1803.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_constructors_issue1803_issue1803, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_constructors_issue1803_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Constructors_Issue1803, Issue1803, arginfo_stub_constructors_issue1803_issue1803, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Constructors_Issue1803, Issue1803, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Constructors_Issue1803, Issue1803, arginfo_stub_constructors_issue1803_issue1803, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/declaretest.zep.h b/ext/stub/declaretest.zep.h index bd341be029..7a15c78f67 100644 --- a/ext/stub/declaretest.zep.h +++ b/ext/stub/declaretest.zep.h @@ -77,95 +77,23 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_declaretest_testdeclaremcallexpression, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_declaretest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testStringDeclare1, arginfo_stub_declaretest_teststringdeclare1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testStringDeclare1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testStringDeclare2, arginfo_stub_declaretest_teststringdeclare2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testStringDeclare2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare1, arginfo_stub_declaretest_testdeclare1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare2, arginfo_stub_declaretest_testdeclare2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare3, arginfo_stub_declaretest_testdeclare3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare4, arginfo_stub_declaretest_testdeclare4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare5, arginfo_stub_declaretest_testdeclare5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare6, arginfo_stub_declaretest_testdeclare6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare7, arginfo_stub_declaretest_testdeclare7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare8, arginfo_stub_declaretest_testdeclare8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare9, arginfo_stub_declaretest_testdeclare9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare10, arginfo_stub_declaretest_testdeclare10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare11, arginfo_stub_declaretest_testdeclare11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare12, arginfo_stub_declaretest_testdeclare12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare13, arginfo_stub_declaretest_testdeclare13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare14, arginfo_stub_declaretest_testdeclare14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclare15, arginfo_stub_declaretest_testdeclare15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclare15, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_DeclareTest, testDeclareMcallExpression, arginfo_stub_declaretest_testdeclaremcallexpression, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_DeclareTest, testDeclareMcallExpression, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_DeclareTest, testStringDeclare1, arginfo_stub_declaretest_teststringdeclare1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testStringDeclare2, arginfo_stub_declaretest_teststringdeclare2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare1, arginfo_stub_declaretest_testdeclare1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare2, arginfo_stub_declaretest_testdeclare2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare3, arginfo_stub_declaretest_testdeclare3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare4, arginfo_stub_declaretest_testdeclare4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare5, arginfo_stub_declaretest_testdeclare5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare6, arginfo_stub_declaretest_testdeclare6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare7, arginfo_stub_declaretest_testdeclare7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare8, arginfo_stub_declaretest_testdeclare8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare9, arginfo_stub_declaretest_testdeclare9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare10, arginfo_stub_declaretest_testdeclare10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare11, arginfo_stub_declaretest_testdeclare11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare12, arginfo_stub_declaretest_testdeclare12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare13, arginfo_stub_declaretest_testdeclare13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare14, arginfo_stub_declaretest_testdeclare14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclare15, arginfo_stub_declaretest_testdeclare15, ZEND_ACC_PUBLIC) +PHP_ME(Stub_DeclareTest, testDeclareMcallExpression, arginfo_stub_declaretest_testdeclaremcallexpression, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/echoes.zep.h b/ext/stub/echoes.zep.h index 01b93baf47..727eecdf8e 100644 --- a/ext/stub/echoes.zep.h +++ b/ext/stub/echoes.zep.h @@ -25,30 +25,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_echoes_testecho5, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_echoes_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho1, arginfo_stub_echoes_testecho1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho2, arginfo_stub_echoes_testecho2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho3, arginfo_stub_echoes_testecho3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho4, arginfo_stub_echoes_testecho4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Echoes, testEcho5, arginfo_stub_echoes_testecho5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Echoes, testEcho5, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Echoes, testEcho1, arginfo_stub_echoes_testecho1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho2, arginfo_stub_echoes_testecho2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho3, arginfo_stub_echoes_testecho3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho4, arginfo_stub_echoes_testecho4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Echoes, testEcho5, arginfo_stub_echoes_testecho5, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/emptytest.zep.c b/ext/stub/emptytest.zep.c index 86489b35f7..1cd3b7f5ef 100644 --- a/ext/stub/emptytest.zep.c +++ b/ext/stub/emptytest.zep.c @@ -116,12 +116,9 @@ PHP_METHOD(Stub_EmptyTest, testString) zval *this_ptr = getThis(); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/emptytest.zep.h b/ext/stub/emptytest.zep.h index 4a39df105a..1174fef9d5 100644 --- a/ext/stub/emptytest.zep.h +++ b/ext/stub/emptytest.zep.h @@ -26,26 +26,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_emptytest_teststring, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_emptytest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testDynamicVarArrayEmpty, arginfo_stub_emptytest_testdynamicvararrayempty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testDynamicVarArrayEmpty, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testDynamicVarArrayNotEmpty, arginfo_stub_emptytest_testdynamicvararraynotempty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testDynamicVarArrayNotEmpty, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testEmptyString, arginfo_stub_emptytest_testemptystring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testEmptyString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_EmptyTest, testNotEmptyString, arginfo_stub_emptytest_testnotemptystring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_EmptyTest, testNotEmptyString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_EmptyTest, testDynamicVarArrayEmpty, arginfo_stub_emptytest_testdynamicvararrayempty, ZEND_ACC_PUBLIC) +PHP_ME(Stub_EmptyTest, testDynamicVarArrayNotEmpty, arginfo_stub_emptytest_testdynamicvararraynotempty, ZEND_ACC_PUBLIC) +PHP_ME(Stub_EmptyTest, testEmptyString, arginfo_stub_emptytest_testemptystring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_EmptyTest, testNotEmptyString, arginfo_stub_emptytest_testnotemptystring, ZEND_ACC_PUBLIC) PHP_ME(Stub_EmptyTest, testString, arginfo_stub_emptytest_teststring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/evaltest.zep.c b/ext/stub/evaltest.zep.c index ec0b6856f3..0633393b5a 100644 --- a/ext/stub/evaltest.zep.c +++ b/ext/stub/evaltest.zep.c @@ -33,12 +33,9 @@ PHP_METHOD(Stub_EvalTest, evalCode) zval *this_ptr = getThis(); ZVAL_UNDEF(&code); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(code) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/exception.zep.c b/ext/stub/exception.zep.c index e118b09254..fceeb455ea 100644 --- a/ext/stub/exception.zep.c +++ b/ext/stub/exception.zep.c @@ -40,12 +40,9 @@ PHP_METHOD(Stub_Exception, testRuntimePropertyFetch) zval *this_ptr = getThis(); ZVAL_UNDEF(&message); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(message) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/exceptions.zep.c b/ext/stub/exceptions.zep.c index 1fa1612ada..aad0530965 100644 --- a/ext/stub/exceptions.zep.c +++ b/ext/stub/exceptions.zep.c @@ -168,12 +168,9 @@ PHP_METHOD(Stub_Exceptions, testExceptionLiteral) zval *this_ptr = getThis(); ZVAL_UNDEF(&type); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(type) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -214,12 +211,9 @@ PHP_METHOD(Stub_Exceptions, testExceptionSprintf) ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -246,13 +240,10 @@ PHP_METHOD(Stub_Exceptions, testExceptionConcat) ZVAL_UNDEF(&framework); ZVAL_UNDEF(&language); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(framework) Z_PARAM_STR(language) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -323,22 +314,19 @@ PHP_METHOD(Stub_Exceptions, testMultiException) ZVAL_UNDEF(&_4$$7); ZVAL_UNDEF(&_6$$10); ZVAL_UNDEF(&_8$$13); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(returnValue) Z_PARAM_ZVAL(exception) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &returnValue, &exception); - ZEPHIR_OBS_VAR(&iexc); + zephir_memory_observe(&iexc); zephir_read_property(&iexc, this_ptr, ZEND_STRL("internalExceptionCallable"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(&exc); + zephir_memory_observe(&exc); zephir_read_property(&exc, this_ptr, ZEND_STRL("exceptionCallable"), PH_NOISY_CC); /* try_start_1: */ diff --git a/ext/stub/exceptions.zep.h b/ext/stub/exceptions.zep.h index 1a6edfd7ec..9e16bab5fb 100644 --- a/ext/stub/exceptions.zep.h +++ b/ext/stub/exceptions.zep.h @@ -67,59 +67,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_exceptions_donoopexception, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_exceptions_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException1, arginfo_stub_exceptions_testexception1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testExceptionStringEscape, arginfo_stub_exceptions_testexceptionstringescape, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testExceptionStringEscape, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException2, arginfo_stub_exceptions_testexception2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException3, arginfo_stub_exceptions_testexception3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, getException, arginfo_stub_exceptions_getexception, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_Exceptions, getException, NULL, ZEND_ACC_PROTECTED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException4, arginfo_stub_exceptions_testexception4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testException5, arginfo_stub_exceptions_testexception5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testException5, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Exceptions, testException1, arginfo_stub_exceptions_testexception1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testExceptionStringEscape, arginfo_stub_exceptions_testexceptionstringescape, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testException2, arginfo_stub_exceptions_testexception2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testException3, arginfo_stub_exceptions_testexception3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, getException, arginfo_stub_exceptions_getexception, ZEND_ACC_PROTECTED) +PHP_ME(Stub_Exceptions, testException4, arginfo_stub_exceptions_testexception4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, testException5, arginfo_stub_exceptions_testexception5, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testExceptionLiteral, arginfo_stub_exceptions_testexceptionliteral, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testExceptionSprintf, arginfo_stub_exceptions_testexceptionsprintf, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testExceptionConcat, arginfo_stub_exceptions_testexceptionconcat, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, testExceptionRethrow, arginfo_stub_exceptions_testexceptionrethrow, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, testExceptionRethrow, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Exceptions, testExceptionRethrow, arginfo_stub_exceptions_testexceptionrethrow, ZEND_ACC_PUBLIC) PHP_ME(Stub_Exceptions, testMultiException, arginfo_stub_exceptions_testmultiexception, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, issue1325, arginfo_stub_exceptions_issue1325, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Exceptions, issue1325, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Exceptions, doNoopException, arginfo_stub_exceptions_donoopexception, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_Exceptions, doNoopException, NULL, ZEND_ACC_PRIVATE) -#endif +PHP_ME(Stub_Exceptions, issue1325, arginfo_stub_exceptions_issue1325, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Exceptions, doNoopException, arginfo_stub_exceptions_donoopexception, ZEND_ACC_PRIVATE) PHP_FE_END }; diff --git a/ext/stub/exists.zep.c b/ext/stub/exists.zep.c index 4a8dd9a916..a1a5ab5ecc 100644 --- a/ext/stub/exists.zep.c +++ b/ext/stub/exists.zep.c @@ -33,14 +33,11 @@ PHP_METHOD(Stub_Exists, testClassExists) ZVAL_UNDEF(&className_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(className) Z_PARAM_OPTIONAL Z_PARAM_BOOL(autoload) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 1, &className, &autoload_param); @@ -63,14 +60,11 @@ PHP_METHOD(Stub_Exists, testInterfaceExists) ZVAL_UNDEF(&interfaceName_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(interfaceName) Z_PARAM_OPTIONAL Z_PARAM_BOOL(autoload) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 1, &interfaceName, &autoload_param); @@ -92,13 +86,10 @@ PHP_METHOD(Stub_Exists, testMethodExists) ZVAL_UNDEF(&obj_sub); ZVAL_UNDEF(&methodName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(obj) Z_PARAM_ZVAL(methodName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &obj, &methodName); @@ -113,12 +104,9 @@ PHP_METHOD(Stub_Exists, testFileExists) zval *this_ptr = getThis(); ZVAL_UNDEF(&fileName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(fileName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &fileName); diff --git a/ext/stub/exitdie.zep.c b/ext/stub/exitdie.zep.c index 797c1a8a1f..372ca02297 100644 --- a/ext/stub/exitdie.zep.c +++ b/ext/stub/exitdie.zep.c @@ -32,13 +32,11 @@ PHP_METHOD(Stub_ExitDie, testExit) ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶m); @@ -61,13 +59,11 @@ PHP_METHOD(Stub_ExitDie, testDie) ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶m); diff --git a/ext/stub/factorial.zep.c b/ext/stub/factorial.zep.c index b75a05a82e..204218a8bd 100644 --- a/ext/stub/factorial.zep.c +++ b/ext/stub/factorial.zep.c @@ -33,12 +33,9 @@ PHP_METHOD(Stub_Factorial, intIterativeFactorial) zend_long n, _1, _2; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &n_param); @@ -77,12 +74,9 @@ PHP_METHOD(Stub_Factorial, intRecursiveFactorial) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/fannkuch.zep.c b/ext/stub/fannkuch.zep.c index 91d53018bf..ec6527207d 100644 --- a/ext/stub/fannkuch.zep.c +++ b/ext/stub/fannkuch.zep.c @@ -56,12 +56,9 @@ PHP_METHOD(Stub_Fannkuch, process) ZVAL_UNDEF(&_17$$13); ZVAL_UNDEF(&_18$$13); ZVAL_UNDEF(&_19$$13); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/fasta.zep.c b/ext/stub/fasta.zep.c index f6d6e80952..eacbc4b304 100644 --- a/ext/stub/fasta.zep.c +++ b/ext/stub/fasta.zep.c @@ -63,13 +63,10 @@ PHP_METHOD(Stub_Fasta, fastaRepeat) ZVAL_UNDEF(&seq); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(n) Z_PARAM_STR(seq) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -171,12 +168,9 @@ PHP_METHOD(Stub_Fasta, main) ZVAL_UNDEF(&homoSap); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/fasta.zep.h b/ext/stub/fasta.zep.h index acc0cf9d48..ddc3d9c374 100644 --- a/ext/stub/fasta.zep.h +++ b/ext/stub/fasta.zep.h @@ -21,11 +21,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fasta_method_entry) { PHP_ME(Stub_Fasta, fastaRepeat, arginfo_stub_fasta_fastarepeat, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fasta, fastRandom, arginfo_stub_fasta_fastrandom, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fasta, fastRandom, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fasta, fastRandom, arginfo_stub_fasta_fastrandom, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fasta, main, arginfo_stub_fasta_main, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/fcall.zep.c b/ext/stub/fcall.zep.c index f390605f66..6db9d1705e 100644 --- a/ext/stub/fcall.zep.c +++ b/ext/stub/fcall.zep.c @@ -181,13 +181,10 @@ PHP_METHOD(Stub_Fcall, testCall5) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -239,14 +236,12 @@ PHP_METHOD(Stub_Fcall, zvalFcallWith1Parameter) ZVAL_UNDEF(&callback_sub); ZVAL_UNDEF(¶m1_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(callback) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param1) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -272,13 +267,10 @@ PHP_METHOD(Stub_Fcall, testCall8) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&x); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -333,12 +325,9 @@ PHP_METHOD(Stub_Fcall, testStrtokVarBySlash) ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -359,13 +348,10 @@ PHP_METHOD(Stub_Fcall, testFunctionGetArgs) ZVAL_UNDEF(¶m1_sub); ZVAL_UNDEF(¶m2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(param1) Z_PARAM_ZVAL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, ¶m1, ¶m2); @@ -406,13 +392,10 @@ PHP_METHOD(Stub_Fcall, testFunctionGetArg) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(param1) Z_PARAM_ZVAL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -522,12 +505,9 @@ PHP_FUNCTION(g_stub_zephir_global_method_test) { zval *str, str_sub, _0; ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -549,12 +529,9 @@ PHP_FUNCTION(g_stub_zephir_global_method_test) { PHP_FUNCTION(g_stub_zephir_global_method_with_type_casting) { zval *variable, variable_sub; ZVAL_UNDEF(&variable_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &variable); @@ -571,12 +548,9 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_test) { ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -599,12 +573,9 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_test) { PHP_FUNCTION(f_Stub_test_call_relative_object_hint) { zval *a, a_sub; ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -616,12 +587,9 @@ PHP_FUNCTION(f_Stub_test_call_relative_object_hint) { PHP_FUNCTION(f_Stub_zephir_namespaced_method_with_type_casting) { zval *variable, variable_sub; ZVAL_UNDEF(&variable_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &variable); @@ -634,12 +602,9 @@ PHP_FUNCTION(f_Stub_zephir_namespaced_method_with_type_casting) { PHP_FUNCTION(f_Stub_test_call_object_hint) { zval *a, a_sub; ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/fcall.zep.h b/ext/stub/fcall.zep.h index 47e875729a..3b955311e4 100644 --- a/ext/stub/fcall.zep.h +++ b/ext/stub/fcall.zep.h @@ -94,27 +94,11 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fcall_method_entry) { PHP_ME(Stub_Fcall, testCall1, arginfo_stub_fcall_testcall1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall2, arginfo_stub_fcall_testcall2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall3, arginfo_stub_fcall_testcall3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall4, arginfo_stub_fcall_testcall4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall4, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fcall, testCall3, arginfo_stub_fcall_testcall3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fcall, testCall4, arginfo_stub_fcall_testcall4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall5, arginfo_stub_fcall_testcall5, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall6, arginfo_stub_fcall_testcall6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fcall, testCall7, arginfo_stub_fcall_testcall7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fcall, testCall7, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fcall, testCall6, arginfo_stub_fcall_testcall6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fcall, testCall7, arginfo_stub_fcall_testcall7, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, zvalFcallWith1Parameter, arginfo_stub_fcall_zvalfcallwith1parameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall8, arginfo_stub_fcall_testcall8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fcall, testCall1FromVar, arginfo_stub_fcall_testcall1fromvar, ZEND_ACC_PUBLIC) diff --git a/ext/stub/fetchtest.zep.c b/ext/stub/fetchtest.zep.c index 41b2d58dfa..4da7da6073 100644 --- a/ext/stub/fetchtest.zep.c +++ b/ext/stub/fetchtest.zep.c @@ -35,12 +35,9 @@ PHP_METHOD(Stub_FetchTest, setValues) zval *this_ptr = getThis(); ZVAL_UNDEF(&values_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(values) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &values); @@ -68,20 +65,17 @@ PHP_METHOD(Stub_FetchTest, testFetchArray1) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_OBS_VAR(&c); + zephir_memory_observe(&c); RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, b, 0)); } @@ -93,13 +87,10 @@ PHP_METHOD(Stub_FetchTest, testFetchArray2) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -120,13 +111,10 @@ PHP_METHOD(Stub_FetchTest, testFetchArray3) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -134,7 +122,7 @@ PHP_METHOD(Stub_FetchTest, testFetchArray3) b = zephir_get_intval(b_param); - ZEPHIR_OBS_VAR(&c); + zephir_memory_observe(&c); RETURN_MM_BOOL(zephir_array_isset_long_fetch(&c, a, b, 0)); } @@ -146,13 +134,10 @@ PHP_METHOD(Stub_FetchTest, testFetchArray4) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -175,13 +160,10 @@ PHP_METHOD(Stub_FetchTest, testFetchArray5) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&c); ZVAL_UNDEF(&b); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_STR(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -189,7 +171,7 @@ PHP_METHOD(Stub_FetchTest, testFetchArray5) zephir_get_strval(&b, b_param); - ZEPHIR_OBS_VAR(&c); + zephir_memory_observe(&c); RETURN_MM_BOOL(zephir_array_isset_fetch(&c, a, &b, 0)); } @@ -202,13 +184,10 @@ PHP_METHOD(Stub_FetchTest, testFetchArray6) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_STR(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -230,20 +209,17 @@ PHP_METHOD(Stub_FetchTest, testFetchObject1) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &a, &b); - ZEPHIR_OBS_VAR(&c); + zephir_memory_observe(&c); RETURN_MM_BOOL(zephir_fetch_property_zval(&c, a, b, PH_SILENT_CC)); } @@ -255,13 +231,10 @@ PHP_METHOD(Stub_FetchTest, testFetchObject2) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -282,12 +255,9 @@ PHP_METHOD(Stub_FetchTest, testFetchPost) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_POST); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -295,7 +265,7 @@ PHP_METHOD(Stub_FetchTest, testFetchPost) zephir_fetch_params(1, 1, 0, &b); - ZEPHIR_OBS_VAR(&c); + zephir_memory_observe(&c); if (!(zephir_array_isset_fetch(&c, &_POST, b, 0))) { RETURN_MM_BOOL(0); } @@ -312,12 +282,9 @@ PHP_METHOD(Stub_FetchTest, hasValue) ZVAL_UNDEF(&name); ZVAL_UNDEF(&_POST); ZVAL_UNDEF(&_0$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -348,12 +315,9 @@ PHP_METHOD(Stub_FetchTest, getValue) ZVAL_UNDEF(&_POST); ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -362,7 +326,7 @@ PHP_METHOD(Stub_FetchTest, getValue) zephir_get_strval(&name, name_param); - ZEPHIR_OBS_VAR(&value); + zephir_memory_observe(&value); if (!(zephir_array_isset_fetch(&value, &_POST, &name, 0))) { ZEPHIR_OBS_NVAR(&value); zephir_read_property(&_0$$3, this_ptr, ZEND_STRL("values"), PH_NOISY_CC | PH_READONLY); diff --git a/ext/stub/fetchtest.zep.h b/ext/stub/fetchtest.zep.h index 0787fec806..16e8467105 100644 --- a/ext/stub/fetchtest.zep.h +++ b/ext/stub/fetchtest.zep.h @@ -78,11 +78,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fetchtest_method_entry) { PHP_ME(Stub_FetchTest, setValues, arginfo_stub_fetchtest_setvalues, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_FetchTest, getValues, arginfo_stub_fetchtest_getvalues, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_FetchTest, getValues, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_FetchTest, getValues, arginfo_stub_fetchtest_getvalues, ZEND_ACC_PUBLIC) PHP_ME(Stub_FetchTest, testFetchArray1, arginfo_stub_fetchtest_testfetcharray1, ZEND_ACC_PUBLIC) PHP_ME(Stub_FetchTest, testFetchArray2, arginfo_stub_fetchtest_testfetcharray2, ZEND_ACC_PUBLIC) PHP_ME(Stub_FetchTest, testFetchArray3, arginfo_stub_fetchtest_testfetcharray3, ZEND_ACC_PUBLIC) diff --git a/ext/stub/fibonnaci.zep.c b/ext/stub/fibonnaci.zep.c index 86f41df03d..f6734b5d1c 100644 --- a/ext/stub/fibonnaci.zep.c +++ b/ext/stub/fibonnaci.zep.c @@ -167,12 +167,9 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciRecursive) ZVAL_UNDEF(&_0$$6); ZVAL_UNDEF(&_1$$6); ZVAL_UNDEF(&_3$$6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -209,12 +206,9 @@ PHP_METHOD(Stub_Fibonnaci, fibonacciFinalRecursive) ZVAL_UNDEF(&_0$$6); ZVAL_UNDEF(&_1$$6); ZVAL_UNDEF(&_3$$6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/fibonnaci.zep.h b/ext/stub/fibonnaci.zep.h index b9a1847d7f..70b8f76f6e 100644 --- a/ext/stub/fibonnaci.zep.h +++ b/ext/stub/fibonnaci.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_fibonnaci_fibonaccifinalrecursive, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_fibonnaci_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibInt, arginfo_stub_fibonnaci_fibint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibDouble, arginfo_stub_fibonnaci_fibdouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibArray, arginfo_stub_fibonnaci_fibarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Fibonnaci, fibArray2, arginfo_stub_fibonnaci_fibarray2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Fibonnaci, fibArray2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Fibonnaci, fibInt, arginfo_stub_fibonnaci_fibint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fibonnaci, fibDouble, arginfo_stub_fibonnaci_fibdouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fibonnaci, fibArray, arginfo_stub_fibonnaci_fibarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Fibonnaci, fibArray2, arginfo_stub_fibonnaci_fibarray2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Fibonnaci, fibonacciRecursive, arginfo_stub_fibonnaci_fibonaccirecursive, ZEND_ACC_PRIVATE) PHP_ME(Stub_Fibonnaci, fibonacciFinalRecursive, arginfo_stub_fibonnaci_fibonaccifinalrecursive, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) PHP_FE_END diff --git a/ext/stub/flow.zep.c b/ext/stub/flow.zep.c index 2f968c657a..c1edb10997 100644 --- a/ext/stub/flow.zep.c +++ b/ext/stub/flow.zep.c @@ -288,12 +288,9 @@ PHP_METHOD(Stub_Flow, testIf16) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -311,12 +308,9 @@ PHP_METHOD(Stub_Flow, testIf17) zval *this_ptr = getThis(); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &b); @@ -608,12 +602,9 @@ PHP_METHOD(Stub_Flow, testWhile10) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -650,13 +641,10 @@ PHP_METHOD(Stub_Flow, testWhile11) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&d_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(d) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -759,12 +747,9 @@ PHP_METHOD(Stub_Flow, testWhileNextTest) ZVAL_UNDEF(&returnValue); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -800,12 +785,9 @@ PHP_METHOD(Stub_Flow, testWhileDoNextTest) ZVAL_UNDEF(&returnValue); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_0$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(variable) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1395,13 +1377,10 @@ PHP_METHOD(Stub_Flow, testFor15) zend_long c, d, a = 0, b = 0, _1, _2; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(c) Z_PARAM_LONG(d) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &c_param, &d_param); @@ -1875,12 +1854,9 @@ PHP_METHOD(Stub_Flow, testFor32) ZVAL_UNDEF(&e_sub); ZVAL_UNDEF(&v); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(e) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1926,12 +1902,9 @@ PHP_METHOD(Stub_Flow, testFor33) ZVAL_UNDEF(&e_sub); ZVAL_UNDEF(&v); ZVAL_UNDEF(&result); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(e, zend_ce_iterator) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1963,13 +1936,11 @@ PHP_METHOD(Stub_Flow, testFor34) ZVAL_NULL(&__$null); ZVAL_UNDEF(&v); ZVAL_UNDEF(&result); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_OBJECT_OF_CLASS_OR_NULL(e, zend_ce_iterator) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2003,12 +1974,9 @@ PHP_METHOD(Stub_Flow, testFor35Aux) zval *this_ptr = getThis(); ZVAL_UNDEF(&hello_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(hello) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &hello); @@ -2062,12 +2030,9 @@ PHP_METHOD(Stub_Flow, testFor36Aux) zval *this_ptr = getThis(); ZVAL_UNDEF(&hello_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(hello) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &hello); diff --git a/ext/stub/flow.zep.h b/ext/stub/flow.zep.h index a999bf1759..d84aeabeff 100644 --- a/ext/stub/flow.zep.h +++ b/ext/stub/flow.zep.h @@ -323,337 +323,81 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_flow_testunrechable3, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_flow_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf1, arginfo_stub_flow_testif1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf2, arginfo_stub_flow_testif2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf3, arginfo_stub_flow_testif3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf4, arginfo_stub_flow_testif4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf5, arginfo_stub_flow_testif5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf6, arginfo_stub_flow_testif6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf7, arginfo_stub_flow_testif7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf8, arginfo_stub_flow_testif8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf9, arginfo_stub_flow_testif9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf10, arginfo_stub_flow_testif10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf12, arginfo_stub_flow_testif12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf13, arginfo_stub_flow_testif13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf14, arginfo_stub_flow_testif14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testIf15, arginfo_stub_flow_testif15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testIf15, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testIf1, arginfo_stub_flow_testif1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf2, arginfo_stub_flow_testif2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf3, arginfo_stub_flow_testif3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf4, arginfo_stub_flow_testif4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf5, arginfo_stub_flow_testif5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf6, arginfo_stub_flow_testif6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf7, arginfo_stub_flow_testif7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf8, arginfo_stub_flow_testif8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf9, arginfo_stub_flow_testif9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf10, arginfo_stub_flow_testif10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf12, arginfo_stub_flow_testif12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf13, arginfo_stub_flow_testif13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf14, arginfo_stub_flow_testif14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testIf15, arginfo_stub_flow_testif15, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testIf16, arginfo_stub_flow_testif16, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testIf17, arginfo_stub_flow_testif17, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop1, arginfo_stub_flow_testloop1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop2, arginfo_stub_flow_testloop2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop3, arginfo_stub_flow_testloop3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testLoop4, arginfo_stub_flow_testloop4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testLoop4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile1, arginfo_stub_flow_testwhile1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile2, arginfo_stub_flow_testwhile2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile3, arginfo_stub_flow_testwhile3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile4, arginfo_stub_flow_testwhile4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile5, arginfo_stub_flow_testwhile5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile6, arginfo_stub_flow_testwhile6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile7, arginfo_stub_flow_testwhile7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile8, arginfo_stub_flow_testwhile8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile9, arginfo_stub_flow_testwhile9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile9, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testLoop1, arginfo_stub_flow_testloop1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testLoop2, arginfo_stub_flow_testloop2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testLoop3, arginfo_stub_flow_testloop3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testLoop4, arginfo_stub_flow_testloop4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile1, arginfo_stub_flow_testwhile1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile2, arginfo_stub_flow_testwhile2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile3, arginfo_stub_flow_testwhile3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile4, arginfo_stub_flow_testwhile4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile5, arginfo_stub_flow_testwhile5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile6, arginfo_stub_flow_testwhile6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile7, arginfo_stub_flow_testwhile7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile8, arginfo_stub_flow_testwhile8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile9, arginfo_stub_flow_testwhile9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhile10, arginfo_stub_flow_testwhile10, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhile11, arginfo_stub_flow_testwhile11, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile12, arginfo_stub_flow_testwhile12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testWhile13, arginfo_stub_flow_testwhile13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testWhile13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testDoWhile1, arginfo_stub_flow_testdowhile1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testDoWhile1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testWhile12, arginfo_stub_flow_testwhile12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testWhile13, arginfo_stub_flow_testwhile13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testDoWhile1, arginfo_stub_flow_testdowhile1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhileNextTest, arginfo_stub_flow_testwhilenexttest, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testWhileDoNextTest, arginfo_stub_flow_testwhiledonexttest, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor1, arginfo_stub_flow_testfor1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor2, arginfo_stub_flow_testfor2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor3, arginfo_stub_flow_testfor3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor4, arginfo_stub_flow_testfor4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor5, arginfo_stub_flow_testfor5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor6, arginfo_stub_flow_testfor6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor7, arginfo_stub_flow_testfor7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor8, arginfo_stub_flow_testfor8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor9, arginfo_stub_flow_testfor9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor10, arginfo_stub_flow_testfor10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor11, arginfo_stub_flow_testfor11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor12, arginfo_stub_flow_testfor12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor12, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor13, arginfo_stub_flow_testfor13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor14, arginfo_stub_flow_testfor14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor14, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor1, arginfo_stub_flow_testfor1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor2, arginfo_stub_flow_testfor2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor3, arginfo_stub_flow_testfor3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor4, arginfo_stub_flow_testfor4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor5, arginfo_stub_flow_testfor5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor6, arginfo_stub_flow_testfor6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor7, arginfo_stub_flow_testfor7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor8, arginfo_stub_flow_testfor8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor9, arginfo_stub_flow_testfor9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor10, arginfo_stub_flow_testfor10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor11, arginfo_stub_flow_testfor11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor12, arginfo_stub_flow_testfor12, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor13, arginfo_stub_flow_testfor13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor14, arginfo_stub_flow_testfor14, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor15, arginfo_stub_flow_testfor15, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor16, arginfo_stub_flow_testfor16, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor16, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor17, arginfo_stub_flow_testfor17, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor17, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor18, arginfo_stub_flow_testfor18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor18, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor19, arginfo_stub_flow_testfor19, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor19, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor20, arginfo_stub_flow_testfor20, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor20, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor21, arginfo_stub_flow_testfor21, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor21, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor22, arginfo_stub_flow_testfor22, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor22, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor23, arginfo_stub_flow_testfor23, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor23, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor24, arginfo_stub_flow_testfor24, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor24, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor30, arginfo_stub_flow_testfor30, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor30, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor31, arginfo_stub_flow_testfor31, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor31, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor16, arginfo_stub_flow_testfor16, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor17, arginfo_stub_flow_testfor17, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor18, arginfo_stub_flow_testfor18, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor19, arginfo_stub_flow_testfor19, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor20, arginfo_stub_flow_testfor20, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor21, arginfo_stub_flow_testfor21, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor22, arginfo_stub_flow_testfor22, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor23, arginfo_stub_flow_testfor23, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor24, arginfo_stub_flow_testfor24, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor30, arginfo_stub_flow_testfor30, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor31, arginfo_stub_flow_testfor31, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor32, arginfo_stub_flow_testfor32, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor33, arginfo_stub_flow_testfor33, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor34, arginfo_stub_flow_testfor34, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor35Aux, arginfo_stub_flow_testfor35aux, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor35, arginfo_stub_flow_testfor35, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor35, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor35, arginfo_stub_flow_testfor35, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow, testFor36Aux, arginfo_stub_flow_testfor36aux, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor36, arginfo_stub_flow_testfor36, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor36, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor37, arginfo_stub_flow_testfor37, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor37, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor38, arginfo_stub_flow_testfor38, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor38, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor39, arginfo_stub_flow_testfor39, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor39, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testFor40, arginfo_stub_flow_testfor40, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testFor40, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testUnrechable1, arginfo_stub_flow_testunrechable1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testUnrechable1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testUnrechable2, arginfo_stub_flow_testunrechable2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testUnrechable2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow, testUnrechable3, arginfo_stub_flow_testunrechable3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow, testUnrechable3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow, testFor36, arginfo_stub_flow_testfor36, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor37, arginfo_stub_flow_testfor37, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor38, arginfo_stub_flow_testfor38, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor39, arginfo_stub_flow_testfor39, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testFor40, arginfo_stub_flow_testfor40, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testUnrechable1, arginfo_stub_flow_testunrechable1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testUnrechable2, arginfo_stub_flow_testunrechable2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Flow, testUnrechable3, arginfo_stub_flow_testunrechable3, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/flow/switchflow.zep.c b/ext/stub/flow/switchflow.zep.c index 45290bd554..c8dc85e636 100644 --- a/ext/stub/flow/switchflow.zep.c +++ b/ext/stub/flow/switchflow.zep.c @@ -233,13 +233,10 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch12) ZVAL_UNDEF(&var1_sub); ZVAL_UNDEF(&var2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(var1) Z_PARAM_ZVAL(var2) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &var1, &var2); @@ -277,12 +274,9 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch13) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -313,13 +307,10 @@ PHP_METHOD(Stub_Flow_SwitchFlow, testSwitch14) ZVAL_UNDEF(&result_type_sub); ZVAL_UNDEF(&ret); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(result_type) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/flow/switchflow.zep.h b/ext/stub/flow/switchflow.zep.h index 6ad791d370..e08126c64d 100644 --- a/ext/stub/flow/switchflow.zep.h +++ b/ext/stub/flow/switchflow.zep.h @@ -75,11 +75,7 @@ ZEPHIR_INIT_FUNCS(stub_flow_switchflow_method_entry) { PHP_ME(Stub_Flow_SwitchFlow, testSwitch8, arginfo_stub_flow_switchflow_testswitch8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch9, arginfo_stub_flow_switchflow_testswitch9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch10, arginfo_stub_flow_switchflow_testswitch10, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Flow_SwitchFlow, testSwitch11, arginfo_stub_flow_switchflow_testswitch11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Flow_SwitchFlow, testSwitch11, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Flow_SwitchFlow, testSwitch11, arginfo_stub_flow_switchflow_testswitch11, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch12, arginfo_stub_flow_switchflow_testswitch12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch13, arginfo_stub_flow_switchflow_testswitch13, ZEND_ACC_PUBLIC) PHP_ME(Stub_Flow_SwitchFlow, testSwitch14, arginfo_stub_flow_switchflow_testswitch14, ZEND_ACC_PUBLIC) diff --git a/ext/stub/functional.zep.c b/ext/stub/functional.zep.c index 390e0b834a..3de668d004 100644 --- a/ext/stub/functional.zep.c +++ b/ext/stub/functional.zep.c @@ -36,12 +36,9 @@ PHP_METHOD(Stub_Functional, map1) ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -68,13 +65,10 @@ PHP_METHOD(Stub_Functional, map2) ZVAL_UNDEF(&a); ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/functionexists.zep.c b/ext/stub/functionexists.zep.c index 8c43503813..fcbe1039b2 100644 --- a/ext/stub/functionexists.zep.c +++ b/ext/stub/functionexists.zep.c @@ -34,12 +34,9 @@ PHP_METHOD(Stub_FunctionExists, testWithPassedName) zval *this_ptr = getThis(); ZVAL_UNDEF(&func); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(func) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/geometry.zep.c b/ext/stub/geometry.zep.c index 8caa3fca86..f338f42cc3 100644 --- a/ext/stub/geometry.zep.c +++ b/ext/stub/geometry.zep.c @@ -45,13 +45,10 @@ PHP_METHOD(Stub_Geometry, run) ZVAL_UNDEF(&_6$$3); ZVAL_UNDEF(&_7$$3); ZVAL_UNDEF(&_8$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(list) Z_PARAM_LONG(count) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -95,13 +92,10 @@ PHP_METHOD(Stub_Geometry, runOptimize) ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(list) Z_PARAM_LONG(count) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -135,15 +129,12 @@ PHP_METHOD(Stub_Geometry, distanceStatic) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(4, 4) Z_PARAM_ZVAL(x1) Z_PARAM_ZVAL(y1) Z_PARAM_ZVAL(x2) Z_PARAM_ZVAL(y2) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(4, 0, &x1_param, &y1_param, &x2_param, &y2_param); diff --git a/ext/stub/globals.zep.c b/ext/stub/globals.zep.c index 6f79b795a2..27e6c99a1f 100644 --- a/ext/stub/globals.zep.c +++ b/ext/stub/globals.zep.c @@ -30,12 +30,9 @@ PHP_METHOD(Stub_Globals, setBoolValueUsingDotNotation) zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &value); @@ -50,12 +47,9 @@ PHP_METHOD(Stub_Globals, setIntValueUsingDotNotation) zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &value); @@ -70,12 +64,9 @@ PHP_METHOD(Stub_Globals, setCharValue) zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &value); @@ -92,12 +83,9 @@ PHP_METHOD(Stub_Globals, setStringValue) zval *this_ptr = getThis(); ZVAL_UNDEF(&value); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -115,12 +103,9 @@ PHP_METHOD(Stub_Globals, setBoolValue) zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &value); @@ -135,12 +120,9 @@ PHP_METHOD(Stub_Globals, setDefaultGlobalsOrmCacheLevel) zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &value); @@ -157,12 +139,9 @@ PHP_METHOD(Stub_Globals, setDefaultGlobalsOrmCachePrefix) zval *this_ptr = getThis(); ZVAL_UNDEF(&value); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/globals.zep.h b/ext/stub/globals.zep.h index c27a3126af..f33b4d4215 100644 --- a/ext/stub/globals.zep.h +++ b/ext/stub/globals.zep.h @@ -94,55 +94,15 @@ ZEPHIR_INIT_FUNCS(stub_globals_method_entry) { PHP_ME(Stub_Globals, setBoolValue, arginfo_stub_globals_setboolvalue, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals, setDefaultGlobalsOrmCacheLevel, arginfo_stub_globals_setdefaultglobalsormcachelevel, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals, setDefaultGlobalsOrmCachePrefix, arginfo_stub_globals_setdefaultglobalsormcacheprefix, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals1, arginfo_stub_globals_getdefaultglobals1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals2, arginfo_stub_globals_getdefaultglobals2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals3, arginfo_stub_globals_getdefaultglobals3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals4, arginfo_stub_globals_getdefaultglobals4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals5, arginfo_stub_globals_getdefaultglobals5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals6, arginfo_stub_globals_getdefaultglobals6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals7, arginfo_stub_globals_getdefaultglobals7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobals8, arginfo_stub_globals_getdefaultglobals8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobals8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCacheLevel, arginfo_stub_globals_getdefaultglobalsormcachelevel, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCacheLevel, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCachePrefix, arginfo_stub_globals_getdefaultglobalsormcacheprefix, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals, getDefaultGlobalsOrmCachePrefix, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Globals, getDefaultGlobals1, arginfo_stub_globals_getdefaultglobals1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals2, arginfo_stub_globals_getdefaultglobals2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals3, arginfo_stub_globals_getdefaultglobals3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals4, arginfo_stub_globals_getdefaultglobals4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals5, arginfo_stub_globals_getdefaultglobals5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals6, arginfo_stub_globals_getdefaultglobals6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals7, arginfo_stub_globals_getdefaultglobals7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobals8, arginfo_stub_globals_getdefaultglobals8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobalsOrmCacheLevel, arginfo_stub_globals_getdefaultglobalsormcachelevel, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Globals, getDefaultGlobalsOrmCachePrefix, arginfo_stub_globals_getdefaultglobalsormcacheprefix, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/globals/env.zep.c b/ext/stub/globals/env.zep.c index c4586c9c22..94171cb5be 100644 --- a/ext/stub/globals/env.zep.c +++ b/ext/stub/globals/env.zep.c @@ -35,12 +35,9 @@ PHP_METHOD(Stub_Globals_Env, read) ZVAL_UNDEF(&name); ZVAL_UNDEF(&_ENV); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/globals/post.zep.c b/ext/stub/globals/post.zep.c index 168f13fe55..4b4906f924 100644 --- a/ext/stub/globals/post.zep.c +++ b/ext/stub/globals/post.zep.c @@ -39,12 +39,9 @@ PHP_METHOD(Stub_Globals_Post, hasValue) ZVAL_UNDEF(&name); ZVAL_UNDEF(&_POST); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/globals/server.zep.h b/ext/stub/globals/server.zep.h index d2e0a123ad..95dc2c3e91 100644 --- a/ext/stub/globals/server.zep.h +++ b/ext/stub/globals/server.zep.h @@ -19,10 +19,6 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_globals_server_method_entry) { PHP_ME(Stub_Globals_Server, f1, arginfo_stub_globals_server_f1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals_Server, f2, arginfo_stub_globals_server_f2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals_Server, check, arginfo_stub_globals_server_check, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals_Server, check, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Globals_Server, check, arginfo_stub_globals_server_check, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/globals/serverrequestfactory.zep.c b/ext/stub/globals/serverrequestfactory.zep.c index c68be91bed..81557c09bb 100644 --- a/ext/stub/globals/serverrequestfactory.zep.c +++ b/ext/stub/globals/serverrequestfactory.zep.c @@ -58,7 +58,6 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 5) Z_PARAM_OPTIONAL @@ -68,7 +67,6 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load) Z_PARAM_ARRAY_OR_NULL(cookies) Z_PARAM_ARRAY_OR_NULL(files) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -167,13 +165,10 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, checkNullArray) ZVAL_UNDEF(&source_sub); ZVAL_UNDEF(&super); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(source) Z_PARAM_ARRAY(super) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/globals/serverrequestfactory.zep.h b/ext/stub/globals/serverrequestfactory.zep.h index ad22f9b253..1e4873d494 100644 --- a/ext/stub/globals/serverrequestfactory.zep.h +++ b/ext/stub/globals/serverrequestfactory.zep.h @@ -7,31 +7,11 @@ PHP_METHOD(Stub_Globals_ServerRequestFactory, load); PHP_METHOD(Stub_Globals_ServerRequestFactory, checkNullArray); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_load, 0, 0, IS_ARRAY, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, server, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, server, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, get, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, post, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, post, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cookies, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, cookies, 1) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, files, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, files, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, server, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, post, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cookies, IS_ARRAY, 1, "[]") +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, files, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_globals_serverrequestfactory_checknullarray, 0, 2, IS_ARRAY, 0) diff --git a/ext/stub/globals/session/base.zep.c b/ext/stub/globals/session/base.zep.c index 698bcd6647..8a5751b79c 100644 --- a/ext/stub/globals/session/base.zep.c +++ b/ext/stub/globals/session/base.zep.c @@ -36,13 +36,10 @@ PHP_METHOD(Stub_Globals_Session_Base, set) ZVAL_UNDEF(&index); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_SESSION); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -65,12 +62,9 @@ PHP_METHOD(Stub_Globals_Session_Base, remove) ZVAL_UNDEF(&index); ZVAL_UNDEF(&_SESSION); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -93,13 +87,10 @@ PHP_METHOD(Stub_Globals_Session_Base, __set) ZVAL_UNDEF(&index); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(index) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -121,12 +112,9 @@ PHP_METHOD(Stub_Globals_Session_Base, __unset) zval *this_ptr = getThis(); ZVAL_UNDEF(&index); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/globals/session/base.zep.h b/ext/stub/globals/session/base.zep.h index d1bad5eb87..d6392cbcdc 100644 --- a/ext/stub/globals/session/base.zep.h +++ b/ext/stub/globals/session/base.zep.h @@ -35,10 +35,6 @@ ZEPHIR_INIT_FUNCS(stub_globals_session_base_method_entry) { PHP_ME(Stub_Globals_Session_Base, remove, arginfo_stub_globals_session_base_remove, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals_Session_Base, __set, arginfo_stub_globals_session_base___set, ZEND_ACC_PUBLIC) PHP_ME(Stub_Globals_Session_Base, __unset, arginfo_stub_globals_session_base___unset, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals_Session_Base, removeSessionData, arginfo_stub_globals_session_base_removesessiondata, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_Globals_Session_Base, removeSessionData, NULL, ZEND_ACC_PROTECTED) -#endif +PHP_ME(Stub_Globals_Session_Base, removeSessionData, arginfo_stub_globals_session_base_removesessiondata, ZEND_ACC_PROTECTED) PHP_FE_END }; diff --git a/ext/stub/globals/session/child.zep.h b/ext/stub/globals/session/child.zep.h index d490cd0a8e..249376ad73 100644 --- a/ext/stub/globals/session/child.zep.h +++ b/ext/stub/globals/session/child.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_globals_session_child_destroy, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_globals_session_child_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Globals_Session_Child, destroy, arginfo_stub_globals_session_child_destroy, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Globals_Session_Child, destroy, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Globals_Session_Child, destroy, arginfo_stub_globals_session_child_destroy, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/instance.zep.c b/ext/stub/instance.zep.c index 325d9f59d9..8129713d1c 100644 --- a/ext/stub/instance.zep.c +++ b/ext/stub/instance.zep.c @@ -45,8 +45,6 @@ PHP_METHOD(Stub_Instance, __construct) ZVAL_UNDEF(&a9_sub); ZVAL_UNDEF(&a10_sub); ZVAL_UNDEF(&a11_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(11, 11) Z_PARAM_OBJECT_OF_CLASS(a1, stub_arithmetic_ce) Z_PARAM_OBJECT_OF_CLASS(a2, stub_arrayobject_ce) @@ -60,7 +58,6 @@ PHP_METHOD(Stub_Instance, __construct) Z_PARAM_OBJECT_OF_CLASS(a10, stub_compare_ce) Z_PARAM_OBJECT_OF_CLASS(a11, stub_concat_ce) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(11, 0, &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9, &a10, &a11); @@ -184,12 +181,9 @@ PHP_METHOD(Stub_Instance, testInstanceCreate) zval *this_ptr = getThis(); ZVAL_UNDEF(&className); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/instanceoff.zep.c b/ext/stub/instanceoff.zep.c index a13582d99c..5d4c2660aa 100644 --- a/ext/stub/instanceoff.zep.c +++ b/ext/stub/instanceoff.zep.c @@ -88,12 +88,9 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf4) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -111,12 +108,9 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf5) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -156,12 +150,9 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf7) zval *this_ptr = getThis(); ZVAL_UNDEF(&test_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(test) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &test); @@ -180,12 +171,9 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf8) ZVAL_UNDEF(&test); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(test) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -212,13 +200,10 @@ PHP_METHOD(Stub_Instanceoff, testInstanceOf9) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&test); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_OBJECT(a) Z_PARAM_STR(test) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/interfaces/implementint.zep.c b/ext/stub/interfaces/implementint.zep.c index b9d582d74f..f5f3b87e33 100644 --- a/ext/stub/interfaces/implementint.zep.c +++ b/ext/stub/interfaces/implementint.zep.c @@ -33,12 +33,9 @@ PHP_METHOD(Stub_Interfaces_ImplementInt, set) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(val) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &val_param); diff --git a/ext/stub/interfaces/implementinterface.zep.c b/ext/stub/interfaces/implementinterface.zep.c index a893ad41ec..ab8face8bf 100644 --- a/ext/stub/interfaces/implementinterface.zep.c +++ b/ext/stub/interfaces/implementinterface.zep.c @@ -34,12 +34,9 @@ PHP_METHOD(Stub_Interfaces_ImplementInterface, get) zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(obj, stub_interfaces_interfaceint_ce) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -57,12 +54,9 @@ PHP_METHOD(Stub_Interfaces_ImplementInterface, getVoid) zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(obj, stub_interfaces_interfaceint_ce) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &obj); diff --git a/ext/stub/interfaces/interfacestaticmethod.zep.h b/ext/stub/interfaces/interfacestaticmethod.zep.h index e608428011..ef679c2b9a 100644 --- a/ext/stub/interfaces/interfacestaticmethod.zep.h +++ b/ext/stub/interfaces/interfacestaticmethod.zep.h @@ -7,10 +7,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_interfaces_interfacestaticmethod_reset, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_interfaces_interfacestaticmethod_method_entry) { -#if PHP_VERSION_ID >= 80000 - ZEND_FENTRY(reset, NULL, arginfo_stub_interfaces_interfacestaticmethod_reset, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - ZEND_FENTRY(reset, NULL, NULL, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +ZEND_FENTRY(reset, NULL, arginfo_stub_interfaces_interfacestaticmethod_reset, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/internalclasses.zep.h b/ext/stub/internalclasses.zep.h index 1148679325..b17fd43426 100644 --- a/ext/stub/internalclasses.zep.h +++ b/ext/stub/internalclasses.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_internalclasses_teststaticpropertyfetch, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_internalclasses_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_InternalClasses, testStaticCall, arginfo_stub_internalclasses_teststaticcall, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_InternalClasses, testStaticCall, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_InternalClasses, testStaticPropertyFetch, arginfo_stub_internalclasses_teststaticpropertyfetch, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_InternalClasses, testStaticPropertyFetch, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_InternalClasses, testStaticCall, arginfo_stub_internalclasses_teststaticcall, ZEND_ACC_PUBLIC) +PHP_ME(Stub_InternalClasses, testStaticPropertyFetch, arginfo_stub_internalclasses_teststaticpropertyfetch, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/invoke.zep.h b/ext/stub/invoke.zep.h index 523313d408..03b45af256 100644 --- a/ext/stub/invoke.zep.h +++ b/ext/stub/invoke.zep.h @@ -17,11 +17,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_invoke_test, 0, 0, IS_STRIN ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_invoke_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Invoke, __construct, arginfo_stub_invoke___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Invoke, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Invoke, __construct, arginfo_stub_invoke___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Invoke, __invoke, arginfo_stub_invoke___invoke, ZEND_ACC_PUBLIC) PHP_ME(Stub_Invoke, test, arginfo_stub_invoke_test, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/invokes/abstractinvoker.zep.h b/ext/stub/invokes/abstractinvoker.zep.h index 4c0eb0c35a..9aa02b8f12 100644 --- a/ext/stub/invokes/abstractinvoker.zep.h +++ b/ext/stub/invokes/abstractinvoker.zep.h @@ -6,22 +6,14 @@ ZEPHIR_INIT_CLASS(Stub_Invokes_AbstractInvoker); PHP_METHOD(Stub_Invokes_AbstractInvoker, __toString); PHP_METHOD(Stub_Invokes_AbstractInvoker, __invoke); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_invokes_abstractinvoker___tostring, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_invokes_abstractinvoker___tostring, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_invokes_abstractinvoker___invoke, 0, 0, Stub\\Invokes\\AbstractInvoker, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_invokes_abstractinvoker_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Invokes_AbstractInvoker, __toString, arginfo_stub_invokes_abstractinvoker___tostring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Invokes_AbstractInvoker, __toString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Invokes_AbstractInvoker, __toString, arginfo_stub_invokes_abstractinvoker___tostring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Invokes_AbstractInvoker, __invoke, arginfo_stub_invokes_abstractinvoker___invoke, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/invokes/abstractinvokercomplex.zep.h b/ext/stub/invokes/abstractinvokercomplex.zep.h index f32ec8339b..dcdce85182 100644 --- a/ext/stub/invokes/abstractinvokercomplex.zep.h +++ b/ext/stub/invokes/abstractinvokercomplex.zep.h @@ -6,22 +6,14 @@ ZEPHIR_INIT_CLASS(Stub_Invokes_AbstractInvokerComplex); PHP_METHOD(Stub_Invokes_AbstractInvokerComplex, __toString); PHP_METHOD(Stub_Invokes_AbstractInvokerComplex, __invoke); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_invokes_abstractinvokercomplex___tostring, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_invokes_abstractinvokercomplex___tostring, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_invokes_abstractinvokercomplex___invoke, 0, 0, Stub\\Invokes\\AbstractInvoker, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_invokes_abstractinvokercomplex_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Invokes_AbstractInvokerComplex, __toString, arginfo_stub_invokes_abstractinvokercomplex___tostring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Invokes_AbstractInvokerComplex, __toString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Invokes_AbstractInvokerComplex, __toString, arginfo_stub_invokes_abstractinvokercomplex___tostring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Invokes_AbstractInvokerComplex, __invoke, arginfo_stub_invokes_abstractinvokercomplex___invoke, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/invokes/abstractprotected.zep.c b/ext/stub/invokes/abstractprotected.zep.c index 566816b694..018fe442b2 100644 --- a/ext/stub/invokes/abstractprotected.zep.c +++ b/ext/stub/invokes/abstractprotected.zep.c @@ -38,12 +38,9 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, protectedMethod1) ZVAL_UNDEF(&text); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&ret); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -67,12 +64,9 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, protectedMethod2) ZVAL_UNDEF(&text); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&ret); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -99,12 +93,9 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, renderArrayElements) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -151,12 +142,9 @@ PHP_METHOD(Stub_Invokes_AbstractProtected, renderArrayElementsComplex) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_6$$3); ZVAL_UNDEF(&_10$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/invokes/invokeprotected.zep.c b/ext/stub/invokes/invokeprotected.zep.c index 4e5f18259d..a09d0c3248 100644 --- a/ext/stub/invokes/invokeprotected.zep.c +++ b/ext/stub/invokes/invokeprotected.zep.c @@ -32,12 +32,9 @@ PHP_METHOD(Stub_Invokes_InvokeProtected, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&text); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/invokes/invokeprotectedcomplex.zep.c b/ext/stub/invokes/invokeprotectedcomplex.zep.c index afe0f35d9f..2bf9f7c9d2 100644 --- a/ext/stub/invokes/invokeprotectedcomplex.zep.c +++ b/ext/stub/invokes/invokeprotectedcomplex.zep.c @@ -32,12 +32,9 @@ PHP_METHOD(Stub_Invokes_InvokeProtectedComplex, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&text); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(text) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/issettest.zep.c b/ext/stub/issettest.zep.c index c5b5d69e31..d82c575852 100644 --- a/ext/stub/issettest.zep.c +++ b/ext/stub/issettest.zep.c @@ -38,13 +38,10 @@ PHP_METHOD(Stub_IssetTest, testIssetArray1) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -60,13 +57,10 @@ PHP_METHOD(Stub_IssetTest, testIssetArray2) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b_param); @@ -85,13 +79,10 @@ PHP_METHOD(Stub_IssetTest, testIssetArray3) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_STR(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -108,12 +99,9 @@ PHP_METHOD(Stub_IssetTest, testIssetArray4) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -128,12 +116,9 @@ PHP_METHOD(Stub_IssetTest, testIssetArray5) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -148,12 +133,9 @@ PHP_METHOD(Stub_IssetTest, testIssetProperty1) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -169,13 +151,10 @@ PHP_METHOD(Stub_IssetTest, testIssetProperty2) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -190,12 +169,9 @@ PHP_METHOD(Stub_IssetTest, testIssetProperty3) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -215,7 +191,7 @@ PHP_METHOD(Stub_IssetTest, testIssetDynamicProperty1) ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&g); + zephir_memory_observe(&g); zephir_read_property(&g, this_ptr, ZEND_STRL("s"), PH_NOISY_CC); if (zephir_array_isset_string(&g, SL("a"))) { RETURN_MM_BOOL(1); @@ -231,19 +207,16 @@ PHP_METHOD(Stub_IssetTest, testIssetDynamicProperty2) ZVAL_UNDEF(&inp_sub); ZVAL_UNDEF(&g); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(inp) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &inp); - ZEPHIR_OBS_VAR(&g); + zephir_memory_observe(&g); zephir_read_property(&g, inp, ZEND_STRL("s"), PH_NOISY_CC); if (zephir_array_isset_string(&g, SL("a"))) { RETURN_MM_BOOL(1); diff --git a/ext/stub/issettest.zep.h b/ext/stub/issettest.zep.h index dc9eca31d3..f191d1050f 100644 --- a/ext/stub/issettest.zep.h +++ b/ext/stub/issettest.zep.h @@ -70,11 +70,7 @@ ZEPHIR_INIT_FUNCS(stub_issettest_method_entry) { PHP_ME(Stub_IssetTest, testIssetProperty1, arginfo_stub_issettest_testissetproperty1, ZEND_ACC_PUBLIC) PHP_ME(Stub_IssetTest, testIssetProperty2, arginfo_stub_issettest_testissetproperty2, ZEND_ACC_PUBLIC) PHP_ME(Stub_IssetTest, testIssetProperty3, arginfo_stub_issettest_testissetproperty3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_IssetTest, testIssetDynamicProperty1, arginfo_stub_issettest_testissetdynamicproperty1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_IssetTest, testIssetDynamicProperty1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_IssetTest, testIssetDynamicProperty1, arginfo_stub_issettest_testissetdynamicproperty1, ZEND_ACC_PUBLIC) PHP_ME(Stub_IssetTest, testIssetDynamicProperty2, arginfo_stub_issettest_testissetdynamicproperty2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/issue1134.zep.c b/ext/stub/issue1134.zep.c index 829e666c58..1adf340111 100644 --- a/ext/stub/issue1134.zep.c +++ b/ext/stub/issue1134.zep.c @@ -36,13 +36,10 @@ PHP_METHOD(Stub_Issue1134, __construct) zval *this_ptr = getThis(); ZVAL_UNDEF(&config); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(config) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -67,13 +64,10 @@ PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue) zval *this_ptr = getThis(); ZVAL_UNDEF(&someDefaultData); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(someDefaultData) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/issue1134.zep.h b/ext/stub/issue1134.zep.h index 6c44ebc836..967e3622f9 100644 --- a/ext/stub/issue1134.zep.h +++ b/ext/stub/issue1134.zep.h @@ -7,19 +7,11 @@ PHP_METHOD(Stub_Issue1134, __construct); PHP_METHOD(Stub_Issue1134, arrayWithFilledDefaultValue); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134___construct, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, config, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, config, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, config, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1134_arraywithfilleddefaultvalue, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, someDefaultData, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someDefaultData, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue1134_method_entry) { diff --git a/ext/stub/issue1521.zep.h b/ext/stub/issue1521.zep.h index 518615b996..bee7d6fc02 100644 --- a/ext/stub/issue1521.zep.h +++ b/ext/stub/issue1521.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue1521_test, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue1521_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue1521, test, arginfo_stub_issue1521_test, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issue1521, test, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Issue1521, test, arginfo_stub_issue1521_test, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/issue2165/issue.zep.c b/ext/stub/issue2165/issue.zep.c index 161dc606e7..5cea899e4b 100644 --- a/ext/stub/issue2165/issue.zep.c +++ b/ext/stub/issue2165/issue.zep.c @@ -45,13 +45,10 @@ PHP_METHOD(Stub_Issue2165_Issue, build) ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -121,14 +118,11 @@ PHP_METHOD(Stub_Issue2165_Issue, __construct) ZVAL_UNDEF(&_42$$15); ZVAL_UNDEF(&_43$$15); ZVAL_UNDEF(&_44$$15); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ARRAY(a) Z_PARAM_OPTIONAL Z_PARAM_BOOL(validate) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -362,13 +356,10 @@ PHP_METHOD(Stub_Issue2165_Issue, quick) ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -398,13 +389,10 @@ PHP_METHOD(Stub_Issue2165_Issue, ones) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(m) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -447,14 +435,11 @@ PHP_METHOD(Stub_Issue2165_Issue, fill) ZVAL_UNDEF(&_11$$5); ZVAL_UNDEF(&_12$$5); ZVAL_UNDEF(&_13$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(value) Z_PARAM_LONG(m) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -556,12 +541,9 @@ PHP_METHOD(Stub_Issue2165_Issue, divideMatrix) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&c); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(b, stub_issue2165_issue_ce) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/issue2165/issue.zep.h b/ext/stub/issue2165/issue.zep.h index 350ac1d298..a959a69e69 100644 --- a/ext/stub/issue2165/issue.zep.h +++ b/ext/stub/issue2165/issue.zep.h @@ -12,11 +12,7 @@ PHP_METHOD(Stub_Issue2165_Issue, reciprocal); PHP_METHOD(Stub_Issue2165_Issue, divideMatrix); ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_build, 0, 0, Stub\\Issue2165\\Issue, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, a, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) @@ -25,11 +21,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue2165_issue___construct, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_quick, 0, 0, Stub\\Issue2165\\Issue, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, a, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, a, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_issue2165_issue_ones, 0, 2, Stub\\Issue2165\\Issue, 0) diff --git a/ext/stub/issue663.zep.c b/ext/stub/issue663.zep.c index 434053e128..7be142cff6 100644 --- a/ext/stub/issue663.zep.c +++ b/ext/stub/issue663.zep.c @@ -36,12 +36,9 @@ PHP_METHOD(Stub_Issue663, is_array_assoc) zval *this_ptr = getThis(); ZVAL_UNDEF(&arr_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arr) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -70,12 +67,9 @@ PHP_METHOD(Stub_Issue663, is_array_assoc_internal) zval *this_ptr = getThis(); ZVAL_UNDEF(&arr); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(arr) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -117,12 +111,9 @@ PHP_METHOD(Stub_Issue663, is_array_indexed) ZVAL_UNDEF(&arr_sub); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arr) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/issue887.zep.c b/ext/stub/issue887.zep.c index 1fa818d024..d1504bbd5f 100644 --- a/ext/stub/issue887.zep.c +++ b/ext/stub/issue887.zep.c @@ -52,13 +52,10 @@ PHP_METHOD(Stub_Issue887, add) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(key) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &key, &value); @@ -87,7 +84,7 @@ PHP_METHOD(Stub_Issue887, fetch_object) ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property(&_0, this_ptr, ZEND_STRL("data"), PH_NOISY_CC); zephir_convert_to_object(&_0); RETURN_CCTOR(&_0); diff --git a/ext/stub/issue887.zep.h b/ext/stub/issue887.zep.h index e83bdd3431..5bd0aa3da4 100644 --- a/ext/stub/issue887.zep.h +++ b/ext/stub/issue887.zep.h @@ -23,21 +23,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue887_fetch_object, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue887_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue887, __construct, arginfo_stub_issue887___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Issue887, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Issue887, __construct, arginfo_stub_issue887___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Issue887, add, arginfo_stub_issue887_add, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue887, fetch_array, arginfo_stub_issue887_fetch_array, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issue887, fetch_array, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue887, fetch_object, arginfo_stub_issue887_fetch_object, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issue887, fetch_object, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Issue887, fetch_array, arginfo_stub_issue887_fetch_array, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Issue887, fetch_object, arginfo_stub_issue887_fetch_object, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/issue914.zep.h b/ext/stub/issue914.zep.h index 6d7521eca8..312f0d8ed4 100644 --- a/ext/stub/issue914.zep.h +++ b/ext/stub/issue914.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_issue914___construct, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issue914_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issue914, __construct, arginfo_stub_issue914___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Issue914, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Issue914, __construct, arginfo_stub_issue914___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_FE_END }; diff --git a/ext/stub/issues.zep.c b/ext/stub/issues.zep.c index bb99ee8142..d3c2405578 100644 --- a/ext/stub/issues.zep.c +++ b/ext/stub/issues.zep.c @@ -31,12 +31,9 @@ PHP_METHOD(Stub_Issues, setAdapter) zval *this_ptr = getThis(); ZVAL_UNDEF(&adapter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(adapter) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &adapter); @@ -54,12 +51,9 @@ PHP_METHOD(Stub_Issues, someMethod) ZVAL_UNDEF(&methodName_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(methodName) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/issues.zep.h b/ext/stub/issues.zep.h index d9cd5f2551..1432b9064b 100644 --- a/ext/stub/issues.zep.h +++ b/ext/stub/issues.zep.h @@ -21,10 +21,6 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_issues_method_entry) { PHP_ME(Stub_Issues, setAdapter, arginfo_stub_issues_setadapter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Issues, someMethod, arginfo_stub_issues_somemethod, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Issues, test, arginfo_stub_issues_test, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Issues, test, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Issues, test, arginfo_stub_issues_test, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/json.zep.h b/ext/stub/json.zep.h index 1b30db4d7e..6c00495d72 100644 --- a/ext/stub/json.zep.h +++ b/ext/stub/json.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_json_testdecodearray, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_json_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testEncodeObject, arginfo_stub_json_testencodeobject, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testEncodeObject, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testEncodeArray, arginfo_stub_json_testencodearray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testEncodeArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testEncodeOptions, arginfo_stub_json_testencodeoptions, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testEncodeOptions, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testDecodeObject, arginfo_stub_json_testdecodeobject, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testDecodeObject, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testDecodeObject2, arginfo_stub_json_testdecodeobject2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testDecodeObject2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Json, testDecodeArray, arginfo_stub_json_testdecodearray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Json, testDecodeArray, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Json, testEncodeObject, arginfo_stub_json_testencodeobject, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testEncodeArray, arginfo_stub_json_testencodearray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testEncodeOptions, arginfo_stub_json_testencodeoptions, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testDecodeObject, arginfo_stub_json_testdecodeobject, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testDecodeObject2, arginfo_stub_json_testdecodeobject2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Json, testDecodeArray, arginfo_stub_json_testdecodearray, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/logical.zep.c b/ext/stub/logical.zep.c index ef408d57bb..a22841f196 100644 --- a/ext/stub/logical.zep.c +++ b/ext/stub/logical.zep.c @@ -106,13 +106,10 @@ PHP_METHOD(Stub_Logical, testAnd9) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_1$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b_param); @@ -195,13 +192,10 @@ PHP_METHOD(Stub_Logical, testMixed2) ZVAL_UNDEF(&match_sub); ZVAL_UNDEF(&minLength_sub); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(match) Z_PARAM_ZVAL(minLength) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &match, &minLength); @@ -257,13 +251,10 @@ PHP_METHOD(Stub_Logical, testMixed4) zend_bool a, b, _0, _1, _2; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_BOOL(a) Z_PARAM_BOOL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); diff --git a/ext/stub/logical.zep.h b/ext/stub/logical.zep.h index 94b84df967..654f6ed011 100644 --- a/ext/stub/logical.zep.h +++ b/ext/stub/logical.zep.h @@ -55,48 +55,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_logical_testmixed4, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_logical_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd1, arginfo_stub_logical_testand1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd2, arginfo_stub_logical_testand2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd3, arginfo_stub_logical_testand3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testAnd4, arginfo_stub_logical_testand4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testAnd4, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Logical, testAnd1, arginfo_stub_logical_testand1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testAnd2, arginfo_stub_logical_testand2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testAnd3, arginfo_stub_logical_testand3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testAnd4, arginfo_stub_logical_testand4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Logical, testAnd9, arginfo_stub_logical_testand9, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testOr1, arginfo_stub_logical_testor1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testOr1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testOr2, arginfo_stub_logical_testor2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testOr2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testMixed1, arginfo_stub_logical_testmixed1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testMixed1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Logical, testOr1, arginfo_stub_logical_testor1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testOr2, arginfo_stub_logical_testor2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Logical, testMixed1, arginfo_stub_logical_testmixed1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Logical, testMixed2, arginfo_stub_logical_testmixed2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Logical, testMixed3, arginfo_stub_logical_testmixed3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Logical, testMixed3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Logical, testMixed3, arginfo_stub_logical_testmixed3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Logical, testMixed4, arginfo_stub_logical_testmixed4, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index c5d4670335..dd976354d2 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -65,13 +65,10 @@ PHP_METHOD(Stub_Mcall, testMethod4) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -88,13 +85,10 @@ PHP_METHOD(Stub_Mcall, testMethod5) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -111,13 +105,10 @@ PHP_METHOD(Stub_Mcall, testMethod6) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -191,13 +182,10 @@ PHP_METHOD(Stub_Mcall, testCall4) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -218,13 +206,10 @@ PHP_METHOD(Stub_Mcall, testCall5) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -245,13 +230,10 @@ PHP_METHOD(Stub_Mcall, testCall6) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -275,13 +257,10 @@ PHP_METHOD(Stub_Mcall, testCall7) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -308,13 +287,10 @@ PHP_METHOD(Stub_Mcall, testCall8) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -340,13 +316,10 @@ PHP_METHOD(Stub_Mcall, testCall9) ZVAL_UNDEF(&b_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -415,13 +388,10 @@ PHP_METHOD(Stub_Mcall, testCall13) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -442,13 +412,10 @@ PHP_METHOD(Stub_Mcall, testCall14) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -469,13 +436,10 @@ PHP_METHOD(Stub_Mcall, testCall15) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -496,13 +460,10 @@ PHP_METHOD(Stub_Mcall, testCall16) ZVAL_UNDEF(&c_sub); ZVAL_UNDEF(&d_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(c) Z_PARAM_ZVAL(d) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -523,13 +484,10 @@ PHP_METHOD(Stub_Mcall, testCall17) ZVAL_UNDEF(&c_sub); ZVAL_UNDEF(&d_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(c) Z_PARAM_ZVAL(d) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -562,13 +520,10 @@ PHP_METHOD(Stub_Mcall, testMethod19) long a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); @@ -591,13 +546,10 @@ PHP_METHOD(Stub_Mcall, testCall20) ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -634,13 +586,10 @@ PHP_METHOD(Stub_Mcall, testMethod21) long a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); @@ -663,13 +612,10 @@ PHP_METHOD(Stub_Mcall, testCall22) ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -708,12 +654,9 @@ PHP_METHOD(Stub_Mcall, optionalRequereString) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(param) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -740,13 +683,10 @@ PHP_METHOD(Stub_Mcall, optionalParameterString) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR(param) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -770,13 +710,11 @@ PHP_METHOD(Stub_Mcall, optionalParameterStringNull) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -797,13 +735,10 @@ PHP_METHOD(Stub_Mcall, optionalParameterInt) zend_long param; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_LONG(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶m_param); @@ -824,13 +759,11 @@ PHP_METHOD(Stub_Mcall, optionalParameterVar) ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶m); @@ -850,13 +783,10 @@ PHP_METHOD(Stub_Mcall, optionalParameterBoolTrue) zend_bool param; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶m_param); @@ -876,13 +806,10 @@ PHP_METHOD(Stub_Mcall, optionalParameterBoolFalse) zend_bool param; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶m_param); @@ -902,13 +829,10 @@ PHP_METHOD(Stub_Mcall, optionalParameterBoolean) zend_bool start; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(start) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, &start_param); @@ -932,13 +856,11 @@ PHP_METHOD(Stub_Mcall, optionalParameterBooleanNull) zend_bool value; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL_OR_NULL(value, is_null_true) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, &value_param); @@ -967,13 +889,10 @@ PHP_METHOD(Stub_Mcall, testArrayParamWithDefaultEmptyArray) zval *this_ptr = getThis(); ZVAL_UNDEF(&driverOptions); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(driverOptions) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -997,13 +916,11 @@ PHP_METHOD(Stub_Mcall, testArrayParamWithDefaultNullValue) zval *this_ptr = getThis(); ZVAL_UNDEF(&driverOptions); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(driverOptions) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1026,12 +943,9 @@ PHP_METHOD(Stub_Mcall, testArrayParam) zval *this_ptr = getThis(); ZVAL_UNDEF(&driverOptions); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(driverOptions) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1048,12 +962,9 @@ PHP_METHOD(Stub_Mcall, testObjectParamCastStdClass) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, zend_standard_class_def) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); @@ -1069,12 +980,9 @@ PHP_METHOD(Stub_Mcall, testObjectParamCastOoParam) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, stub_oo_param_ce) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); @@ -1224,13 +1132,11 @@ PHP_METHOD(Stub_Mcall, issue2245VarArgumentNullable) ZVAL_UNDEF(¶m_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶m); diff --git a/ext/stub/mcall.zep.h b/ext/stub/mcall.zep.h index cd90993017..781f28c894 100644 --- a/ext/stub/mcall.zep.h +++ b/ext/stub/mcall.zep.h @@ -213,19 +213,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_optionalparameterbooleannull, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultemptyarray, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, driverOptions, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparamwithdefaultnullvalue, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 1, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, driverOptions, 1) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 1, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_testarrayparam, 0, 0, 1) @@ -260,71 +252,31 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcall_issue2245varargumentnullable, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcall_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testMethod1, arginfo_stub_mcall_testmethod1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testMethod1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testMethod2, arginfo_stub_mcall_testmethod2, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_Mcall, testMethod2, NULL, ZEND_ACC_PROTECTED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testMethod3, arginfo_stub_mcall_testmethod3, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_Mcall, testMethod3, NULL, ZEND_ACC_PRIVATE) -#endif +PHP_ME(Stub_Mcall, testMethod1, arginfo_stub_mcall_testmethod1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testMethod2, arginfo_stub_mcall_testmethod2, ZEND_ACC_PROTECTED) +PHP_ME(Stub_Mcall, testMethod3, arginfo_stub_mcall_testmethod3, ZEND_ACC_PRIVATE) PHP_ME(Stub_Mcall, testMethod4, arginfo_stub_mcall_testmethod4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testMethod5, arginfo_stub_mcall_testmethod5, ZEND_ACC_PROTECTED) PHP_ME(Stub_Mcall, testMethod6, arginfo_stub_mcall_testmethod6, ZEND_ACC_PRIVATE) PHP_ME(Stub_Mcall, testMethod7, arginfo_stub_mcall_testmethod7, ZEND_ACC_PRIVATE) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall1, arginfo_stub_mcall_testcall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall2, arginfo_stub_mcall_testcall2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall3, arginfo_stub_mcall_testcall3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, testCall1, arginfo_stub_mcall_testcall1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall2, arginfo_stub_mcall_testcall2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall3, arginfo_stub_mcall_testcall3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall4, arginfo_stub_mcall_testcall4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall5, arginfo_stub_mcall_testcall5, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall6, arginfo_stub_mcall_testcall6, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall7, arginfo_stub_mcall_testcall7, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall8, arginfo_stub_mcall_testcall8, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall9, arginfo_stub_mcall_testcall9, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall10, arginfo_stub_mcall_testcall10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall11, arginfo_stub_mcall_testcall11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall12, arginfo_stub_mcall_testcall12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall12, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, testCall10, arginfo_stub_mcall_testcall10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall11, arginfo_stub_mcall_testcall11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCall12, arginfo_stub_mcall_testcall12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall13, arginfo_stub_mcall_testcall13, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall14, arginfo_stub_mcall_testcall14, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall15, arginfo_stub_mcall_testcall15, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall16, arginfo_stub_mcall_testcall16, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall17, arginfo_stub_mcall_testcall17, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCall18, arginfo_stub_mcall_testcall18, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCall18, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, testCall18, arginfo_stub_mcall_testcall18, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testMethod19, arginfo_stub_mcall_testmethod19, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testCall20, arginfo_stub_mcall_testcall20, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testMethod21, arginfo_stub_mcall_testmethod21, ZEND_ACC_PRIVATE) @@ -343,31 +295,11 @@ ZEPHIR_INIT_FUNCS(stub_mcall_method_entry) { PHP_ME(Stub_Mcall, testArrayParam, arginfo_stub_mcall_testarrayparam, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testObjectParamCastStdClass, arginfo_stub_mcall_testobjectparamcaststdclass, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, testObjectParamCastOoParam, arginfo_stub_mcall_testobjectparamcastooparam, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, bb, arginfo_stub_mcall_bb, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_Mcall, bb, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCallablePass, arginfo_stub_mcall_testcallablepass, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCallablePass, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, testCallableArrayThisMethodPass, arginfo_stub_mcall_testcallablearraythismethodpass, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, testCallableArrayThisMethodPass, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, aa, arginfo_stub_mcall_aa, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, aa, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Mcall, issue1136, arginfo_stub_mcall_issue1136, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Mcall, issue1136, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Mcall, bb, arginfo_stub_mcall_bb, ZEND_ACC_PRIVATE) +PHP_ME(Stub_Mcall, testCallablePass, arginfo_stub_mcall_testcallablepass, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, testCallableArrayThisMethodPass, arginfo_stub_mcall_testcallablearraythismethodpass, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, aa, arginfo_stub_mcall_aa, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Mcall, issue1136, arginfo_stub_mcall_issue1136, ZEND_ACC_PUBLIC) PHP_ME(Stub_Mcall, issue2245VarArgumentNullable, arginfo_stub_mcall_issue2245varargumentnullable, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcall/caller.zep.c b/ext/stub/mcall/caller.zep.c index 34671d4553..875093db51 100644 --- a/ext/stub/mcall/caller.zep.c +++ b/ext/stub/mcall/caller.zep.c @@ -32,12 +32,9 @@ PHP_METHOD(Stub_Mcall_Caller, start) zval *this_ptr = getThis(); ZVAL_UNDEF(&f_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(f) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/mcallchained.zep.h b/ext/stub/mcallchained.zep.h index f090ac8d60..c538fcafd9 100644 --- a/ext/stub/mcallchained.zep.h +++ b/ext/stub/mcallchained.zep.h @@ -33,40 +33,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcallchained_testchained4, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcallchained_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testMethod1, arginfo_stub_mcallchained_testmethod1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testMethod1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testMethod2, arginfo_stub_mcallchained_testmethod2, ZEND_ACC_PROTECTED) -#else - PHP_ME(Stub_McallChained, testMethod2, NULL, ZEND_ACC_PROTECTED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testMethod3, arginfo_stub_mcallchained_testmethod3, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_McallChained, testMethod3, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained1, arginfo_stub_mcallchained_testchained1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained2, arginfo_stub_mcallchained_testchained2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained3, arginfo_stub_mcallchained_testchained3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallChained, testChained4, arginfo_stub_mcallchained_testchained4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallChained, testChained4, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallChained, testMethod1, arginfo_stub_mcallchained_testmethod1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testMethod2, arginfo_stub_mcallchained_testmethod2, ZEND_ACC_PROTECTED) +PHP_ME(Stub_McallChained, testMethod3, arginfo_stub_mcallchained_testmethod3, ZEND_ACC_PRIVATE) +PHP_ME(Stub_McallChained, testChained1, arginfo_stub_mcallchained_testchained1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testChained2, arginfo_stub_mcallchained_testchained2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testChained3, arginfo_stub_mcallchained_testchained3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallChained, testChained4, arginfo_stub_mcallchained_testchained4, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcalldynamic.zep.c b/ext/stub/mcalldynamic.zep.c index 58a97970f9..784b32899d 100644 --- a/ext/stub/mcalldynamic.zep.c +++ b/ext/stub/mcalldynamic.zep.c @@ -69,13 +69,10 @@ PHP_METHOD(Stub_McallDynamic, __call) ZVAL_UNDEF(&method_sub); ZVAL_UNDEF(&arguments_sub); ZVAL_UNDEF(&realMethod); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(method) Z_PARAM_ZVAL(arguments) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/mcalldynamic.zep.h b/ext/stub/mcalldynamic.zep.h index b0eecbaa09..a8df47f9eb 100644 --- a/ext/stub/mcalldynamic.zep.h +++ b/ext/stub/mcalldynamic.zep.h @@ -23,21 +23,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_mcalldynamic_testcallanonymousfunctionwithco ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcalldynamic_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallDynamic, testMethod1, arginfo_stub_mcalldynamic_testmethod1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallDynamic, testMethod1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallDynamic, testMagicCall1, arginfo_stub_mcalldynamic_testmagiccall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallDynamic, testMagicCall1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallDynamic, testMethod1, arginfo_stub_mcalldynamic_testmethod1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallDynamic, testMagicCall1, arginfo_stub_mcalldynamic_testmagiccall1, ZEND_ACC_PUBLIC) PHP_ME(Stub_McallDynamic, __call, arginfo_stub_mcalldynamic___call, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallDynamic, testCallAnonymousFunctionWithContext, arginfo_stub_mcalldynamic_testcallanonymousfunctionwithcontext, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallDynamic, testCallAnonymousFunctionWithContext, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallDynamic, testCallAnonymousFunctionWithContext, arginfo_stub_mcalldynamic_testcallanonymousfunctionwithcontext, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/mcallinternal.zep.c b/ext/stub/mcallinternal.zep.c index 8d9dd305f0..cc832af566 100644 --- a/ext/stub/mcallinternal.zep.c +++ b/ext/stub/mcallinternal.zep.c @@ -48,13 +48,10 @@ void zep_Stub_McallInternal_b(int ht, zend_execute_data *execute_data, zval *ret zval *a, a_sub, *b, b_sub; ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif a = a_ext; @@ -69,13 +66,10 @@ void zep_Stub_McallInternal_c(int ht, zend_execute_data *execute_data, zval *ret { zval *a_param = NULL, *b_param = NULL; long a, b; -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif a_param = a_param_ext; @@ -223,13 +217,10 @@ void zep_Stub_McallInternal_other(int ht, zend_execute_data *execute_data, zval { zval *a_param = NULL, *b_param = NULL; long a, b; -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif a_param = a_param_ext; diff --git a/ext/stub/mcallinternal.zep.h b/ext/stub/mcallinternal.zep.h index 55d3ad272b..2f14cd511e 100644 --- a/ext/stub/mcallinternal.zep.h +++ b/ext/stub/mcallinternal.zep.h @@ -55,26 +55,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_mcallinternal_issue1956, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_mcallinternal_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, e, arginfo_stub_mcallinternal_e, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, e, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, d, arginfo_stub_mcallinternal_d, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, d, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, f, arginfo_stub_mcallinternal_f, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, f, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_McallInternal, g, arginfo_stub_mcallinternal_g, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_McallInternal, g, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_McallInternal, e, arginfo_stub_mcallinternal_e, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallInternal, d, arginfo_stub_mcallinternal_d, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallInternal, f, arginfo_stub_mcallinternal_f, ZEND_ACC_PUBLIC) +PHP_ME(Stub_McallInternal, g, arginfo_stub_mcallinternal_g, ZEND_ACC_PUBLIC) PHP_ME(Stub_McallInternal, callFibonacci, arginfo_stub_mcallinternal_callfibonacci, ZEND_ACC_PUBLIC) PHP_ME(Stub_McallInternal, issue1956, arginfo_stub_mcallinternal_issue1956, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/methodabstract.zep.h b/ext/stub/methodabstract.zep.h index 7ce2010185..9dc7a8c2a2 100644 --- a/ext/stub/methodabstract.zep.h +++ b/ext/stub/methodabstract.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_methodabstract_testinterfacemetho, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_methodabstract_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_MethodAbstract, testInterfaceMetho, arginfo_stub_methodabstract_testinterfacemetho, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_MethodAbstract, testInterfaceMetho, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_MethodAbstract, testInterfaceMetho, arginfo_stub_methodabstract_testinterfacemetho, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/methodargs.zep.c b/ext/stub/methodargs.zep.c index ca807e4031..09af308245 100644 --- a/ext/stub/methodargs.zep.c +++ b/ext/stub/methodargs.zep.c @@ -41,12 +41,9 @@ PHP_METHOD(Stub_MethodArgs, setCallable) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -61,12 +58,9 @@ PHP_METHOD(Stub_MethodArgs, setObject) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -81,12 +75,9 @@ PHP_METHOD(Stub_MethodArgs, setCallableStrict) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -105,12 +96,9 @@ PHP_METHOD(Stub_MethodArgs, setObjectStrict) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -129,12 +117,9 @@ PHP_METHOD(Stub_MethodArgs, setResourceStrict) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); @@ -157,13 +142,10 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalValueWithDefaultStaticConstantAccess) zval *this_ptr = getThis(); ZVAL_UNDEF(&method_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(method) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -191,13 +173,10 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalStringValueWithDefaultStaticConstantAc zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -223,13 +202,10 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalDoubleValueWithDefaultStaticConstantAc double parameter; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶meter_param); @@ -253,13 +229,10 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalBoolValueWithDefaultStaticConstantAcce zend_bool parameter; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶meter_param); @@ -283,13 +256,10 @@ PHP_METHOD(Stub_MethodArgs, methodOptionalIntValueWithDefaultStaticConstantAcces zend_long parameter; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_LONG(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, ¶meter_param); diff --git a/ext/stub/namespaces/classentry.zep.c b/ext/stub/namespaces/classentry.zep.c index 347d7d32ae..c2281e7a46 100644 --- a/ext/stub/namespaces/classentry.zep.c +++ b/ext/stub/namespaces/classentry.zep.c @@ -29,12 +29,9 @@ PHP_METHOD(Stub_Namespaces_ClassEntry, setParam) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, stub_namespaces_a_b_sub_ce) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); @@ -50,12 +47,9 @@ PHP_METHOD(Stub_Namespaces_ClassEntry, setParamImported) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(param, stub_namespaces_a_b_sub_ce) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); diff --git a/ext/stub/nativearray.zep.c b/ext/stub/nativearray.zep.c index d3cd029e2f..0b6bf9723b 100644 --- a/ext/stub/nativearray.zep.c +++ b/ext/stub/nativearray.zep.c @@ -773,7 +773,7 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess1) ZEPHIR_INIT_NVAR(&_0); ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_long(&b, &a, 0, PH_NOISY, "stub/nativearray.zep", 245); RETURN_CCTOR(&b); } @@ -795,7 +795,7 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess2) add_assoc_long_ex(&a, SL("a"), 1); add_assoc_long_ex(&a, SL("b"), 2); add_assoc_long_ex(&a, SL("c"), 3); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_string(&b, &a, SL("a"), PH_NOISY, "stub/nativearray.zep", 255); RETURN_CCTOR(&b); } @@ -826,7 +826,7 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess3) ZVAL_LONG(&_0, 3); zephir_array_fast_append(&a, &_0); c = 0; - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_long(&b, &a, c, PH_NOISY, "stub/nativearray.zep", 267); RETURN_CCTOR(&b); } @@ -852,7 +852,7 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess4) add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch(&b, &a, &c, PH_NOISY, "stub/nativearray.zep", 279); RETURN_CCTOR(&b); } @@ -877,7 +877,7 @@ PHP_METHOD(Stub_NativeArray, testArrayAccess5) add_assoc_long_ex(&a, SL("c"), 3); ZEPHIR_INIT_VAR(&c); ZVAL_STRING(&c, "a"); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch(&b, &a, &c, PH_NOISY, "stub/nativearray.zep", 290); RETURN_CCTOR(&b); } @@ -931,7 +931,7 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess1) add_index_stringl(&_0, 1, SL("b")); zephir_array_update_long(&a, 0, &_0, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_fetch_long(&_1, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 310); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_long(&b, &_1, 0, PH_NOISY, "stub/nativearray.zep", 310); RETURN_CCTOR(&b); } @@ -964,7 +964,7 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess2) zephir_array_fast_append(&_0, &_1); zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_2, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 320); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_long(&b, &_2, 1, PH_NOISY, "stub/nativearray.zep", 320); RETURN_CCTOR(&b); } @@ -1003,7 +1003,7 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess3) zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 330); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_long(&b, &_4, 1, PH_NOISY, "stub/nativearray.zep", 330); RETURN_CCTOR(&b); } @@ -1042,7 +1042,7 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess4) zephir_array_fast_append(&a, &_0); zephir_array_fetch_long(&_3, &a, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); zephir_array_fetch_long(&_4, &_3, 0, PH_NOISY | PH_READONLY, "stub/nativearray.zep", 340); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_long(&b, &_4, 1, PH_NOISY, "stub/nativearray.zep", 340); RETURN_CCTOR(&b); } @@ -1076,7 +1076,7 @@ PHP_METHOD(Stub_NativeArray, testArrayMultipleAccess5) zephir_array_update_string(&a, SL("a"), &_0, PH_COPY | PH_SEPARATE); zephir_array_fetch_string(&_2, &a, SL("a"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); zephir_array_fetch_string(&_3, &_2, SL("b"), PH_NOISY | PH_READONLY, "stub/nativearray.zep", 350); - ZEPHIR_OBS_VAR(&b); + zephir_memory_observe(&b); zephir_array_fetch_string(&b, &_3, SL("c"), PH_NOISY, "stub/nativearray.zep", 350); RETURN_CCTOR(&b); } @@ -1749,12 +1749,9 @@ PHP_METHOD(Stub_NativeArray, testArrayKeys) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); @@ -1772,12 +1769,9 @@ PHP_METHOD(Stub_NativeArray, testImplodeArray) ZVAL_UNDEF(¶m_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1830,12 +1824,9 @@ PHP_METHOD(Stub_NativeArray, issue264) zval *this_ptr = getThis(); ZVAL_UNDEF(&tokens); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(tokens) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1855,12 +1846,9 @@ PHP_METHOD(Stub_NativeArray, issue743a) ZVAL_UNDEF(¤t743a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(current743a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1883,12 +1871,9 @@ PHP_METHOD(Stub_NativeArray, issue743b) ZVAL_UNDEF(¤t); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(current) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1912,12 +1897,9 @@ PHP_METHOD(Stub_NativeArray, issue743c) ZVAL_UNDEF(¤t); ZVAL_UNDEF(&key); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(current) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -2008,13 +1990,10 @@ PHP_METHOD(Stub_NativeArray, Issue1140) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_1$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(prefix) Z_PARAM_STR(baseDir) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/nativearray.zep.h b/ext/stub/nativearray.zep.h index adea753285..7154aee39f 100644 --- a/ext/stub/nativearray.zep.h +++ b/ext/stub/nativearray.zep.h @@ -386,10 +386,6 @@ ZEPHIR_INIT_FUNCS(stub_nativearray_method_entry) { PHP_ME(Stub_NativeArray, issue743c, arginfo_stub_nativearray_issue743c, ZEND_ACC_PUBLIC) PHP_ME(Stub_NativeArray, issue709, arginfo_stub_nativearray_issue709, ZEND_ACC_PUBLIC) PHP_ME(Stub_NativeArray, Issue1140, arginfo_stub_nativearray_issue1140, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_NativeArray, Issue1159, arginfo_stub_nativearray_issue1159, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_NativeArray, Issue1159, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_NativeArray, Issue1159, arginfo_stub_nativearray_issue1159, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo.zep.h b/ext/stub/oo.zep.h index 33a50a44b2..e28e6fe0b9 100644 --- a/ext/stub/oo.zep.h +++ b/ext/stub/oo.zep.h @@ -57,66 +57,18 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_createinstancesinloop, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance1, arginfo_stub_oo_testinstance1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance2, arginfo_stub_oo_testinstance2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance3, arginfo_stub_oo_testinstance3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance4, arginfo_stub_oo_testinstance4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance5, arginfo_stub_oo_testinstance5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance6, arginfo_stub_oo_testinstance6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance6, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance7, arginfo_stub_oo_testinstance7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance8, arginfo_stub_oo_testinstance8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance9, arginfo_stub_oo_testinstance9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance10, arginfo_stub_oo_testinstance10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance11, arginfo_stub_oo_testinstance11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance11, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo, testInstance12, arginfo_stub_oo_testinstance12, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo, testInstance12, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo, testInstance1, arginfo_stub_oo_testinstance1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance2, arginfo_stub_oo_testinstance2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance3, arginfo_stub_oo_testinstance3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance4, arginfo_stub_oo_testinstance4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance5, arginfo_stub_oo_testinstance5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance6, arginfo_stub_oo_testinstance6, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance7, arginfo_stub_oo_testinstance7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance8, arginfo_stub_oo_testinstance8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance9, arginfo_stub_oo_testinstance9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance10, arginfo_stub_oo_testinstance10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance11, arginfo_stub_oo_testinstance11, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo, testInstance12, arginfo_stub_oo_testinstance12, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo, createInstancesInLoop, arginfo_stub_oo_createinstancesinloop, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/abstractclass.zep.h b/ext/stub/oo/abstractclass.zep.h index 137e96b858..44d7936ef4 100644 --- a/ext/stub/oo/abstractclass.zep.h +++ b/ext/stub/oo/abstractclass.zep.h @@ -41,19 +41,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_abstractclass_testabstra ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_abstractclass_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_AbstractClass, testMethodDeclaration, arginfo_stub_oo_abstractclass_testmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_AbstractClass, testMethodDeclaration, NULL, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_AbstractClass, testMethodDeclaration, arginfo_stub_oo_abstractclass_testmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testMethodDeclarationWithReturnType, arginfo_stub_oo_abstractclass_testmethoddeclarationwithreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testMethodDeclarationWithParameter, arginfo_stub_oo_abstractclass_testmethoddeclarationwithparameter, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testMethodDeclarationWithParameterAndReturnType, arginfo_stub_oo_abstractclass_testmethoddeclarationwithparameterandreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclaration, arginfo_stub_oo_abstractclass_testabstractmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclaration, NULL, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclaration, arginfo_stub_oo_abstractclass_testabstractmethoddeclaration, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclarationWithReturnType, arginfo_stub_oo_abstractclass_testabstractmethoddeclarationwithreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclarationWithParameter, arginfo_stub_oo_abstractclass_testabstractmethoddeclarationwithparameter, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_AbstractClass, testAbstractMethodDeclarationWithParameterAndReturnType, arginfo_stub_oo_abstractclass_testabstractmethoddeclarationwithparameterandreturntype, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) diff --git a/ext/stub/oo/concretestatic.zep.h b/ext/stub/oo/concretestatic.zep.h index e2e2f17be8..d1b9de9364 100644 --- a/ext/stub/oo/concretestatic.zep.h +++ b/ext/stub/oo/concretestatic.zep.h @@ -21,16 +21,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_concretestatic_simplesta ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_concretestatic_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConcreteStatic, parentFunction, arginfo_stub_oo_concretestatic_parentfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_ConcreteStatic, parentFunction, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConcreteStatic, childFunction, arginfo_stub_oo_concretestatic_childfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_ConcreteStatic, childFunction, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Oo_ConcreteStatic, parentFunction, arginfo_stub_oo_concretestatic_parentfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_ConcreteStatic, childFunction, arginfo_stub_oo_concretestatic_childfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Oo_ConcreteStatic, callParentFunction, arginfo_stub_oo_concretestatic_callparentfunction, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Oo_ConcreteStatic, simpleStaticIntReturn, arginfo_stub_oo_concretestatic_simplestaticintreturn, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/oo/constantsinterface.zep.h b/ext/stub/oo/constantsinterface.zep.h index f6c552dca8..2d8bd3dd36 100644 --- a/ext/stub/oo/constantsinterface.zep.h +++ b/ext/stub/oo/constantsinterface.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_constantsinterface_testreadinterfaceconst ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_constantsinterface_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant3, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant4, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant5, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant6, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant1, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant2, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant3, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant3, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant4, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant4, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant5, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant5, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_ConstantsInterface, testReadInterfaceConstant6, arginfo_stub_oo_constantsinterface_testreadinterfaceconstant6, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/deprecatedmethods.zep.h b/ext/stub/oo/deprecatedmethods.zep.h index 0ffa7652bc..67fe030525 100644 --- a/ext/stub/oo/deprecatedmethods.zep.h +++ b/ext/stub/oo/deprecatedmethods.zep.h @@ -17,20 +17,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_deprecatedmethods_privatedeprecated, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_deprecatedmethods_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DeprecatedMethods, publicDeprecated, arginfo_stub_oo_deprecatedmethods_publicdeprecated, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#else - PHP_ME(Stub_Oo_DeprecatedMethods, publicDeprecated, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DeprecatedMethods, normalMethod, arginfo_stub_oo_deprecatedmethods_normalmethod, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_DeprecatedMethods, normalMethod, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DeprecatedMethods, privateDeprecated, arginfo_stub_oo_deprecatedmethods_privatedeprecated, ZEND_ACC_PRIVATE|ZEND_ACC_DEPRECATED) -#else - PHP_ME(Stub_Oo_DeprecatedMethods, privateDeprecated, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_DEPRECATED) -#endif +PHP_ME(Stub_Oo_DeprecatedMethods, publicDeprecated, arginfo_stub_oo_deprecatedmethods_publicdeprecated, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED) +PHP_ME(Stub_Oo_DeprecatedMethods, normalMethod, arginfo_stub_oo_deprecatedmethods_normalmethod, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_DeprecatedMethods, privateDeprecated, arginfo_stub_oo_deprecatedmethods_privatedeprecated, ZEND_ACC_PRIVATE|ZEND_ACC_DEPRECATED) PHP_FE_END }; diff --git a/ext/stub/oo/dynamicprop.zep.c b/ext/stub/oo/dynamicprop.zep.c index cf635b15f1..a8fdfc728b 100644 --- a/ext/stub/oo/dynamicprop.zep.c +++ b/ext/stub/oo/dynamicprop.zep.c @@ -39,12 +39,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyInt) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -75,12 +72,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyBoolTrue) ZVAL_UNDEF(&property); ZVAL_BOOL(&__$true, 1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -109,12 +103,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyBoolFalse) ZVAL_UNDEF(&property); ZVAL_BOOL(&__$false, 0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -143,12 +134,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyString) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -180,12 +168,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyChar) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -218,12 +203,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyUChar) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -255,12 +237,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyNull) ZVAL_UNDEF(&property); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -290,12 +269,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableInt) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -327,12 +303,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableString) ZVAL_UNDEF(&property); ZVAL_UNDEF(&a); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -364,12 +337,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableBoolTrue) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -402,12 +372,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setPropertyVariableBoolFalse) ZVAL_UNDEF(&property); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(property) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -455,12 +422,9 @@ PHP_METHOD(Stub_Oo_DynamicProp, setExistingStringPropertyString) zval *this_ptr = getThis(); ZVAL_UNDEF(&value); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/oo/dynamicprop.zep.h b/ext/stub/oo/dynamicprop.zep.h index 4daece4bc4..401bde56f3 100644 --- a/ext/stub/oo/dynamicprop.zep.h +++ b/ext/stub/oo/dynamicprop.zep.h @@ -84,16 +84,8 @@ ZEPHIR_INIT_FUNCS(stub_oo_dynamicprop_method_entry) { PHP_ME(Stub_Oo_DynamicProp, setPropertyVariableString, arginfo_stub_oo_dynamicprop_setpropertyvariablestring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_DynamicProp, setPropertyVariableBoolTrue, arginfo_stub_oo_dynamicprop_setpropertyvariablebooltrue, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_DynamicProp, setPropertyVariableBoolFalse, arginfo_stub_oo_dynamicprop_setpropertyvariableboolfalse, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DynamicProp, setExistingStringProperty, arginfo_stub_oo_dynamicprop_setexistingstringproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_DynamicProp, setExistingStringProperty, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_DynamicProp, setExistingStringProperty, arginfo_stub_oo_dynamicprop_setexistingstringproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_DynamicProp, setExistingStringPropertyString, arginfo_stub_oo_dynamicprop_setexistingstringpropertystring, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_DynamicProp, setNonExistingStringProperty, arginfo_stub_oo_dynamicprop_setnonexistingstringproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_DynamicProp, setNonExistingStringProperty, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_DynamicProp, setNonExistingStringProperty, arginfo_stub_oo_dynamicprop_setnonexistingstringproperty, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/extendpdoclass.zep.c b/ext/stub/oo/extendpdoclass.zep.c index 7adbea3715..f1789c9add 100644 --- a/ext/stub/oo/extendpdoclass.zep.c +++ b/ext/stub/oo/extendpdoclass.zep.c @@ -42,7 +42,6 @@ PHP_METHOD(Stub_Oo_ExtendPdoClass, __construct) ZVAL_UNDEF(&attrs_sub); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_STR(dsn) @@ -51,7 +50,6 @@ PHP_METHOD(Stub_Oo_ExtendPdoClass, __construct) Z_PARAM_STR_OR_NULL(password) Z_PARAM_ZVAL(attrs) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/oo/ooconstruct.zep.h b/ext/stub/oo/ooconstruct.zep.h index 8cebd6a463..cf1b3ee82e 100644 --- a/ext/stub/oo/ooconstruct.zep.h +++ b/ext/stub/oo/ooconstruct.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooconstruct___construct, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_ooconstruct_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoConstruct, __construct, arginfo_stub_oo_ooconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Oo_OoConstruct, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Oo_OoConstruct, __construct, arginfo_stub_oo_ooconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_FE_END }; diff --git a/ext/stub/oo/ooconstructparams.zep.c b/ext/stub/oo/ooconstructparams.zep.c index 439939bb35..92b8f922c0 100644 --- a/ext/stub/oo/ooconstructparams.zep.c +++ b/ext/stub/oo/ooconstructparams.zep.c @@ -35,13 +35,10 @@ PHP_METHOD(Stub_Oo_OoConstructParams, __construct) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); diff --git a/ext/stub/oo/ooconstructparams.zep.h b/ext/stub/oo/ooconstructparams.zep.h index 2d97ecad9a..2c9698e7bb 100644 --- a/ext/stub/oo/ooconstructparams.zep.h +++ b/ext/stub/oo/ooconstructparams.zep.h @@ -20,15 +20,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_ooconstructparams_method_entry) { PHP_ME(Stub_Oo_OoConstructParams, __construct, arginfo_stub_oo_ooconstructparams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoConstructParams, getA, arginfo_stub_oo_ooconstructparams_geta, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoConstructParams, getA, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoConstructParams, getB, arginfo_stub_oo_ooconstructparams_getb, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoConstructParams, getB, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoConstructParams, getA, arginfo_stub_oo_ooconstructparams_geta, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoConstructParams, getB, arginfo_stub_oo_ooconstructparams_getb, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/oodestruct.zep.c b/ext/stub/oo/oodestruct.zep.c index 07905d7ce1..fa330e94fb 100644 --- a/ext/stub/oo/oodestruct.zep.c +++ b/ext/stub/oo/oodestruct.zep.c @@ -184,7 +184,6 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) ZVAL_UNDEF(&_31$$14); ZVAL_UNDEF(&_33$$14); ZVAL_UNDEF(&_34$$14); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_STR(file) @@ -192,7 +191,6 @@ PHP_METHOD(Stub_Oo_OoDestruct, __construct) Z_PARAM_LONG_OR_NULL(width, is_null_true) Z_PARAM_LONG_OR_NULL(height, is_null_true) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/oo/oodestruct.zep.h b/ext/stub/oo/oodestruct.zep.h index 478daeadd3..2da8d24122 100644 --- a/ext/stub/oo/oodestruct.zep.h +++ b/ext/stub/oo/oodestruct.zep.h @@ -49,25 +49,13 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oodestruct_method_entry) { PHP_ME(Stub_Oo_OoDestruct, getHeight, arginfo_stub_oo_oodestruct_getheight, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDestruct, getImage, arginfo_stub_oo_oodestruct_getimage, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDestruct, getImage, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDestruct, getImage, arginfo_stub_oo_oodestruct_getimage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, getMime, arginfo_stub_oo_oodestruct_getmime, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDestruct, getRealpath, arginfo_stub_oo_oodestruct_getrealpath, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDestruct, getRealpath, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDestruct, getRealpath, arginfo_stub_oo_oodestruct_getrealpath, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, getType, arginfo_stub_oo_oodestruct_gettype, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, getWidth, arginfo_stub_oo_oodestruct_getwidth, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoDestruct, __construct, arginfo_stub_oo_oodestruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDestruct, __destruct, arginfo_stub_oo_oodestruct___destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) -#else - PHP_ME(Stub_Oo_OoDestruct, __destruct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) -#endif +PHP_ME(Stub_Oo_OoDestruct, __destruct, arginfo_stub_oo_oodestruct___destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) PHP_ME(Stub_Oo_OoDestruct, check, arginfo_stub_oo_oodestruct_check, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Oo_OoDestruct, getVersion, arginfo_stub_oo_oodestruct_getversion, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/oo/oodynamica.zep.h b/ext/stub/oo/oodynamica.zep.h index c96fa916fb..3c855f9ed9 100644 --- a/ext/stub/oo/oodynamica.zep.h +++ b/ext/stub/oo/oodynamica.zep.h @@ -25,30 +25,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oodynamica_execute2, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oodynamica_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, getNew, arginfo_stub_oo_oodynamica_getnew, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, getNew, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, call2, arginfo_stub_oo_oodynamica_call2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, call2, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, call1, arginfo_stub_oo_oodynamica_call1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, call1, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, execute, arginfo_stub_oo_oodynamica_execute, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, execute, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicA, execute2, arginfo_stub_oo_oodynamica_execute2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicA, execute2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDynamicA, getNew, arginfo_stub_oo_oodynamica_getnew, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_OoDynamicA, call2, arginfo_stub_oo_oodynamica_call2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_OoDynamicA, call1, arginfo_stub_oo_oodynamica_call1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Oo_OoDynamicA, execute, arginfo_stub_oo_oodynamica_execute, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoDynamicA, execute2, arginfo_stub_oo_oodynamica_execute2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/oodynamicb.zep.h b/ext/stub/oo/oodynamicb.zep.h index a003c816de..0a39d3ebe6 100644 --- a/ext/stub/oo/oodynamicb.zep.h +++ b/ext/stub/oo/oodynamicb.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oodynamicb_execute2, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oodynamicb_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicB, execute, arginfo_stub_oo_oodynamicb_execute, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicB, execute, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoDynamicB, execute2, arginfo_stub_oo_oodynamicb_execute2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoDynamicB, execute2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoDynamicB, execute, arginfo_stub_oo_oodynamicb_execute, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoDynamicB, execute2, arginfo_stub_oo_oodynamicb_execute2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/oonativeimplements.zep.c b/ext/stub/oo/oonativeimplements.zep.c index ca47fe0c27..86a903fa08 100644 --- a/ext/stub/oo/oonativeimplements.zep.c +++ b/ext/stub/oo/oonativeimplements.zep.c @@ -112,12 +112,9 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, seek) zend_long position; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &position_param); @@ -140,12 +137,9 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, offsetExists) zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &offset); @@ -159,12 +153,9 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, offsetGet) zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &offset); @@ -179,13 +170,10 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, offsetSet) ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(offset) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); @@ -199,12 +187,9 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, offsetUnset) zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &offset); @@ -228,12 +213,9 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, unserialize) zval *this_ptr = getThis(); ZVAL_UNDEF(&serialized); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(serialized) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -261,12 +243,9 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, __unserialize) 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(); diff --git a/ext/stub/oo/oonativeimplements.zep.h b/ext/stub/oo/oonativeimplements.zep.h index eca407a308..dc29ca4604 100644 --- a/ext/stub/oo/oonativeimplements.zep.h +++ b/ext/stub/oo/oonativeimplements.zep.h @@ -26,18 +26,10 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, __unserialize); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_next, 0, 0, IS_VOID, 0) diff --git a/ext/stub/oo/ooparams.zep.c b/ext/stub/oo/ooparams.zep.c index 7f2c6be9ce..73c17eac43 100644 --- a/ext/stub/oo/ooparams.zep.c +++ b/ext/stub/oo/ooparams.zep.c @@ -74,12 +74,9 @@ PHP_METHOD(Stub_Oo_OoParams, setAge) zend_long age; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &age_param); @@ -95,12 +92,9 @@ PHP_METHOD(Stub_Oo_OoParams, setAverage) double average; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &average_param); @@ -118,12 +112,9 @@ PHP_METHOD(Stub_Oo_OoParams, setName) zval *this_ptr = getThis(); ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -140,12 +131,9 @@ PHP_METHOD(Stub_Oo_OoParams, setEnabled) zend_bool enabled; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(enabled) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &enabled_param); @@ -163,12 +151,9 @@ PHP_METHOD(Stub_Oo_OoParams, setList) zval *this_ptr = getThis(); ZVAL_UNDEF(&someList); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(someList) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -185,12 +170,9 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictAge) zend_long age; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &age_param); @@ -210,12 +192,9 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictAverage) double average; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &average_param); @@ -255,12 +234,9 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictName) zval *this_ptr = getThis(); ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -285,12 +261,9 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictEnabled) zend_bool enabled; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(enabled) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &enabled_param); @@ -308,12 +281,9 @@ PHP_METHOD(Stub_Oo_OoParams, setStrictList) zval *this_ptr = getThis(); ZVAL_UNDEF(&someList); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(someList) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -330,13 +300,10 @@ PHP_METHOD(Stub_Oo_OoParams, setAgeDefault) zend_long age; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, &age_param); @@ -356,13 +323,10 @@ PHP_METHOD(Stub_Oo_OoParams, setAverageDefault) double average; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, &average_param); @@ -384,13 +348,10 @@ PHP_METHOD(Stub_Oo_OoParams, setNameDefault) zval *this_ptr = getThis(); ZVAL_UNDEF(&name); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -412,13 +373,10 @@ PHP_METHOD(Stub_Oo_OoParams, setEnabledDefault) zend_bool enabled; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(enabled) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, &enabled_param); @@ -440,13 +398,10 @@ PHP_METHOD(Stub_Oo_OoParams, setListDefault) zval *this_ptr = getThis(); ZVAL_UNDEF(&someList); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(someList) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -468,12 +423,9 @@ PHP_METHOD(Stub_Oo_OoParams, setConstAge) zend_long age; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(age) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &age_param); @@ -489,12 +441,9 @@ PHP_METHOD(Stub_Oo_OoParams, setConstAverage) double average; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(average) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &average_param); @@ -510,12 +459,9 @@ PHP_METHOD(Stub_Oo_OoParams, setObject) zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT(obj) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &obj); @@ -531,12 +477,9 @@ PHP_METHOD(Stub_Oo_OoParams, setCallable) zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(obj) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &obj); @@ -552,12 +495,9 @@ PHP_METHOD(Stub_Oo_OoParams, setResource) zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(obj) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &obj); @@ -573,12 +513,9 @@ PHP_METHOD(Stub_Oo_OoParams, setObjectClassCast) zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(parameter, stub_oo_param_ce) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶meter); diff --git a/ext/stub/oo/ooparams.zep.h b/ext/stub/oo/ooparams.zep.h index 61d77c2103..6293f97ca9 100644 --- a/ext/stub/oo/ooparams.zep.h +++ b/ext/stub/oo/ooparams.zep.h @@ -94,11 +94,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setenableddefault, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setlistdefault, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someList, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, someList, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, someList, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setconstage, 0, 0, 1) @@ -126,16 +122,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_ooparams_setobjectclasscast, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_ooparams_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoParams, createThisClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createthisclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoParams, createThisClassWithoutWriteCurrentNamespace, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createotherclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoParams, createThisClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createthisclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace, arginfo_stub_oo_ooparams_createotherclasswithoutwritecurrentnamespace, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setAge, arginfo_stub_oo_ooparams_setage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setAverage, arginfo_stub_oo_ooparams_setaverage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setName, arginfo_stub_oo_ooparams_setname, ZEND_ACC_PUBLIC) @@ -143,11 +131,7 @@ ZEPHIR_INIT_FUNCS(stub_oo_ooparams_method_entry) { PHP_ME(Stub_Oo_OoParams, setList, arginfo_stub_oo_ooparams_setlist, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictAge, arginfo_stub_oo_ooparams_setstrictage, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictAverage, arginfo_stub_oo_ooparams_setstrictaverage, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_OoParams, setStrictNameFromZephirLand, arginfo_stub_oo_ooparams_setstrictnamefromzephirland, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoParams, setStrictNameFromZephirLand, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_OoParams, setStrictNameFromZephirLand, arginfo_stub_oo_ooparams_setstrictnamefromzephirland, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictName, arginfo_stub_oo_ooparams_setstrictname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictEnabled, arginfo_stub_oo_ooparams_setstrictenabled, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoParams, setStrictList, arginfo_stub_oo_ooparams_setstrictlist, ZEND_ACC_PUBLIC) diff --git a/ext/stub/oo/propertyaccess.zep.c b/ext/stub/oo/propertyaccess.zep.c index 80148c4d66..038d7f52ba 100644 --- a/ext/stub/oo/propertyaccess.zep.c +++ b/ext/stub/oo/propertyaccess.zep.c @@ -80,7 +80,7 @@ PHP_METHOD(Stub_Oo_PropertyAccess, __construct) ZEPHIR_INIT_VAR(&_6); zephir_create_array(&_6, 4, 0); zephir_read_property(&_7, &test, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&_8); + zephir_memory_observe(&_8); zephir_array_fetch_long(&_8, &_7, 1, PH_NOISY, "stub/oo/propertyaccess.zep", 19); zephir_array_fast_append(&_6, &_8); ZEPHIR_INIT_NVAR(&_1); @@ -97,7 +97,7 @@ PHP_METHOD(Stub_Oo_PropertyAccess, __construct) zephir_read_property(&_9, this_ptr, ZEND_STRL("a"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_10, &_9, ZEND_STRL("test2"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("b"), &_10); - ZEPHIR_OBS_VAR(&test1); + zephir_memory_observe(&test1); zephir_read_property(&test1, this_ptr, ZEND_STRL("a"), PH_NOISY_CC); ZEPHIR_MM_RESTORE(); } @@ -111,12 +111,9 @@ PHP_METHOD(Stub_Oo_PropertyAccess, setPrivatevariable) zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &value); diff --git a/ext/stub/oo/propertyaccess.zep.h b/ext/stub/oo/propertyaccess.zep.h index 396ffb1c75..24b7119d1b 100644 --- a/ext/stub/oo/propertyaccess.zep.h +++ b/ext/stub/oo/propertyaccess.zep.h @@ -18,16 +18,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_propertyaccess_getprivatevariable, 0, 0, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_propertyaccess_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_PropertyAccess, __construct, arginfo_stub_oo_propertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Oo_PropertyAccess, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Oo_PropertyAccess, __construct, arginfo_stub_oo_propertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Oo_PropertyAccess, setPrivatevariable, arginfo_stub_oo_propertyaccess_setprivatevariable, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_PropertyAccess, getPrivatevariable, arginfo_stub_oo_propertyaccess_getprivatevariable, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_PropertyAccess, getPrivatevariable, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_PropertyAccess, getPrivatevariable, arginfo_stub_oo_propertyaccess_getprivatevariable, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/scopes/abstractclass.zep.c b/ext/stub/oo/scopes/abstractclass.zep.c index db0a61fafa..e6ea292ccc 100644 --- a/ext/stub/oo/scopes/abstractclass.zep.c +++ b/ext/stub/oo/scopes/abstractclass.zep.c @@ -35,13 +35,10 @@ PHP_METHOD(Stub_Oo_Scopes_AbstractClass, setProperty) ZVAL_UNDEF(&name); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(name) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/oo/scopes/abstractclass.zep.h b/ext/stub/oo/scopes/abstractclass.zep.h index 37f2604910..53459bd219 100644 --- a/ext/stub/oo/scopes/abstractclass.zep.h +++ b/ext/stub/oo/scopes/abstractclass.zep.h @@ -20,15 +20,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_scopes_abstractclass_method_entry) { PHP_ME(Stub_Oo_Scopes_AbstractClass, setProperty, arginfo_stub_oo_scopes_abstractclass_setproperty, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_Scopes_AbstractClass, getPrivateProperty2, arginfo_stub_oo_scopes_abstractclass_getprivateproperty2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_Scopes_AbstractClass, getPrivateProperty2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Oo_Scopes_AbstractClass, getProtectedProperty2, arginfo_stub_oo_scopes_abstractclass_getprotectedproperty2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_Scopes_AbstractClass, getProtectedProperty2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Oo_Scopes_AbstractClass, getPrivateProperty2, arginfo_stub_oo_scopes_abstractclass_getprivateproperty2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Oo_Scopes_AbstractClass, getProtectedProperty2, arginfo_stub_oo_scopes_abstractclass_getprotectedproperty2, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/oo/scopes/abstractclassmagic.zep.c b/ext/stub/oo/scopes/abstractclassmagic.zep.c index 384bf61af4..92a8c7162e 100644 --- a/ext/stub/oo/scopes/abstractclassmagic.zep.c +++ b/ext/stub/oo/scopes/abstractclassmagic.zep.c @@ -39,13 +39,10 @@ PHP_METHOD(Stub_Oo_Scopes_AbstractClassMagic, __set) ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(name) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -70,12 +67,9 @@ PHP_METHOD(Stub_Oo_Scopes_AbstractClassMagic, __get) ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -83,7 +77,7 @@ PHP_METHOD(Stub_Oo_Scopes_AbstractClassMagic, __get) zephir_get_strval(&name, name_param); - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property_zval(&_0, this_ptr, &name, PH_NOISY_CC); RETURN_CCTOR(&_0); } diff --git a/ext/stub/oo/scopes/privatescopetester.zep.c b/ext/stub/oo/scopes/privatescopetester.zep.c index 4e535f3260..ffabb986d0 100644 --- a/ext/stub/oo/scopes/privatescopetester.zep.c +++ b/ext/stub/oo/scopes/privatescopetester.zep.c @@ -55,14 +55,11 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, setPropertyObj) ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&property); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(obj) Z_PARAM_STR(property) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -72,7 +69,7 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, setPropertyObj) zephir_update_property_zval_zval(obj, &property, value); - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property_zval(&_0, obj, &property, PH_NOISY_CC); RETURN_CCTOR(&_0); } @@ -92,14 +89,11 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, setPropertyNew) ZVAL_UNDEF(&property); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&obj); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_STR(className) Z_PARAM_STR(property) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -126,12 +120,9 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, getObjVars) zval *this_ptr = getThis(); ZVAL_UNDEF(&obj_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(obj) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -156,12 +147,9 @@ PHP_METHOD(Stub_Oo_Scopes_PrivateScopeTester, getNewVars) ZVAL_UNDEF(&className); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(className) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/operator.zep.c b/ext/stub/operator.zep.c index 5919ab865e..26b9f54495 100644 --- a/ext/stub/operator.zep.c +++ b/ext/stub/operator.zep.c @@ -33,13 +33,10 @@ PHP_METHOD(Stub_Operator, testIdentical) ZVAL_UNDEF(¶m1_sub); ZVAL_UNDEF(¶m2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(param1) Z_PARAM_ZVAL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, ¶m1, ¶m2); @@ -58,12 +55,9 @@ PHP_METHOD(Stub_Operator, testIdenticalIfComplex) ZVAL_UNDEF(&input_sub); ZVAL_UNDEF(&a); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(input) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -87,12 +81,9 @@ PHP_METHOD(Stub_Operator, testIdenticalVarFalse) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); @@ -107,12 +98,9 @@ PHP_METHOD(Stub_Operator, testIdenticalFalseVar) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); @@ -131,13 +119,10 @@ PHP_METHOD(Stub_Operator, testBoolComparison) ZVAL_UNDEF(&varTrue_sub); ZVAL_UNDEF(&varFalse_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(varTrue) Z_PARAM_ZVAL(varFalse) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -184,12 +169,9 @@ PHP_METHOD(Stub_Operator, testNewInstanceOperator) ZVAL_UNDEF(&className_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(className) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/optimizers/acos.zep.c b/ext/stub/optimizers/acos.zep.c index c726af1373..92ba9fe706 100644 --- a/ext/stub/optimizers/acos.zep.c +++ b/ext/stub/optimizers/acos.zep.c @@ -89,12 +89,9 @@ PHP_METHOD(Stub_Optimizers_ACos, testIntParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -116,12 +113,9 @@ PHP_METHOD(Stub_Optimizers_ACos, testVarParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/optimizers/acos.zep.h b/ext/stub/optimizers/acos.zep.h index b2c9fd88af..e2ffa8f34c 100644 --- a/ext/stub/optimizers/acos.zep.h +++ b/ext/stub/optimizers/acos.zep.h @@ -27,21 +27,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_acos_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_acos_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ACos, testInt, arginfo_stub_optimizers_acos_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ACos, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ACos, testVar, arginfo_stub_optimizers_acos_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ACos, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ACos, testIntValue1, arginfo_stub_optimizers_acos_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ACos, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_ACos, testInt, arginfo_stub_optimizers_acos_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ACos, testVar, arginfo_stub_optimizers_acos_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ACos, testIntValue1, arginfo_stub_optimizers_acos_testintvalue1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ACos, testIntParameter, arginfo_stub_optimizers_acos_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ACos, testVarParameter, arginfo_stub_optimizers_acos_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/arraymerge.zep.c b/ext/stub/optimizers/arraymerge.zep.c index 8a4bbc453f..ce62150606 100644 --- a/ext/stub/optimizers/arraymerge.zep.c +++ b/ext/stub/optimizers/arraymerge.zep.c @@ -34,13 +34,10 @@ PHP_METHOD(Stub_Optimizers_ArrayMerge, mergeTwoRequiredArrays) ZVAL_UNDEF(&arr1); ZVAL_UNDEF(&arr2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(arr1) Z_PARAM_ARRAY(arr2) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/optimizers/asin.zep.c b/ext/stub/optimizers/asin.zep.c index c73f52c51d..786ebb6218 100644 --- a/ext/stub/optimizers/asin.zep.c +++ b/ext/stub/optimizers/asin.zep.c @@ -89,12 +89,9 @@ PHP_METHOD(Stub_Optimizers_ASin, testIntParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -116,12 +113,9 @@ PHP_METHOD(Stub_Optimizers_ASin, testVarParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/optimizers/asin.zep.h b/ext/stub/optimizers/asin.zep.h index 0d005332bb..d92501abd9 100644 --- a/ext/stub/optimizers/asin.zep.h +++ b/ext/stub/optimizers/asin.zep.h @@ -27,21 +27,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_asin_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_asin_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ASin, testInt, arginfo_stub_optimizers_asin_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ASin, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ASin, testVar, arginfo_stub_optimizers_asin_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ASin, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_ASin, testIntValue1, arginfo_stub_optimizers_asin_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_ASin, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_ASin, testInt, arginfo_stub_optimizers_asin_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ASin, testVar, arginfo_stub_optimizers_asin_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_ASin, testIntValue1, arginfo_stub_optimizers_asin_testintvalue1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ASin, testIntParameter, arginfo_stub_optimizers_asin_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_ASin, testVarParameter, arginfo_stub_optimizers_asin_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/cos.zep.c b/ext/stub/optimizers/cos.zep.c index 974c32428d..82e788e8c5 100644 --- a/ext/stub/optimizers/cos.zep.c +++ b/ext/stub/optimizers/cos.zep.c @@ -89,12 +89,9 @@ PHP_METHOD(Stub_Optimizers_Cos, testIntParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a_param); @@ -111,12 +108,9 @@ PHP_METHOD(Stub_Optimizers_Cos, testVarParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/optimizers/cos.zep.h b/ext/stub/optimizers/cos.zep.h index f0d22dd5d0..f261d2718d 100644 --- a/ext/stub/optimizers/cos.zep.h +++ b/ext/stub/optimizers/cos.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_cos_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_cos_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testInt, arginfo_stub_optimizers_cos_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testVar, arginfo_stub_optimizers_cos_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testIntValue1, arginfo_stub_optimizers_cos_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Cos, testIntValue2, arginfo_stub_optimizers_cos_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Cos, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Cos, testInt, arginfo_stub_optimizers_cos_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Cos, testVar, arginfo_stub_optimizers_cos_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Cos, testIntValue1, arginfo_stub_optimizers_cos_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Cos, testIntValue2, arginfo_stub_optimizers_cos_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Cos, testIntParameter, arginfo_stub_optimizers_cos_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Cos, testVarParameter, arginfo_stub_optimizers_cos_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/createarray.zep.c b/ext/stub/optimizers/createarray.zep.c index e81ebd146a..46787d67d3 100644 --- a/ext/stub/optimizers/createarray.zep.c +++ b/ext/stub/optimizers/createarray.zep.c @@ -44,12 +44,9 @@ PHP_METHOD(Stub_Optimizers_CreateArray, createSize) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &n_param); diff --git a/ext/stub/optimizers/createarray.zep.h b/ext/stub/optimizers/createarray.zep.h index af6e783edd..be494beac1 100644 --- a/ext/stub/optimizers/createarray.zep.h +++ b/ext/stub/optimizers/createarray.zep.h @@ -14,11 +14,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_createarray_createsize, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_createarray_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_CreateArray, createNoSize, arginfo_stub_optimizers_createarray_createnosize, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_CreateArray, createNoSize, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_CreateArray, createNoSize, arginfo_stub_optimizers_createarray_createnosize, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_CreateArray, createSize, arginfo_stub_optimizers_createarray_createsize, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/optimizers/isscalar.zep.c b/ext/stub/optimizers/isscalar.zep.c index 60e8860926..bec2ddcf17 100644 --- a/ext/stub/optimizers/isscalar.zep.c +++ b/ext/stub/optimizers/isscalar.zep.c @@ -121,12 +121,9 @@ PHP_METHOD(Stub_Optimizers_IsScalar, testVarParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/optimizers/ldexp.zep.c b/ext/stub/optimizers/ldexp.zep.c index 1bd155f09b..8ad0396e25 100644 --- a/ext/stub/optimizers/ldexp.zep.c +++ b/ext/stub/optimizers/ldexp.zep.c @@ -121,13 +121,10 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testIntParameter) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(x) Z_PARAM_LONG(exponent) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &x_param, &exponent_param); @@ -147,13 +144,10 @@ PHP_METHOD(Stub_Optimizers_Ldexp, testVarParameter) ZVAL_UNDEF(&x_sub); ZVAL_UNDEF(&exponent_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(x) Z_PARAM_ZVAL(exponent) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &x, &exponent); diff --git a/ext/stub/optimizers/ldexp.zep.h b/ext/stub/optimizers/ldexp.zep.h index a6f5e681a7..e0fe4971b6 100644 --- a/ext/stub/optimizers/ldexp.zep.h +++ b/ext/stub/optimizers/ldexp.zep.h @@ -37,31 +37,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_ldexp_testvarparameter, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_ldexp_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testInt, arginfo_stub_optimizers_ldexp_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testDoubleInt, arginfo_stub_optimizers_ldexp_testdoubleint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testDoubleInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testDouble, arginfo_stub_optimizers_ldexp_testdouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testVar, arginfo_stub_optimizers_ldexp_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Ldexp, testIntValue1, arginfo_stub_optimizers_ldexp_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Ldexp, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Ldexp, testInt, arginfo_stub_optimizers_ldexp_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testDoubleInt, arginfo_stub_optimizers_ldexp_testdoubleint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testDouble, arginfo_stub_optimizers_ldexp_testdouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testVar, arginfo_stub_optimizers_ldexp_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Ldexp, testIntValue1, arginfo_stub_optimizers_ldexp_testintvalue1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Ldexp, testIntParameter, arginfo_stub_optimizers_ldexp_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Ldexp, testVarParameter, arginfo_stub_optimizers_ldexp_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/sin.zep.c b/ext/stub/optimizers/sin.zep.c index eda01e722c..3177487586 100644 --- a/ext/stub/optimizers/sin.zep.c +++ b/ext/stub/optimizers/sin.zep.c @@ -89,12 +89,9 @@ PHP_METHOD(Stub_Optimizers_Sin, testIntParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a_param); @@ -111,12 +108,9 @@ PHP_METHOD(Stub_Optimizers_Sin, testVarParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/optimizers/sin.zep.h b/ext/stub/optimizers/sin.zep.h index 48216e6c96..90be245b37 100644 --- a/ext/stub/optimizers/sin.zep.h +++ b/ext/stub/optimizers/sin.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_sin_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_sin_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testInt, arginfo_stub_optimizers_sin_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testVar, arginfo_stub_optimizers_sin_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testIntValue1, arginfo_stub_optimizers_sin_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sin, testIntValue2, arginfo_stub_optimizers_sin_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sin, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Sin, testInt, arginfo_stub_optimizers_sin_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sin, testVar, arginfo_stub_optimizers_sin_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sin, testIntValue1, arginfo_stub_optimizers_sin_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sin, testIntValue2, arginfo_stub_optimizers_sin_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sin, testIntParameter, arginfo_stub_optimizers_sin_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sin, testVarParameter, arginfo_stub_optimizers_sin_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/sqrt.zep.c b/ext/stub/optimizers/sqrt.zep.c index 22d9bbd37f..323c8294a2 100644 --- a/ext/stub/optimizers/sqrt.zep.c +++ b/ext/stub/optimizers/sqrt.zep.c @@ -89,12 +89,9 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testIntParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a_param); @@ -111,12 +108,9 @@ PHP_METHOD(Stub_Optimizers_Sqrt, testVarParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/optimizers/sqrt.zep.h b/ext/stub/optimizers/sqrt.zep.h index c4f7fc76e0..d093b250c6 100644 --- a/ext/stub/optimizers/sqrt.zep.h +++ b/ext/stub/optimizers/sqrt.zep.h @@ -31,26 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_sqrt_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_sqrt_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testInt, arginfo_stub_optimizers_sqrt_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testVar, arginfo_stub_optimizers_sqrt_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testIntValue1, arginfo_stub_optimizers_sqrt_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Sqrt, testIntValue2, arginfo_stub_optimizers_sqrt_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Sqrt, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Sqrt, testInt, arginfo_stub_optimizers_sqrt_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sqrt, testVar, arginfo_stub_optimizers_sqrt_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sqrt, testIntValue1, arginfo_stub_optimizers_sqrt_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Sqrt, testIntValue2, arginfo_stub_optimizers_sqrt_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sqrt, testIntParameter, arginfo_stub_optimizers_sqrt_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Sqrt, testVarParameter, arginfo_stub_optimizers_sqrt_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/optimizers/strreplace.zep.h b/ext/stub/optimizers/strreplace.zep.h index 3ba4c7d920..2a0b361f92 100644 --- a/ext/stub/optimizers/strreplace.zep.h +++ b/ext/stub/optimizers/strreplace.zep.h @@ -21,25 +21,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_strreplace_issue732b, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_strreplace_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue1055, arginfo_stub_optimizers_strreplace_issue1055, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue1055, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue1087, arginfo_stub_optimizers_strreplace_issue1087, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue1087, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue732A, arginfo_stub_optimizers_strreplace_issue732a, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue732A, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_StrReplace, issue732B, arginfo_stub_optimizers_strreplace_issue732b, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_StrReplace, issue732B, NULL, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_StrReplace, issue1055, arginfo_stub_optimizers_strreplace_issue1055, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_StrReplace, issue1087, arginfo_stub_optimizers_strreplace_issue1087, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_StrReplace, issue732A, arginfo_stub_optimizers_strreplace_issue732a, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_StrReplace, issue732B, arginfo_stub_optimizers_strreplace_issue732b, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/optimizers/substr.zep.c b/ext/stub/optimizers/substr.zep.c index 251762c431..f7d1992911 100644 --- a/ext/stub/optimizers/substr.zep.c +++ b/ext/stub/optimizers/substr.zep.c @@ -32,13 +32,10 @@ PHP_METHOD(Stub_Optimizers_Substr, testTwoArguments) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&start_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(start) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &str, &start); @@ -56,14 +53,11 @@ PHP_METHOD(Stub_Optimizers_Substr, testThreeArguments) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&start_sub); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(start) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(3, 0, &str, &start, &offset); diff --git a/ext/stub/optimizers/tan.zep.c b/ext/stub/optimizers/tan.zep.c index 80c945a3cd..46049d9b3e 100644 --- a/ext/stub/optimizers/tan.zep.c +++ b/ext/stub/optimizers/tan.zep.c @@ -104,12 +104,9 @@ PHP_METHOD(Stub_Optimizers_Tan, testIntParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a_param); @@ -126,12 +123,9 @@ PHP_METHOD(Stub_Optimizers_Tan, testVarParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(&a_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &a); diff --git a/ext/stub/optimizers/tan.zep.h b/ext/stub/optimizers/tan.zep.h index 2d1c61c8f2..63a0757b7b 100644 --- a/ext/stub/optimizers/tan.zep.h +++ b/ext/stub/optimizers/tan.zep.h @@ -35,31 +35,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_optimizers_tan_testvarparameter, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_optimizers_tan_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testInt, arginfo_stub_optimizers_tan_testint, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testInt, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testVar, arginfo_stub_optimizers_tan_testvar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testVar2, arginfo_stub_optimizers_tan_testvar2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testVar2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testIntValue1, arginfo_stub_optimizers_tan_testintvalue1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testIntValue1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Optimizers_Tan, testIntValue2, arginfo_stub_optimizers_tan_testintvalue2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Optimizers_Tan, testIntValue2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Optimizers_Tan, testInt, arginfo_stub_optimizers_tan_testint, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testVar, arginfo_stub_optimizers_tan_testvar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testVar2, arginfo_stub_optimizers_tan_testvar2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testIntValue1, arginfo_stub_optimizers_tan_testintvalue1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Optimizers_Tan, testIntValue2, arginfo_stub_optimizers_tan_testintvalue2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Tan, testIntParameter, arginfo_stub_optimizers_tan_testintparameter, ZEND_ACC_PUBLIC) PHP_ME(Stub_Optimizers_Tan, testVarParameter, arginfo_stub_optimizers_tan_testvarparameter, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/pregmatch.zep.c b/ext/stub/pregmatch.zep.c index 6c9a9be178..4ce8f97469 100644 --- a/ext/stub/pregmatch.zep.c +++ b/ext/stub/pregmatch.zep.c @@ -160,13 +160,10 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch2Params) ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&subject_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -186,14 +183,11 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch3Params) ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&subject_sub); ZVAL_UNDEF(&matches_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) Z_PARAM_ZVAL(matches) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(3, 0, &pattern, &subject, &matches); @@ -212,15 +206,12 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch4Params) ZVAL_UNDEF(&subject_sub); ZVAL_UNDEF(&matches_sub); ZVAL_UNDEF(&flags_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(4, 4) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) Z_PARAM_ZVAL(matches) Z_PARAM_ZVAL(flags) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(4, 0, &pattern, &subject, &matches, &flags); @@ -240,8 +231,6 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch5Params) ZVAL_UNDEF(&matches_sub); ZVAL_UNDEF(&flags_sub); ZVAL_UNDEF(&offset_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(5, 5) Z_PARAM_ZVAL(pattern) Z_PARAM_ZVAL(subject) @@ -249,7 +238,6 @@ PHP_METHOD(Stub_Pregmatch, testPregMatch5Params) Z_PARAM_ZVAL(flags) Z_PARAM_ZVAL(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(5, 0, &pattern, &subject, &matches, &flags, &offset); @@ -273,13 +261,10 @@ PHP_METHOD(Stub_Pregmatch, testPregMatchSaveMatches) ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&matches); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(str) Z_PARAM_STR(pattern) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -307,12 +292,9 @@ PHP_METHOD(Stub_Pregmatch, testMatchAll) ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(flags) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/pregmatch.zep.h b/ext/stub/pregmatch.zep.h index d6f813d60d..ea40bcd257 100644 --- a/ext/stub/pregmatch.zep.h +++ b/ext/stub/pregmatch.zep.h @@ -70,41 +70,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_pregmatch_testmatchallinzep, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_pregmatch_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testWithoutReturnAndMatches, arginfo_stub_pregmatch_testwithoutreturnandmatches, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testWithoutReturnAndMatches, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testWithoutReturns, arginfo_stub_pregmatch_testwithoutreturns, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testWithoutReturns, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testWithoutMatches, arginfo_stub_pregmatch_testwithoutmatches, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testWithoutMatches, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testPregMatchAll, arginfo_stub_pregmatch_testpregmatchall, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testPregMatchAll, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testPregMatchFallback, arginfo_stub_pregmatch_testpregmatchfallback, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testPregMatchFallback, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Pregmatch, testWithoutReturnAndMatches, arginfo_stub_pregmatch_testwithoutreturnandmatches, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testWithoutReturns, arginfo_stub_pregmatch_testwithoutreturns, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testWithoutMatches, arginfo_stub_pregmatch_testwithoutmatches, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testPregMatchAll, arginfo_stub_pregmatch_testpregmatchall, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Pregmatch, testPregMatchFallback, arginfo_stub_pregmatch_testpregmatchfallback, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch2Params, arginfo_stub_pregmatch_testpregmatch2params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch3Params, arginfo_stub_pregmatch_testpregmatch3params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch4Params, arginfo_stub_pregmatch_testpregmatch4params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatch5Params, arginfo_stub_pregmatch_testpregmatch5params, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testPregMatchSaveMatches, arginfo_stub_pregmatch_testpregmatchsavematches, ZEND_ACC_PUBLIC) PHP_ME(Stub_Pregmatch, testMatchAll, arginfo_stub_pregmatch_testmatchall, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Pregmatch, testMatchAllInZep, arginfo_stub_pregmatch_testmatchallinzep, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Pregmatch, testMatchAllInZep, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Pregmatch, testMatchAllInZep, arginfo_stub_pregmatch_testmatchallinzep, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/app.zep.h b/ext/stub/properties/app.zep.h index 22e9a1daa2..d13be1fd36 100644 --- a/ext/stub/properties/app.zep.h +++ b/ext/stub/properties/app.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_app___construct, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_app_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_App, getInstance, arginfo_stub_properties_app_getinstance, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_App, getInstance, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_App, __construct, arginfo_stub_properties_app___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Properties_App, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Properties_App, getInstance, arginfo_stub_properties_app_getinstance, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_App, __construct, arginfo_stub_properties_app___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_FE_END }; diff --git a/ext/stub/properties/privateproperties.zep.h b/ext/stub/properties/privateproperties.zep.h index 598523ace7..9bbc4859b7 100644 --- a/ext/stub/properties/privateproperties.zep.h +++ b/ext/stub/properties/privateproperties.zep.h @@ -33,40 +33,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_privateproperties_getsomestring, ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_privateproperties_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeNull, arginfo_stub_properties_privateproperties_getsomenull, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeNull, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeNullInitial, arginfo_stub_properties_privateproperties_getsomenullinitial, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeNullInitial, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeFalse, arginfo_stub_properties_privateproperties_getsomefalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeTrue, arginfo_stub_properties_privateproperties_getsometrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeInteger, arginfo_stub_properties_privateproperties_getsomeinteger, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeInteger, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeDouble, arginfo_stub_properties_privateproperties_getsomedouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PrivateProperties, getSomeString, arginfo_stub_properties_privateproperties_getsomestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PrivateProperties, getSomeString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PrivateProperties, getSomeNull, arginfo_stub_properties_privateproperties_getsomenull, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeNullInitial, arginfo_stub_properties_privateproperties_getsomenullinitial, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeFalse, arginfo_stub_properties_privateproperties_getsomefalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeTrue, arginfo_stub_properties_privateproperties_getsometrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeInteger, arginfo_stub_properties_privateproperties_getsomeinteger, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeDouble, arginfo_stub_properties_privateproperties_getsomedouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PrivateProperties, getSomeString, arginfo_stub_properties_privateproperties_getsomestring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/propertyarray.zep.c b/ext/stub/properties/propertyarray.zep.c index 95ba68716a..d20e6b7260 100644 --- a/ext/stub/properties/propertyarray.zep.c +++ b/ext/stub/properties/propertyarray.zep.c @@ -74,12 +74,9 @@ PHP_METHOD(Stub_Properties_PropertyArray, appendSome) ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -97,12 +94,9 @@ PHP_METHOD(Stub_Properties_PropertyArray, setOtherArray) zval *this_ptr = getThis(); ZVAL_UNDEF(&arr_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arr) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &arr); diff --git a/ext/stub/properties/propertyarray.zep.h b/ext/stub/properties/propertyarray.zep.h index 652ea134aa..c9e5276bea 100644 --- a/ext/stub/properties/propertyarray.zep.h +++ b/ext/stub/properties/propertyarray.zep.h @@ -31,22 +31,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_propertyarray_zephir_init_propert ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_propertyarray_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyArray, __construct, arginfo_stub_properties_propertyarray___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_Properties_PropertyArray, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_Properties_PropertyArray, __construct, arginfo_stub_properties_propertyarray___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Properties_PropertyArray, appendSome, arginfo_stub_properties_propertyarray_appendsome, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_PropertyArray, setOtherArray, arginfo_stub_properties_propertyarray_setotherarray, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyArray, getOtherArray, arginfo_stub_properties_propertyarray_getotherarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PropertyArray, getOtherArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyArray, testIssues1831, arginfo_stub_properties_propertyarray_testissues1831, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PropertyArray, testIssues1831, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PropertyArray, getOtherArray, arginfo_stub_properties_propertyarray_getotherarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PropertyArray, testIssues1831, arginfo_stub_properties_propertyarray_testissues1831, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/propertyupdate.zep.h b/ext/stub/properties/propertyupdate.zep.h index 3c4d182696..4275a18b13 100644 --- a/ext/stub/properties/propertyupdate.zep.h +++ b/ext/stub/properties/propertyupdate.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_properties_propertyupdate_update1, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_propertyupdate_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PropertyUpdate, update1, arginfo_stub_properties_propertyupdate_update1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PropertyUpdate, update1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PropertyUpdate, update1, arginfo_stub_properties_propertyupdate_update1, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/protectedproperties.zep.c b/ext/stub/properties/protectedproperties.zep.c index 820d70ae2b..37d630c30e 100644 --- a/ext/stub/properties/protectedproperties.zep.c +++ b/ext/stub/properties/protectedproperties.zep.c @@ -74,12 +74,9 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeVar) zval *this_ptr = getThis(); ZVAL_UNDEF(&someVar_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(someVar) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &someVar); @@ -111,12 +108,9 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeArrayVar) zval *this_ptr = getThis(); ZVAL_UNDEF(&someArrayVar); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(someArrayVar) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -161,12 +155,9 @@ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeNull) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); diff --git a/ext/stub/properties/protectedproperties.zep.h b/ext/stub/properties/protectedproperties.zep.h index 7d18ddeec3..f99816ad31 100644 --- a/ext/stub/properties/protectedproperties.zep.h +++ b/ext/stub/properties/protectedproperties.zep.h @@ -61,48 +61,16 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_protectedproperties_method_entry) { PHP_ME(Stub_Properties_ProtectedProperties, setSomeVar, arginfo_stub_properties_protectedproperties_setsomevar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeVar, arginfo_stub_properties_protectedproperties_getsomevar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeVar, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_ProtectedProperties, getSomeVar, arginfo_stub_properties_protectedproperties_getsomevar, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_ProtectedProperties, setSomeArrayVar, arginfo_stub_properties_protectedproperties_setsomearrayvar, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_ProtectedProperties, getSomeArrayVar, arginfo_stub_properties_protectedproperties_getsomearrayvar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNull, arginfo_stub_properties_protectedproperties_getsomenull, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNull, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_ProtectedProperties, getSomeNull, arginfo_stub_properties_protectedproperties_getsomenull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Properties_ProtectedProperties, setSomeNull, arginfo_stub_properties_protectedproperties_setsomenull, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNullInitial, arginfo_stub_properties_protectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeNullInitial, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeFalse, arginfo_stub_properties_protectedproperties_getsomefalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeTrue, arginfo_stub_properties_protectedproperties_getsometrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeInteger, arginfo_stub_properties_protectedproperties_getsomeinteger, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeInteger, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeDouble, arginfo_stub_properties_protectedproperties_getsomedouble, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeDouble, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_ProtectedProperties, getSomeString, arginfo_stub_properties_protectedproperties_getsomestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_ProtectedProperties, getSomeString, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_ProtectedProperties, getSomeNullInitial, arginfo_stub_properties_protectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeFalse, arginfo_stub_properties_protectedproperties_getsomefalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeTrue, arginfo_stub_properties_protectedproperties_getsometrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeInteger, arginfo_stub_properties_protectedproperties_getsomeinteger, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeDouble, arginfo_stub_properties_protectedproperties_getsomedouble, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_ProtectedProperties, getSomeString, arginfo_stub_properties_protectedproperties_getsomestring, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/publicproperties.zep.c b/ext/stub/properties/publicproperties.zep.c index 81bae5e641..bcc66f5f9b 100644 --- a/ext/stub/properties/publicproperties.zep.c +++ b/ext/stub/properties/publicproperties.zep.c @@ -83,12 +83,9 @@ PHP_METHOD(Stub_Properties_PublicProperties, setSomeGetterSetterArray) zval *this_ptr = getThis(); ZVAL_UNDEF(&someGetterSetterArray_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(someGetterSetterArray) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &someGetterSetterArray); @@ -118,7 +115,7 @@ PHP_METHOD(Stub_Properties_PublicProperties, test394Issue) ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_property(&_0, this_ptr, ZEND_STRL("someTrue"), PH_NOISY_CC); RETURN_CCTOR(&_0); } diff --git a/ext/stub/properties/publicproperties.zep.h b/ext/stub/properties/publicproperties.zep.h index 59b09e0ffd..d4003232ea 100644 --- a/ext/stub/properties/publicproperties.zep.h +++ b/ext/stub/properties/publicproperties.zep.h @@ -23,15 +23,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_publicproperties_method_entry) { PHP_ME(Stub_Properties_PublicProperties, setSomeGetterSetterArray, arginfo_stub_properties_publicproperties_setsomegettersetterarray, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PublicProperties, getSomeGetterSetterArray, arginfo_stub_properties_publicproperties_getsomegettersetterarray, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PublicProperties, getSomeGetterSetterArray, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_PublicProperties, test394Issue, arginfo_stub_properties_publicproperties_test394issue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_PublicProperties, test394Issue, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Properties_PublicProperties, getSomeGetterSetterArray, arginfo_stub_properties_publicproperties_getsomegettersetterarray, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_PublicProperties, test394Issue, arginfo_stub_properties_publicproperties_test394issue, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/staticprivateproperties.zep.c b/ext/stub/properties/staticprivateproperties.zep.c index 857f63f907..36f9d6eafd 100644 --- a/ext/stub/properties/staticprivateproperties.zep.c +++ b/ext/stub/properties/staticprivateproperties.zep.c @@ -38,7 +38,7 @@ PHP_METHOD(Stub_Properties_StaticPrivateProperties, getInstance) ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&localInstance); + zephir_memory_observe(&localInstance); zephir_read_static_property_ce(&localInstance, stub_properties_staticprivateproperties_ce, SL("instance"), PH_NOISY_CC); if (UNEXPECTED(Z_TYPE_P(&localInstance) != IS_OBJECT)) { ZEPHIR_INIT_NVAR(&localInstance); diff --git a/ext/stub/properties/staticprotectedproperties.zep.c b/ext/stub/properties/staticprotectedproperties.zep.c index 0b3a75a4be..35c243347d 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.c +++ b/ext/stub/properties/staticprotectedproperties.zep.c @@ -59,12 +59,9 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, setSomeVar) zval *this_ptr = getThis(); ZVAL_UNDEF(&someVar_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(someVar) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &someVar); @@ -102,12 +99,9 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, setSomeNull) zval *this_ptr = getThis(); ZVAL_UNDEF(¶m_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶m); @@ -209,7 +203,7 @@ PHP_METHOD(Stub_Properties_StaticProtectedProperties, compareStaticNull) ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_read_static_property_ce(&_0, stub_properties_staticprotectedproperties_ce, SL("someNull"), PH_NOISY_CC); ZEPHIR_CPY_WRT(&someNull, &_0); if (Z_TYPE_P(&someNull) == IS_NULL) { diff --git a/ext/stub/properties/staticprotectedproperties.zep.h b/ext/stub/properties/staticprotectedproperties.zep.h index 05205678d4..da3a02ca05 100644 --- a/ext/stub/properties/staticprotectedproperties.zep.h +++ b/ext/stub/properties/staticprotectedproperties.zep.h @@ -52,47 +52,15 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_staticprotectedproperties_method_entry) { PHP_ME(Stub_Properties_StaticProtectedProperties, setSomeVar, arginfo_stub_properties_staticprotectedproperties_setsomevar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeVar, arginfo_stub_properties_staticprotectedproperties_getsomevar, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeVar, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNull, arginfo_stub_properties_staticprotectedproperties_getsomenull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNull, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeVar, arginfo_stub_properties_staticprotectedproperties_getsomevar, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNull, arginfo_stub_properties_staticprotectedproperties_getsomenull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Properties_StaticProtectedProperties, setSomeNull, arginfo_stub_properties_staticprotectedproperties_setsomenull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNullInitial, arginfo_stub_properties_staticprotectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNullInitial, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeFalse, arginfo_stub_properties_staticprotectedproperties_getsomefalse, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeFalse, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeTrue, arginfo_stub_properties_staticprotectedproperties_getsometrue, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeTrue, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeInteger, arginfo_stub_properties_staticprotectedproperties_getsomeinteger, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeInteger, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeDouble, arginfo_stub_properties_staticprotectedproperties_getsomedouble, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeDouble, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeString, arginfo_stub_properties_staticprotectedproperties_getsomestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeNullInitial, arginfo_stub_properties_staticprotectedproperties_getsomenullinitial, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeFalse, arginfo_stub_properties_staticprotectedproperties_getsomefalse, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeTrue, arginfo_stub_properties_staticprotectedproperties_getsometrue, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeInteger, arginfo_stub_properties_staticprotectedproperties_getsomeinteger, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeDouble, arginfo_stub_properties_staticprotectedproperties_getsomedouble, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticProtectedProperties, getSomeString, arginfo_stub_properties_staticprotectedproperties_getsomestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Properties_StaticProtectedProperties, compareStaticNull, arginfo_stub_properties_staticprotectedproperties_comparestaticnull, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/properties/staticpublicproperties.zep.c b/ext/stub/properties/staticpublicproperties.zep.c index bc1f220b5d..2dc1b7e57d 100644 --- a/ext/stub/properties/staticpublicproperties.zep.c +++ b/ext/stub/properties/staticpublicproperties.zep.c @@ -59,12 +59,9 @@ PHP_METHOD(Stub_Properties_StaticPublicProperties, setSomeString) 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); diff --git a/ext/stub/properties/staticpublicproperties.zep.h b/ext/stub/properties/staticpublicproperties.zep.h index 446af459fb..002b5d1190 100644 --- a/ext/stub/properties/staticpublicproperties.zep.h +++ b/ext/stub/properties/staticpublicproperties.zep.h @@ -31,30 +31,10 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_properties_staticpublicproperties_method_entry) { PHP_ME(Stub_Properties_StaticPublicProperties, setSomeString, arginfo_stub_properties_staticpublicproperties_setsomestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub, arginfo_stub_properties_staticpublicproperties_testaddandsub, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub2, arginfo_stub_properties_staticpublicproperties_testaddandsub2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub2, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub3, arginfo_stub_properties_staticpublicproperties_testaddandsub3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub3, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub4, arginfo_stub_properties_staticpublicproperties_testaddandsub4, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub4, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub5, arginfo_stub_properties_staticpublicproperties_testaddandsub5, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub5, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub, arginfo_stub_properties_staticpublicproperties_testaddandsub, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub2, arginfo_stub_properties_staticpublicproperties_testaddandsub2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub3, arginfo_stub_properties_staticpublicproperties_testaddandsub3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub4, arginfo_stub_properties_staticpublicproperties_testaddandsub4, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Properties_StaticPublicProperties, testAddAndSub5, arginfo_stub_properties_staticpublicproperties_testaddandsub5, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/quantum.zep.c b/ext/stub/quantum.zep.c index 4d8f1ffc25..2dfb6c04db 100644 --- a/ext/stub/quantum.zep.c +++ b/ext/stub/quantum.zep.c @@ -97,12 +97,9 @@ PHP_METHOD(Stub_Quantum, harmos) ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_10$$4); ZVAL_UNDEF(&_11$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(x) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/range.zep.h b/ext/stub/range.zep.h index 7fdad5e842..b90e1ba2fb 100644 --- a/ext/stub/range.zep.h +++ b/ext/stub/range.zep.h @@ -13,15 +13,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_range_exclusive1, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_range_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Range, inclusive1, arginfo_stub_range_inclusive1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Range, inclusive1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Range, exclusive1, arginfo_stub_range_exclusive1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Range, exclusive1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Range, inclusive1, arginfo_stub_range_inclusive1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Range, exclusive1, arginfo_stub_range_exclusive1, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/references.zep.h b/ext/stub/references.zep.h index b4c5d4d063..a3817ddfaf 100644 --- a/ext/stub/references.zep.h +++ b/ext/stub/references.zep.h @@ -9,10 +9,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_references_assignbyref, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_references_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_References, assignByRef, arginfo_stub_references_assignbyref, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_References, assignByRef, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_References, assignByRef, arginfo_stub_references_assignbyref, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/reflection.zep.c b/ext/stub/reflection.zep.c index 839790de5e..a81dac18f3 100644 --- a/ext/stub/reflection.zep.c +++ b/ext/stub/reflection.zep.c @@ -72,12 +72,9 @@ PHP_METHOD(Stub_Reflection, setReflectionParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(parameter, zephir_get_internal_ce(SL("reflectionparameter"))) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, ¶meter); diff --git a/ext/stub/regexdna.zep.c b/ext/stub/regexdna.zep.c index cb15a4461a..8eaa81fff5 100644 --- a/ext/stub/regexdna.zep.c +++ b/ext/stub/regexdna.zep.c @@ -59,12 +59,9 @@ PHP_METHOD(Stub_RegexDNA, process) ZVAL_UNDEF(&_7$$3); ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_9$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/requires.zep.c b/ext/stub/requires.zep.c index 2c38aebf4f..443751c6a4 100644 --- a/ext/stub/requires.zep.c +++ b/ext/stub/requires.zep.c @@ -37,12 +37,9 @@ PHP_METHOD(Stub_Requires, requireExternal1) ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -62,12 +59,9 @@ PHP_METHOD(Stub_Requires, requireExternal2) zval *this_ptr = getThis(); ZVAL_UNDEF(&path_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &path); @@ -89,12 +83,9 @@ PHP_METHOD(Stub_Requires, requireExternal3) ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&external3); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(path) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -122,12 +113,9 @@ PHP_METHOD(Stub_Requires, setContent) zval *this_ptr = getThis(); ZVAL_UNDEF(&content_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(content) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &content); @@ -155,13 +143,10 @@ PHP_METHOD(Stub_Requires, renderTemplate) ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_5$$4); ZVAL_UNDEF(&_6$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(templatePath) Z_PARAM_ZVAL(params) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -238,12 +223,9 @@ PHP_METHOD(Stub_Requires, requireOnce) ZVAL_UNDEF(&path); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(path) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/requires/external3.zep.c b/ext/stub/requires/external3.zep.c index 0d3ef34abe..fc7a17189f 100644 --- a/ext/stub/requires/external3.zep.c +++ b/ext/stub/requires/external3.zep.c @@ -39,13 +39,10 @@ PHP_METHOD(Stub_Requires_External3, req) ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&requires_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(path) Z_PARAM_ZVAL(requires) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/resourcetest.zep.h b/ext/stub/resourcetest.zep.h index 58f3a9622b..b44eaa804c 100644 --- a/ext/stub/resourcetest.zep.h +++ b/ext/stub/resourcetest.zep.h @@ -29,35 +29,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_resourcetest_testfunctionsforstdin, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_resourcetest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testLetStatementSTDIN, arginfo_stub_resourcetest_testletstatementstdin, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testLetStatementSTDIN, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testLetStatementSTDOUT, arginfo_stub_resourcetest_testletstatementstdout, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testLetStatementSTDOUT, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testLetStatementSTDERR, arginfo_stub_resourcetest_testletstatementstderr, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testLetStatementSTDERR, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testTypeOffResource, arginfo_stub_resourcetest_testtypeoffresource, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testTypeOffResource, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testIsResource, arginfo_stub_resourcetest_testisresource, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testIsResource, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ResourceTest, testFunctionsForSTDIN, arginfo_stub_resourcetest_testfunctionsforstdin, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ResourceTest, testFunctionsForSTDIN, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ResourceTest, testLetStatementSTDIN, arginfo_stub_resourcetest_testletstatementstdin, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testLetStatementSTDOUT, arginfo_stub_resourcetest_testletstatementstdout, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testLetStatementSTDERR, arginfo_stub_resourcetest_testletstatementstderr, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testTypeOffResource, arginfo_stub_resourcetest_testtypeoffresource, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testIsResource, arginfo_stub_resourcetest_testisresource, ZEND_ACC_PUBLIC) +PHP_ME(Stub_ResourceTest, testFunctionsForSTDIN, arginfo_stub_resourcetest_testfunctionsforstdin, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/returns.zep.c b/ext/stub/returns.zep.c index 8b309060fd..abe36d8911 100644 --- a/ext/stub/returns.zep.c +++ b/ext/stub/returns.zep.c @@ -72,12 +72,9 @@ PHP_METHOD(Stub_Returns, returnWithParameter) zval *this_ptr = getThis(); ZVAL_UNDEF(¶meter); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(parameter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/returns.zep.h b/ext/stub/returns.zep.h index 3d5dd2d644..02a7f82bc7 100644 --- a/ext/stub/returns.zep.h +++ b/ext/stub/returns.zep.h @@ -35,10 +35,6 @@ ZEPHIR_INIT_FUNCS(stub_returns_method_entry) { PHP_ME(Stub_Returns, testReturnCast3, arginfo_stub_returns_testreturncast3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Returns, testReturnCast4, arginfo_stub_returns_testreturncast4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Returns, returnWithParameter, arginfo_stub_returns_returnwithparameter, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Returns, returnWithoutParameter, arginfo_stub_returns_returnwithoutparameter, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Returns, returnWithoutParameter, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Returns, returnWithoutParameter, arginfo_stub_returns_returnwithoutparameter, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/router.zep.c b/ext/stub/router.zep.c index cbe15fa480..6a750782a8 100644 --- a/ext/stub/router.zep.c +++ b/ext/stub/router.zep.c @@ -99,13 +99,10 @@ PHP_METHOD(Stub_Router, __construct) ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_1$$3); ZVAL_UNDEF(&_4$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(defaultRoutes) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -161,12 +158,9 @@ PHP_METHOD(Stub_Router, setDI) zval *this_ptr = getThis(); ZVAL_UNDEF(&dependencyInjector_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_OBJECT_OF_CLASS(dependencyInjector, stub_diinterface_ce) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &dependencyInjector); @@ -214,7 +208,7 @@ PHP_METHOD(Stub_Router, getRewriteUri) zephir_read_property(&_0, this_ptr, ZEND_STRL("_uriSource"), PH_NOISY_CC | PH_READONLY); if (!(zephir_is_true(&_0))) { - ZEPHIR_OBS_VAR(&url); + zephir_memory_observe(&url); if (zephir_array_isset_string_fetch(&url, &_GET, SL("_url"), 0)) { if (!(zephir_is_true(&url))) { RETURN_CCTOR(&url); @@ -250,12 +244,9 @@ PHP_METHOD(Stub_Router, setUriSource) zval *this_ptr = getThis(); ZVAL_UNDEF(&uriSource_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(uriSource) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &uriSource); @@ -277,12 +268,9 @@ PHP_METHOD(Stub_Router, removeExtraSlashes) zval *this_ptr = getThis(); ZVAL_UNDEF(&remove_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(remove) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &remove); @@ -304,12 +292,9 @@ PHP_METHOD(Stub_Router, setDefaultNamespace) zval *this_ptr = getThis(); ZVAL_UNDEF(&namespaceName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(namespaceName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &namespaceName); @@ -331,12 +316,9 @@ PHP_METHOD(Stub_Router, setDefaultModule) zval *this_ptr = getThis(); ZVAL_UNDEF(&moduleName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(moduleName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &moduleName); @@ -358,12 +340,9 @@ PHP_METHOD(Stub_Router, setDefaultController) zval *this_ptr = getThis(); ZVAL_UNDEF(&controllerName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(controllerName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &controllerName); @@ -385,12 +364,9 @@ PHP_METHOD(Stub_Router, setDefaultAction) zval *this_ptr = getThis(); ZVAL_UNDEF(&actionName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(actionName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &actionName); @@ -425,12 +401,9 @@ PHP_METHOD(Stub_Router, setDefaults) ZVAL_UNDEF(&controller); ZVAL_UNDEF(&action); ZVAL_UNDEF(¶ms); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(defaults) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &defaults); @@ -467,12 +440,9 @@ PHP_METHOD(Stub_Router, doRemoveExtraSlashes) zval *this_ptr = getThis(); ZVAL_UNDEF(&route_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(route) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &route); @@ -562,13 +532,11 @@ PHP_METHOD(Stub_Router, handle) ZVAL_UNDEF(&_29$$96); ZVAL_UNDEF(&_30$$96); ZVAL_UNDEF(&_31$$96); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(uri) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -952,7 +920,7 @@ PHP_METHOD(Stub_Router, handle) } } if (!(zephir_is_true(&routeFound))) { - ZEPHIR_OBS_VAR(¬FoundPaths); + zephir_memory_observe(¬FoundPaths); zephir_read_property(¬FoundPaths, this_ptr, ZEND_STRL("_notFoundPaths"), PH_NOISY_CC); if (Z_TYPE_P(¬FoundPaths) != IS_NULL) { ZEPHIR_CPY_WRT(&parts, ¬FoundPaths); @@ -961,7 +929,7 @@ PHP_METHOD(Stub_Router, handle) } } if (zephir_is_true(&routeFound)) { - ZEPHIR_OBS_VAR(&vnamespace); + zephir_memory_observe(&vnamespace); if (zephir_array_isset_string_fetch(&vnamespace, &parts, SL("namespace"), 0)) { if (!(zephir_is_numeric(&vnamespace))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_namespace"), &vnamespace); @@ -971,7 +939,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_22$$82, this_ptr, ZEND_STRL("_defaultNamespace"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_namespace"), &_22$$82); } - ZEPHIR_OBS_VAR(&module); + zephir_memory_observe(&module); if (zephir_array_isset_string_fetch(&module, &parts, SL("module"), 0)) { if (!(zephir_is_numeric(&module))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_module"), &module); @@ -981,7 +949,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_23$$85, this_ptr, ZEND_STRL("_defaultModule"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_module"), &_23$$85); } - ZEPHIR_OBS_VAR(&controller); + zephir_memory_observe(&controller); if (zephir_array_isset_string_fetch(&controller, &parts, SL("controller"), 0)) { if (!(zephir_is_numeric(&controller))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_controller"), &controller); @@ -991,7 +959,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_24$$88, this_ptr, ZEND_STRL("_defaultController"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_controller"), &_24$$88); } - ZEPHIR_OBS_VAR(&action); + zephir_memory_observe(&action); if (zephir_array_isset_string_fetch(&action, &parts, SL("action"), 0)) { if (!(zephir_is_numeric(&action))) { zephir_update_property_zval(this_ptr, ZEND_STRL("_action"), &action); @@ -1001,7 +969,7 @@ PHP_METHOD(Stub_Router, handle) zephir_read_property(&_25$$91, this_ptr, ZEND_STRL("_defaultAction"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, ZEND_STRL("_action"), &_25$$91); } - ZEPHIR_OBS_VAR(¶msStr); + zephir_memory_observe(¶msStr); if (zephir_array_isset_string_fetch(¶msStr, &parts, SL("params"), 0)) { ZVAL_LONG(&_26$$92, 1); ZEPHIR_INIT_VAR(&strParams); @@ -1058,7 +1026,6 @@ PHP_METHOD(Stub_Router, add) ZVAL_UNDEF(&httpMethods_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&route); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_ZVAL(pattern) @@ -1066,7 +1033,6 @@ PHP_METHOD(Stub_Router, add) Z_PARAM_ZVAL_OR_NULL(paths) Z_PARAM_ZVAL_OR_NULL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1107,14 +1073,12 @@ PHP_METHOD(Stub_Router, addGet) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1150,14 +1114,12 @@ PHP_METHOD(Stub_Router, addPost) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1193,14 +1155,12 @@ PHP_METHOD(Stub_Router, addPut) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1236,14 +1196,12 @@ PHP_METHOD(Stub_Router, addPatch) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1279,14 +1237,12 @@ PHP_METHOD(Stub_Router, addDelete) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1322,14 +1278,12 @@ PHP_METHOD(Stub_Router, addOptions) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1365,14 +1319,12 @@ PHP_METHOD(Stub_Router, addHead) ZVAL_UNDEF(&paths_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1412,12 +1364,9 @@ PHP_METHOD(Stub_Router, mount) ZVAL_UNDEF(&_1$$5); ZVAL_UNDEF(&_3$$8); ZVAL_UNDEF(&_4$$11); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(group) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1496,7 +1445,7 @@ PHP_METHOD(Stub_Router, mount) } ZEPHIR_INIT_NVAR(&route); } - ZEPHIR_OBS_VAR(&routes); + zephir_memory_observe(&routes); zephir_read_property(&routes, this_ptr, ZEND_STRL("_routes"), PH_NOISY_CC); if (Z_TYPE_P(&routes) == IS_ARRAY) { ZEPHIR_INIT_VAR(&_4$$11); @@ -1520,12 +1469,9 @@ PHP_METHOD(Stub_Router, notFound) zval *this_ptr = getThis(); ZVAL_UNDEF(&paths_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &paths); @@ -1706,12 +1652,9 @@ PHP_METHOD(Stub_Router, getRouteById) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(id) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1774,12 +1717,9 @@ PHP_METHOD(Stub_Router, getRouteByName) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_4$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(name) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/router.zep.h b/ext/stub/router.zep.h index 0cff207b84..e7cda4f79d 100644 --- a/ext/stub/router.zep.h +++ b/ext/stub/router.zep.h @@ -179,16 +179,8 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_router_method_entry) { PHP_ME(Stub_Router, __construct, arginfo_stub_router___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_Router, setDI, arginfo_stub_router_setdi, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getDI, arginfo_stub_router_getdi, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getDI, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getRewriteUri, arginfo_stub_router_getrewriteuri, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getRewriteUri, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router, getDI, arginfo_stub_router_getdi, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getRewriteUri, arginfo_stub_router_getrewriteuri, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, setUriSource, arginfo_stub_router_seturisource, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, removeExtraSlashes, arginfo_stub_router_removeextraslashes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, setDefaultNamespace, arginfo_stub_router_setdefaultnamespace, ZEND_ACC_PUBLIC) @@ -208,56 +200,16 @@ ZEPHIR_INIT_FUNCS(stub_router_method_entry) { PHP_ME(Stub_Router, addHead, arginfo_stub_router_addhead, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, mount, arginfo_stub_router_mount, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, notFound, arginfo_stub_router_notfound, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, clear, arginfo_stub_router_clear, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, clear, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getNamespaceName, arginfo_stub_router_getnamespacename, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getNamespaceName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getModuleName, arginfo_stub_router_getmodulename, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getModuleName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getControllerName, arginfo_stub_router_getcontrollername, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getControllerName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getActionName, arginfo_stub_router_getactionname, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getActionName, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getParams, arginfo_stub_router_getparams, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getParams, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getMatchedRoute, arginfo_stub_router_getmatchedroute, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getMatchedRoute, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getMatches, arginfo_stub_router_getmatches, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getMatches, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, wasMatched, arginfo_stub_router_wasmatched, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, wasMatched, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router, getRoutes, arginfo_stub_router_getroutes, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router, getRoutes, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router, clear, arginfo_stub_router_clear, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getNamespaceName, arginfo_stub_router_getnamespacename, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getModuleName, arginfo_stub_router_getmodulename, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getControllerName, arginfo_stub_router_getcontrollername, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getActionName, arginfo_stub_router_getactionname, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getParams, arginfo_stub_router_getparams, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getMatchedRoute, arginfo_stub_router_getmatchedroute, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getMatches, arginfo_stub_router_getmatches, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, wasMatched, arginfo_stub_router_wasmatched, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router, getRoutes, arginfo_stub_router_getroutes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, getRouteById, arginfo_stub_router_getroutebyid, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router, getRouteByName, arginfo_stub_router_getroutebyname, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/router/route.zep.c b/ext/stub/router/route.zep.c index e5f4af8a24..179006356e 100644 --- a/ext/stub/router/route.zep.c +++ b/ext/stub/router/route.zep.c @@ -61,7 +61,6 @@ PHP_METHOD(Stub_Router_Route, __construct) ZVAL_UNDEF(&paths_sub); ZVAL_UNDEF(&httpMethods_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 3) Z_PARAM_ZVAL(pattern) @@ -69,7 +68,6 @@ PHP_METHOD(Stub_Router_Route, __construct) Z_PARAM_ZVAL_OR_NULL(paths) Z_PARAM_ZVAL_OR_NULL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -118,12 +116,9 @@ PHP_METHOD(Stub_Router_Route, compilePattern) ZVAL_UNDEF(&_11$$9); ZVAL_UNDEF(&_12$$9); ZVAL_UNDEF(&_13$$9); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(pattern) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -210,12 +205,9 @@ PHP_METHOD(Stub_Router_Route, via) zval *this_ptr = getThis(); ZVAL_UNDEF(&httpMethods_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &httpMethods); @@ -261,12 +253,9 @@ PHP_METHOD(Stub_Router_Route, extractNamedParams) ZVAL_UNDEF(&_23$$16); ZVAL_UNDEF(&_27$$19); ZVAL_UNDEF(&_28$$28); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(pattern) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -493,14 +482,12 @@ PHP_METHOD(Stub_Router_Route, reConfigure) ZVAL_UNDEF(&_1$$10); ZVAL_UNDEF(&_2$$19); ZVAL_UNDEF(&_3$$19); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(pattern) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(paths) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -589,7 +576,7 @@ PHP_METHOD(Stub_Router_Route, reConfigure) if (zephir_memnstr_str(pattern, SL("{"), "stub/router/route.zep", 348)) { ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); zephir_check_call_status(); - ZEPHIR_OBS_VAR(&pcrePattern); + zephir_memory_observe(&pcrePattern); zephir_array_fetch_long(&pcrePattern, &extracted, 0, PH_NOISY, "stub/router/route.zep", 351); ZEPHIR_INIT_VAR(&_2$$19); zephir_array_fetch_long(&_3$$19, &extracted, 1, PH_NOISY | PH_READONLY, "stub/router/route.zep", 352); @@ -641,12 +628,9 @@ PHP_METHOD(Stub_Router_Route, setName) zval *this_ptr = getThis(); ZVAL_UNDEF(&name_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(name) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &name); @@ -670,12 +654,9 @@ PHP_METHOD(Stub_Router_Route, beforeMatch) zval *this_ptr = getThis(); ZVAL_UNDEF(&callback_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(callback) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &callback); @@ -835,12 +816,9 @@ PHP_METHOD(Stub_Router_Route, setHttpMethods) zval *this_ptr = getThis(); ZVAL_UNDEF(&httpMethods_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(httpMethods) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &httpMethods); @@ -880,12 +858,9 @@ PHP_METHOD(Stub_Router_Route, setHostname) zval *this_ptr = getThis(); ZVAL_UNDEF(&hostname_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(hostname) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &hostname); @@ -923,13 +898,10 @@ PHP_METHOD(Stub_Router_Route, convert) ZVAL_UNDEF(&name_sub); ZVAL_UNDEF(&converter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(name) Z_PARAM_ZVAL(converter) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &name, &converter); diff --git a/ext/stub/router/route.zep.h b/ext/stub/router/route.zep.h index a55bc0e79c..50a7eecf16 100644 --- a/ext/stub/router/route.zep.h +++ b/ext/stub/router/route.zep.h @@ -104,60 +104,20 @@ ZEPHIR_INIT_FUNCS(stub_router_route_method_entry) { PHP_ME(Stub_Router_Route, via, arginfo_stub_router_route_via, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, extractNamedParams, arginfo_stub_router_route_extractnamedparams, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, reConfigure, arginfo_stub_router_route_reconfigure, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getName, arginfo_stub_router_route_getname, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getName, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getName, arginfo_stub_router_route_getname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, setName, arginfo_stub_router_route_setname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, beforeMatch, arginfo_stub_router_route_beforematch, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getBeforeMatch, arginfo_stub_router_route_getbeforematch, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getBeforeMatch, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getRouteId, arginfo_stub_router_route_getrouteid, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getRouteId, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getPattern, arginfo_stub_router_route_getpattern, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getPattern, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getCompiledPattern, arginfo_stub_router_route_getcompiledpattern, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getCompiledPattern, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getPaths, arginfo_stub_router_route_getpaths, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getPaths, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getReversedPaths, arginfo_stub_router_route_getreversedpaths, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getReversedPaths, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getBeforeMatch, arginfo_stub_router_route_getbeforematch, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getRouteId, arginfo_stub_router_route_getrouteid, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getPattern, arginfo_stub_router_route_getpattern, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getCompiledPattern, arginfo_stub_router_route_getcompiledpattern, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getPaths, arginfo_stub_router_route_getpaths, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Router_Route, getReversedPaths, arginfo_stub_router_route_getreversedpaths, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, setHttpMethods, arginfo_stub_router_route_sethttpmethods, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getHttpMethods, arginfo_stub_router_route_gethttpmethods, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getHttpMethods, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getHttpMethods, arginfo_stub_router_route_gethttpmethods, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, setHostname, arginfo_stub_router_route_sethostname, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getHostname, arginfo_stub_router_route_gethostname, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getHostname, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getHostname, arginfo_stub_router_route_gethostname, ZEND_ACC_PUBLIC) PHP_ME(Stub_Router_Route, convert, arginfo_stub_router_route_convert, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Router_Route, getConverters, arginfo_stub_router_route_getconverters, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Router_Route, getConverters, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Router_Route, getConverters, arginfo_stub_router_route_getconverters, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/scall.zep.c b/ext/stub/scall.zep.c index 51a6364b19..4104dd602c 100644 --- a/ext/stub/scall.zep.c +++ b/ext/stub/scall.zep.c @@ -62,13 +62,10 @@ PHP_METHOD(Stub_Scall, testMethod4) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -85,13 +82,10 @@ PHP_METHOD(Stub_Scall, testMethod5) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -108,13 +102,10 @@ PHP_METHOD(Stub_Scall, testMethod6) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a, &b); @@ -189,13 +180,10 @@ PHP_METHOD(Stub_Scall, testCall4) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -216,13 +204,10 @@ PHP_METHOD(Stub_Scall, testCall5) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -244,13 +229,10 @@ PHP_METHOD(Stub_Scall, testCall6) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -317,13 +299,10 @@ PHP_METHOD(Stub_Scall, testCall10) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -344,13 +323,10 @@ PHP_METHOD(Stub_Scall, testCall11) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -372,13 +348,10 @@ PHP_METHOD(Stub_Scall, testCall12) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -441,13 +414,10 @@ PHP_METHOD(Stub_Scall, testMethod16) long a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); @@ -470,13 +440,10 @@ PHP_METHOD(Stub_Scall, testCall17) ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -519,13 +486,10 @@ PHP_METHOD(Stub_Scall, testCall18) ZVAL_UNDEF(&p_sub); ZVAL_UNDEF(&_3$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(k) Z_PARAM_ZVAL(p) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/scall.zep.h b/ext/stub/scall.zep.h index e9a61d09bc..f339923fa0 100644 --- a/ext/stub/scall.zep.h +++ b/ext/stub/scall.zep.h @@ -148,57 +148,21 @@ ZEPHIR_INIT_FUNCS(stub_scall_method_entry) { PHP_ME(Stub_Scall, testMethod5, arginfo_stub_scall_testmethod5, ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) PHP_ME(Stub_Scall, testMethod6, arginfo_stub_scall_testmethod6, ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) PHP_ME(Stub_Scall, testMethod7, arginfo_stub_scall_testmethod7, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall1, arginfo_stub_scall_testcall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall2, arginfo_stub_scall_testcall2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall3, arginfo_stub_scall_testcall3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Scall, testCall1, arginfo_stub_scall_testcall1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall2, arginfo_stub_scall_testcall2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall3, arginfo_stub_scall_testcall3, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall4, arginfo_stub_scall_testcall4, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall5, arginfo_stub_scall_testcall5, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall6, arginfo_stub_scall_testcall6, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall7, arginfo_stub_scall_testcall7, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall7, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall8, arginfo_stub_scall_testcall8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall9, arginfo_stub_scall_testcall9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall9, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Scall, testCall7, arginfo_stub_scall_testcall7, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall8, arginfo_stub_scall_testcall8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall9, arginfo_stub_scall_testcall9, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall10, arginfo_stub_scall_testcall10, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall11, arginfo_stub_scall_testcall11, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testCall12, arginfo_stub_scall_testcall12, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall13, arginfo_stub_scall_testcall13, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall13, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall14, arginfo_stub_scall_testcall14, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall14, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scall, testCall15, arginfo_stub_scall_testcall15, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Scall, testCall15, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Scall, testCall13, arginfo_stub_scall_testcall13, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall14, arginfo_stub_scall_testcall14, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Scall, testCall15, arginfo_stub_scall_testcall15, ZEND_ACC_PUBLIC) PHP_ME(Stub_Scall, testMethod16, arginfo_stub_scall_testmethod16, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Scall, testCall17, arginfo_stub_scall_testcall17, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(Stub_Scall, testCall18, arginfo_stub_scall_testcall18, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) diff --git a/ext/stub/scalldynamic.zep.c b/ext/stub/scalldynamic.zep.c index 2317b8aa05..83a39118ec 100644 --- a/ext/stub/scalldynamic.zep.c +++ b/ext/stub/scalldynamic.zep.c @@ -61,12 +61,9 @@ PHP_METHOD(Stub_ScallDynamic, selfDynamicCall1) zval *this_ptr = getThis(); ZVAL_UNDEF(&methodName_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(methodName) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &methodName); diff --git a/ext/stub/scallexternal.zep.c b/ext/stub/scallexternal.zep.c index 35913cf7e6..c69d4d9a17 100644 --- a/ext/stub/scallexternal.zep.c +++ b/ext/stub/scallexternal.zep.c @@ -53,13 +53,10 @@ PHP_METHOD(Stub_ScallExternal, testCall2) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&b_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -77,13 +74,10 @@ PHP_METHOD(Stub_ScallExternal, testMethod3) long a, b; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(a) Z_PARAM_LONG(b) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &a_param, &b_param); diff --git a/ext/stub/scallexternal.zep.h b/ext/stub/scallexternal.zep.h index ca8217a5af..4082998035 100644 --- a/ext/stub/scallexternal.zep.h +++ b/ext/stub/scallexternal.zep.h @@ -21,11 +21,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_scallexternal_testmethod3, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_scallexternal_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ScallExternal, testCall1, arginfo_stub_scallexternal_testcall1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ScallExternal, testCall1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ScallExternal, testCall1, arginfo_stub_scallexternal_testcall1, ZEND_ACC_PUBLIC) PHP_ME(Stub_ScallExternal, testCall2, arginfo_stub_scallexternal_testcall2, ZEND_ACC_PUBLIC) PHP_ME(Stub_ScallExternal, testMethod3, arginfo_stub_scallexternal_testmethod3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END diff --git a/ext/stub/scalllateconstruct.zep.h b/ext/stub/scalllateconstruct.zep.h index 4c8a480459..78bc84d2b8 100644 --- a/ext/stub/scalllateconstruct.zep.h +++ b/ext/stub/scalllateconstruct.zep.h @@ -21,17 +21,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_scalllateconstruct_varvalue ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_scalllateconstruct_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ScallLateConstruct, __construct, arginfo_stub_scalllateconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_ScallLateConstruct, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_ScallLateConstruct, __construct, arginfo_stub_scalllateconstruct___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_ScallLateConstruct, testStaticInit, arginfo_stub_scalllateconstruct_teststaticinit, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_ScallLateConstruct, testPublicInit, arginfo_stub_scalllateconstruct_testpublicinit, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ScallLateConstruct, testPublicInit, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_ScallLateConstruct, testPublicInit, arginfo_stub_scalllateconstruct_testpublicinit, ZEND_ACC_PUBLIC) PHP_ME(Stub_ScallLateConstruct, varValue, arginfo_stub_scalllateconstruct_varvalue, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/scope.zep.c b/ext/stub/scope.zep.c index 1cb63ee4b9..0cfc2c2b47 100644 --- a/ext/stub/scope.zep.c +++ b/ext/stub/scope.zep.c @@ -44,12 +44,9 @@ PHP_METHOD(Stub_Scope, getDyStr) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(g) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/scope.zep.h b/ext/stub/scope.zep.h index 5b4b68e810..87a825ae27 100644 --- a/ext/stub/scope.zep.h +++ b/ext/stub/scope.zep.h @@ -26,26 +26,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_scope_test3, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_scope_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, getStr, arginfo_stub_scope_getstr, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, getStr, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Scope, getStr, arginfo_stub_scope_getstr, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) PHP_ME(Stub_Scope, getDyStr, arginfo_stub_scope_getdystr, ZEND_ACC_PRIVATE|ZEND_ACC_STATIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, test1, arginfo_stub_scope_test1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, test1, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, test2, arginfo_stub_scope_test2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, test2, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Scope, test3, arginfo_stub_scope_test3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#else - PHP_ME(Stub_Scope, test3, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) -#endif +PHP_ME(Stub_Scope, test1, arginfo_stub_scope_test1, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Scope, test2, arginfo_stub_scope_test2, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +PHP_ME(Stub_Scope, test3, arginfo_stub_scope_test3, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; diff --git a/ext/stub/sort.zep.c b/ext/stub/sort.zep.c index 8a3a658e3f..9669c4d1dc 100644 --- a/ext/stub/sort.zep.c +++ b/ext/stub/sort.zep.c @@ -47,12 +47,9 @@ PHP_METHOD(Stub_Sort, quick) ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&_5$$5); ZVAL_UNDEF(&_6$$6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(arr) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -64,7 +61,7 @@ PHP_METHOD(Stub_Sort, quick) if (length <= 1) { RETURN_CTOR(&arr); } - ZEPHIR_OBS_VAR(&_0); + zephir_memory_observe(&_0); zephir_array_fetch_long(&_0, &arr, 0, PH_NOISY, "stub/sort.zep", 18); pivot = zephir_get_intval(&_0); ZEPHIR_INIT_VAR(&left); diff --git a/ext/stub/spectralnorm.zep.c b/ext/stub/spectralnorm.zep.c index 9378e0b718..ddf74f5e5f 100644 --- a/ext/stub/spectralnorm.zep.c +++ b/ext/stub/spectralnorm.zep.c @@ -42,13 +42,10 @@ PHP_METHOD(Stub_SpectralNorm, Ax) ZVAL_UNDEF(&j_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(i) Z_PARAM_ZVAL(j) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -80,14 +77,11 @@ PHP_METHOD(Stub_SpectralNorm, Au) ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_10$$4); ZVAL_UNDEF(&_12$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_LONG(n) Z_PARAM_OBJECT_OF_CLASS(u, spl_ce_SplFixedArray) Z_PARAM_OBJECT_OF_CLASS(v, spl_ce_SplFixedArray) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -163,14 +157,11 @@ PHP_METHOD(Stub_SpectralNorm, Atu) ZVAL_UNDEF(&_8$$4); ZVAL_UNDEF(&_10$$4); ZVAL_UNDEF(&_12$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_LONG(n) Z_PARAM_OBJECT_OF_CLASS(u, spl_ce_SplFixedArray) Z_PARAM_OBJECT_OF_CLASS(v, spl_ce_SplFixedArray) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -239,15 +230,12 @@ PHP_METHOD(Stub_SpectralNorm, AtAu) ZVAL_UNDEF(&u_sub); ZVAL_UNDEF(&v_sub); ZVAL_UNDEF(&w_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(4, 4) Z_PARAM_ZVAL(n) Z_PARAM_ZVAL(u) Z_PARAM_ZVAL(v) Z_PARAM_ZVAL(w) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -282,12 +270,9 @@ PHP_METHOD(Stub_SpectralNorm, process) ZVAL_UNDEF(&_18$$5); ZVAL_UNDEF(&_19$$5); ZVAL_UNDEF(&_20$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(n) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/spl.zep.c b/ext/stub/spl.zep.c index dd43f0df9b..0e3b625130 100644 --- a/ext/stub/spl.zep.c +++ b/ext/stub/spl.zep.c @@ -38,12 +38,9 @@ PHP_METHOD(Stub_Spl, issue1212) zval *this_ptr = getThis(); ZVAL_UNDEF(&file); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(file) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/spropertyaccess.zep.c b/ext/stub/spropertyaccess.zep.c index a7f504409e..688ad6c17d 100644 --- a/ext/stub/spropertyaccess.zep.c +++ b/ext/stub/spropertyaccess.zep.c @@ -63,7 +63,7 @@ PHP_METHOD(Stub_SPropertyAccess, __construct) ZEPHIR_INIT_VAR(&_3); zephir_substr(&_3, &_0, 0 , 1 , 0); zephir_update_static_property_ce(stub_spropertyaccess_ce, ZEND_STRL("b"), &_3); - ZEPHIR_OBS_VAR(&_4); + zephir_memory_observe(&_4); zephir_read_static_property_ce(&_4, stub_spropertyaccess_ce, SL("b"), PH_NOISY_CC); zephir_update_static_property_ce(stub_scallexternal_ce, ZEND_STRL("sproperty"), &_4); ZEPHIR_OBS_NVAR(&_4); @@ -80,13 +80,11 @@ PHP_METHOD(Stub_SPropertyAccess, testArgumentWithUnderscore) ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -116,13 +114,11 @@ PHP_METHOD(Stub_SPropertyAccess, testArgument) ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0$$3); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -136,7 +132,7 @@ PHP_METHOD(Stub_SPropertyAccess, testArgument) if (ZEPHIR_IS_EMPTY(delimiter)) { - ZEPHIR_OBS_VAR(&_0$$3); + zephir_memory_observe(&_0$$3); zephir_read_static_property_ce(&_0$$3, stub_spropertyaccess_ce, SL("delimiter"), PH_NOISY_CC); ZEPHIR_CPY_WRT(delimiter, &_0$$3); } diff --git a/ext/stub/spropertyaccess.zep.h b/ext/stub/spropertyaccess.zep.h index 798cd7f4df..f6fda7dba6 100644 --- a/ext/stub/spropertyaccess.zep.h +++ b/ext/stub/spropertyaccess.zep.h @@ -39,11 +39,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_spropertyaccess_zephir_init_static_propertie ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_spropertyaccess_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_SPropertyAccess, __construct, arginfo_stub_spropertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#else - PHP_ME(Stub_SPropertyAccess, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -#endif +PHP_ME(Stub_SPropertyAccess, __construct, arginfo_stub_spropertyaccess___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Stub_SPropertyAccess, testArgumentWithUnderscore, arginfo_stub_spropertyaccess_testargumentwithunderscore, ZEND_ACC_PUBLIC) PHP_ME(Stub_SPropertyAccess, testArgument, arginfo_stub_spropertyaccess_testargument, ZEND_ACC_PUBLIC) PHP_ME(Stub_SPropertyAccess, mutateStringVarInsideCycle, arginfo_stub_spropertyaccess_mutatestringvarinsidecycle, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) diff --git a/ext/stub/statements.zep.c b/ext/stub/statements.zep.c index f6677f6d4f..a8593f1824 100644 --- a/ext/stub/statements.zep.c +++ b/ext/stub/statements.zep.c @@ -86,12 +86,9 @@ PHP_METHOD(Stub_Statements, testElseIf) zend_long num; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -115,12 +112,9 @@ PHP_METHOD(Stub_Statements, testElseIf1) zend_long num, total; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(num) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &num_param); @@ -144,13 +138,10 @@ PHP_METHOD(Stub_Statements, testElseIf2) zval *this_ptr = getThis(); ZVAL_UNDEF(&total_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(num) Z_PARAM_ZVAL(total) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &num_param, &total); @@ -189,12 +180,9 @@ PHP_METHOD(Stub_Statements, test544Issue) ZVAL_UNDEF(&_13$$4); ZVAL_UNDEF(&_14$$5); ZVAL_UNDEF(&_15$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(step) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -261,12 +249,9 @@ PHP_METHOD(Stub_Statements, test544IssueWithVariable) ZVAL_UNDEF(&_11$$4); ZVAL_UNDEF(&_12$$5); ZVAL_UNDEF(&_13$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(step) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/statements.zep.h b/ext/stub/statements.zep.h index fb266864d1..c4157250ac 100644 --- a/ext/stub/statements.zep.h +++ b/ext/stub/statements.zep.h @@ -35,11 +35,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_statements_test544issuewithvariable, 0, 0, 1 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_statements_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Statements, testPropertyAcccessAvoidTmpReuse, arginfo_stub_statements_testpropertyacccessavoidtmpreuse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Statements, testPropertyAcccessAvoidTmpReuse, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Statements, testPropertyAcccessAvoidTmpReuse, arginfo_stub_statements_testpropertyacccessavoidtmpreuse, ZEND_ACC_PUBLIC) PHP_ME(Stub_Statements, testElseIf, arginfo_stub_statements_testelseif, ZEND_ACC_PUBLIC) PHP_ME(Stub_Statements, testElseIf1, arginfo_stub_statements_testelseif1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Statements, testElseIf2, arginfo_stub_statements_testelseif2, ZEND_ACC_PUBLIC) diff --git a/ext/stub/strings.zep.c b/ext/stub/strings.zep.c index e7c8500331..afb11bb6d6 100644 --- a/ext/stub/strings.zep.c +++ b/ext/stub/strings.zep.c @@ -40,14 +40,12 @@ PHP_METHOD(Stub_Strings, camelize) ZVAL_UNDEF(&str); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -73,14 +71,12 @@ PHP_METHOD(Stub_Strings, uncamelize) ZVAL_UNDEF(&str); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_OR_NULL(delimiter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -102,12 +98,9 @@ PHP_METHOD(Stub_Strings, testTrim) zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -123,12 +116,9 @@ PHP_METHOD(Stub_Strings, testRtrim) zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -144,12 +134,9 @@ PHP_METHOD(Stub_Strings, testLtrim) zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -166,13 +153,10 @@ PHP_METHOD(Stub_Strings, testTrim2Params) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&charlist_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(charlist) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &str, &charlist); @@ -189,13 +173,10 @@ PHP_METHOD(Stub_Strings, testRtrim2Params) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&charlist_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(charlist) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &str, &charlist); @@ -212,13 +193,10 @@ PHP_METHOD(Stub_Strings, testLtrim2Params) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&charlist_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_ZVAL(charlist) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &str, &charlist); @@ -235,13 +213,10 @@ PHP_METHOD(Stub_Strings, testImplode) ZVAL_UNDEF(&glue_sub); ZVAL_UNDEF(&pieces_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(glue) Z_PARAM_ZVAL(pieces) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &glue, &pieces); @@ -258,13 +233,10 @@ PHP_METHOD(Stub_Strings, testStrpos) ZVAL_UNDEF(&haystack_sub); ZVAL_UNDEF(&needle_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(haystack) Z_PARAM_ZVAL(needle) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &haystack, &needle); @@ -283,14 +255,11 @@ PHP_METHOD(Stub_Strings, testStrposOffset) ZVAL_UNDEF(&haystack_sub); ZVAL_UNDEF(&needle_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(haystack) Z_PARAM_ZVAL(needle) Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(3, 0, &haystack, &needle, &offset_param); @@ -309,13 +278,10 @@ PHP_METHOD(Stub_Strings, testExplode) ZVAL_UNDEF(&delimiter_sub); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(delimiter) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &delimiter, &str); @@ -331,12 +297,9 @@ PHP_METHOD(Stub_Strings, testExplodeStr) zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -354,13 +317,10 @@ PHP_METHOD(Stub_Strings, testExplodeLimit) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_LONG(limit) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &str, &limit_param); @@ -381,14 +341,11 @@ PHP_METHOD(Stub_Strings, testSubstr) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(str) Z_PARAM_LONG(from) Z_PARAM_LONG(len) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(3, 0, &str, &from_param, &len_param); @@ -410,13 +367,10 @@ PHP_METHOD(Stub_Strings, testSubstr2) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str) Z_PARAM_LONG(from) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &str, &from_param); @@ -435,12 +389,9 @@ PHP_METHOD(Stub_Strings, testSubstr3) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -459,12 +410,9 @@ PHP_METHOD(Stub_Strings, testSubstr4) ZVAL_UNDEF(&str_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -482,12 +430,9 @@ PHP_METHOD(Stub_Strings, testAddslashes) zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -503,12 +448,9 @@ PHP_METHOD(Stub_Strings, testStripslashes) zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -524,12 +466,9 @@ PHP_METHOD(Stub_Strings, testStripcslashes) zval *this_ptr = getThis(); ZVAL_UNDEF(&str_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(str) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &str); @@ -546,13 +485,10 @@ PHP_METHOD(Stub_Strings, testHashEquals) ZVAL_UNDEF(&str1_sub); ZVAL_UNDEF(&str2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(str1) Z_PARAM_ZVAL(str2) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &str1, &str2); @@ -657,12 +593,9 @@ PHP_METHOD(Stub_Strings, strToHex) ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&_3$$3); ZVAL_UNDEF(&_5$$3); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -707,12 +640,9 @@ PHP_METHOD(Stub_Strings, issue1267) ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_7); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -762,13 +692,11 @@ PHP_METHOD(Stub_Strings, issue2186) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -791,13 +719,11 @@ PHP_METHOD(Stub_Strings, issue2186SegFault) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -824,13 +750,11 @@ PHP_METHOD(Stub_Strings, issue2186SegFaultCall) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -856,13 +780,11 @@ PHP_METHOD(Stub_Strings, issue2186Child1) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -889,13 +811,11 @@ PHP_METHOD(Stub_Strings, issue2186Child2) ZVAL_UNDEF(&val); ZVAL_UNDEF(&_0$$3); ZVAL_UNDEF(&output); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -928,13 +848,11 @@ PHP_METHOD(Stub_Strings, issue2234Strict) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -969,13 +887,11 @@ PHP_METHOD(Stub_Strings, issue2234StrictParent) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1011,13 +927,11 @@ PHP_METHOD(Stub_Strings, issue2234StrictChild) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1051,13 +965,11 @@ PHP_METHOD(Stub_Strings, nullableStringReturnType) zval *this_ptr = getThis(); ZVAL_UNDEF(&val); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(val) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -1094,13 +1006,11 @@ PHP_METHOD(Stub_Strings, issue2299NullableStringCondition) 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(); diff --git a/ext/stub/strings.zep.h b/ext/stub/strings.zep.h index 7c4fb6c8ed..3a885f8ff3 100644 --- a/ext/stub/strings.zep.h +++ b/ext/stub/strings.zep.h @@ -236,36 +236,12 @@ ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, testStripslashes, arginfo_stub_strings_teststripslashes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, testStripcslashes, arginfo_stub_strings_teststripcslashes, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, testHashEquals, arginfo_stub_strings_testhashequals, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testHardcodedMultilineString, arginfo_stub_strings_testhardcodedmultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testHardcodedMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testEchoMultilineString, arginfo_stub_strings_testechomultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testEchoMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testTrimMultilineString, arginfo_stub_strings_testtrimmultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testTrimMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testWellEscapedMultilineString, arginfo_stub_strings_testwellescapedmultilinestring, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testWellEscapedMultilineString, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testInternedString1, arginfo_stub_strings_testinternedstring1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testInternedString1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Strings, testInternedString2, arginfo_stub_strings_testinternedstring2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Strings, testInternedString2, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Strings, testHardcodedMultilineString, arginfo_stub_strings_testhardcodedmultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testEchoMultilineString, arginfo_stub_strings_testechomultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testTrimMultilineString, arginfo_stub_strings_testtrimmultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testWellEscapedMultilineString, arginfo_stub_strings_testwellescapedmultilinestring, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testInternedString1, arginfo_stub_strings_testinternedstring1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Strings, testInternedString2, arginfo_stub_strings_testinternedstring2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, strToHex, arginfo_stub_strings_strtohex, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue1267, arginfo_stub_strings_issue1267, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue2186, arginfo_stub_strings_issue2186, ZEND_ACC_PUBLIC) diff --git a/ext/stub/stubs.zep.c b/ext/stub/stubs.zep.c index 278582d5dc..6d82866832 100644 --- a/ext/stub/stubs.zep.c +++ b/ext/stub/stubs.zep.c @@ -84,14 +84,11 @@ PHP_METHOD(Stub_Stubs, testMixedInputParamsDocBlock) zval *this_ptr = getThis(); ZVAL_UNDEF(&intOrString_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(intOrString) Z_PARAM_OPTIONAL Z_PARAM_LONG(number) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 1, &intOrString, &number_param); @@ -121,14 +118,11 @@ PHP_METHOD(Stub_Stubs, testMixedInputParamsDocBlockDeclared) zval *this_ptr = getThis(); ZVAL_UNDEF(&intOrString_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(intOrString) Z_PARAM_OPTIONAL Z_PARAM_LONG(number) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 1, &intOrString, &number_param); diff --git a/ext/stub/stubs.zep.h b/ext/stub/stubs.zep.h index 4362d6a02d..d73f315516 100644 --- a/ext/stub/stubs.zep.h +++ b/ext/stub/stubs.zep.h @@ -46,20 +46,8 @@ ZEPHIR_INIT_FUNCS(stub_stubs_method_entry) { PHP_ME(Stub_Stubs, testMixedInputParamsDocBlock, arginfo_stub_stubs_testmixedinputparamsdocblock, ZEND_ACC_PUBLIC) PHP_ME(Stub_Stubs, testMixedInputParamsDocBlockDeclared, arginfo_stub_stubs_testmixedinputparamsdocblockdeclared, ZEND_ACC_PUBLIC) PHP_ME(Stub_Stubs, testVariableLength, arginfo_stub_stubs_testvariablelength, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature2, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Stubs, testMultiReturnTypeWithBool, arginfo_stub_stubs_testmultireturntypewithbool, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Stubs, testMultiReturnTypeWithBool, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature1, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Stubs, testMultiReturnTypeWithMixedInDocAndEmptyInSignature2, arginfo_stub_stubs_testmultireturntypewithmixedindocandemptyinsignature2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Stubs, testMultiReturnTypeWithBool, arginfo_stub_stubs_testmultireturntypewithbool, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/ternary.zep.c b/ext/stub/ternary.zep.c index 71e0384b22..70c3a4b0fe 100644 --- a/ext/stub/ternary.zep.c +++ b/ext/stub/ternary.zep.c @@ -58,12 +58,9 @@ PHP_METHOD(Stub_Ternary, testTernary2) zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(b) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -91,13 +88,10 @@ PHP_METHOD(Stub_Ternary, testTernaryComplex1) ZVAL_UNDEF(&y_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(y) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -132,13 +126,10 @@ PHP_METHOD(Stub_Ternary, testTernaryComplex2) ZVAL_UNDEF(&y_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(a) Z_PARAM_ZVAL(y) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -171,12 +162,9 @@ PHP_METHOD(Stub_Ternary, testTernaryComplex3) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -267,12 +255,9 @@ PHP_METHOD(Stub_Ternary, testShortTernary) ZVAL_UNDEF(&a_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -297,13 +282,10 @@ PHP_METHOD(Stub_Ternary, testShortTernaryComplex) ZVAL_UNDEF(&left_sub); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(left) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/ternary.zep.h b/ext/stub/ternary.zep.h index 48e20926e5..4e80b013d5 100644 --- a/ext/stub/ternary.zep.h +++ b/ext/stub/ternary.zep.h @@ -50,25 +50,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_ternary_testshortternarycomplex, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_ternary_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Ternary, testTernary1, arginfo_stub_ternary_testternary1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Ternary, testTernary1, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Ternary, testTernary1, arginfo_stub_ternary_testternary1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernary2, arginfo_stub_ternary_testternary2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernaryComplex1, arginfo_stub_ternary_testternarycomplex1, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernaryComplex2, arginfo_stub_ternary_testternarycomplex2, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testTernaryComplex3, arginfo_stub_ternary_testternarycomplex3, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Ternary, testTernaryWithPromotedTemporaryVariable, arginfo_stub_ternary_testternarywithpromotedtemporaryvariable, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Ternary, testTernaryWithPromotedTemporaryVariable, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Ternary, testTernaryAfterLetVariable, arginfo_stub_ternary_testternaryafterletvariable, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Ternary, testTernaryAfterLetVariable, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Ternary, testTernaryWithPromotedTemporaryVariable, arginfo_stub_ternary_testternarywithpromotedtemporaryvariable, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Ternary, testTernaryAfterLetVariable, arginfo_stub_ternary_testternaryafterletvariable, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testShortTernary, arginfo_stub_ternary_testshortternary, ZEND_ACC_PUBLIC) PHP_ME(Stub_Ternary, testShortTernaryComplex, arginfo_stub_ternary_testshortternarycomplex, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/trytest.zep.c b/ext/stub/trytest.zep.c index 288621cec1..8192ec19a4 100644 --- a/ext/stub/trytest.zep.c +++ b/ext/stub/trytest.zep.c @@ -166,12 +166,9 @@ PHP_METHOD(Stub_TryTest, testTry4) ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -241,12 +238,9 @@ PHP_METHOD(Stub_TryTest, testTry5) ZVAL_UNDEF(&_3$$5); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -315,12 +309,9 @@ PHP_METHOD(Stub_TryTest, testTry6) ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$5); ZVAL_UNDEF(&_3$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -388,12 +379,9 @@ PHP_METHOD(Stub_TryTest, testTry7) ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$5); ZVAL_UNDEF(&_3$$5); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_BOOL(a) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/trytest.zep.h b/ext/stub/trytest.zep.h index aa4e7f609b..7cc320c457 100644 --- a/ext/stub/trytest.zep.h +++ b/ext/stub/trytest.zep.h @@ -69,64 +69,20 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_trytest_testtry11, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_trytest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testThrow1, arginfo_stub_trytest_testthrow1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testThrow1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testThrow2, arginfo_stub_trytest_testthrow2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testThrow2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry1, arginfo_stub_trytest_testtry1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry2, arginfo_stub_trytest_testtry2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry3, arginfo_stub_trytest_testtry3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TryTest, testThrow1, arginfo_stub_trytest_testthrow1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testThrow2, arginfo_stub_trytest_testthrow2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry1, arginfo_stub_trytest_testtry1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry2, arginfo_stub_trytest_testtry2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry3, arginfo_stub_trytest_testtry3, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry4, arginfo_stub_trytest_testtry4, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry5, arginfo_stub_trytest_testtry5, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry6, arginfo_stub_trytest_testtry6, ZEND_ACC_PUBLIC) PHP_ME(Stub_TryTest, testTry7, arginfo_stub_trytest_testtry7, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry8, arginfo_stub_trytest_testtry8, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry8, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, someMethod1, arginfo_stub_trytest_somemethod1, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_TryTest, someMethod1, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, someMethod2, arginfo_stub_trytest_somemethod2, ZEND_ACC_PRIVATE) -#else - PHP_ME(Stub_TryTest, someMethod2, NULL, ZEND_ACC_PRIVATE) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry9, arginfo_stub_trytest_testtry9, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry9, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry10, arginfo_stub_trytest_testtry10, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry10, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TryTest, testTry11, arginfo_stub_trytest_testtry11, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TryTest, testTry11, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TryTest, testTry8, arginfo_stub_trytest_testtry8, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, someMethod1, arginfo_stub_trytest_somemethod1, ZEND_ACC_PRIVATE) +PHP_ME(Stub_TryTest, someMethod2, arginfo_stub_trytest_somemethod2, ZEND_ACC_PRIVATE) +PHP_ME(Stub_TryTest, testTry9, arginfo_stub_trytest_testtry9, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry10, arginfo_stub_trytest_testtry10, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TryTest, testTry11, arginfo_stub_trytest_testtry11, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/typehinting/testabstract.zep.h b/ext/stub/typehinting/testabstract.zep.h index 8ce152d978..d8eda05954 100644 --- a/ext/stub/typehinting/testabstract.zep.h +++ b/ext/stub/typehinting/testabstract.zep.h @@ -15,11 +15,7 @@ PHP_METHOD(Stub_TypeHinting_TestAbstract, returnBoolean); PHP_METHOD(Stub_TypeHinting_TestAbstract, returnChar); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typehinting_testabstract_testfunc, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, text, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, text, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, text, IS_ARRAY, 0, "[]") ZEND_ARG_TYPE_INFO(0, text2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, flag, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, optional, IS_LONG, 1) @@ -54,11 +50,7 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_typehinting_testabstract_method_entry) { PHP_ME(Stub_TypeHinting_TestAbstract, testFunc, arginfo_stub_typehinting_testabstract_testfunc, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeHinting_TestAbstract, returnOneOfScalar, arginfo_stub_typehinting_testabstract_returnoneofscalar, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeHinting_TestAbstract, returnOneOfScalar, NULL, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TypeHinting_TestAbstract, returnOneOfScalar, arginfo_stub_typehinting_testabstract_returnoneofscalar, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_TypeHinting_TestAbstract, returnInt, arginfo_stub_typehinting_testabstract_returnint, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_TypeHinting_TestAbstract, returnUint, arginfo_stub_typehinting_testabstract_returnuint, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) PHP_ME(Stub_TypeHinting_TestAbstract, returnLong, arginfo_stub_typehinting_testabstract_returnlong, ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC) diff --git a/ext/stub/typeinstances.zep.h b/ext/stub/typeinstances.zep.h index 0ead29c972..fe13f28d3d 100644 --- a/ext/stub/typeinstances.zep.h +++ b/ext/stub/typeinstances.zep.h @@ -17,20 +17,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typeinstances_testinstanceofstring3, 0, 0, 0 ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_typeinstances_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeInstances, testInstanceOfString1, arginfo_stub_typeinstances_testinstanceofstring1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeInstances, testInstanceOfString1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeInstances, testInstanceOfString2, arginfo_stub_typeinstances_testinstanceofstring2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeInstances, testInstanceOfString2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_TypeInstances, testInstanceOfString3, arginfo_stub_typeinstances_testinstanceofstring3, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_TypeInstances, testInstanceOfString3, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_TypeInstances, testInstanceOfString1, arginfo_stub_typeinstances_testinstanceofstring1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TypeInstances, testInstanceOfString2, arginfo_stub_typeinstances_testinstanceofstring2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_TypeInstances, testInstanceOfString3, arginfo_stub_typeinstances_testinstanceofstring3, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/typeoff.zep.c b/ext/stub/typeoff.zep.c index 83da9a340c..db31da9fb1 100644 --- a/ext/stub/typeoff.zep.c +++ b/ext/stub/typeoff.zep.c @@ -185,7 +185,7 @@ PHP_METHOD(Stub_Typeoff, testClassPropertyAccess) ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "test string"); zephir_update_property_zval(this_ptr, ZEND_STRL("property"), &_0); - ZEPHIR_OBS_VAR(&_1); + zephir_memory_observe(&_1); zephir_read_property(&_1, this_ptr, ZEND_STRL("property"), PH_NOISY_CC); RETURN_MM_BOOL(Z_TYPE_P(&_1) == IS_STRING); } @@ -198,12 +198,9 @@ PHP_METHOD(Stub_Typeoff, testUnknownTypeOf) ZVAL_UNDEF(&u_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(u) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -221,12 +218,9 @@ PHP_METHOD(Stub_Typeoff, testCallableTypeOf) zval *this_ptr = getThis(); ZVAL_UNDEF(&cb_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(cb) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &cb); diff --git a/ext/stub/typeoff.zep.h b/ext/stub/typeoff.zep.h index fff8eb9b6a..032589a7a9 100644 --- a/ext/stub/typeoff.zep.h +++ b/ext/stub/typeoff.zep.h @@ -59,61 +59,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_typeoff_testcallabletypeof, 0, 0, 1) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_typeoff_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeStringFalse, arginfo_stub_typeoff_testnativestringfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeStringFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeStringTrue, arginfo_stub_typeoff_testnativestringtrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeStringTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeIntFalse, arginfo_stub_typeoff_testnativeintfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeIntFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeIntTrue, arginfo_stub_typeoff_testnativeinttrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeIntTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeDoubleTrue, arginfo_stub_typeoff_testnativedoubletrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeDoubleTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeBoolTrue, arginfo_stub_typeoff_testnativebooltrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeBoolTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNotBoolTrue, arginfo_stub_typeoff_testnotbooltrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNotBoolTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testNativeBoolFalse, arginfo_stub_typeoff_testnativeboolfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testNativeBoolFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testArrayFalse, arginfo_stub_typeoff_testarrayfalse, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testArrayFalse, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testArrayTrue, arginfo_stub_typeoff_testarraytrue, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testArrayTrue, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Typeoff, testClassPropertyAccess, arginfo_stub_typeoff_testclasspropertyaccess, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Typeoff, testClassPropertyAccess, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Typeoff, testNativeStringFalse, arginfo_stub_typeoff_testnativestringfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeStringTrue, arginfo_stub_typeoff_testnativestringtrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeIntFalse, arginfo_stub_typeoff_testnativeintfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeIntTrue, arginfo_stub_typeoff_testnativeinttrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeDoubleTrue, arginfo_stub_typeoff_testnativedoubletrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeBoolTrue, arginfo_stub_typeoff_testnativebooltrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNotBoolTrue, arginfo_stub_typeoff_testnotbooltrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testNativeBoolFalse, arginfo_stub_typeoff_testnativeboolfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testArrayFalse, arginfo_stub_typeoff_testarrayfalse, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testArrayTrue, arginfo_stub_typeoff_testarraytrue, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Typeoff, testClassPropertyAccess, arginfo_stub_typeoff_testclasspropertyaccess, ZEND_ACC_PUBLIC) PHP_ME(Stub_Typeoff, testUnknownTypeOf, arginfo_stub_typeoff_testunknowntypeof, ZEND_ACC_PUBLIC) PHP_ME(Stub_Typeoff, testCallableTypeOf, arginfo_stub_typeoff_testcallabletypeof, ZEND_ACC_PUBLIC) PHP_FE_END diff --git a/ext/stub/types/maybe.zep.c b/ext/stub/types/maybe.zep.c index 559628295d..aca622c891 100644 --- a/ext/stub/types/maybe.zep.c +++ b/ext/stub/types/maybe.zep.c @@ -30,12 +30,9 @@ PHP_METHOD(Stub_Types_MayBe, gc) 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); diff --git a/ext/stub/types/maybe.zep.h b/ext/stub/types/maybe.zep.h index 3730deddc8..1ff34a95ae 100644 --- a/ext/stub/types/maybe.zep.h +++ b/ext/stub/types/maybe.zep.h @@ -6,19 +6,11 @@ ZEPHIR_INIT_CLASS(Stub_Types_MayBe); PHP_METHOD(Stub_Types_MayBe, gc); PHP_METHOD(Stub_Types_MayBe, gcFalse); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gc, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gc, 0, 1, IS_LONG, 0) -#endif ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, MAY_BE_LONG|MAY_BE_FALSE) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, IS_LONG, 0) -#endif ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_types_maybe_method_entry) { diff --git a/ext/stub/types/mixedtype.zep.c b/ext/stub/types/mixedtype.zep.c index c7d26b7c01..7f07f48400 100644 --- a/ext/stub/types/mixedtype.zep.c +++ b/ext/stub/types/mixedtype.zep.c @@ -99,13 +99,10 @@ PHP_METHOD(Stub_Types_MixedType, returnMixed74) zend_bool diff; zval *this_ptr = getThis(); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_BOOL(diff) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(0, 1, &diff_param); @@ -142,12 +139,9 @@ PHP_METHOD(Stub_Types_MixedType, paramMixed) 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); @@ -165,13 +159,10 @@ PHP_METHOD(Stub_Types_MixedType, paramMixedTwo) ZVAL_UNDEF(&val1_sub); ZVAL_UNDEF(&val2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(val1) Z_PARAM_ZVAL(val2) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &val1, &val2); @@ -195,14 +186,11 @@ PHP_METHOD(Stub_Types_MixedType, paramMixedWithMulti) ZVAL_UNDEF(&mixedVal_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&stringVal); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_LONG(intVal) Z_PARAM_STR(stringVal) Z_PARAM_ZVAL(mixedVal) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -230,12 +218,9 @@ PHP_METHOD(Stub_Types_MixedType, paramAndReturnMixed) 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); @@ -255,12 +240,9 @@ PHP_METHOD(Stub_Types_MixedType, castToStringMixedAndReturnMixed) 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(); @@ -281,12 +263,9 @@ PHP_METHOD(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed) 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(); @@ -306,12 +285,9 @@ PHP_METHOD(Stub_Types_MixedType, castToIntMixedAndReturnMixed) 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); @@ -329,12 +305,9 @@ PHP_METHOD(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed) 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(); @@ -355,12 +328,9 @@ PHP_METHOD(Stub_Types_MixedType, castToBoolMixedAndReturnMixed) 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); @@ -378,12 +348,9 @@ PHP_METHOD(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed) 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(); @@ -404,12 +371,9 @@ PHP_METHOD(Stub_Types_MixedType, castToFloatMixedAndReturnMixed) 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); @@ -427,12 +391,9 @@ PHP_METHOD(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed) 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(); @@ -456,12 +417,9 @@ PHP_METHOD(Stub_Types_MixedType, mixedInCondition) 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); diff --git a/ext/stub/types/mixedtype.zep.h b/ext/stub/types/mixedtype.zep.h index ec7b8d6b5b..7f6ca6c0ad 100644 --- a/ext/stub/types/mixedtype.zep.h +++ b/ext/stub/types/mixedtype.zep.h @@ -26,60 +26,28 @@ PHP_METHOD(Stub_Types_MixedType, castToFloatMixedAndReturnMixed); PHP_METHOD(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed); PHP_METHOD(Stub_Types_MixedType, mixedInCondition); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedobject, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedobject, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedarray, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedarray, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedstring, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedstring, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedint, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedint, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedfloat, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedfloat, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedbool, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixedbool, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixednull, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixednull, 0, 0, 0) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixed74, 0, 0, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_returnmixed74, 0, 0, 0) -#endif ZEND_ARG_TYPE_INFO(0, diff, _IS_BOOL, 0) ZEND_END_ARG_INFO() @@ -101,75 +69,39 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_parammixedwithmulti, 0, 0, 3 ZEND_ARG_INFO(0, mixedVal) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_paramandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_paramandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, 0, 0, 1) -#endif ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() @@ -187,11 +119,7 @@ ZEPHIR_INIT_FUNCS(stub_types_mixedtype_method_entry) { PHP_ME(Stub_Types_MixedType, returnMixedBool, arginfo_stub_types_mixedtype_returnmixedbool, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, returnMixedNull, arginfo_stub_types_mixedtype_returnmixednull, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, returnMixed74, arginfo_stub_types_mixedtype_returnmixed74, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Types_MixedType, returnMultiButAlwaysMixed, arginfo_stub_types_mixedtype_returnmultibutalwaysmixed, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Types_MixedType, returnMultiButAlwaysMixed, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Types_MixedType, returnMultiButAlwaysMixed, arginfo_stub_types_mixedtype_returnmultibutalwaysmixed, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramMixed, arginfo_stub_types_mixedtype_parammixed, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramMixedTwo, arginfo_stub_types_mixedtype_parammixedtwo, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramMixedWithMulti, arginfo_stub_types_mixedtype_parammixedwithmulti, ZEND_ACC_PUBLIC) diff --git a/ext/stub/types/obj.zep.h b/ext/stub/types/obj.zep.h index a799f6ff68..195def6669 100644 --- a/ext/stub/types/obj.zep.h +++ b/ext/stub/types/obj.zep.h @@ -7,25 +7,13 @@ PHP_METHOD(Stub_Types_Obj, nullableObjectReturnNull); PHP_METHOD(Stub_Types_Obj, nullableObjectReturnObj); PHP_METHOD(Stub_Types_Obj, objectReturn); -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_obj_nullableobjectreturnnull, 0, 0, MAY_BE_NULL|MAY_BE_OBJECT) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_obj_nullableobjectreturnnull, 0, 0, IS_OBJECT, 1) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_obj_nullableobjectreturnobj, 0, 0, MAY_BE_NULL|MAY_BE_OBJECT) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_obj_nullableobjectreturnobj, 0, 0, IS_OBJECT, 1) -#endif ZEND_END_ARG_INFO() -#if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_obj_objectreturn, 0, 0, MAY_BE_OBJECT) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_obj_objectreturn, 0, 0, IS_OBJECT, 0) -#endif ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_types_obj_method_entry) { diff --git a/ext/stub/unsettest.zep.c b/ext/stub/unsettest.zep.c index c638e61dc0..802cafd62c 100644 --- a/ext/stub/unsettest.zep.c +++ b/ext/stub/unsettest.zep.c @@ -45,12 +45,9 @@ PHP_METHOD(Stub_Unsettest, has) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(key) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &key); @@ -67,13 +64,10 @@ PHP_METHOD(Stub_Unsettest, addValueToProperty) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&value_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(key) Z_PARAM_ZVAL(value) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &key, &value); @@ -89,12 +83,9 @@ PHP_METHOD(Stub_Unsettest, testUnsetValueFromProperty) ZVAL_UNDEF(&key_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(key) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(1, 0, &key); @@ -112,12 +103,9 @@ PHP_METHOD(Stub_Unsettest, testUnsetFromArray) zval *this_ptr = getThis(); ZVAL_UNDEF(&arrayParameter_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(arrayParameter) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -138,13 +126,10 @@ PHP_METHOD(Stub_Unsettest, testUnsetFromArrayByIndexVar) ZVAL_UNDEF(&arrayParameter_sub); ZVAL_UNDEF(&index_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(arrayParameter) Z_PARAM_ZVAL(index) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -206,13 +191,10 @@ PHP_METHOD(Stub_Unsettest, testUnsetTypedArray) ZVAL_UNDEF(&arr); ZVAL_UNDEF(&key); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ARRAY(arr) Z_PARAM_STR(key) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/unsettest.zep.h b/ext/stub/unsettest.zep.h index 068f5147b5..aa589a35f4 100644 --- a/ext/stub/unsettest.zep.h +++ b/ext/stub/unsettest.zep.h @@ -50,26 +50,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_unsettest_testunsettypedarray, 0, 0, 2) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_unsettest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Unsettest, getProperty, arginfo_stub_unsettest_getproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Unsettest, getProperty, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Unsettest, getProperty, arginfo_stub_unsettest_getproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, has, arginfo_stub_unsettest_has, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, addValueToProperty, arginfo_stub_unsettest_addvaluetoproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetValueFromProperty, arginfo_stub_unsettest_testunsetvaluefromproperty, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetFromArray, arginfo_stub_unsettest_testunsetfromarray, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetFromArrayByIndexVar, arginfo_stub_unsettest_testunsetfromarraybyindexvar, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Unsettest, testUnsetProperty, arginfo_stub_unsettest_testunsetproperty, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Unsettest, testUnsetProperty, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Unsettest, testStdClassUnset, arginfo_stub_unsettest_teststdclassunset, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Unsettest, testStdClassUnset, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Unsettest, testUnsetProperty, arginfo_stub_unsettest_testunsetproperty, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Unsettest, testStdClassUnset, arginfo_stub_unsettest_teststdclassunset, ZEND_ACC_PUBLIC) PHP_ME(Stub_Unsettest, testUnsetTypedArray, arginfo_stub_unsettest_testunsettypedarray, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/usetest.zep.h b/ext/stub/usetest.zep.h index 6c32b08e57..4967791a22 100644 --- a/ext/stub/usetest.zep.h +++ b/ext/stub/usetest.zep.h @@ -25,26 +25,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_testusenamespacealias, 0, 0, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_usetest_method_entry) { -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, createInstance, arginfo_stub_usetest_createinstance, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, createInstance, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_UseTest, createInstance, arginfo_stub_usetest_createinstance, ZEND_ACC_PUBLIC) PHP_ME(Stub_UseTest, count, arginfo_stub_usetest_count, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, testUseClass1, arginfo_stub_usetest_testuseclass1, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, testUseClass1, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, testUseClass2, arginfo_stub_usetest_testuseclass2, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, testUseClass2, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_UseTest, testUseNamespaceAlias, arginfo_stub_usetest_testusenamespacealias, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, testUseNamespaceAlias, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_UseTest, testUseClass1, arginfo_stub_usetest_testuseclass1, ZEND_ACC_PUBLIC) +PHP_ME(Stub_UseTest, testUseClass2, arginfo_stub_usetest_testuseclass2, ZEND_ACC_PUBLIC) +PHP_ME(Stub_UseTest, testUseNamespaceAlias, arginfo_stub_usetest_testusenamespacealias, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/vars.zep.c b/ext/stub/vars.zep.c index f8eb58f698..4b3631336a 100644 --- a/ext/stub/vars.zep.c +++ b/ext/stub/vars.zep.c @@ -47,12 +47,9 @@ PHP_METHOD(Stub_Vars, testParam) ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_7$$4); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(config) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -140,12 +137,9 @@ PHP_METHOD(Stub_Vars, testVarDump2) ZVAL_UNDEF(&ret_sub); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(ret) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -213,14 +207,12 @@ PHP_METHOD(Stub_Vars, test88Issue) ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); -#if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(param1) Z_PARAM_OPTIONAL Z_PARAM_STR_OR_NULL(param2) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -266,14 +258,11 @@ PHP_METHOD(Stub_Vars, test88IssueParam2InitString) ZVAL_UNDEF(¶m1); ZVAL_UNDEF(¶m2); ZVAL_UNDEF(&_0); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(param1) Z_PARAM_OPTIONAL Z_PARAM_STR(param2) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -308,13 +297,10 @@ PHP_METHOD(Stub_Vars, testVarDump2param) ZVAL_UNDEF(&p1_sub); ZVAL_UNDEF(&p2_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(p1) Z_PARAM_ZVAL(p2) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(2, 0, &p1, &p2); @@ -332,14 +318,11 @@ PHP_METHOD(Stub_Vars, testVarDump3param) ZVAL_UNDEF(&p1_sub); ZVAL_UNDEF(&p2_sub); ZVAL_UNDEF(&p3_sub); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(3, 3) Z_PARAM_ZVAL(p1) Z_PARAM_ZVAL(p2) Z_PARAM_ZVAL(p3) ZEND_PARSE_PARAMETERS_END(); -#endif zephir_fetch_params_without_memory_grow(3, 0, &p1, &p2, &p3); @@ -359,12 +342,9 @@ PHP_METHOD(Stub_Vars, testCountOptimizerVarDumpAndExport) ZVAL_UNDEF(&testVar_sub); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(testVar) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); @@ -392,13 +372,10 @@ PHP_METHOD(Stub_Vars, testArrayTypeVarDumpAndExport) ZVAL_UNDEF(&testVar); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); -#if PHP_VERSION_ID >= 80000 - bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL Z_PARAM_ARRAY(testVar) ZEND_PARSE_PARAMETERS_END(); -#endif ZEPHIR_MM_GROW(); diff --git a/ext/stub/vars.zep.h b/ext/stub/vars.zep.h index f8473e514e..48c3dc669f 100644 --- a/ext/stub/vars.zep.h +++ b/ext/stub/vars.zep.h @@ -58,11 +58,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testcountoptimizervardumpandexport, 0, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testarraytypevardumpandexport, 0, 0, 0) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, testVar, IS_ARRAY, 0, "[]") -#else - ZEND_ARG_ARRAY_INFO(0, testVar, 0) -#endif +ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, testVar, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_vars_testintvardump, 0, 0, 0) @@ -79,42 +75,18 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_vars_method_entry) { PHP_ME(Stub_Vars, testParam, arginfo_stub_vars_testparam, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testVarDump, arginfo_stub_vars_testvardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testVarDump, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Vars, testVarDump, arginfo_stub_vars_testvardump, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testVarDump2, arginfo_stub_vars_testvardump2, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testVarExport, arginfo_stub_vars_testvarexport, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testVarExport, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Vars, testVarExport, arginfo_stub_vars_testvarexport, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, test88Issue, arginfo_stub_vars_test88issue, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, test88IssueParam2InitString, arginfo_stub_vars_test88issueparam2initstring, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testVarDump2param, arginfo_stub_vars_testvardump2param, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testVarDump3param, arginfo_stub_vars_testvardump3param, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testCountOptimizerVarDumpAndExport, arginfo_stub_vars_testcountoptimizervardumpandexport, ZEND_ACC_PUBLIC) PHP_ME(Stub_Vars, testArrayTypeVarDumpAndExport, arginfo_stub_vars_testarraytypevardumpandexport, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testIntVarDump, arginfo_stub_vars_testintvardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testIntVarDump, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testDoubleVarDump, arginfo_stub_vars_testdoublevardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testDoubleVarDump, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testBoolVarDump, arginfo_stub_vars_testboolvardump, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testBoolVarDump, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 - PHP_ME(Stub_Vars, testGetDefinedVars, arginfo_stub_vars_testgetdefinedvars, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Vars, testGetDefinedVars, NULL, ZEND_ACC_PUBLIC) -#endif +PHP_ME(Stub_Vars, testIntVarDump, arginfo_stub_vars_testintvardump, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Vars, testDoubleVarDump, arginfo_stub_vars_testdoublevardump, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Vars, testBoolVarDump, arginfo_stub_vars_testboolvardump, ZEND_ACC_PUBLIC) +PHP_ME(Stub_Vars, testGetDefinedVars, arginfo_stub_vars_testgetdefinedvars, ZEND_ACC_PUBLIC) PHP_FE_END }; From 56187c7f107dc8bdfe62201e9ec40df3093e2958 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 21 Nov 2023 09:22:41 +0000 Subject: [PATCH 134/375] Remove deprecated `zend_uint` typedef --- kernel/main.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/kernel/main.h b/kernel/main.h index 72278a569f..0d75b965c4 100644 --- a/kernel/main.h +++ b/kernel/main.h @@ -36,11 +36,6 @@ extern zend_string* i_self; #define PH_COPY 1024 #define PH_CTOR 4096 -/* Deprecated */ -#ifndef zend_uint - #define zend_uint uint32_t -#endif - #ifndef ZEND_ACC_FINAL_CLASS #define ZEND_ACC_FINAL_CLASS ZEND_ACC_FINAL #endif From e5915ec517f62a023c7d9ec0cba2658b5c6ce1cf Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 21 Nov 2023 19:53:57 +0000 Subject: [PATCH 135/375] Remove `ZEPHIR_SEPARATE(z)` macro definiton --- kernel/memory.h | 4 +--- kernel/operators.h | 6 +++--- src/Variable/Variable.php | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 762be8a03c..8daf35e035 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -164,12 +164,10 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); } \ } while (0) -#define ZEPHIR_SEPARATE(z) SEPARATE_ZVAL(z) - #define ZEPHIR_SEPARATE_PARAM(z) \ do { \ zval *orig_ptr = z; \ - ZEPHIR_SEPARATE(orig_ptr); \ + SEPARATE_ZVAL(orig_ptr); \ } while (0) #endif diff --git a/kernel/operators.h b/kernel/operators.h index f481d7c3ea..44351f897a 100644 --- a/kernel/operators.h +++ b/kernel/operators.h @@ -159,7 +159,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_ADD_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ add_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ @@ -173,7 +173,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_SUB_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ sub_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ @@ -187,7 +187,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); #define ZEPHIR_MUL_ASSIGN(z, v) \ { \ zval tmp; \ - ZEPHIR_SEPARATE(z); \ + SEPARATE_ZVAL(z); \ mul_function(&tmp, z, v); \ if (Z_TYPE(tmp) == IS_LONG) { \ Z_LVAL_P(z) = Z_LVAL(tmp); \ diff --git a/src/Variable/Variable.php b/src/Variable/Variable.php index bed4abdeb9..63b904bc16 100644 --- a/src/Variable/Variable.php +++ b/src/Variable/Variable.php @@ -710,7 +710,7 @@ public function getDefaultInitValue(): mixed public function separate(CompilationContext $compilationContext): void { if (!\in_array($this->getName(), [self::VAR_THIS_POINTER, self::VAR_RETURN_VALUE], true)) { - $compilationContext->codePrinter->output('ZEPHIR_SEPARATE('.$compilationContext->backend->getVariableCode($this).');'); + $compilationContext->codePrinter->output('SEPARATE_ZVAL('.$compilationContext->backend->getVariableCode($this).');'); } } From 2d184ad8e4e2c4b49c4fe5c869b555e1e2d65236 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 21 Nov 2023 22:27:45 +0000 Subject: [PATCH 136/375] Remove `ZEPHIR_NUM_PREALLOCATED_FRAMES` macro definition --- kernel/memory.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 8daf35e035..dbab7d488e 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -21,8 +21,6 @@ #define ZEPHIR_ENABLE_64BITS 1 #endif -#define ZEPHIR_NUM_PREALLOCATED_FRAMES 25 - /** Memory frame */ typedef struct _zephir_memory_entry { size_t pointer; From 0b5c991b3018ba34ea2192d95240c4b865dd2fde Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 21 Nov 2023 22:29:13 +0000 Subject: [PATCH 137/375] Remove `ZEPHIR_ENABLE_64BITS` condition --- kernel/memory.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index dbab7d488e..79961c037f 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -17,10 +17,6 @@ #include "php_ext.h" #include "kernel/globals.h" -#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) - #define ZEPHIR_ENABLE_64BITS 1 -#endif - /** Memory frame */ typedef struct _zephir_memory_entry { size_t pointer; From 7b35b99901e78b5cc400ad32945bad3a0b6374a5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 21 Nov 2023 22:32:46 +0000 Subject: [PATCH 138/375] Remove `ZEPHIR_INIT_LNVAR(z)` macro definition --- kernel/memory.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 79961c037f..d93a2a2700 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -94,9 +94,6 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); ZVAL_NULL(z); \ } while (0) -/* only removes the value body of the zval */ -#define ZEPHIR_INIT_LNVAR(z) ZEPHIR_INIT_NVAR(&z) - #define ZEPHIR_CPY_WRT(d, v) \ Z_TRY_ADDREF_P(v); \ if (Z_TYPE_P(d) > IS_UNDEF) { \ From 979418a2d776d24ba9438b957970ac8155e687f0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 21 Nov 2023 22:36:30 +0000 Subject: [PATCH 139/375] Remove unused `zephir_cleanup_fcache()` function --- kernel/memory.c | 25 ------------------------- kernel/memory.h | 1 - 2 files changed, 26 deletions(-) diff --git a/kernel/memory.c b/kernel/memory.c index 4fb7271bb2..9e8214bc2b 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -292,31 +292,6 @@ int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value) return SUCCESS; } -/** - * Cleans the function/method cache up - */ -int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key *hash_key) -{ - zephir_fcall_cache_entry **entry = (zephir_fcall_cache_entry**) pDest; - zend_class_entry *scope; - size_t len = ZSTR_LEN(hash_key->key); - - assert(hash_key->key != NULL); - assert(len > 2 * sizeof(zend_class_entry**)); - - memcpy(&scope, &ZSTR_VAL(hash_key->key)[(len -1) - 2 * sizeof(zend_class_entry**)], sizeof(zend_class_entry*)); - - if ((*entry)->type != ZEND_INTERNAL_FUNCTION || (scope && scope->type != ZEND_INTERNAL_CLASS)) { - return ZEND_HASH_APPLY_REMOVE; - } - - if (scope && scope->type == ZEND_INTERNAL_CLASS && scope->info.internal.module->type != MODULE_PERSISTENT) { - return ZEND_HASH_APPLY_REMOVE; - } - - return ZEND_HASH_APPLY_KEEP; -} - void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g) { zephir_memory_entry *frame = g->active_memory; diff --git a/kernel/memory.h b/kernel/memory.h index d93a2a2700..31a19decdc 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -57,7 +57,6 @@ void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const ZEPHIR_METHOD_GLOBALS_PTR = NULL; void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); -int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_hash_key *hash_key); void zephir_deinitialize_memory(); #define zephir_ptr_dtor(x) zval_ptr_dtor(x) From 0cfdd90409c693308951fa4dfc3524560786ff68 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Tue, 21 Nov 2023 22:46:25 +0000 Subject: [PATCH 140/375] Remove unused `zephir_set_symbol_str()` function --- kernel/memory.c | 18 ------------------ kernel/memory.h | 1 - 2 files changed, 19 deletions(-) diff --git a/kernel/memory.c b/kernel/memory.c index 9e8214bc2b..f0bf4326f3 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -274,24 +274,6 @@ int zephir_set_symbol(zval *key_name, zval *value) return SUCCESS; } -/** - * Exports a string symbol to the active symbol table - */ -int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value) -{ - zend_array *symbol_table = zend_rebuild_symbol_table(); - - if (!symbol_table) { - php_error_docref(NULL, E_WARNING, "Cannot find a valid symbol_table"); - return FAILURE; - } - - Z_TRY_ADDREF_P(value); - zend_hash_str_update(symbol_table, key_name, key_length, value); - - return SUCCESS; -} - void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g) { zephir_memory_entry *frame = g->active_memory; diff --git a/kernel/memory.h b/kernel/memory.h index 31a19decdc..529b9749bf 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -71,7 +71,6 @@ void zephir_create_symbol_table(zephir_method_globals *g); #define ZEPHIR_CREATE_SYMBOL_TABLE() zephir_create_symbol_table(ZEPHIR_METHOD_GLOBALS_PTR); int zephir_set_symbol(zval *key_name, zval *value); -int zephir_set_symbol_str(char *key_name, unsigned int key_length, zval *value); #define ZEPHIR_INIT_VAR(z) \ zephir_memory_observe(z); \ From ec45cfe015994a41a5362e3e48484dccfe132242 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 25 Nov 2023 17:45:30 +0000 Subject: [PATCH 141/375] Use definition of `ZEPHIR_MM_GROW()` directly --- kernel/exception.c | 3 ++- kernel/memory.h | 4 ---- src/Class/Method/Method.php | 5 ++++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/exception.c b/kernel/exception.c index 2d81541f32..404162af8d 100644 --- a/kernel/exception.c +++ b/kernel/exception.c @@ -38,7 +38,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) ZVAL_UNDEF(&curline); - ZEPHIR_MM_GROW(); + ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); + zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); if (Z_TYPE_P(object) != IS_OBJECT) { ZVAL_COPY_VALUE(&object_copy, object); diff --git a/kernel/memory.h b/kernel/memory.h index 529b9749bf..44922d8cf1 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -47,10 +47,6 @@ typedef struct _zephir_method_globals { void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func); void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func); -#define ZEPHIR_MM_GROW() \ - ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); \ - zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - #define ZEPHIR_MM_RESTORE() \ zephir_memory_restore_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); \ pefree(ZEPHIR_METHOD_GLOBALS_PTR, 0); \ diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 87c4aef02c..7ebdc21501 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1735,7 +1735,10 @@ public function compile(CompilationContext $compilationContext): void $methodGlobals->setReadOnly(true); $compilationContext->symbolTable->addRawVariable($methodGlobals); } - $codePrinter->preOutput("\t".'ZEPHIR_MM_GROW();'); + + // #define ZEPHIR_MM_GROW() + $codePrinter->preOutput("\t".'zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__);'); + $codePrinter->preOutput("\t".'ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0);'); } /** From c930b364d108f296b12e93285bde2da9e36b724e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 25 Nov 2023 17:54:25 +0000 Subject: [PATCH 142/375] Replace `zephir_ptr_dtor(x)` with `zval_ptr_dtor(x)` --- kernel/main.h | 2 +- kernel/memory.h | 10 ++++------ kernel/object.c | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/kernel/main.h b/kernel/main.h index 0d75b965c4..7d28f37757 100644 --- a/kernel/main.h +++ b/kernel/main.h @@ -284,7 +284,7 @@ int zephir_fetch_parameters(int num_args, int required_args, int optional_args, zval _null; \ ZVAL_NULL(&_null); \ ZVAL_COPY(return_value, &_null); \ - zephir_ptr_dtor(&_null); \ + zval_ptr_dtor(&_null); \ } else { \ ZVAL_COPY(return_value, _constant_ptr); \ } \ diff --git a/kernel/memory.h b/kernel/memory.h index 44922d8cf1..47e45199ea 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -55,8 +55,6 @@ void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); void zephir_deinitialize_memory(); -#define zephir_ptr_dtor(x) zval_ptr_dtor(x) - void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g); #define zephir_memory_observe(var) zephir_do_memory_observe(var, ZEPHIR_METHOD_GLOBALS_PTR); @@ -92,7 +90,7 @@ int zephir_set_symbol(zval *key_name, zval *value); Z_TRY_ADDREF_P(v); \ if (Z_TYPE_P(d) > IS_UNDEF) { \ if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ - zephir_ptr_dtor(d); \ + zval_ptr_dtor(d); \ } \ } else { \ zephir_memory_observe(d); \ @@ -102,7 +100,7 @@ int zephir_set_symbol(zval *key_name, zval *value); #define ZEPHIR_CPY_WRT_CTOR(d, v) \ if (d) { \ if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ - zephir_ptr_dtor(d); \ + zval_ptr_dtor(d); \ } \ } \ ZVAL_DUP(d, v); @@ -126,7 +124,7 @@ int zephir_set_symbol(zval *key_name, zval *value); if (Z_REFCOUNTED_P(z) && Z_REFCOUNT_P(z) > 1) { \ Z_DELREF_P(z); \ } else {\ - zephir_ptr_dtor(z); \ + zval_ptr_dtor(z); \ ZVAL_NULL(z); \ } \ } else { \ @@ -141,7 +139,7 @@ int zephir_set_symbol(zval *key_name, zval *value); zval *tmp_ = (ppzv); \ if (tmp_ != NULL) { \ if (Z_TYPE_P(tmp_) != IS_UNDEF) { \ - zephir_ptr_dtor(tmp_); \ + zval_ptr_dtor(tmp_); \ } else { \ zephir_memory_observe(tmp_); \ } \ diff --git a/kernel/object.c b/kernel/object.c index 62b03d79c7..12f703ef27 100644 --- a/kernel/object.c +++ b/kernel/object.c @@ -740,7 +740,7 @@ int zephir_update_property_array(zval *object, const char *property, uint32_t pr if (separated) { zephir_update_property_zval(object, property, property_length, &tmp); - zephir_ptr_dtor(&tmp); + zval_ptr_dtor(&tmp); } return SUCCESS; @@ -828,7 +828,7 @@ int zephir_update_property_array_append(zval *object, char *property, unsigned i if (separated) { zephir_update_property_zval(object, property, property_length, &tmp); - zephir_ptr_dtor(&tmp); + zval_ptr_dtor(&tmp); } return SUCCESS; @@ -890,7 +890,7 @@ int zephir_update_property_array_multi(zval *object, const char *property, uint3 if (separated) { zephir_update_property_zval(object, property, property_length, &tmp_arr); - zephir_ptr_dtor(&tmp_arr); + zval_ptr_dtor(&tmp_arr); } } From 5f8126bb18c7b3822f3e3ee5f1526b493292814d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 25 Nov 2023 18:02:02 +0000 Subject: [PATCH 143/375] Merge `ZEPHIR_OBS_VAR_ONCE()` into `ZEPHIR_OBS_COPY_OR_DUP()` --- kernel/memory.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 47e45199ea..9cdf59e0ac 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -105,13 +105,10 @@ int zephir_set_symbol(zval *key_name, zval *value); } \ ZVAL_DUP(d, v); -#define ZEPHIR_OBS_VAR_ONCE(z) \ +#define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ if (Z_TYPE_P(z) == IS_UNDEF) { \ zephir_memory_observe(z); \ - } - -#define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ - ZEPHIR_OBS_VAR_ONCE(z); \ + } \ ZVAL_COPY(z, v); #define ZEPHIR_HASH_COPY(z, v) \ From 8d489af92ae95c6db6665ddb4473ae6ff40c03e6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 25 Nov 2023 18:05:30 +0000 Subject: [PATCH 144/375] Use `ZVAL_UNDEF()` directly instead of `ZEPHIR_INIT_ZVAL_NREF()` --- kernel/memory.h | 2 -- src/Variable/Variable.php | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 9cdf59e0ac..7da4ec47e2 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -70,8 +70,6 @@ int zephir_set_symbol(zval *key_name, zval *value); zephir_memory_observe(z); \ ZVAL_NULL(z); -#define ZEPHIR_INIT_ZVAL_NREF(z) ZVAL_UNDEF(&z); - #define ZEPHIR_INIT_NVAR(z) \ do { \ if (Z_TYPE_P(z) == IS_UNDEF) { \ diff --git a/src/Variable/Variable.php b/src/Variable/Variable.php index 63b904bc16..a83f38361c 100644 --- a/src/Variable/Variable.php +++ b/src/Variable/Variable.php @@ -741,8 +741,7 @@ public function getSkipVariant(): int */ public function initNonReferenced(CompilationContext $compilationContext): void { - $compilationContext->headersManager->add('kernel/memory'); - $compilationContext->codePrinter->output('ZEPHIR_INIT_ZVAL_NREF('.$this->getName().');'); + $compilationContext->codePrinter->output('ZVAL_UNDEF(&'.$this->getName().');'); } /** From 33b303a9d43b26468e3e17c542ef8ef300c749b0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sat, 25 Nov 2023 18:12:39 +0000 Subject: [PATCH 145/375] Add types in arguments --- src/Backend/Backend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index 8f9c4ca5f6..fc9663eef0 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -100,7 +100,7 @@ public function declareVariables($method, $typeToVariables) return $varInitCode; } - public function initVar(Variable $variable, CompilationContext $context, $useCodePrinter = true, $second = false): string + public function initVar(Variable $variable, CompilationContext $context, bool $useCodePrinter = true, bool $second = false): string { $macro = !$second ? 'ZEPHIR_INIT_VAR' : 'ZEPHIR_INIT_NVAR'; $code = $macro.'('.$this->getVariableCode($variable).');'; From 6a122431daf8117805fb92461171ae322b5f744d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 11:09:38 +0000 Subject: [PATCH 146/375] Remove "Should correctly specify ARGINFO" test --- tests/sharness/t0002-generate.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/sharness/t0002-generate.sh b/tests/sharness/t0002-generate.sh index fff3dddc4f..8e049632ac 100755 --- a/tests/sharness/t0002-generate.sh +++ b/tests/sharness/t0002-generate.sh @@ -6,16 +6,6 @@ test_description="Test generate commands" # shellcheck disable=SC1091 source ./setup.sh -test_expect_success "Should correctly specify ARGINFO" " - cd $FIXTURESDIR/typehints && - zephirc fullclean 2>&1 >/dev/null && - zephirc generate 2>&1 >/dev/null && - test_cmp ext/typehints.c expected3.c && - test_cmp ext/typehints/args.zep.h expected_args3.h && - test_cmp ext/typehints/retval.zep.h expected_retval3.h && - test_cmp ext/typehints/both.zep.h expected_both3.h -" - test_expect_success "Life Cycle Test" " cd $FIXTURESDIR/lifecycle && zephirc fullclean 2>&1 >/dev/null && From 55b3d839699b4fe1cbca4bdee36fdbcf9c7644fe Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 11:14:59 +0000 Subject: [PATCH 147/375] Remove "Should generate valid code with inheritance of prototype interfaces" test --- tests/sharness/t0002-generate.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/sharness/t0002-generate.sh b/tests/sharness/t0002-generate.sh index 8e049632ac..16b0e5e283 100755 --- a/tests/sharness/t0002-generate.sh +++ b/tests/sharness/t0002-generate.sh @@ -13,12 +13,4 @@ test_expect_success "Life Cycle Test" " test_cmp ext/lifecycle.c expected3.c " -# See: https://github.com/zephir-lang/zephir/issues/1758 -test_expect_success "Should generate valid code with inheritance of prototype interfaces" " - cd $FIXTURESDIR/protodir && - zephirc fullclean 2>&1 >/dev/null && - zephirc generate 2>&1 >/dev/null && - test_cmp ext/protodir/connectionexception.zep.h connectionexception.h -" - test_done From 99fd8138385aa91d8d0d9fccd4362e60be322e27 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 11:20:35 +0000 Subject: [PATCH 148/375] Lock 'shivammathur/setup-php' action --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 433e64637b..7d46027c05 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,7 @@ jobs: fetch-depth: 1 - name: Setup PHP - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@a36e1e52ff4a1c9e9c9be31551ee4712a6cb6bd0 env: PHP_CS_FIXER_VERSION: 3.37.0 with: From 81a492442254ae820b4b9ffda5e37df3e7942898 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 13:07:15 +0000 Subject: [PATCH 149/375] Add return type --- src/Branch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Branch.php b/src/Branch.php index eaba669db2..2583a30687 100644 --- a/src/Branch.php +++ b/src/Branch.php @@ -117,7 +117,7 @@ public function getLevel(): int /** * @param $uniqueId */ - public function setUniqueId($uniqueId) + public function setUniqueId($uniqueId): void { $this->uniqueId = $uniqueId; } From 6c27ce3342c3170b83fbc3b98779cff470030d38 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 13:08:47 +0000 Subject: [PATCH 150/375] Add return type --- src/CompilerFile.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/CompilerFile.php b/src/CompilerFile.php index 77e14612fc..e2fa41bfea 100644 --- a/src/CompilerFile.php +++ b/src/CompilerFile.php @@ -119,7 +119,7 @@ public function __construct( /** * @param string $filePath */ - public function setFilePath(string $filePath) + public function setFilePath(string $filePath): void { $this->filePath = $filePath; } @@ -127,7 +127,7 @@ public function setFilePath(string $filePath) /** * @param string $className */ - public function setClassName(string $className) + public function setClassName(string $className): void { $this->className = $className; } @@ -171,7 +171,7 @@ public function isExternal(): bool * * @throws CompilerException */ - public function addFunction(Compiler $compiler, FunctionDefinition $func, array $statement = []) + public function addFunction(Compiler $compiler, FunctionDefinition $func, array $statement = []): void { $compiler->addFunction($func, $statement); $funcName = strtolower($func->getInternalName()); @@ -240,7 +240,7 @@ public function compileClass(CompilationContext $compilationContext): void * * @throws Exception */ - public function compileFunction(CompilationContext $compilationContext, FunctionDefinition $functionDefinition) + public function compileFunction(CompilationContext $compilationContext, FunctionDefinition $functionDefinition): void { /** Make sure we do not produce calls like ZEPHIR_CALL_SELF */ $bakClassDefinition = $compilationContext->classDefinition; @@ -264,7 +264,7 @@ public function compileFunction(CompilationContext $compilationContext, Function * @param CompilationContext $compilationContext * @param array $topStatement */ - public function compileComment(CompilationContext $compilationContext, $topStatement) + public function compileComment(CompilationContext $compilationContext, $topStatement): void { $compilationContext->codePrinter->output('/'.$topStatement['value'].'/'); } @@ -276,7 +276,7 @@ public function compileComment(CompilationContext $compilationContext, $topState * @param array $topStatement * @param array $docblock */ - public function preCompileInterface($namespace, $topStatement, $docblock) + public function preCompileInterface($namespace, $topStatement, $docblock): void { $classDefinition = new Definition($namespace, $topStatement['name']); $classDefinition->setIsExternal($this->external); @@ -342,7 +342,7 @@ public function preCompileInterface($namespace, $topStatement, $docblock) * @param array $topStatement * @param array $docblock */ - public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock) + public function preCompileClass(CompilationContext $compilationContext, $namespace, $topStatement, $docblock): void { $classDefinition = new Definition($namespace, $topStatement['name']); $classDefinition->setIsExternal($this->external); @@ -452,7 +452,7 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa * @throws IllegalStateException * @throws ParseException */ - public function preCompile(Compiler $compiler) + public function preCompile(Compiler $compiler): void { $ir = $this->genIR($compiler); @@ -649,7 +649,7 @@ public function getCompiledFile(): string * * @throws \ReflectionException */ - public function checkDependencies(Compiler $compiler) + public function checkDependencies(Compiler $compiler): void { $classDefinition = $this->classDefinition; @@ -740,7 +740,7 @@ public function checkDependencies(Compiler $compiler) * * @throws CompilerException */ - public function compile(Compiler $compiler, StringsManager $stringsManager) + public function compile(Compiler $compiler, StringsManager $stringsManager): void { if (!$this->ir) { throw new CompilerException('Unable to locate the intermediate representation of the compiled file'); @@ -887,7 +887,7 @@ public function compile(Compiler $compiler, StringsManager $stringsManager) $this->ir = null; } - public function applyClassHeaders(CompilationContext $compilationContext) + public function applyClassHeaders(CompilationContext $compilationContext): void { $classDefinition = $this->classDefinition; @@ -972,9 +972,7 @@ protected function processShortcuts(array $property, Definition $classDefinition $docBlockParsed = $docBlockParser->parse(); if ($annotations = $docBlockParsed->getAnnotationsByType('var')) { - $returnsType = array_map(function ($type) { - return 'mixed' == ($type = trim($type)) ? 'variable' : $type; - }, explode('|', $annotations[0]->getString())); + $returnsType = array_map(fn ($type) => 'mixed' == ($type = trim($type)) ? 'variable' : $type, explode('|', $annotations[0]->getString())); } // Clear annotations From d8e14ca8b8f2dc5bb3cfaa008e78e397e1075416 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 13:10:11 +0000 Subject: [PATCH 151/375] Add return type --- src/CompilerFileAnonymous.php | 6 +++--- src/Config.php | 6 +++--- src/Documentation.php | 6 ++++-- src/FunctionCall.php | 4 ++-- src/HeadersManager.php | 2 +- src/StaticCall.php | 2 +- src/SymbolTable.php | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/CompilerFileAnonymous.php b/src/CompilerFileAnonymous.php index 957b48efaf..cb18d165f1 100644 --- a/src/CompilerFileAnonymous.php +++ b/src/CompilerFileAnonymous.php @@ -84,7 +84,7 @@ public function isExternal(): bool * @throws Exception * @throws \ReflectionException */ - private function compileClass(CompilationContext $compilationContext) + private function compileClass(CompilationContext $compilationContext): void { $classDefinition = $this->classDefinition; @@ -137,7 +137,7 @@ private function compileClass(CompilationContext $compilationContext) * * @throws Exception */ - public function compile(Compiler $compiler, StringsManager $stringsManager) + public function compile(Compiler $compiler, StringsManager $stringsManager): void { /** * Compilation context stores common objects required by compilation entities. @@ -237,7 +237,7 @@ public function getCompiledFile() * * @param Compiler $compiler */ - public function preCompile(Compiler $compiler) + public function preCompile(Compiler $compiler): void { // nothing to do } diff --git a/src/Config.php b/src/Config.php index fa2f2b6dde..b2e79f74a5 100644 --- a/src/Config.php +++ b/src/Config.php @@ -243,7 +243,7 @@ public function offsetGet($offset) * @param mixed $value */ #[\ReturnTypeWillChange] - public function offsetSet($key, $value) + public function offsetSet($key, $value): void { if (!\is_array($key)) { $this->container[$key] = $value; @@ -269,7 +269,7 @@ public function offsetSet($key, $value) * @param mixed $key */ #[\ReturnTypeWillChange] - public function offsetUnset($key) + public function offsetUnset($key): void { unset($this->container[$key]); } @@ -294,7 +294,7 @@ public function get($key, $namespace = null) * @param mixed $value * @param mixed $namespace */ - public function set($key, $value, $namespace = null) + public function set($key, $value, $namespace = null): void { null !== $namespace ? $this->offsetSet([$namespace => $key], $value) : $this->offsetSet($key, $value); } diff --git a/src/Documentation.php b/src/Documentation.php index ed00e2e120..cb76e8c55f 100644 --- a/src/Documentation.php +++ b/src/Documentation.php @@ -1,5 +1,7 @@ config->get('theme', 'api'); @@ -148,7 +150,7 @@ public function findThemePathByName($name) /** * @throws Exception */ - public function build() + public function build(): void { foreach ($this->classes as $class) { // class files (class/ns1/n2/class.html) diff --git a/src/FunctionCall.php b/src/FunctionCall.php index bfa2e4d5e6..16aa0677bd 100644 --- a/src/FunctionCall.php +++ b/src/FunctionCall.php @@ -165,7 +165,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext * * @param string $directory */ - public static function addOptimizerDir($directory) + public static function addOptimizerDir($directory): void { self::$optimizerDirectories[] = $directory; } @@ -258,7 +258,7 @@ protected function markReferences( CompilationContext $compilationContext, &$references, $expression - ) { + ): void { if ($this->isBuiltInFunction($funcName)) { return; } diff --git a/src/HeadersManager.php b/src/HeadersManager.php index d83645ffbe..08f3da8124 100644 --- a/src/HeadersManager.php +++ b/src/HeadersManager.php @@ -55,7 +55,7 @@ class HeadersManager * * @throws \InvalidArgumentException */ - public function add($path, $position = 0) + public function add($path, $position = 0): void { if (!\is_string($path)) { throw new \InvalidArgumentException('$path must be only string type'); diff --git a/src/StaticCall.php b/src/StaticCall.php index 1d9a44da86..5e111a7e63 100644 --- a/src/StaticCall.php +++ b/src/StaticCall.php @@ -352,7 +352,7 @@ protected function call( * * @throws Exception */ - protected function callParent(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method) + protected function callParent(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method): void { $codePrinter = $compilationContext->codePrinter; $classCe = $classDefinition->getClassEntry($compilationContext); diff --git a/src/SymbolTable.php b/src/SymbolTable.php index 553a53a0af..352064a44d 100644 --- a/src/SymbolTable.php +++ b/src/SymbolTable.php @@ -823,7 +823,7 @@ public function getTempVariableForObserveOrNullify($type, CompilationContext $co * * @param CompilationContext $compilationContext */ - public function markTemporalVariablesIdle(CompilationContext $compilationContext) + public function markTemporalVariablesIdle(CompilationContext $compilationContext): void { $compilationContext = $compilationContext ?: $this->compilationContext; $branchId = $compilationContext->branchManager->getCurrentBranchId(); From 6065f03650d4634def8640ac5a9dbd8f8c76f40f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 13:20:31 +0000 Subject: [PATCH 152/375] Enable 'strict_types' --- src/Backend/FcallManagerInterface.php | 2 + src/Backend/StringsManager.php | 48 +++++++++---------- src/Cache/StaticMethodCache.php | 2 + src/Compiler/FileInterface.php | 2 + src/Documentation/Annotation/Link.php | 2 + src/Exception.php | 2 + src/Exception/CompilerException.php | 2 + src/Exception/ExceptionExtraAwareTrait.php | 2 + src/Exception/ExceptionInterface.php | 2 + src/Exception/FileSystemException.php | 2 + src/Exception/IllegalOperationException.php | 2 + src/Exception/IllegalStateException.php | 2 + src/Exception/InvalidArgumentException.php | 2 + src/Exception/LogicException.php | 2 + src/Exception/NotImplementedException.php | 2 + src/Exception/ParseException.php | 2 + src/Exception/RuntimeException.php | 2 + src/Expression/Builder/AbstractBuilder.php | 2 + src/Expression/Builder/BuilderFactory.php | 2 + .../Builder/Operators/AbstractOperator.php | 2 + .../Operators/AssignPropertyOperator.php | 2 + .../Operators/AssignVariableOperator.php | 2 + .../Builder/Operators/BinaryOperator.php | 2 + .../Builder/Operators/RawOperator.php | 2 + .../Builder/Operators/UnaryOperator.php | 2 + src/Expression/Builder/RawExpression.php | 2 + .../Builder/Statements/AbstractStatement.php | 2 + .../Statements/CallFunctionStatement.php | 2 + .../Statements/CallMethodStatement.php | 2 + .../Statements/CallStaticStatement.php | 2 + .../Builder/Statements/IfStatement.php | 2 + .../Builder/Statements/LetStatement.php | 2 + .../Builder/Statements/RawStatement.php | 2 + .../Builder/Statements/StatementsBlock.php | 2 + src/Expression/Constants.php | 2 + src/Expression/PropertyAccess.php | 2 + src/Expression/PropertyDynamicAccess.php | 2 + src/FunctionCall.php | 2 + src/HeadersManager.php | 2 + src/LiteralCompiledExpression.php | 2 + src/MethodCall.php | 2 + src/Operators/Arithmetical/AddOperator.php | 2 + .../Arithmetical/ArithmeticalBaseOperator.php | 2 + src/Operators/Arithmetical/DivOperator.php | 2 + src/Operators/Arithmetical/ModOperator.php | 2 + src/Operators/Arithmetical/MulOperator.php | 2 + src/Operators/Arithmetical/SubOperator.php | 2 + src/Operators/Bitwise/BitwiseAndOperator.php | 2 + src/Operators/Bitwise/BitwiseOrOperator.php | 2 + src/Operators/Bitwise/BitwiseXorOperator.php | 2 + src/Operators/Bitwise/ShiftLeftOperator.php | 2 + src/Operators/Bitwise/ShiftRightOperator.php | 2 + src/Operators/Comparison/EqualsOperator.php | 2 + .../Comparison/GreaterEqualOperator.php | 2 + src/Operators/Comparison/GreaterOperator.php | 2 + .../Comparison/IdenticalOperator.php | 2 + .../Comparison/LessEqualOperator.php | 2 + src/Operators/Comparison/LessOperator.php | 2 + .../Comparison/NotEqualsOperator.php | 2 + .../Comparison/NotIdenticalOperator.php | 2 + src/Optimizers/FunctionCall/ACosOptimizer.php | 2 + src/Optimizers/FunctionCall/ASinOptimizer.php | 2 + .../FunctionCall/AddslashesOptimizer.php | 2 + .../FunctionCall/ArrayKeyExistsOptimizer.php | 2 + .../FunctionCall/ArrayKeysOptimizer.php | 2 + .../FunctionCall/ArrayMergeOptimizer.php | 2 + .../FunctionCall/BasenameOptimizer.php | 2 + .../CallUserFuncArrayOptimizer.php | 2 + .../FunctionCall/CallUserFuncOptimizer.php | 2 + .../FunctionCall/CamelizeOptimizer.php | 2 + src/Optimizers/FunctionCall/CeilOptimizer.php | 2 + .../FunctionCall/ClassExistsOptimizer.php | 2 + .../FunctionCall/CompareMtimeOptimizer.php | 2 + src/Optimizers/FunctionCall/CosOptimizer.php | 2 + .../FunctionCall/CountOptimizer.php | 2 + .../FunctionCall/Crc32Optimizer.php | 2 + .../FunctionCall/CreateArrayOptimizer.php | 2 + .../FunctionCall/CreateInstanceOptimizer.php | 2 + .../CreateInstanceParamsOptimizer.php | 2 + .../CreateSymbolTableOptimizer.php | 2 + src/Optimizers/FunctionCall/DieOptimizer.php | 2 + .../FunctionCall/DoublevalOptimizer.php | 2 + .../FunctionCall/EndsWithOptimizer.php | 2 + src/Optimizers/FunctionCall/EvalOptimizer.php | 2 + src/Optimizers/FunctionCall/ExitOptimizer.php | 6 ++- .../FunctionCall/ExplodeOptimizer.php | 2 + .../FunctionCall/FcloseOptimizer.php | 2 + src/Optimizers/FunctionCall/FeofOptimizer.php | 2 + .../FunctionCall/FileExistsOptimizer.php | 2 + .../FunctionCall/FileGetContentsOptimizer.php | 2 + .../FunctionCall/FilePutContentsOptimizer.php | 2 + .../FunctionCall/FilemtimeOptimizer.php | 2 + .../FunctionCall/FloorOptimizer.php | 2 + .../FunctionCall/FuncGetArgOptimizer.php | 2 + .../FunctionCall/FuncGetArgsOptimizer.php | 2 + .../FunctionCall/FuncNumArgsOptimizer.php | 2 + .../FunctionCall/FwriteOptimizer.php | 2 + .../FunctionCall/GetCalledClassOptimizer.php | 2 + .../FunctionCall/GetClassLowerOptimizer.php | 2 + .../FunctionCall/GetClassNsOptimizer.php | 2 + .../FunctionCall/GetClassOptimizer.php | 2 + .../FunctionCall/GetDefinedVarsOptimizer.php | 2 + .../FunctionCall/GetNsClassOptimizer.php | 2 + .../FunctionCall/GettypeOptimizer.php | 2 + .../FunctionCall/HashEqualsOptimizer.php | 2 + .../FunctionCall/ImplodeOptimizer.php | 2 + .../FunctionCall/InArrayOptimizer.php | 2 + .../FunctionCall/InterfaceExistsOptimizer.php | 2 + .../FunctionCall/IntvalOptimizer.php | 2 + .../FunctionCall/IsArrayOptimizer.php | 2 + .../FunctionCall/IsBoolOptimizer.php | 2 + .../FunctionCall/IsCallableOptimizer.php | 2 + .../FunctionCall/IsIntOptimizer.php | 2 + .../FunctionCall/IsNullOptimizer.php | 2 + .../FunctionCall/IsNumericOptimizer.php | 2 + .../FunctionCall/IsObjectOptimizer.php | 2 + .../FunctionCall/IsPhpVersionOptimizer.php | 2 + .../IsPrivatePropertyOptimizer.php | 2 + .../FunctionCall/IsResourceOptimizer.php | 2 + .../FunctionCall/IsScalarOptimizer.php | 2 + .../FunctionCall/IsStringOptimizer.php | 2 + src/Optimizers/FunctionCall/JoinOptimizer.php | 2 + .../FunctionCall/JsonDecodeOptimizer.php | 2 + .../FunctionCall/JsonEncodeOptimizer.php | 2 + .../FunctionCall/LdexpOptimizer.php | 2 + .../FunctionCall/LtrimOptimizer.php | 2 + src/Optimizers/FunctionCall/Md5Optimizer.php | 2 + .../FunctionCall/MemstrOptimizer.php | 2 + .../FunctionCall/MergeAppendOptimizer.php | 2 + .../FunctionCall/MethodExistsOptimizer.php | 2 + .../FunctionCall/MicrotimeOptimizer.php | 2 + src/Optimizers/FunctionCall/PowOptimizer.php | 2 + .../FunctionCall/PregMatchAllOptimizer.php | 4 +- .../FunctionCall/PregMatchOptimizer.php | 2 + .../PrepareVirtualPathOptimizer.php | 2 + .../FunctionCall/RoundOptimizer.php | 2 + .../FunctionCall/RtrimOptimizer.php | 2 + src/Optimizers/FunctionCall/SinOptimizer.php | 2 + src/Optimizers/FunctionCall/SqrtOptimizer.php | 2 + .../FunctionCall/StartsWithOptimizer.php | 2 + .../FunctionCall/StrReplaceOptimizer.php | 2 + .../FunctionCall/StripcslashesOptimizer.php | 2 + .../FunctionCall/StripslashesOptimizer.php | 2 + .../FunctionCall/StrlenOptimizer.php | 2 + .../FunctionCall/StrposOptimizer.php | 2 + .../FunctionCall/StrtokOptimizer.php | 2 + .../FunctionCall/StrtolowerOptimizer.php | 2 + .../FunctionCall/StrtoupperOptimizer.php | 2 + .../FunctionCall/SubstrOptimizer.php | 2 + src/Optimizers/FunctionCall/TanOptimizer.php | 2 + src/Optimizers/FunctionCall/TimeOptimizer.php | 2 + src/Optimizers/FunctionCall/TrimOptimizer.php | 2 + .../FunctionCall/UcfirstOptimizer.php | 2 + .../FunctionCall/UncamelizeOptimizer.php | 2 + .../FunctionCall/UniqueKeyOptimizer.php | 2 + .../FunctionCall/UniquePathKeyOptimizer.php | 2 + .../FunctionCall/VarDumpOptimizer.php | 2 + .../FunctionCall/VarExportOptimizer.php | 2 + .../ZephirStringToHexOptimizer.php | 2 + src/Parser/Manager.php | 2 + src/Passes/LoopBreakPass.php | 2 + src/Passes/MutateGathererPass.php | 2 + src/Passes/StaticTypeInference.php | 2 + src/Statements/BreakStatement.php | 2 + src/Statements/ContinueStatement.php | 2 + src/Statements/DeclareStatement.php | 2 + src/Statements/DoWhileStatement.php | 2 + src/Statements/EchoStatement.php | 2 + src/Statements/ForStatement.php | 2 + src/Statements/IfStatement.php | 2 + src/Statements/Let/ArrayIndex.php | 2 + src/Statements/Let/ArrayIndexAppend.php | 2 + src/Statements/Let/Decr.php | 2 + src/Statements/Let/ExportSymbol.php | 2 + src/Statements/Let/ExportSymbolString.php | 2 + src/Statements/Let/Incr.php | 2 + src/Statements/Let/ObjectPropertyAppend.php | 2 + .../Let/ObjectPropertyArrayIndex.php | 2 + .../Let/ObjectPropertyArrayIndexAppend.php | 2 + src/Statements/Let/ObjectPropertyDecr.php | 2 + src/Statements/Let/ObjectPropertyIncr.php | 2 + src/Statements/Let/StaticPropertyAdd.php | 2 + src/Statements/Let/StaticPropertyAppend.php | 2 + .../Let/StaticPropertyArrayIndex.php | 2 + .../Let/StaticPropertyArrayIndexAppend.php | 2 + src/Statements/Let/StaticPropertySub.php | 2 + src/Statements/Let/Variable.php | 2 + src/Statements/Let/VariableAppend.php | 2 + src/Statements/LetStatement.php | 2 + src/Statements/LoopStatement.php | 2 + src/Statements/RequireStatement.php | 2 + src/Statements/ReturnStatement.php | 2 + src/Statements/StatementAbstract.php | 2 + src/Statements/SwitchStatement.php | 2 + src/Statements/TryCatchStatement.php | 2 + src/Statements/WhileStatement.php | 2 + src/StatementsBlock.php | 2 + src/StaticCall.php | 2 + src/TypeAwareInterface.php | 2 + src/Types/ArrayType.php | 2 + 200 files changed, 425 insertions(+), 27 deletions(-) diff --git a/src/Backend/FcallManagerInterface.php b/src/Backend/FcallManagerInterface.php index 8c136055b3..6c6b478470 100644 --- a/src/Backend/FcallManagerInterface.php +++ b/src/Backend/FcallManagerInterface.php @@ -1,5 +1,7 @@ codePrinter->output('ZEPHIR_MM_RESTORE();'); + // $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); $context->codePrinter->output('zephir_exit_empty();'); } else { $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); + // $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); $context->codePrinter->output('zephir_exit('.$resolvedParams[0].');'); } diff --git a/src/Optimizers/FunctionCall/ExplodeOptimizer.php b/src/Optimizers/FunctionCall/ExplodeOptimizer.php index 89021e7b2a..317253c14a 100644 --- a/src/Optimizers/FunctionCall/ExplodeOptimizer.php +++ b/src/Optimizers/FunctionCall/ExplodeOptimizer.php @@ -1,5 +1,7 @@ Date: Sun, 26 Nov 2023 13:24:55 +0000 Subject: [PATCH 153/375] Use short syntax --- src/Backend/FcallManager.php | 2 +- src/Compiler.php | 20 ++++++-------------- src/Console/Command/RemoveOptionsTrait.php | 4 +--- src/MethodCall.php | 2 +- src/StaticCall.php | 6 +++--- tests/Extension/BuiltIn/StringMethodTest.php | 4 +--- tests/Extension/ClosureTest.php | 4 +--- tests/Extension/FunctionExistsTest.php | 4 +--- tests/Extension/MethodArgsTest.php | 2 +- tests/Extension/Optimizers/IsScalarTest.php | 2 +- tests/Extension/ReflectionTest.php | 4 +--- tests/Extension/StringTest.php | 4 +--- tests/Extension/VarsTest.php | 12 +++--------- 13 files changed, 22 insertions(+), 48 deletions(-) diff --git a/src/Backend/FcallManager.php b/src/Backend/FcallManager.php index 9ba5c97c41..b6ee89b715 100644 --- a/src/Backend/FcallManager.php +++ b/src/Backend/FcallManager.php @@ -66,7 +66,7 @@ public function genFcallCode(): void ksort($this->requiredMacros); foreach ($this->requiredMacros as $name => $info) { - list($scope, $mode, $paramCount) = $info; + [$scope, $mode, $paramCount] = $info; $paramsStr = ''; $retParam = ''; $retValueUsed = '0'; diff --git a/src/Compiler.php b/src/Compiler.php index e42448f579..c45972a091 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -940,18 +940,14 @@ public function createConfigFiles(string $project): bool $safeProject = 'zend' === $project ? 'zend_' : $project; - $compiledFiles = array_map(function ($file) { - return str_replace('.c', '.zep.c', $file); - }, $this->compiledFiles); + $compiledFiles = array_map(fn ($file) => str_replace('.c', '.zep.c', $file), $this->compiledFiles); /** * If export-classes is enabled all headers are copied to include/php/ext. */ $exportClasses = $this->config->get('export-classes', 'extra'); if ($exportClasses) { - $compiledHeaders = array_map(function ($file) { - return str_replace('.c', '.zep.h', $file); - }, $this->compiledFiles); + $compiledHeaders = array_map(fn ($file) => str_replace('.c', '.zep.h', $file), $this->compiledFiles); } else { $compiledHeaders = ['php_'.strtoupper($project).'.h']; } @@ -1464,7 +1460,7 @@ public function createProjectFiles(string $project): bool /** * Round 3. Process extension globals */ - list($globalCode, $globalStruct, $globalsDefault, $initEntries) = $this->processExtensionGlobals($project); + [$globalCode, $globalStruct, $globalsDefault, $initEntries] = $this->processExtensionGlobals($project); if ('zend' == $project) { $safeProject = 'zend_'; } else { @@ -1479,7 +1475,7 @@ public function createProjectFiles(string $project): bool /** * Round 5. Generate Function entries (FE) */ - list($feHeader, $feEntries) = $this->generateFunctionInformation(); + [$feHeader, $feEntries] = $this->generateFunctionInformation(); /** * Check if there are module/request/global destructors. @@ -1537,9 +1533,7 @@ public function createProjectFiles(string $project): bool } } - $modRequires = array_map(function ($mod) { - return sprintf('ZEND_MOD_REQUIRED("%s")', strtolower($mod)); - }, $this->config->get('extensions', 'requires') ?: []); + $modRequires = array_map(fn ($mod) => sprintf('ZEND_MOD_REQUIRED("%s")', strtolower($mod)), $this->config->get('extensions', 'requires') ?: []); $toReplace = [ '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), @@ -2155,9 +2149,7 @@ private function getGccVersion(): string private function toUnixPaths(array $paths): array { return array_map( - static function (string $path): string { - return str_replace(\DIRECTORY_SEPARATOR, '/', $path); - }, + static fn (string $path): string => str_replace(\DIRECTORY_SEPARATOR, '/', $path), $paths ); } diff --git a/src/Console/Command/RemoveOptionsTrait.php b/src/Console/Command/RemoveOptionsTrait.php index e1c9ee7e3e..ca3bc4eb8c 100644 --- a/src/Console/Command/RemoveOptionsTrait.php +++ b/src/Console/Command/RemoveOptionsTrait.php @@ -23,9 +23,7 @@ protected function removeOptions(array $names): void /** @var InputDefinition $definition */ $definition = $this->getDefinition(); - $filtered = \array_filter($definition->getOptions(), function (InputOption $option) use ($names) { - return !\in_array($option->getName(), $names, true); - }); + $filtered = \array_filter($definition->getOptions(), fn (InputOption $option) => !\in_array($option->getName(), $names, true)); $definition->setOptions($filtered); } diff --git a/src/MethodCall.php b/src/MethodCall.php index 4d9b36a154..8ae24cb58c 100644 --- a/src/MethodCall.php +++ b/src/MethodCall.php @@ -563,7 +563,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext $expression['parameters'], $compilationContext, $expression, - isset($method) ? $method : null + $method ?? null ); if (\count($references)) { diff --git a/src/StaticCall.php b/src/StaticCall.php index 659d03825a..4f865ed7bd 100644 --- a/src/StaticCall.php +++ b/src/StaticCall.php @@ -373,7 +373,7 @@ protected function callParent(string $methodName, array $expression, $symbolVari * Check if the method call can have an inline cache. */ $methodCache = $compilationContext->cacheManager->getStaticMethodCache(); - $cachePointer = $methodCache->get($compilationContext, isset($method) ? $method : null); + $cachePointer = $methodCache->get($compilationContext, $method ?? null); $params = []; if (isset($expression['parameters']) && \count($expression['parameters'])) { @@ -516,7 +516,7 @@ protected function callFromClass($methodName, array $expression, $symbolVariable */ protected function callFromDynamicClass(string $methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, CompilationContext $compilationContext): void { - list($params, $classEntry) = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); + [$params, $classEntry] = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); if ($symbolVariable) { $symbol = $compilationContext->backend->getVariableCode($symbolVariable); @@ -567,7 +567,7 @@ protected function callFromDynamicClass(string $methodName, array $expression, $ */ protected function callFromDynamicClassDynamicMethod(array $expression, $symbolVariable, bool $mustInit, bool $isExpecting, CompilationContext $compilationContext): void { - list($params, $classEntry) = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); + [$params, $classEntry] = $this->fetchClassParams($expression, $compilationContext, $symbolVariable, $mustInit); /** * Obtain the method name from the variable. diff --git a/tests/Extension/BuiltIn/StringMethodTest.php b/tests/Extension/BuiltIn/StringMethodTest.php index 809a22e689..11db666f7b 100644 --- a/tests/Extension/BuiltIn/StringMethodTest.php +++ b/tests/Extension/BuiltIn/StringMethodTest.php @@ -184,9 +184,7 @@ public function providerCamelizeWrongSecondParam(): array [0], [[]], [ - function () { - return '-'; - }, + fn () => '-', ], [new \stdClass()], ]; diff --git a/tests/Extension/ClosureTest.php b/tests/Extension/ClosureTest.php index e84ce190da..c5c2e5acd0 100644 --- a/tests/Extension/ClosureTest.php +++ b/tests/Extension/ClosureTest.php @@ -34,9 +34,7 @@ public function testIssue1036(): void $test = new Closures(); $test->issue1036SetArgument(true); - $test->issue1036SetFunction(function ($argument) { - return $argument; - }); + $test->issue1036SetFunction(fn ($argument) => $argument); $this->assertTrue($test->issue1036Call()); } diff --git a/tests/Extension/FunctionExistsTest.php b/tests/Extension/FunctionExistsTest.php index b5d633265b..26e6ff3993 100644 --- a/tests/Extension/FunctionExistsTest.php +++ b/tests/Extension/FunctionExistsTest.php @@ -70,9 +70,7 @@ public function providerInternalFunctions(): array shuffle($allFunctions['internal']); $functions = array_map( - function ($value) { - return [$value]; - }, + fn ($value) => [$value], $allFunctions['internal'] ); diff --git a/tests/Extension/MethodArgsTest.php b/tests/Extension/MethodArgsTest.php index 7291cf6a8b..a7e8be014d 100644 --- a/tests/Extension/MethodArgsTest.php +++ b/tests/Extension/MethodArgsTest.php @@ -27,7 +27,7 @@ protected function setUp(): void public function testCallable(): void { - $callback = function () { + $callback = function (): void { }; $this->test->setCallable($callback); diff --git a/tests/Extension/Optimizers/IsScalarTest.php b/tests/Extension/Optimizers/IsScalarTest.php index d2b7ce0fb8..0f2bf5cede 100644 --- a/tests/Extension/Optimizers/IsScalarTest.php +++ b/tests/Extension/Optimizers/IsScalarTest.php @@ -50,7 +50,7 @@ public function testVariableParameter(): void $this->assertFalse($this->test->testVarParameter($this)); $this->assertFalse( $this->test->testVarParameter( - function () { + function (): void { } ) ); diff --git a/tests/Extension/ReflectionTest.php b/tests/Extension/ReflectionTest.php index fad207f0fb..556dd132bd 100644 --- a/tests/Extension/ReflectionTest.php +++ b/tests/Extension/ReflectionTest.php @@ -26,9 +26,7 @@ public function testMethods(): void $this->assertInstanceOf(\ReflectionFunction::class, $class->getReflectionFunction()); $this->assertNull($class->getReflectionParameter()); - $class->setReflectionParameter(new \ReflectionParameter(function ($test) { - return 1; - }, 0)); + $class->setReflectionParameter(new \ReflectionParameter(fn ($test) => 1, 0)); $this->assertInstanceOf(\ReflectionParameter::class, $class->getReflectionParameter()); } diff --git a/tests/Extension/StringTest.php b/tests/Extension/StringTest.php index ecff820a28..eaa9906842 100644 --- a/tests/Extension/StringTest.php +++ b/tests/Extension/StringTest.php @@ -413,9 +413,7 @@ public function providerCamelizeWrongSecondParam(): array [0], [[]], [ - function () { - return '-'; - }, + fn () => '-', ], [new \stdClass()], ]; diff --git a/tests/Extension/VarsTest.php b/tests/Extension/VarsTest.php index 61df81ff96..9791119b8f 100644 --- a/tests/Extension/VarsTest.php +++ b/tests/Extension/VarsTest.php @@ -62,9 +62,7 @@ public function testVarDumpWithTwoParams(): void public function testVarDumpWithThreeParams(): void { $this->setOutputCallback( - function ($output) { - return str_replace(["\n", ' '], '', $output); - } + fn ($output) => str_replace(["\n", ' '], '', $output) ); $this->expectOutputString( @@ -80,9 +78,7 @@ function ($output) { public function testVarExport(): void { $this->setOutputCallback( - function ($output) { - return str_replace(["\n", ' '], '', $output); - } + fn ($output) => str_replace(["\n", ' '], '', $output) ); $this->expectOutputString( @@ -123,9 +119,7 @@ public function testVarDumpAndCountOptimizer(): void public function testArrayTypeVarDumpAndExport(): void { $this->setOutputCallback( - function ($output) { - return str_replace(["\n", ' '], '', $output); - } + fn ($output) => str_replace(["\n", ' '], '', $output) ); $this->expectOutputString( From 35ece52fbc7e0231f923bbe9622bfeb0bd5985a3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:14:16 +0000 Subject: [PATCH 154/375] Adjust strict in test cases --- tests/Extension/Oo/OoParamsTest.php | 37 +++++++++++++++---- .../Extension/Optimizers/IsPhpVersionTest.php | 4 +- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/tests/Extension/Oo/OoParamsTest.php b/tests/Extension/Oo/OoParamsTest.php index 690f0ca013..34c65a190a 100644 --- a/tests/Extension/Oo/OoParamsTest.php +++ b/tests/Extension/Oo/OoParamsTest.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Extension\Oo; use PHPUnit\Framework\TestCase; @@ -29,23 +31,15 @@ public function testOoParams(): void $this->assertinstanceOf('Stub\Oo\OoDynamicA', $this->test->createOtherClassWithoutWriteCurrentNamespace()); $this->assertSame($this->test->setAge(17), 17); - $this->assertSame($this->test->setAge('17'), 17); - $this->assertSame($this->test->setAge(17.0), 17); $this->assertSame($this->test->setAverage(17.1), 17.1); $this->assertSame($this->test->setAverage(17), 17.0); $this->assertSame($this->test->setAverage('17.5'), 17.5); $this->assertSame($this->test->setName('peter'), 'peter'); - $this->assertSame($this->test->setName(12.5), '12.5'); - $this->assertSame($this->test->setName(17), '17'); $this->assertSame($this->test->setEnabled(true), true); $this->assertSame($this->test->setEnabled(false), false); - $this->assertSame($this->test->setEnabled(1), true); - $this->assertSame($this->test->setEnabled(0), false); - $this->assertSame($this->test->setEnabled('1'), true); - $this->assertSame($this->test->setEnabled('0'), false); $this->assertSame($this->test->setList([1, 2, 3, 4, 5]), [1, 2, 3, 4, 5]); $this->assertSame($this->test->setList([]), []); @@ -58,6 +52,33 @@ public function setObjectClassCast(): void $this->assertInstanceOf('Stub\Oo\Param', $result); } + public function testTypError(): void + { + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setAge('17'), 17); + + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setAge(17.0), 17); + + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setName(12.5), '12.5'); + + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setName(17), '17'); + + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setEnabled(1), true); + + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setEnabled(0), false); + + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setEnabled('1'), true); + + $this->expectException(\TypeError::class); + $this->assertSame($this->test->setEnabled('0'), false); + } + /** * @issue https://github.com/zephir-lang/zephir/issues/938 */ diff --git a/tests/Extension/Optimizers/IsPhpVersionTest.php b/tests/Extension/Optimizers/IsPhpVersionTest.php index 4313ea71b0..acab4b2557 100644 --- a/tests/Extension/Optimizers/IsPhpVersionTest.php +++ b/tests/Extension/Optimizers/IsPhpVersionTest.php @@ -241,9 +241,9 @@ protected function onNotSuccessfulTest(\Throwable $error): void * * @throws \Exception */ - private function isPhpVersion($version): bool + private function isPhpVersion(float|int|string $version): bool { - preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', $version, $matches); + preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', (string)$version, $matches); if (!\count($matches)) { throw new \Exception('Could not parse PHP version'); } From e4be31e6ac1ce12d63ca047546dded91f586ad7c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:15:34 +0000 Subject: [PATCH 155/375] Adjust CS in tests --- tests/Extension/AssignTest.php | 6 +- tests/Extension/BitwiseTest.php | 6 +- tests/Extension/ConstantsTest.php | 8 +- tests/Extension/ExceptionsTest.php | 14 +- .../Extension/Optimizers/IsPhpVersionTest.php | 8 +- .../Properties/PropertyUpdateTest.php | 6 +- tests/Extension/TypeoffTest.php | 6 +- tests/Zephir/ConfigTest.php | 22 +- .../Documentation/DocblockParserTest.php | 26 +- tests/Zephir/Documentation/DocblockTest.php | 20 +- tests/Zephir/Statements/Let/VariableTest.php | 8 +- tests/Zephir/Stubs/DocBlockTest.php | 296 +++++++++--------- tests/Zephir/Stubs/GeneratorTest.php | 86 ++--- tests/Zephir/Variable/VariableTest.php | 2 +- 14 files changed, 256 insertions(+), 258 deletions(-) diff --git a/tests/Extension/AssignTest.php b/tests/Extension/AssignTest.php index de5a00ee89..948ec3ac34 100644 --- a/tests/Extension/AssignTest.php +++ b/tests/Extension/AssignTest.php @@ -1,7 +1,5 @@ assertCount($getCount + 2, $_GET); } - public function testIssue597() + public function testIssue597(): void { $_GET = []; $this->test->issue597(); diff --git a/tests/Extension/BitwiseTest.php b/tests/Extension/BitwiseTest.php index 8281d3d5b3..7c4ccd7e29 100644 --- a/tests/Extension/BitwiseTest.php +++ b/tests/Extension/BitwiseTest.php @@ -1,7 +1,5 @@ expectException(\Exception::class); - $this->expectExceptionMessage(123); + $this->expectExceptionMessage('123'); $this->test->testExceptionLiteral('int'); } @@ -91,7 +93,7 @@ public function testExceptionInt(): void public function testExceptionDouble(): void { $this->expectException(\Exception::class); - $this->expectExceptionMessage(123.123); + $this->expectExceptionMessage('123.123'); $this->test->testExceptionLiteral('double'); } @@ -130,9 +132,7 @@ public function testMultiException(): void $this->assertSame($e->getMessage(), 'Some Exception'); } - $this->test->internalExceptionCallable = function () { - return false; - }; + $this->test->internalExceptionCallable = fn () => false; try { $value = $this->test->testMultiException('test', new Exception('Some Exception')); @@ -147,9 +147,7 @@ public function testMultiException(): void $this->assertSame($e->getMessage(), 'Some Exception'); } - $this->test->exceptionCallable = function () { - return false; - }; + $this->test->exceptionCallable = fn () => false; try { $this->test->testMultiException('test', new \Exception('Some Exception')); diff --git a/tests/Extension/Optimizers/IsPhpVersionTest.php b/tests/Extension/Optimizers/IsPhpVersionTest.php index acab4b2557..ea8cb6e590 100644 --- a/tests/Extension/Optimizers/IsPhpVersionTest.php +++ b/tests/Extension/Optimizers/IsPhpVersionTest.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Extension\Optimizers; use PHPUnit\Framework\TestCase; @@ -21,8 +23,8 @@ */ final class IsPhpVersionTest extends TestCase { - const PHP_RELEASES_LIMIT = 17; - const PHP_MINOR_LIMIT = 3; + public const PHP_RELEASES_LIMIT = 17; + public const PHP_MINOR_LIMIT = 3; protected $test; @@ -63,7 +65,7 @@ public function phpVersionProvider(): array */ public function testOptimizer($version, $expected): void { - $isPhpVersion = (bool) $this->isPhpVersion($version); + $isPhpVersion = $this->isPhpVersion($version); $this->assertEquals($expected, $isPhpVersion); } diff --git a/tests/Extension/Properties/PropertyUpdateTest.php b/tests/Extension/Properties/PropertyUpdateTest.php index 1cb5ac4448..743d8a2a8a 100644 --- a/tests/Extension/Properties/PropertyUpdateTest.php +++ b/tests/Extension/Properties/PropertyUpdateTest.php @@ -1,7 +1,5 @@ gc.refcount == 1) || ((ht)->u.flags & (1<<6))), function _zend_hash_index_add_or_update_i $test = new PropertyUpdate(); diff --git a/tests/Extension/TypeoffTest.php b/tests/Extension/TypeoffTest.php index bb56b3c8fd..1762c23e53 100644 --- a/tests/Extension/TypeoffTest.php +++ b/tests/Extension/TypeoffTest.php @@ -1,7 +1,5 @@ assertTrue($this->test->testCallableTypeOf($callback)); $this->assertFalse($this->test->testCallableTypeOf(true)); diff --git a/tests/Zephir/ConfigTest.php b/tests/Zephir/ConfigTest.php index 265f8da8d4..8f4458d058 100644 --- a/tests/Zephir/ConfigTest.php +++ b/tests/Zephir/ConfigTest.php @@ -65,15 +65,15 @@ private function cleanTmpConfigFile(): void private function stubsBanner(): string { return << - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ -DOC; + /** + * This file is part of the Zephir. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + DOC; } /** @@ -132,7 +132,7 @@ public function setConfigProvider(): array */ public function testShouldSetConfigParams(array $test, $expected): void { - list($key, $value, $namespace) = $test; + [$key, $value, $namespace] = $test; $this->config->set($key, $value, $namespace); $actual = $this->config->get($key, $namespace); @@ -167,7 +167,7 @@ public function defaultConfigProvider(): array * @param string $key * @param mixed $expected */ - public function testShouldGetDefaultConfigParams($namespace, string $key, $expected) + public function testShouldGetDefaultConfigParams($namespace, string $key, $expected): void { if (Os::isWindows()) { $this->markTestSkipped('Warning: Strings contain different line endings!'); diff --git a/tests/Zephir/Documentation/DocblockParserTest.php b/tests/Zephir/Documentation/DocblockParserTest.php index ba6998550b..895cfbc40f 100644 --- a/tests/Zephir/Documentation/DocblockParserTest.php +++ b/tests/Zephir/Documentation/DocblockParserTest.php @@ -31,19 +31,19 @@ public function testShouldParseDocblockFromString(): void } $test = <<getLinkText(); diff --git a/tests/Zephir/Documentation/DocblockTest.php b/tests/Zephir/Documentation/DocblockTest.php index d29aa2f8fe..04f5d9f7de 100644 --- a/tests/Zephir/Documentation/DocblockTest.php +++ b/tests/Zephir/Documentation/DocblockTest.php @@ -75,16 +75,16 @@ public function testShouldAddAnnotations(): void public function testShouldGenerateDocblock(): void { $expected = <<docblock->setDescription('Example description block.'); $this->docblock->setSummary('Example summary block.'); $this->docblock->setAnnotations([ diff --git a/tests/Zephir/Statements/Let/VariableTest.php b/tests/Zephir/Statements/Let/VariableTest.php index 90af5c5538..d9b7700bb5 100644 --- a/tests/Zephir/Statements/Let/VariableTest.php +++ b/tests/Zephir/Statements/Let/VariableTest.php @@ -44,21 +44,19 @@ public function exceptionTestProvider(): array 'immutable variable' => [ [], 'Cannot mutate variable \'foo\' because it is read only', - function (ZephirVariable $var) { + function (ZephirVariable $var): void { $var->setReadOnly(true); }, ], 'not initialized variable' => [ ['operator' => 'concat'], 'Cannot mutate variable \'foo\' because it is not initialized', - function (ZephirVariable $var) { - return; - }, + fn (ZephirVariable $var) => null, ], 'unknown variable type' => [ ['operator' => 'assign'], 'Unknown type: prototype', - function (ZephirVariable $var) { + function (ZephirVariable $var): void { $var->setType('prototype'); }, ], diff --git a/tests/Zephir/Stubs/DocBlockTest.php b/tests/Zephir/Stubs/DocBlockTest.php index 8fda3d585d..0e0d43be86 100644 --- a/tests/Zephir/Stubs/DocBlockTest.php +++ b/tests/Zephir/Stubs/DocBlockTest.php @@ -33,17 +33,17 @@ public function testDescription(): void } $doc = <<assertSame($expected, (string) $docBlock); @@ -80,18 +80,18 @@ public function testPhpDocWithDescription(): void } $doc = << - * if (\$foo !== \$bar) { - * // Some comment - * - * // Another comment - * - * while (true) { - * // Some staff - * } - * } - * - * - * @return string - */ -DOC; + /** + * Some method. + * + * + * if (\$foo !== \$bar) { + * // Some comment + * + * // Another comment + * + * while (true) { + * // Some staff + * } + * } + * + * + * @return string + */ + DOC; $expected = << - * if (\$foo !== \$bar) { - * // Some comment - * - * // Another comment - * - * while (true) { - * // Some staff - * } - * } - * - * - * @return string - */ -DOC; + /** + * Some method. + * + * + * if (\$foo !== \$bar) { + * // Some comment + * + * // Another comment + * + * while (true) { + * // Some staff + * } + * } + * + * + * @return string + */ + DOC; $docBlock = new DocBlock($doc); @@ -156,52 +156,52 @@ public function testPhpDocWithScalarParams(): void } $doc = <<assertSame($expected, (string) $docBlock); @@ -214,37 +214,37 @@ public function testPhpDocWithVariousDocBlockTags(): void } $doc = << - * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) - * @license MIT https://docs.zephir-lang.com/0.12/en/license - * @link https://github.com/zephir-lang/zephir - * @since 1.0.0 - * @todo Something - * @uses MyClass::function doSmthName - * @version 1.0.0 - * @api Some Api Description - * @wrongTag - \$somethingStrange - */ -DOC; + /** + * Method with various tags + * @author Phalcon Team + * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) + * @license MIT https://docs.zephir-lang.com/0.12/en/license + * @link https://github.com/zephir-lang/zephir + * @since 1.0.0 + * @todo Something + * @uses MyClass::function doSmthName + * @version 1.0.0 + * @api Some Api Description + * @wrongTag - \$somethingStrange + */ + DOC; $expected = << - * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) - * @license MIT https://docs.zephir-lang.com/0.12/en/license - * @link https://github.com/zephir-lang/zephir - * @since 1.0.0 - * @todo Something - * @uses MyClass::function doSmthName - * @version 1.0.0 - * @api Some Api Description - * @wrongTag - \$somethingStrange - */ -DOC; + /** + * Method with various tags + * + * @author Phalcon Team + * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) + * @license MIT https://docs.zephir-lang.com/0.12/en/license + * @link https://github.com/zephir-lang/zephir + * @since 1.0.0 + * @todo Something + * @uses MyClass::function doSmthName + * @version 1.0.0 + * @api Some Api Description + * @wrongTag - \$somethingStrange + */ + DOC; $docBlock = new DocBlock($doc); $this->assertSame($expected, (string) $docBlock); @@ -257,16 +257,16 @@ public function testPhpDocWithDoubleDollarSymbols(): void } $doc = <<assertSame($expected, (string) $docBlock); diff --git a/tests/Zephir/Stubs/GeneratorTest.php b/tests/Zephir/Stubs/GeneratorTest.php index 4f11177886..fa0f2558f3 100644 --- a/tests/Zephir/Stubs/GeneratorTest.php +++ b/tests/Zephir/Stubs/GeneratorTest.php @@ -63,38 +63,38 @@ public function testShouldBuildClass(): void } $expected = <<invokeArgs( diff --git a/tests/Zephir/Variable/VariableTest.php b/tests/Zephir/Variable/VariableTest.php index a250667937..80f477e25a 100644 --- a/tests/Zephir/Variable/VariableTest.php +++ b/tests/Zephir/Variable/VariableTest.php @@ -211,7 +211,7 @@ public function testShouldEnableDefaultAutoInitValue(): void 'variable', 'string', 'array', ]; - $delegate = function (Variable $zephirVar, string $type) { + $delegate = function (Variable $zephirVar, string $type): void { $zephirVar->setDefaultInitValue('default'); $zephirVar->setType($type); $zephirVar->enableDefaultAutoInitValue(); From faced3a6589749fd96a8c10d2155de460733e79e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:16:10 +0000 Subject: [PATCH 156/375] Remove `string` type from method's argument --- stub/fetchtest.zep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stub/fetchtest.zep b/stub/fetchtest.zep index 8c7c08f948..04cc16da81 100644 --- a/stub/fetchtest.zep +++ b/stub/fetchtest.zep @@ -64,7 +64,7 @@ class FetchTest return c; } - public function hasValue(string name) -> boolean + public function hasValue(name) -> boolean { // Check if there is a post value for the item if isset _POST[name] { @@ -79,7 +79,7 @@ class FetchTest return false; } - public function getValue(string name) + public function getValue(name) { var value; From ac6cefe011a8ef60a74767266704543549d5850b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:18:08 +0000 Subject: [PATCH 157/375] Use short syntax --- src/Backend/Backend.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index fc9663eef0..9648ae5efb 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -72,7 +72,7 @@ public function declareVariables($method, $typeToVariables) $additionalCode = $method ? $this->onPreInitVar($method) : ''; foreach ($typeToVariables as $type => $variables) { - list($pointer, $code) = $this->getTypeDefinition($type); + [$pointer, $code] = $this->getTypeDefinition($type); $code .= ' '; $groupVariables = []; @@ -1396,7 +1396,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $compilationContext) { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); $symbol = $this->resolveValue($symbolVariable, $compilationContext, true); $varCode = $this->getVariableCode($variable); @@ -1414,7 +1414,7 @@ public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExp public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext): void { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); $compilationContext->codePrinter->output( @@ -1432,7 +1432,7 @@ public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $pr public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) { - list($keys, $offsetItems, $numberParams) = $this->resolveOffsetExprs($offsetExprs, $compilationContext); + [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); $offsetStr = $offsetItems ? ', '.implode(', ', $offsetItems) : ''; From 99d2c8721dfc6889c2da7b6752db9789999d7951 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:19:17 +0000 Subject: [PATCH 158/375] Adjust CS --- src/Class/Definition/Definition.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Class/Definition/Definition.php b/src/Class/Definition/Definition.php index 4834b4c7b5..1e5110587c 100644 --- a/src/Class/Definition/Definition.php +++ b/src/Class/Definition/Definition.php @@ -1150,7 +1150,7 @@ public function compile(CompilationContext $compilationContext): void $codePrinter->output( sprintf( // TODO: Rename to ZEND_ME - "PHP_ME(%s_%s, %s, %s, %s)", + 'PHP_ME(%s_%s, %s, %s, %s)', $this->getCNamespace(), $this->getName(), $method->getName(), @@ -1175,7 +1175,7 @@ public function compile(CompilationContext $compilationContext): void } else { $codePrinter->output( sprintf( - "ZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)", + 'ZEND_FENTRY(%s, NULL, %s, ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_PUBLIC)', $method->getName(), $method->getArgInfoName($this) ) From 9b724ebc7b14d3b382d9169969af27f6a1735719 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:19:24 +0000 Subject: [PATCH 159/375] Adjust CS --- src/Code/ArgInfoDefinition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Code/ArgInfoDefinition.php b/src/Code/ArgInfoDefinition.php index b93ca5d439..143e741fd6 100644 --- a/src/Code/ArgInfoDefinition.php +++ b/src/Code/ArgInfoDefinition.php @@ -249,7 +249,7 @@ private function renderEnd(): void } else { $this->codePrinter->output( sprintf( - "ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)", + 'ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(%d, %s, IS_ARRAY, %d, %s)', $this->passByReference($parameter), $parameter['name'], (int) $this->allowNull($parameter), From b6f8535a88c8a35a5ea97ccf1e0f9a46ae6b9f69 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:23:36 +0000 Subject: [PATCH 160/375] Add return type --- src/Compiler.php | 6 +++--- src/Console/Command/ApiCommand.php | 2 +- src/Console/Command/BuildCommand.php | 2 +- src/Console/Command/CleanCommand.php | 2 +- src/Console/Command/CompileCommand.php | 2 +- src/Console/Command/FullCleanCommand.php | 2 +- src/Console/Command/GenerateCommand.php | 2 +- src/Console/Command/InstallCommand.php | 2 +- src/Console/Command/ListCommand.php | 4 ++-- src/Console/Command/StubsCommand.php | 2 +- src/Documentation/Annotation/Link.php | 2 +- src/Documentation/Annotation/ReturnAnnotation.php | 4 +++- src/Documentation/Annotation/See.php | 4 +++- src/Documentation/Docblock.php | 2 +- src/Documentation/DocblockParser.php | 2 +- src/Documentation/NamespaceAccessor.php | 2 +- src/Documentation/Theme.php | 8 ++++---- src/Expression/PropertyAccess.php | 2 +- src/Expression/PropertyDynamicAccess.php | 6 +++--- src/Passes/StaticTypeInference.php | 14 +++++++------- src/Statements/Let/ArrayIndex.php | 6 +++--- src/Statements/Let/ArrayIndexAppend.php | 4 ++-- 22 files changed, 43 insertions(+), 39 deletions(-) diff --git a/src/Compiler.php b/src/Compiler.php index c45972a091..be5604fd84 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -903,7 +903,7 @@ public function install(bool $development = false): void ] ); - array_map(function ($entry) { + array_map(function ($entry): void { if (!empty($entry)) { $this->logger->debug(trim($entry)); } @@ -1919,7 +1919,7 @@ private function recursiveProcess($src, $dest, $pattern = null, $callback = 'cop * @param string $path Directory to deletes files * @param string $mask Regular expression to deletes files */ - private function recursiveDeletePath($path, $mask) + private function recursiveDeletePath($path, $mask): void { if (!file_exists($path) || !is_dir($path) || !is_readable($path)) { $this->logger->warning("Directory '{$path}' is not readable. Skip..."); @@ -1946,7 +1946,7 @@ private function recursiveDeletePath($path, $mask) * * @throws Exception */ - private function loadConstantsSources(array $constantsSources) + private function loadConstantsSources(array $constantsSources): void { foreach ($constantsSources as $constantsSource) { if (!file_exists($constantsSource)) { diff --git a/src/Console/Command/ApiCommand.php b/src/Console/Command/ApiCommand.php index c496639acb..dfd76ca35a 100644 --- a/src/Console/Command/ApiCommand.php +++ b/src/Console/Command/ApiCommand.php @@ -33,7 +33,7 @@ public function __construct(private Compiler $compiler, private Config $config) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('api') diff --git a/src/Console/Command/BuildCommand.php b/src/Console/Command/BuildCommand.php index a7f10a0aac..735ef3922a 100644 --- a/src/Console/Command/BuildCommand.php +++ b/src/Console/Command/BuildCommand.php @@ -28,7 +28,7 @@ final class BuildCommand extends AbstractCommand use DevelopmentModeAwareTrait; use ZflagsAwareTrait; - protected function configure() + protected function configure(): void { $this ->setName('build') diff --git a/src/Console/Command/CleanCommand.php b/src/Console/Command/CleanCommand.php index fd432bcd15..00a03647d8 100644 --- a/src/Console/Command/CleanCommand.php +++ b/src/Console/Command/CleanCommand.php @@ -34,7 +34,7 @@ public function __construct(FileSystemInterface $filesystem) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('clean') diff --git a/src/Console/Command/CompileCommand.php b/src/Console/Command/CompileCommand.php index d5e7bcf695..e5d772120e 100644 --- a/src/Console/Command/CompileCommand.php +++ b/src/Console/Command/CompileCommand.php @@ -38,7 +38,7 @@ public function __construct(Compiler $compiler) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('compile') diff --git a/src/Console/Command/FullCleanCommand.php b/src/Console/Command/FullCleanCommand.php index 8431826300..5078450e2a 100644 --- a/src/Console/Command/FullCleanCommand.php +++ b/src/Console/Command/FullCleanCommand.php @@ -27,7 +27,7 @@ */ final class FullCleanCommand extends AbstractCommand { - protected function configure() + protected function configure(): void { $this ->setName('fullclean') diff --git a/src/Console/Command/GenerateCommand.php b/src/Console/Command/GenerateCommand.php index e5e2871abf..1b3d886edc 100644 --- a/src/Console/Command/GenerateCommand.php +++ b/src/Console/Command/GenerateCommand.php @@ -40,7 +40,7 @@ public function __construct(Compiler $compiler) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('generate') diff --git a/src/Console/Command/InstallCommand.php b/src/Console/Command/InstallCommand.php index 2758525463..aab80d743c 100644 --- a/src/Console/Command/InstallCommand.php +++ b/src/Console/Command/InstallCommand.php @@ -44,7 +44,7 @@ public function __construct(Compiler $compiler, Config $config) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('install') diff --git a/src/Console/Command/ListCommand.php b/src/Console/Command/ListCommand.php index 01c28dc8f0..3a5de699f9 100644 --- a/src/Console/Command/ListCommand.php +++ b/src/Console/Command/ListCommand.php @@ -27,7 +27,7 @@ final class ListCommand extends Command /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { parent::configure(); @@ -39,7 +39,7 @@ protected function configure() * * @param bool $mergeArgs */ - public function mergeApplicationDefinition($mergeArgs = true) + public function mergeApplicationDefinition($mergeArgs = true): void { parent::mergeApplicationDefinition($mergeArgs); diff --git a/src/Console/Command/StubsCommand.php b/src/Console/Command/StubsCommand.php index 3613595b4a..5c229d3e2a 100644 --- a/src/Console/Command/StubsCommand.php +++ b/src/Console/Command/StubsCommand.php @@ -38,7 +38,7 @@ public function __construct(Compiler $compiler) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setName('stubs') diff --git a/src/Documentation/Annotation/Link.php b/src/Documentation/Annotation/Link.php index 7caeb674e3..00a1f2f922 100644 --- a/src/Documentation/Annotation/Link.php +++ b/src/Documentation/Annotation/Link.php @@ -44,7 +44,7 @@ public function getLinkText() return $this->linkText; } - protected function parseContent() + protected function parseContent(): void { $spaceIndex = strpos($this->string, ' '); diff --git a/src/Documentation/Annotation/ReturnAnnotation.php b/src/Documentation/Annotation/ReturnAnnotation.php index 6bda8943d0..9ee0f8a827 100644 --- a/src/Documentation/Annotation/ReturnAnnotation.php +++ b/src/Documentation/Annotation/ReturnAnnotation.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\Annotation; use Zephir\Documentation\Annotation; @@ -39,7 +41,7 @@ public function getDescription(): string return $this->description; } - protected function parseContent() + protected function parseContent(): void { $spaceIndex = strpos($this->string, ' '); diff --git a/src/Documentation/Annotation/See.php b/src/Documentation/Annotation/See.php index 4fac67b8bc..0c3dfbe74f 100644 --- a/src/Documentation/Annotation/See.php +++ b/src/Documentation/Annotation/See.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Documentation\Annotation; use Zephir\Documentation\Annotation; @@ -39,7 +41,7 @@ public function getText(): string return $this->text; } - protected function parseContent() + protected function parseContent(): void { $spaceIndex = strpos($this->string, ' '); diff --git a/src/Documentation/Docblock.php b/src/Documentation/Docblock.php index 2d66ccadc0..03d6a412b3 100644 --- a/src/Documentation/Docblock.php +++ b/src/Documentation/Docblock.php @@ -92,7 +92,7 @@ public function setDescription(string $description) /** * @param Annotation $annotation */ - public function addAnnotation(Annotation $annotation) + public function addAnnotation(Annotation $annotation): void { $this->annotations[] = $annotation; } diff --git a/src/Documentation/DocblockParser.php b/src/Documentation/DocblockParser.php index fe746af5c1..098bc575e1 100644 --- a/src/Documentation/DocblockParser.php +++ b/src/Documentation/DocblockParser.php @@ -54,7 +54,7 @@ public function __construct(string $annotation) /** * check if there is a currently parsed annotation, registers it, and stops the current annotation parsing. */ - private function __tryRegisterAnnotation() + private function __tryRegisterAnnotation(): void { if (($this->annotationNameOpen || $this->annotationOpen) && $this->currentAnnotationStr !== '') { $annotation = $this->__createAnnotation($this->currentAnnotationStr, $this->currentAnnotationContentStr); diff --git a/src/Documentation/NamespaceAccessor.php b/src/Documentation/NamespaceAccessor.php index a2de18db50..103dc6c3f6 100644 --- a/src/Documentation/NamespaceAccessor.php +++ b/src/Documentation/NamespaceAccessor.php @@ -43,7 +43,7 @@ public function getNamespaceTree() return $this->namespaceTree; } - public function build() + public function build(): void { $byNamespace = []; $tree = []; diff --git a/src/Documentation/Theme.php b/src/Documentation/Theme.php index ad942b7204..df204b4aa4 100644 --- a/src/Documentation/Theme.php +++ b/src/Documentation/Theme.php @@ -68,7 +68,7 @@ public function __construct($themeDir, $outputDir, $themeConfig, $config, Docume * @param $dst * @param $files */ - private function __copyDir($src, $dst, &$files = null) + private function __copyDir($src, $dst, &$files = null): void { $dir = opendir($src); @mkdir($dst); @@ -94,7 +94,7 @@ private function __copyDir($src, $dst, &$files = null) * * @throws Exception */ - public function drawFile(FileInterface $file) + public function drawFile(FileInterface $file): void { $outputFile = ltrim($file->getOutputFile(), '/'); @@ -164,7 +164,7 @@ public function getThemeInfoExtendAware($name) /** * copy the static directory of the theme into the output directory. */ - public function buildStaticDirectory() + public function buildStaticDirectory(): void { $outputStt = $this->getOutputPath('asset'); @@ -248,7 +248,7 @@ public function buildJsonClassDefinition($classList, NamespaceAccessor $nsA) return json_encode($output); } - public function createFile($path, $content) + public function createFile($path, $content): void { $outputFile = $this->getOutputPath($path); touch($outputFile); diff --git a/src/Expression/PropertyAccess.php b/src/Expression/PropertyAccess.php index f2bf44dc54..0d1600fca7 100644 --- a/src/Expression/PropertyAccess.php +++ b/src/Expression/PropertyAccess.php @@ -50,7 +50,7 @@ public function setExpectReturn(bool $expecting, Variable $expectingVariable = n * * @param bool $readOnly */ - public function setReadOnly($readOnly) + public function setReadOnly($readOnly): void { $this->readOnly = $readOnly; } diff --git a/src/Expression/PropertyDynamicAccess.php b/src/Expression/PropertyDynamicAccess.php index b2dff4dc87..72599000f4 100644 --- a/src/Expression/PropertyDynamicAccess.php +++ b/src/Expression/PropertyDynamicAccess.php @@ -40,7 +40,7 @@ class PropertyDynamicAccess * @param bool $expecting * @param Variable $expectingVariable */ - public function setExpectReturn($expecting, Variable $expectingVariable = null) + public function setExpectReturn($expecting, Variable $expectingVariable = null): void { $this->expecting = $expecting; $this->expectingVariable = $expectingVariable; @@ -51,7 +51,7 @@ public function setExpectReturn($expecting, Variable $expectingVariable = null) * * @param bool $readOnly */ - public function setReadOnly($readOnly) + public function setReadOnly($readOnly): void { $this->readOnly = $readOnly; } @@ -61,7 +61,7 @@ public function setReadOnly($readOnly) * * @param bool $noisy */ - public function setNoisy($noisy) + public function setNoisy($noisy): void { $this->noisy = $noisy; } diff --git a/src/Passes/StaticTypeInference.php b/src/Passes/StaticTypeInference.php index 46f69edc42..80698457e4 100644 --- a/src/Passes/StaticTypeInference.php +++ b/src/Passes/StaticTypeInference.php @@ -30,12 +30,12 @@ class StaticTypeInference * * @param StatementsBlock $block */ - public function pass(StatementsBlock $block) + public function pass(StatementsBlock $block): void { $this->passStatementBlock($block->getStatements()); } - public function declareVariables(array $statement) + public function declareVariables(array $statement): void { foreach ($statement['variables'] as $variable) { if (!isset($this->variables[$variable['variable']])) { @@ -208,7 +208,7 @@ public function getInferedType($variable) return false; } - public function passLetStatement(array $statement) + public function passLetStatement(array $statement): void { foreach ($statement['assignments'] as $assignment) { switch ($assignment['assign-type']) { @@ -237,7 +237,7 @@ public function passLetStatement(array $statement) } } - public function passCall(array $expression) + public function passCall(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -246,14 +246,14 @@ public function passCall(array $expression) } } - public function passArray(array $expression) + public function passArray(array $expression): void { foreach ($expression['left'] as $item) { $this->passExpression($item['value']); } } - public function passNew(array $expression) + public function passNew(array $expression): void { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { @@ -474,7 +474,7 @@ public function passExpression(array $expression) } } - public function passStatementBlock(array $statements) + public function passStatementBlock(array $statements): void { foreach ($statements as $statement) { switch ($statement['type']) { diff --git a/src/Statements/Let/ArrayIndex.php b/src/Statements/Let/ArrayIndex.php index 4958d4caf0..ba4de5f814 100644 --- a/src/Statements/Let/ArrayIndex.php +++ b/src/Statements/Let/ArrayIndex.php @@ -38,7 +38,7 @@ class ArrayIndex * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { /* * Arrays must be stored in the HEAP @@ -198,7 +198,7 @@ protected function _getResolvedArrayItem(CompiledExpression $resolvedExpr, Compi * * @throws CompilerException */ - protected function _assignArrayIndexSingle($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + protected function _assignArrayIndexSingle($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { $expression = new Expression($statement['index-expr'][0]); $exprIndex = $expression->compile($compilationContext); @@ -272,7 +272,7 @@ protected function _assignArrayIndexMultiple( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement - ) { + ): void { $offsetExprs = []; foreach ($statement['index-expr'] as $indexExpr) { diff --git a/src/Statements/Let/ArrayIndexAppend.php b/src/Statements/Let/ArrayIndexAppend.php index e9acc395e5..11bb11613f 100644 --- a/src/Statements/Let/ArrayIndexAppend.php +++ b/src/Statements/Let/ArrayIndexAppend.php @@ -37,7 +37,7 @@ class ArrayIndexAppend extends ArrayIndex * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { /* * Arrays must be stored in the HEAP @@ -91,7 +91,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres * @param CompilationContext $compilationContext * @param array $statement */ - protected function _assignArrayIndexMultiple($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + protected function _assignArrayIndexMultiple($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { $offsetExprs = []; foreach ($statement['index-expr'] as $indexExpr) { From be7eb4f0bb359279d43a59aeacab5812d2d3dcb6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:23:56 +0000 Subject: [PATCH 161/375] Add return type --- src/StaticCall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StaticCall.php b/src/StaticCall.php index 4f865ed7bd..1ee6bc5fca 100644 --- a/src/StaticCall.php +++ b/src/StaticCall.php @@ -426,7 +426,7 @@ protected function callParent(string $methodName, array $expression, $symbolVari * * @throws Exception */ - protected function callFromClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method) + protected function callFromClass($methodName, array $expression, $symbolVariable, $mustInit, $isExpecting, Definition $classDefinition, CompilationContext $compilationContext, Method $method): void { $codePrinter = $compilationContext->codePrinter; From 43226af8d8a928ba85c4c4f0e842f75347001811 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:24:03 +0000 Subject: [PATCH 162/375] Fix strict types --- src/StaticCall.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/StaticCall.php b/src/StaticCall.php index 1ee6bc5fca..984b39ff72 100644 --- a/src/StaticCall.php +++ b/src/StaticCall.php @@ -318,14 +318,14 @@ protected function call( $ce = $method->getClassDefinition()->getClassEntry($compilationContext); if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, true, $paramCount); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount); $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); } else { $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount); $codePrinter->output($macro.'('.$symbol.', '.$ce.', '.$method->getInternalName().$paramsStr.');'); } } else { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, false, $paramCount); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount); $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); } } @@ -472,14 +472,14 @@ protected function callFromClass($methodName, array $expression, $symbolVariable $ce = $classDefinition->getClassEntry($compilationContext); if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, true, $paramCount); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 1, $paramCount); $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); } else { $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 2, $paramCount); $codePrinter->output($macro.'('.$symbol.', '.$ce.', '.$method->getInternalName().$paramsStr.');'); } } else { - $macro = $compilationContext->backend->getFcallManager()->getMacro(true, false, $paramCount); + $macro = $compilationContext->backend->getFcallManager()->getMacro(true, 0, $paramCount); $codePrinter->output($macro.'('.$ce.', '.$method->getInternalName().$paramsStr.');'); } } else { From 90b1b9493bc1825c863a0c6510dfe4fd916216e5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:28:37 +0000 Subject: [PATCH 163/375] Add return type --- src/Backend/Backend.php | 30 +++++++++---------- src/Statements/Let/ArrayIndexAppend.php | 4 +-- src/Statements/Let/Decr.php | 2 +- src/Statements/Let/ExportSymbol.php | 2 +- src/Statements/Let/ExportSymbolString.php | 2 +- src/Statements/Let/Incr.php | 2 +- src/Statements/Let/ObjectDynamicProperty.php | 2 +- .../Let/ObjectDynamicStringProperty.php | 2 +- src/Statements/Let/ObjectProperty.php | 2 +- src/Statements/Let/ObjectPropertyAppend.php | 2 +- .../Let/ObjectPropertyArrayIndex.php | 4 +-- .../Let/ObjectPropertyArrayIndexAppend.php | 4 +-- src/Statements/Let/ObjectPropertyDecr.php | 2 +- src/Statements/Let/ObjectPropertyIncr.php | 2 +- src/Statements/Let/StaticProperty.php | 2 +- src/Statements/Let/StaticPropertyAdd.php | 2 +- src/Statements/Let/StaticPropertyAppend.php | 4 +-- .../Let/StaticPropertyArrayIndex.php | 4 +-- .../Let/StaticPropertyArrayIndexAppend.php | 4 +-- src/Statements/Let/StaticPropertySub.php | 2 +- src/Statements/Let/Variable.php | 14 ++++----- src/Statements/Let/VariableAppend.php | 2 +- src/Statements/LetStatement.php | 2 +- src/Statements/RequireOnceStatement.php | 2 +- src/Statements/RequireStatement.php | 2 +- src/Statements/WhileStatement.php | 2 +- 26 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index 9648ae5efb..3a55b08f96 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -420,7 +420,7 @@ public function initializeVariableDefaults(array $variables, CompilationContext return $codePrinter->getOutput(); } - public function declareConstant($type, $name, $value, CompilationContext $context) + public function declareConstant($type, $name, $value, CompilationContext $context): void { $ce = $context->classDefinition->getClassEntry($context); @@ -538,7 +538,7 @@ public function assignString( * @param string $code * @param CompilationContext $context */ - public function assignZval(Variable $variable, $code, CompilationContext $context) + public function assignZval(Variable $variable, $code, CompilationContext $context): void { $code = $this->resolveValue($code, $context); if (!$variable->isDoublePointer()) { @@ -580,7 +580,7 @@ public function assignNull(Variable $variable, CompilationContext $context, $use return $output; } - public function createClosure(Variable $variable, $classDefinition, CompilationContext $context) + public function createClosure(Variable $variable, $classDefinition, CompilationContext $context): void { $symbol = $this->getVariableCode($variable); $context->codePrinter->output( @@ -745,7 +745,7 @@ public function propertyIsset(Variable $var, $key) return new CompiledExpression('bool', 'zephir_isset_property('.$this->getVariableCode($var).', SL("'.$key.'"))', null); } - public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context) + public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationContext $context): void { $context->headersManager->add('kernel/array'); $variableCode = $this->getVariableCode($variable); @@ -758,7 +758,7 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo $this->arrayUnset2($variable, $exprIndex, $flags, $context); } - public function arrayUnset2(Variable $variable, $exprIndex, $flags, CompilationContext $context) + public function arrayUnset2(Variable $variable, $exprIndex, $flags, CompilationContext $context): void { $context->headersManager->add('kernel/array'); $variableCode = $this->getVariableCode($variable); @@ -811,7 +811,7 @@ public function fetchGlobal(Variable $globalVar, CompilationContext $compilation return $output; } - public function fetchClass(Variable $zendClassEntry, $className, $guarded, CompilationContext $context) + public function fetchClass(Variable $zendClassEntry, $className, $guarded, CompilationContext $context): void { $context->headersManager->add('kernel/object'); if ($guarded) { @@ -838,7 +838,7 @@ public function fetchProperty( $property, $readOnly, CompilationContext $context - ) { + ): void { $flags = 'PH_NOISY_CC'; if ($readOnly) { $flags .= ' | PH_READONLY'; @@ -1069,7 +1069,7 @@ public function copyOnWrite(Variable $target, $var, CompilationContext $context) } } - public function forStatement(Variable $exprVariable, $keyVariable, $variable, $duplicateKey, $duplicateHash, $statement, $statementBlock, CompilationContext $compilationContext) + public function forStatement(Variable $exprVariable, $keyVariable, $variable, $duplicateKey, $duplicateHash, $statement, $statementBlock, CompilationContext $compilationContext): void { /** * Create a temporary zval to fetch the items from the hash. @@ -1280,14 +1280,14 @@ public function initArray(Variable $variable, CompilationContext $context, int $ $context->codePrinter->output($output); } - public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context) + public function concatSelf(Variable $variable, Variable $itemVariable, CompilationContext $context): void { $variable = $this->getVariableCode($variable); $itemVariable = $this->getVariableCode($itemVariable); $context->codePrinter->output('zephir_concat_self('.$variable.', '.$itemVariable.');'); } - public function updateArray(Variable $symbolVariable, $key, $value, CompilationContext $compilationContext, $flags = null) + public function updateArray(Variable $symbolVariable, $key, $value, CompilationContext $compilationContext, $flags = null): void { $value = $this->resolveValue($value, $compilationContext, true); if (!isset($flags)) { @@ -1394,7 +1394,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA return $output; } - public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $compilationContext) + public function assignArrayMulti(Variable $variable, $symbolVariable, $offsetExprs, CompilationContext $compilationContext): void { [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); @@ -1430,7 +1430,7 @@ public function assignPropertyArrayMulti(Variable $variable, $valueVariable, $pr ); } - public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext) + public function assignStaticPropertyArrayMulti($classEntry, $valueVariable, $propertyName, $offsetExprs, CompilationContext $compilationContext): void { [$keys, $offsetItems, $numberParams] = $this->resolveOffsetExprs($offsetExprs, $compilationContext); $valueVariable = $this->resolveValue($valueVariable, $compilationContext, true); @@ -1454,7 +1454,7 @@ public function checkConstructor(Variable $var, CompilationContext $context): vo $context->codePrinter->output('if (zephir_has_constructor('.$this->getVariableCode($var).')) {'); } - public function callDynamicFunction($symbolVariable, Variable $variable, CompilationContext $context, $params = [], $cache = 'NULL', $cacheSlot = 0) + public function callDynamicFunction($symbolVariable, Variable $variable, CompilationContext $context, $params = [], $cache = 'NULL', $cacheSlot = 0): void { $paramStr = null != $params ? ', '.implode(', ', $params) : ''; if (!isset($symbolVariable)) { @@ -1466,7 +1466,7 @@ public function callDynamicFunction($symbolVariable, Variable $variable, Compila } } - public function zvalOperator($zvalOperator, Variable $expected, Variable $variableLeft, Variable $variableRight, CompilationContext $compilationContext) + public function zvalOperator($zvalOperator, Variable $expected, Variable $variableLeft, Variable $variableRight, CompilationContext $compilationContext): void { $expected = $this->getVariableCode($expected); $op1 = $this->getVariableCode($variableLeft); @@ -1475,7 +1475,7 @@ public function zvalOperator($zvalOperator, Variable $expected, Variable $variab $compilationContext->codePrinter->output($zvalOperator.'('.$expected.', '.$op1.', '.$op2.');'); } - public function checkStrictType($type, $var, CompilationContext $context) + public function checkStrictType($type, $var, CompilationContext $context): void { $codePrinter = $context->codePrinter; $conditions = []; diff --git a/src/Statements/Let/ArrayIndexAppend.php b/src/Statements/Let/ArrayIndexAppend.php index 11bb11613f..613f6993b4 100644 --- a/src/Statements/Let/ArrayIndexAppend.php +++ b/src/Statements/Let/ArrayIndexAppend.php @@ -1,7 +1,5 @@ isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/Let/ExportSymbol.php b/src/Statements/Let/ExportSymbol.php index b24d8d58b5..f2dacfb513 100644 --- a/src/Statements/Let/ExportSymbol.php +++ b/src/Statements/Let/ExportSymbol.php @@ -34,7 +34,7 @@ class ExportSymbol * @param CompilationContext $compilationContext, * @param array $statement */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { $codePrinter = $compilationContext->codePrinter; diff --git a/src/Statements/Let/ExportSymbolString.php b/src/Statements/Let/ExportSymbolString.php index 5f216564e9..ceb8c0c5ac 100644 --- a/src/Statements/Let/ExportSymbolString.php +++ b/src/Statements/Let/ExportSymbolString.php @@ -34,7 +34,7 @@ class ExportSymbolString * @param CompilationContext $compilationContext, * @param array $statement */ - public function assign($variable, ZephirVariable $symbolVariable = null, CompiledExpression $resolvedExpr = null, CompilationContext $compilationContext = null, $statement = null) + public function assign($variable, ZephirVariable $symbolVariable = null, CompiledExpression $resolvedExpr = null, CompilationContext $compilationContext = null, $statement = null): void { $codePrinter = $compilationContext->codePrinter; diff --git a/src/Statements/Let/Incr.php b/src/Statements/Let/Incr.php index 43084965df..b11b0995ce 100644 --- a/src/Statements/Let/Incr.php +++ b/src/Statements/Let/Incr.php @@ -34,7 +34,7 @@ class Incr * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/Let/ObjectDynamicProperty.php b/src/Statements/Let/ObjectDynamicProperty.php index bdb85e1beb..20de5311ad 100644 --- a/src/Statements/Let/ObjectDynamicProperty.php +++ b/src/Statements/Let/ObjectDynamicProperty.php @@ -35,7 +35,7 @@ class ObjectDynamicProperty * @throws CompilerException * @throws \Exception */ - public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/Let/ObjectDynamicStringProperty.php b/src/Statements/Let/ObjectDynamicStringProperty.php index c20d2251d0..1d45a06f79 100644 --- a/src/Statements/Let/ObjectDynamicStringProperty.php +++ b/src/Statements/Let/ObjectDynamicStringProperty.php @@ -35,7 +35,7 @@ class ObjectDynamicStringProperty * @throws CompilerException * @throws \Exception */ - public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/Let/ObjectProperty.php b/src/Statements/Let/ObjectProperty.php index 09d9a63227..c88d8ea05a 100644 --- a/src/Statements/Let/ObjectProperty.php +++ b/src/Statements/Let/ObjectProperty.php @@ -42,7 +42,7 @@ public function assign( Expression $expression, Context $context, array $statement - ) { + ): void { if (!$symbolVariable->isInitialized()) { throw new Exception( "Cannot mutate variable '{$variable}' because it is not initialized", diff --git a/src/Statements/Let/ObjectPropertyAppend.php b/src/Statements/Let/ObjectPropertyAppend.php index 56731a3c0c..3e17ee39f5 100644 --- a/src/Statements/Let/ObjectPropertyAppend.php +++ b/src/Statements/Let/ObjectPropertyAppend.php @@ -36,7 +36,7 @@ class ObjectPropertyAppend * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/Let/ObjectPropertyArrayIndex.php b/src/Statements/Let/ObjectPropertyArrayIndex.php index ebe38ac50a..1473d6879e 100644 --- a/src/Statements/Let/ObjectPropertyArrayIndex.php +++ b/src/Statements/Let/ObjectPropertyArrayIndex.php @@ -37,7 +37,7 @@ class ObjectPropertyArrayIndex extends ArrayIndex * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); @@ -68,7 +68,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres * * @throws CompilerException */ - protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); diff --git a/src/Statements/Let/ObjectPropertyArrayIndexAppend.php b/src/Statements/Let/ObjectPropertyArrayIndexAppend.php index a05b5d3eb4..af559bf02c 100644 --- a/src/Statements/Let/ObjectPropertyArrayIndexAppend.php +++ b/src/Statements/Let/ObjectPropertyArrayIndexAppend.php @@ -34,7 +34,7 @@ class ObjectPropertyArrayIndexAppend extends ArrayIndex * @param CompilationContext $compilationContext, * @param array $statement */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); @@ -58,7 +58,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres * @throws \ReflectionException * @throws Exception */ - protected function _assignPropertyArrayMultipleIndex(ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + protected function _assignPropertyArrayMultipleIndex(ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); diff --git a/src/Statements/Let/ObjectPropertyDecr.php b/src/Statements/Let/ObjectPropertyDecr.php index 605d7d7cc0..d34d812135 100644 --- a/src/Statements/Let/ObjectPropertyDecr.php +++ b/src/Statements/Let/ObjectPropertyDecr.php @@ -33,7 +33,7 @@ class ObjectPropertyDecr * @param array $statement * @param mixed $property */ - public function assign($variable, $property, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement) + public function assign($variable, $property, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/Let/ObjectPropertyIncr.php b/src/Statements/Let/ObjectPropertyIncr.php index ce07933dfc..0f560b55a5 100644 --- a/src/Statements/Let/ObjectPropertyIncr.php +++ b/src/Statements/Let/ObjectPropertyIncr.php @@ -33,7 +33,7 @@ class ObjectPropertyIncr * @param CompilationContext $compilationContext * @param array $statement */ - public function assign($variable, $property, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement) + public function assign($variable, $property, ZephirVariable $symbolVariable, CompilationContext $compilationContext, $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/Let/StaticProperty.php b/src/Statements/Let/StaticProperty.php index 2f011da5a9..627a5f3cea 100644 --- a/src/Statements/Let/StaticProperty.php +++ b/src/Statements/Let/StaticProperty.php @@ -41,7 +41,7 @@ public function assignStatic( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $classDefinition = $compilationContext->classLookup($className); if (!$propertyDefinition = $classDefinition->getProperty($property)) { diff --git a/src/Statements/Let/StaticPropertyAdd.php b/src/Statements/Let/StaticPropertyAdd.php index 6c3fedc976..af1df7c2d4 100644 --- a/src/Statements/Let/StaticPropertyAdd.php +++ b/src/Statements/Let/StaticPropertyAdd.php @@ -44,7 +44,7 @@ public function assignStatic( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $classDefinition = $compilationContext->classLookup($className); if (!$propertyDefinition = $classDefinition->getProperty($property)) { diff --git a/src/Statements/Let/StaticPropertyAppend.php b/src/Statements/Let/StaticPropertyAppend.php index f89b138747..86e6af7204 100644 --- a/src/Statements/Let/StaticPropertyAppend.php +++ b/src/Statements/Let/StaticPropertyAppend.php @@ -44,7 +44,7 @@ public function assignStatic( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $compiler = $compilationContext->compiler; if (!\in_array($className, ['self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); @@ -109,7 +109,7 @@ protected function _assignStaticPropertyArrayMultipleIndex( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); diff --git a/src/Statements/Let/StaticPropertyArrayIndex.php b/src/Statements/Let/StaticPropertyArrayIndex.php index 1bd6ad1d49..8e9e6e1882 100644 --- a/src/Statements/Let/StaticPropertyArrayIndex.php +++ b/src/Statements/Let/StaticPropertyArrayIndex.php @@ -45,7 +45,7 @@ public function assignStatic( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $compiler = $compilationContext->compiler; if (!\in_array($className, ['self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); @@ -113,7 +113,7 @@ protected function _assignStaticPropertyArrayMultipleIndex( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement - ) { + ): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); diff --git a/src/Statements/Let/StaticPropertyArrayIndexAppend.php b/src/Statements/Let/StaticPropertyArrayIndexAppend.php index 3ab3276d34..c51d0ef6ff 100644 --- a/src/Statements/Let/StaticPropertyArrayIndexAppend.php +++ b/src/Statements/Let/StaticPropertyArrayIndexAppend.php @@ -45,7 +45,7 @@ public function assignStatic( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $compiler = $compilationContext->compiler; if (!\in_array($className, ['self', 'static', 'parent'])) { $className = $compilationContext->getFullName($className); @@ -112,7 +112,7 @@ protected function _assignStaticPropertyArrayMultipleIndex( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement - ) { + ): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); diff --git a/src/Statements/Let/StaticPropertySub.php b/src/Statements/Let/StaticPropertySub.php index e5de271543..c9a4fa5de1 100644 --- a/src/Statements/Let/StaticPropertySub.php +++ b/src/Statements/Let/StaticPropertySub.php @@ -44,7 +44,7 @@ public function assignStatic( CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement - ) { + ): void { $classDefinition = $compilationContext->classLookup($className); if (!$propertyDefinition = $classDefinition->getProperty($property)) { diff --git a/src/Statements/Let/Variable.php b/src/Statements/Let/Variable.php index ef4fbab8e9..4df0c74ac6 100644 --- a/src/Statements/Let/Variable.php +++ b/src/Statements/Let/Variable.php @@ -49,7 +49,7 @@ public function assign( ReadDetector $readDetector, CompilationContext $compilationContext, array $statement - ) { + ): void { if ($symbolVariable->isReadOnly()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is read only", $statement); } @@ -122,7 +122,7 @@ private function doNumericAssignment( string $variable, array $statement, CompilationContext $compilationContext - ) { + ): void { switch ($resolvedExpr->getType()) { case 'null': switch ($statement['operator']) { @@ -354,7 +354,7 @@ private function doDoubleAssignment( string $variable, array $statement, CompilationContext $compilationContext - ) { + ): void { switch ($resolvedExpr->getType()) { case 'null': switch ($statement['operator']) { @@ -536,7 +536,7 @@ private function doStringAssignment( string $variable, array $statement, CompilationContext $compilationContext - ) { + ): void { switch ($resolvedExpr->getType()) { case 'null': switch ($statement['operator']) { @@ -724,7 +724,7 @@ private function doArrayAssignment( string $variable, array $statement, CompilationContext $compilationContext - ) { + ): void { switch ($resolvedExpr->getType()) { case 'variable': case 'array': @@ -771,7 +771,7 @@ private function doBoolAssignment( string $variable, array $statement, CompilationContext $compilationContext - ) { + ): void { switch ($resolvedExpr->getType()) { case 'null': switch ($statement['operator']) { @@ -910,7 +910,7 @@ private function doVariableAssignment( array $statement, CompilationContext $compilationContext, ReadDetector $readDetector - ) { + ): void { switch ($resolvedExpr->getType()) { case 'null': switch ($statement['operator']) { diff --git a/src/Statements/Let/VariableAppend.php b/src/Statements/Let/VariableAppend.php index 243d9675e9..d0bf3f1526 100644 --- a/src/Statements/Let/VariableAppend.php +++ b/src/Statements/Let/VariableAppend.php @@ -36,7 +36,7 @@ class VariableAppend * * @throws CompilerException */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement) + public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, $statement): void { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); diff --git a/src/Statements/LetStatement.php b/src/Statements/LetStatement.php index 3a514cfa6e..003086b74a 100644 --- a/src/Statements/LetStatement.php +++ b/src/Statements/LetStatement.php @@ -55,7 +55,7 @@ class LetStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $readDetector = new ReadDetector(); diff --git a/src/Statements/RequireOnceStatement.php b/src/Statements/RequireOnceStatement.php index b6046c3555..8241e9f64f 100644 --- a/src/Statements/RequireOnceStatement.php +++ b/src/Statements/RequireOnceStatement.php @@ -29,7 +29,7 @@ class RequireOnceStatement extends StatementAbstract * * @throws Exception */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $expression = [ 'type' => 'require_once', diff --git a/src/Statements/RequireStatement.php b/src/Statements/RequireStatement.php index b7783d21e5..599a354828 100644 --- a/src/Statements/RequireStatement.php +++ b/src/Statements/RequireStatement.php @@ -29,7 +29,7 @@ class RequireStatement extends StatementAbstract * * @throws CompilerException */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $expression = [ 'type' => 'require', diff --git a/src/Statements/WhileStatement.php b/src/Statements/WhileStatement.php index 98baa169e2..d548850957 100644 --- a/src/Statements/WhileStatement.php +++ b/src/Statements/WhileStatement.php @@ -27,7 +27,7 @@ class WhileStatement extends StatementAbstract /** * @param CompilationContext $compilationContext */ - public function compile(CompilationContext $compilationContext) + public function compile(CompilationContext $compilationContext): void { $exprRaw = $this->statement['expr']; $codePrinter = $compilationContext->codePrinter; From 959c4b45f6844ca1063e9fd9e489738d932fabdf Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:30:11 +0000 Subject: [PATCH 164/375] Add visibility in class constants --- .../Builder/Operators/BinaryOperator.php | 64 +++++++++---------- .../Builder/Operators/UnaryOperator.php | 28 ++++---- .../Statements/CallFunctionStatement.php | 6 +- src/FunctionCall.php | 6 +- src/HeadersManager.php | 4 +- src/MethodCall.php | 6 +- .../FunctionCall/PregMatchOptimizer.php | 2 +- 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/Expression/Builder/Operators/BinaryOperator.php b/src/Expression/Builder/Operators/BinaryOperator.php index dc7e039d39..b7ebbd57a9 100644 --- a/src/Expression/Builder/Operators/BinaryOperator.php +++ b/src/Expression/Builder/Operators/BinaryOperator.php @@ -21,100 +21,100 @@ class BinaryOperator extends AbstractOperator { // x + y - const OPERATOR_ADD = 'add'; + public const OPERATOR_ADD = 'add'; // x - y - const OPERATOR_SUB = 'sub'; + public const OPERATOR_SUB = 'sub'; // x * y - const OPERATOR_MUL = 'mul'; + public const OPERATOR_MUL = 'mul'; // x / y - const OPERATOR_DIV = 'div'; + public const OPERATOR_DIV = 'div'; // x % y - const OPERATOR_MOD = 'mod'; + public const OPERATOR_MOD = 'mod'; // x . y - const OPERATOR_CONCAT = 'concat'; + public const OPERATOR_CONCAT = 'concat'; // x && y - const OPERATOR_AND = 'and'; + public const OPERATOR_AND = 'and'; // x || y - const OPERATOR_OR = 'or'; + public const OPERATOR_OR = 'or'; // x | y - const OPERATOR_BITWISE_OR = 'bitwise_or'; + public const OPERATOR_BITWISE_OR = 'bitwise_or'; // x & y - const OPERATOR_BITWISE_AND = 'bitwise_and'; + public const OPERATOR_BITWISE_AND = 'bitwise_and'; // x ^ y - const OPERATOR_BITWISE_XOR = 'bitwise_xor'; + public const OPERATOR_BITWISE_XOR = 'bitwise_xor'; // x << y - const OPERATOR_BITWISE_SHIFT_LEFT = 'bitwise_shiftleft'; + public const OPERATOR_BITWISE_SHIFT_LEFT = 'bitwise_shiftleft'; // x >> y - const OPERATOR_BITWISE_SHIFT_RIGHT = 'bitwise_shiftright'; + public const OPERATOR_BITWISE_SHIFT_RIGHT = 'bitwise_shiftright'; // x instanceof y - const OPERATOR_INSTANCEOF = 'instanceof'; + public const OPERATOR_INSTANCEOF = 'instanceof'; // x .. y - const OPERATOR_IRANGE = 'irange'; + public const OPERATOR_IRANGE = 'irange'; // x ... y - const OPERATOR_ERANGE = 'erange'; + public const OPERATOR_ERANGE = 'erange'; // x == y - const OPERATOR_EQUALS = 'equals'; + public const OPERATOR_EQUALS = 'equals'; // x != y - const OPERATOR_NOT_EQUALS = 'not-equals'; + public const OPERATOR_NOT_EQUALS = 'not-equals'; // x ==- y - const OPERATOR_IDENTICAL = 'identical'; + public const OPERATOR_IDENTICAL = 'identical'; // x !== y - const OPERATOR_NOT_IDENTICAL = 'not-identical'; + public const OPERATOR_NOT_IDENTICAL = 'not-identical'; // x < y - const OPERATOR_LESS = 'less'; + public const OPERATOR_LESS = 'less'; // x > y - const OPERATOR_GREATER = 'greater'; + public const OPERATOR_GREATER = 'greater'; // x <= y - const OPERATOR_LESS_EQUAL = 'less-equal'; + public const OPERATOR_LESS_EQUAL = 'less-equal'; // x >= y - const OPERATOR_GREATER_EQUAL = 'greater-equal'; + public const OPERATOR_GREATER_EQUAL = 'greater-equal'; // (type) a - const OPERATOR_CAST = 'cast'; + public const OPERATOR_CAST = 'cast'; // a - const OPERATOR_TYPE_HINT = 'type-hint'; + public const OPERATOR_TYPE_HINT = 'type-hint'; // x -> y - const OPERATOR_ACCESS_PROPERTY = 'property-access'; + public const OPERATOR_ACCESS_PROPERTY = 'property-access'; // x -> {y} - const OPERATOR_ACCESS_PROPERTY_DYNAMIC = 'property-dynamic-access'; + public const OPERATOR_ACCESS_PROPERTY_DYNAMIC = 'property-dynamic-access'; // x -> {"string"} - const OPERATOR_ACCESS_PROPERTY_STRING = 'property-string-access'; + public const OPERATOR_ACCESS_PROPERTY_STRING = 'property-string-access'; // x :: y - const OPERATOR_ACCESS_STATIC_PROPERTY = 'static-property-access'; + public const OPERATOR_ACCESS_STATIC_PROPERTY = 'static-property-access'; // x :: CONSTANT - const OPERATOR_ACCESS_STATIC_CONSTANT = 'static-constant-access'; + public const OPERATOR_ACCESS_STATIC_CONSTANT = 'static-constant-access'; // x [{expr}] - const OPERATOR_ACCESS_ARRAY = 'array-access'; + public const OPERATOR_ACCESS_ARRAY = 'array-access'; private $operator; private $leftExpression; diff --git a/src/Expression/Builder/Operators/UnaryOperator.php b/src/Expression/Builder/Operators/UnaryOperator.php index f575c55a59..6d208aa79b 100644 --- a/src/Expression/Builder/Operators/UnaryOperator.php +++ b/src/Expression/Builder/Operators/UnaryOperator.php @@ -21,46 +21,46 @@ class UnaryOperator extends AbstractOperator { // y = &a - const OPERATOR_REFERENCE = 'reference'; + public const OPERATOR_REFERENCE = 'reference'; // y = !a - const OPERATOR_NOT = 'not'; + public const OPERATOR_NOT = 'not'; // y = ~a - const OPERATOR_BITWISE_NOT = 'bitwise_not'; + public const OPERATOR_BITWISE_NOT = 'bitwise_not'; // y = -a - const OPERATOR_MINUS = 'minus'; + public const OPERATOR_MINUS = 'minus'; // y = +a - const OPERATOR_PLUS = 'plus'; + public const OPERATOR_PLUS = 'plus'; // y = isset a - const OPERATOR_ISSET = 'isset'; + public const OPERATOR_ISSET = 'isset'; // y = require a - const OPERATOR_REQUIRE = 'require'; + public const OPERATOR_REQUIRE = 'require'; // y = require_once a - const OPERATOR_REQUIRE_ONCE = 'require_once'; + public const OPERATOR_REQUIRE_ONCE = 'require_once'; // y = clone a - const OPERATOR_CLONE = 'clone'; + public const OPERATOR_CLONE = 'clone'; // y = empty a - const OPERATOR_EMPTY = 'empty'; + public const OPERATOR_EMPTY = 'empty'; // y = likely a - const OPERATOR_LIKELY = 'likely'; + public const OPERATOR_LIKELY = 'likely'; // y = unlikely a - const OPERATOR_UNLIKELY = 'unlikely'; + public const OPERATOR_UNLIKELY = 'unlikely'; // y = list a - const OPERATOR_LIST = 'list'; + public const OPERATOR_LIST = 'list'; // y = typeof a - const OPERATOR_TYPEOF = 'typeof'; + public const OPERATOR_TYPEOF = 'typeof'; private $operator; private $expression; diff --git a/src/Expression/Builder/Statements/CallFunctionStatement.php b/src/Expression/Builder/Statements/CallFunctionStatement.php index d853a58752..fba9fc362c 100644 --- a/src/Expression/Builder/Statements/CallFunctionStatement.php +++ b/src/Expression/Builder/Statements/CallFunctionStatement.php @@ -23,17 +23,17 @@ class CallFunctionStatement extends AbstractStatement /** * f(x, y, ... , N). */ - const TYPE_CALL_DIRECT = FunctionCall::CALL_NORMAL; + public const TYPE_CALL_DIRECT = FunctionCall::CALL_NORMAL; /** * {f}(x, y, ... , N). */ - const TYPE_CALL_DYNAMIC = FunctionCall::CALL_DYNAMIC; + public const TYPE_CALL_DYNAMIC = FunctionCall::CALL_DYNAMIC; /** * {"f"}(x, y, ... , N). */ - const TYPE_CALL_DYNAMIC_STRING = FunctionCall::CALL_DYNAMIC_STRING; + public const TYPE_CALL_DYNAMIC_STRING = FunctionCall::CALL_DYNAMIC_STRING; private $name; private $arguments; diff --git a/src/FunctionCall.php b/src/FunctionCall.php index 3791dda5e6..6818376635 100644 --- a/src/FunctionCall.php +++ b/src/FunctionCall.php @@ -25,17 +25,17 @@ class FunctionCall extends Call /** * Function is called using a normal method name. */ - const CALL_NORMAL = 1; + public const CALL_NORMAL = 1; /** * Function is called using a dynamic variable as method name. */ - const CALL_DYNAMIC = 2; + public const CALL_DYNAMIC = 2; /** * Function is called using a dynamic string as method name. */ - const CALL_DYNAMIC_STRING = 3; + public const CALL_DYNAMIC_STRING = 3; protected static $optimizers = []; diff --git a/src/HeadersManager.php b/src/HeadersManager.php index 607f88b9b9..37ae87fb10 100644 --- a/src/HeadersManager.php +++ b/src/HeadersManager.php @@ -21,12 +21,12 @@ class HeadersManager /** * Insert the header at the beginning of the header list. */ - const POSITION_FIRST = 1; + public const POSITION_FIRST = 1; /** * Insert the header at the end of the header list. */ - const POSITION_LAST = 2; + public const POSITION_LAST = 2; /** * List of headers. diff --git a/src/MethodCall.php b/src/MethodCall.php index 8ae24cb58c..119335eef6 100644 --- a/src/MethodCall.php +++ b/src/MethodCall.php @@ -27,17 +27,17 @@ class MethodCall extends Call /** * Function is called using a normal method name. */ - const CALL_NORMAL = 1; + public const CALL_NORMAL = 1; /** * Function is called using a dynamic variable as method name. */ - const CALL_DYNAMIC = 2; + public const CALL_DYNAMIC = 2; /** * Function is called using a dynamic string as method name. */ - const CALL_DYNAMIC_STRING = 3; + public const CALL_DYNAMIC_STRING = 3; /** * Compiles a method call. diff --git a/src/Optimizers/FunctionCall/PregMatchOptimizer.php b/src/Optimizers/FunctionCall/PregMatchOptimizer.php index ade57e1b99..7678d5d2b0 100644 --- a/src/Optimizers/FunctionCall/PregMatchOptimizer.php +++ b/src/Optimizers/FunctionCall/PregMatchOptimizer.php @@ -28,7 +28,7 @@ */ class PregMatchOptimizer extends OptimizerAbstract { - const GLOBAL_MATCH = 0; + public const GLOBAL_MATCH = 0; /** * {@inheritdoc} From 1383391cf1fe8addafb4c0012b6b273892d2a9ca Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:31:15 +0000 Subject: [PATCH 165/375] Use short syntax --- src/Optimizers/FunctionCall/PregMatchOptimizer.php | 2 +- src/Statements/TryCatchStatement.php | 2 +- src/Stubs/DocBlock.php | 4 +--- src/Stubs/MethodDocBlock.php | 4 ++-- src/Types/Types.php | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Optimizers/FunctionCall/PregMatchOptimizer.php b/src/Optimizers/FunctionCall/PregMatchOptimizer.php index 7678d5d2b0..8a752078d4 100644 --- a/src/Optimizers/FunctionCall/PregMatchOptimizer.php +++ b/src/Optimizers/FunctionCall/PregMatchOptimizer.php @@ -64,7 +64,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont } $matches = $this->createMatches($expression, $context); - list($flags, $offset) = $this->processOptionals($expression, $call, $context); + [$flags, $offset] = $this->processOptionals($expression, $call, $context); /* * Process the expected symbol to be returned diff --git a/src/Statements/TryCatchStatement.php b/src/Statements/TryCatchStatement.php index 31c4b695ee..8a75af39f3 100644 --- a/src/Statements/TryCatchStatement.php +++ b/src/Statements/TryCatchStatement.php @@ -98,7 +98,7 @@ public function compile(CompilationContext $compilationContext): void $exprBuilder->statements()->rawC('zend_clear_exception();'), $assignExceptionVarStmt, ], - isset($catch['statements']) ? $catch['statements'] : [] + $catch['statements'] ?? [] ))); } } diff --git a/src/Stubs/DocBlock.php b/src/Stubs/DocBlock.php index f0ba7018e1..41f5320fc4 100644 --- a/src/Stubs/DocBlock.php +++ b/src/Stubs/DocBlock.php @@ -108,9 +108,7 @@ public function __toString(): string } if (!empty($this->lines)) { - $lines = array_map(function ($line) use ($indent) { - return "$indent * $line"; - }, $this->lines); + $lines = array_map(fn ($line) => "$indent * $line", $this->lines); if (!empty($doc)) { $doc .= "\n$indent *"; diff --git a/src/Stubs/MethodDocBlock.php b/src/Stubs/MethodDocBlock.php index 31722746cd..35120a734b 100644 --- a/src/Stubs/MethodDocBlock.php +++ b/src/Stubs/MethodDocBlock.php @@ -240,7 +240,7 @@ protected function parseLines(): void private function appendReturnLine(): void { if (!isset($this->predefinedParams['return'])) { - list($type, $description) = $this->return; + [$type, $description] = $this->return; $return = $this->aliasManager->getAliasForClassName($type).' '.$description; $this->lines[] = '@return '.trim($return, ' '); @@ -281,7 +281,7 @@ private function appendParametersLines(): void } if (!isset($this->predefinedParams[trim($name, '$')])) { - list($type, $description) = $parameter; + [$type, $description] = $parameter; $param = $type.' '.$name.' '.$description; $this->lines[] = '@param '.trim($param, ' '); diff --git a/src/Types/Types.php b/src/Types/Types.php index 4f7a95eb46..08034d6028 100644 --- a/src/Types/Types.php +++ b/src/Types/Types.php @@ -51,7 +51,7 @@ public function getReturnTypeAnnotation(Method $method, array $returnTypes = nul } $isProcessedReturnType = null !== $returnTypes; - $returnTypes = $returnTypes ?? $method->getReturnTypes(); + $returnTypes ??= $method->getReturnTypes(); $typesCount = \count($returnTypes); $isDynamic = \in_array('var', array_keys($returnTypes)); From d50fb8fd071ce8dbd83bc87ef39420972a5d2ea0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:31:40 +0000 Subject: [PATCH 166/375] Fix strict types --- src/MethodCall.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MethodCall.php b/src/MethodCall.php index 119335eef6..53e62298b4 100644 --- a/src/MethodCall.php +++ b/src/MethodCall.php @@ -759,7 +759,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext if ($isExpecting) { if ('return_value' == $symbolVariable->getName()) { - $macro = $compilationContext->backend->getFcallManager()->getMacro(false, true, $paramCount); + $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 1, $paramCount); $codePrinter->output($macro.'('.$variableCode.', '.$method->getInternalName().$paramsStr.');'); } else { $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 2, $paramCount); @@ -768,7 +768,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext ); } } else { - $macro = $compilationContext->backend->getFcallManager()->getMacro(false, false, $paramCount); + $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 0, $paramCount); $codePrinter->output($macro.'('.$variableCode.', '.$method->getInternalName().$paramsStr.');'); } } From bb7294338cc3e15cfe8c9b399aeb86b04bfc5858 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:31:53 +0000 Subject: [PATCH 167/375] Force cast to string --- src/Statements/IfStatement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Statements/IfStatement.php b/src/Statements/IfStatement.php index 4d574ba0c2..85a75d7718 100644 --- a/src/Statements/IfStatement.php +++ b/src/Statements/IfStatement.php @@ -74,7 +74,7 @@ public function compile(CompilationContext $compilationContext): void $symbolTable = $compilationContext->symbolTable; foreach ($skipVariantInit->getVariables() as $variable) { - if ($symbolTable->hasVariable($variable)) { + if ($symbolTable->hasVariable((string)$variable)) { $symbolVariable = $symbolTable->getVariable($variable); if ('variable' === $symbolVariable->getType()) { if (!$readDetector->detect($variable, $exprRaw)) { From 71b2d92934135dbd0817078d0ba3b66222ece85e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:32:01 +0000 Subject: [PATCH 168/375] Add return type --- src/Statements/Let/ObjectPropertyArrayIndex.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Statements/Let/ObjectPropertyArrayIndex.php b/src/Statements/Let/ObjectPropertyArrayIndex.php index 1473d6879e..b3a112a379 100644 --- a/src/Statements/Let/ObjectPropertyArrayIndex.php +++ b/src/Statements/Let/ObjectPropertyArrayIndex.php @@ -277,7 +277,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy * * @throws CompilerException */ - protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + protected function _assignPropertyArrayMultipleIndex($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement): void { $property = $statement['property']; $compilationContext->headersManager->add('kernel/object'); From 606b1e2da16a9b7d144f4639a29f556e5ffbaeb3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:33:14 +0000 Subject: [PATCH 169/375] Fix CS --- src/Class/Method/Method.php | 55 ++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 7ebdc21501..718f1f4f21 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -13,7 +13,6 @@ namespace Zephir\Class\Method; -use ReflectionException; use Zephir\Branch; use Zephir\BranchManager; use Zephir\Cache\Manager; @@ -35,12 +34,6 @@ use Zephir\SymbolTable; use Zephir\Variable\Variable; -use function array_key_exists; -use function count; -use function in_array; -use function is_array; -use function is_object; - /** * Represents a class method */ @@ -503,7 +496,7 @@ public function getParameters(): ?Parameters */ public function hasReturnTypes(): bool { - return count($this->returnTypes) || count($this->returnClassTypes); + return \count($this->returnTypes) || \count($this->returnClassTypes); } /** @@ -522,7 +515,7 @@ public function areReturnTypesIntCompatible(): bool $types = ['int', 'uint', 'char', 'uchar', 'long', 'ulong']; foreach ($this->returnTypes as $returnType => $definition) { - if (in_array($returnType, $types)) { + if (\in_array($returnType, $types)) { return true; } } @@ -627,7 +620,7 @@ public function getNumberOfRequiredParameters(): int */ public function hasModifier(string $modifier): bool { - return in_array($modifier, $this->visibility); + return \in_array($modifier, $this->visibility); } /** @@ -640,7 +633,7 @@ public function getVisibility(): array public function isDeprecated(): bool { - return !empty($this->visibility) && in_array('deprecated', $this->visibility, true); + return !empty($this->visibility) && \in_array('deprecated', $this->visibility, true); } /** @@ -721,7 +714,7 @@ public function isMixed(): bool */ public function isPrivate(): bool { - return in_array('private', $this->visibility); + return \in_array('private', $this->visibility); } /** @@ -729,7 +722,7 @@ public function isPrivate(): bool */ public function isProtected(): bool { - return in_array('protected', $this->visibility); + return \in_array('protected', $this->visibility); } /** @@ -862,7 +855,7 @@ public function removeMemoryStackReferences(SymbolTable $symbolTable, string $co * Assigns a default value. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function assignDefaultValue(array $parameter, CompilationContext $compilationContext): string { @@ -1222,7 +1215,7 @@ public function assignZvalValue(array $parameter, CompilationContext $compilatio { $dataType = $this->getParamDataType($parameter); - if (in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { + if (\in_array($dataType, ['variable', 'callable', 'object', 'resource', 'mixed'])) { return ''; } @@ -1274,7 +1267,7 @@ public function preCompile(CompilationContext $compilationContext): void $typeInference = null; $callGathererPass = null; - if (is_object($this->statements)) { + if (\is_object($this->statements)) { $compilationContext->currentMethod = $this; /** @@ -1318,7 +1311,7 @@ public function preCompile(CompilationContext $compilationContext): void * Compiles the method. * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -1453,12 +1446,12 @@ public function compile(CompilationContext $compilationContext): void */ if (!empty($parameter['const'])) { $symbol->setReadOnly(true); - if (is_object($symbolParam)) { + if (\is_object($symbolParam)) { $symbolParam->setReadOnly(true); } } - if (is_object($symbolParam)) { + if (\is_object($symbolParam)) { /** * Parameters are marked as 'external' */ @@ -1528,7 +1521,7 @@ public function compile(CompilationContext $compilationContext): void /** * Compile the block of statements if any */ - if (is_object($this->statements)) { + if (\is_object($this->statements)) { $compilationContext->staticContext = $this->hasModifier('static'); /** @@ -1567,7 +1560,7 @@ public function compile(CompilationContext $compilationContext): void * variable is modified so as do the proper separation. */ $parametersToSeparate = []; - if (is_object($this->statements)) { + if (\is_object($this->statements)) { if (!$this->localContext instanceof LocalContextPass) { $writeDetector = new WriteDetector(); } @@ -1788,7 +1781,7 @@ public function compile(CompilationContext $compilationContext): void if (!$variable->isUsed()) { $node = $variable->getLastUsedNode(); - if (is_array($node)) { + if (\is_array($node)) { $expression = $node['expr'] ?? $node; $compilationContext->logger->warning( 'Variable "'.$variable->getName().'" assigned but not used in '.$completeName.'::'.$this->getName(), @@ -1803,7 +1796,7 @@ public function compile(CompilationContext $compilationContext): void } } - if (count($usedVariables)) { + if (\count($usedVariables)) { $codePrinter->preOutputBlankLine(); } @@ -1859,7 +1852,7 @@ public function compile(CompilationContext $compilationContext): void /** * Finalize the method compilation */ - if (is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { + if (\is_object($this->statements) && !empty($statement = $this->statements->getLastStatement())) { /** * If the last statement is not a 'return' or 'throw' we need to * restore the memory stack if needed. @@ -1909,7 +1902,7 @@ public function compile(CompilationContext $compilationContext): void */ public function hasChildReturnStatementType(array $statement): bool { - if (!isset($statement['statements']) || !is_array($statement['statements'])) { + if (!isset($statement['statements']) || !\is_array($statement['statements'])) { return false; } @@ -1995,7 +1988,7 @@ public function isReturnTypesHintDetermined(): bool return true; } - if (0 === count($this->returnTypes)) { + if (0 === \count($this->returnTypes)) { return false; } @@ -2015,7 +2008,7 @@ public function isReturnTypesHintDetermined(): bool || $this->areReturnTypesStringCompatible() || $this->areReturnTypesFalseCompatible() || $this->areReturnTypesObjectCompatible() - || array_key_exists('array', $this->getReturnTypes()) + || \array_key_exists('array', $this->getReturnTypes()) ) { continue; } @@ -2037,7 +2030,7 @@ public function isReturnTypesHintDetermined(): bool */ public function isReturnTypeNullableObject(): bool { - return count($this->returnTypes) === 2 + return \count($this->returnTypes) === 2 && isset($this->returnTypes['object']) && isset($this->returnTypes['null']); } @@ -2047,7 +2040,7 @@ public function isReturnTypeNullableObject(): bool */ public function isReturnTypeObject(): bool { - return count($this->returnTypes) === 1 && isset($this->returnTypes['object']); + return \count($this->returnTypes) === 1 && isset($this->returnTypes['object']); } /** @@ -2060,12 +2053,12 @@ public function areReturnTypesCompatible(): bool return true; } - $totalTypes = count($this->returnTypes); + $totalTypes = \count($this->returnTypes); // union types if ($totalTypes > 1) { $diff = array_diff(array_keys($this->returnTypes), array_keys($this->mayBeArgTypes)); - if (count($diff) === 0) { + if (\count($diff) === 0) { return true; } } From 777b9912f8aad0edc224453ed8b9e3571d61e34a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:33:37 +0000 Subject: [PATCH 170/375] Fix CS --- src/Class/Method/Method.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 718f1f4f21..dbc149fd01 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -239,12 +239,12 @@ public function setReturnTypes(array $returnType = null): void } } - if (count($castTypes) > 0) { + if (\count($castTypes) > 0) { $types['object'] = []; $this->returnClassTypes = $castTypes; } - if (count($types) > 0) { + if (\count($types) > 0) { $this->returnTypes = $types; } } @@ -290,47 +290,47 @@ public function isEmpty(): bool */ public function checkVisibility(array $visibility, string $name, array $original = null): void { - if (count($visibility) > 1) { - if (in_array('public', $visibility) && in_array('protected', $visibility)) { + if (\count($visibility) > 1) { + if (\in_array('public', $visibility) && \in_array('protected', $visibility)) { throw new CompilerException("Method '$name' cannot be 'public' and 'protected' at the same time", $original); } - if (in_array('public', $visibility) && in_array('private', $visibility)) { + if (\in_array('public', $visibility) && \in_array('private', $visibility)) { throw new CompilerException("Method '$name' cannot be 'public' and 'private' at the same time", $original); } - if (in_array('private', $visibility) && in_array('protected', $visibility)) { + if (\in_array('private', $visibility) && \in_array('protected', $visibility)) { throw new CompilerException("Method '$name' cannot be 'protected' and 'private' at the same time", $original); } - if (in_array('private', $visibility) && in_array('internal', $visibility)) { + if (\in_array('private', $visibility) && \in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'private' at the same time", $original); } - if (in_array('protected', $visibility) && in_array('internal', $visibility)) { + if (\in_array('protected', $visibility) && \in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'protected' at the same time", $original); } - if (in_array('public', $visibility) && in_array('internal', $visibility)) { + if (\in_array('public', $visibility) && \in_array('internal', $visibility)) { throw new CompilerException("Method '$name' cannot be 'internal' and 'public' at the same time", $original); } } if ('__construct' === $name) { - if (in_array('static', $visibility)) { + if (\in_array('static', $visibility)) { throw new CompilerException("Constructors cannot be 'static'", $original); } } elseif ('__destruct' === $name) { - if (in_array('static', $visibility)) { + if (\in_array('static', $visibility)) { throw new CompilerException("Destructors cannot be 'static'", $original); } } - $this->isAbstract = in_array('abstract', $visibility); - $this->isStatic = in_array('static', $visibility); - $this->isFinal = in_array('final', $visibility); - $this->isPublic = in_array('public', $visibility); - $this->isInternal = in_array('internal', $visibility); + $this->isAbstract = \in_array('abstract', $visibility); + $this->isStatic = \in_array('static', $visibility); + $this->isFinal = \in_array('final', $visibility); + $this->isPublic = \in_array('public', $visibility); + $this->isInternal = \in_array('internal', $visibility); } /** From e9436eef9e3ecd1af52d796fbbd169cec8b93577 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 15:41:48 +0000 Subject: [PATCH 171/375] Remove memory management logic --- kernel/exception.c | 5 ----- kernel/exception.h | 4 ---- kernel/fcall.h | 4 ---- kernel/main.h | 19 +++++++------------ kernel/memory.c | 2 -- kernel/memory.h | 23 ++++------------------- src/Class/Method/Method.php | 10 +++++----- src/Statements/ThrowStatement.php | 2 +- 8 files changed, 17 insertions(+), 52 deletions(-) diff --git a/kernel/exception.c b/kernel/exception.c index 404162af8d..46b1ca7c82 100644 --- a/kernel/exception.c +++ b/kernel/exception.c @@ -31,16 +31,12 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) { zend_class_entry *default_exception_ce; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; int ZEPHIR_LAST_CALL_STATUS = 0; zval curline; zval object_copy; ZVAL_UNDEF(&curline); - ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0); - zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); - if (Z_TYPE_P(object) != IS_OBJECT) { ZVAL_COPY_VALUE(&object_copy, object); object_init_ex(object, zend_exception_get_default()); @@ -63,7 +59,6 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line) if (ZEPHIR_LAST_CALL_STATUS != FAILURE) { zend_throw_exception_object(object); } - ZEPHIR_MM_RESTORE(); } /** diff --git a/kernel/exception.h b/kernel/exception.h index 5ae19973ad..c13f7498cb 100644 --- a/kernel/exception.h +++ b/kernel/exception.h @@ -19,25 +19,21 @@ #define ZEPHIR_THROW_EXCEPTION_STR(class_entry, message) \ do { \ zephir_throw_exception_string(class_entry, message, strlen(message)); \ - ZEPHIR_MM_RESTORE(); \ } while (0) #define ZEPHIR_THROW_EXCEPTION_DEBUG_STR(class_entry, message, file, line) \ do { \ zephir_throw_exception_string_debug(class_entry, message, strlen(message), file, line); \ - ZEPHIR_MM_RESTORE(); \ } while (0) #define ZEPHIR_THROW_EXCEPTION_ZVAL(class_entry, message) \ do { \ zephir_throw_exception_zval(class_entry, message); \ - ZEPHIR_MM_RESTORE(); \ } while (0) #define ZEPHIR_THROW_EXCEPTION_DEBUG_ZVAL(class_entry, message, file, line) \ do { \ zephir_throw_exception_zval(class_entry, message, file, line); \ - ZEPHIR_MM_RESTORE(); \ } while (0) diff --git a/kernel/fcall.h b/kernel/fcall.h index 4754bf4626..4e879d2674 100644 --- a/kernel/fcall.h +++ b/kernel/fcall.h @@ -394,7 +394,6 @@ ZEPHIR_ATTR_WARN_UNUSED_RESULT ZEPHIR_ATTR_NONNULL static inline int zephir_has_ #define zephir_check_call_status() \ do { \ if (ZEPHIR_LAST_CALL_STATUS == FAILURE) { \ - ZEPHIR_MM_RESTORE(); \ return; \ } \ } while(0) @@ -404,9 +403,6 @@ ZEPHIR_ATTR_WARN_UNUSED_RESULT ZEPHIR_ATTR_NONNULL static inline int zephir_has_ if (ZEPHIR_LAST_CALL_STATUS == FAILURE) { \ if (EG(exception)) { \ goto label; \ - } else { \ - ZEPHIR_MM_RESTORE(); \ - return; \ } \ } \ } while (0) diff --git a/kernel/main.h b/kernel/main.h index 7d28f37757..513f670d88 100644 --- a/kernel/main.h +++ b/kernel/main.h @@ -112,7 +112,6 @@ extern zend_string* i_self; #define RETURN_CTOR(var) \ do { \ RETVAL_ZVAL(var, 1, 0); \ - ZEPHIR_MM_RESTORE(); \ return; \ } while (0) @@ -127,7 +126,6 @@ extern zend_string* i_self; #define RETURN_CCTOR(v) \ do { \ ZVAL_DUP(return_value, v); \ - ZEPHIR_MM_RESTORE(); \ return; \ } while (0) @@ -146,7 +144,6 @@ extern zend_string* i_self; #define RETURN_THIS() { \ RETVAL_ZVAL(getThis(), 1, 0); \ } \ - ZEPHIR_MM_RESTORE(); \ return; #define RETURN_LCTORW(var) RETURN_CCTORW(var); @@ -161,20 +158,20 @@ extern zend_string* i_self; return; /** Return without change return_value */ -#define RETURN_MM() { ZEPHIR_MM_RESTORE(); return; } +#define RETURN_MM() { return; } /** Return null restoring memory frame */ -#define RETURN_MM_BOOL(value) { RETVAL_BOOL(value); ZEPHIR_MM_RESTORE(); return; } +#define RETURN_MM_BOOL(value) { RETVAL_BOOL(value); return; } /** Return string restoring memory frame */ -#define RETURN_MM_STRING(str) { RETVAL_STRING(str); ZEPHIR_MM_RESTORE(); return; } -#define RETURN_MM_EMPTY_STRING() { RETVAL_EMPTY_STRING(); ZEPHIR_MM_RESTORE(); return; } +#define RETURN_MM_STRING(str) { RETVAL_STRING(str); return; } +#define RETURN_MM_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; } /* Return long */ -#define RETURN_MM_LONG(value) { RETVAL_LONG(value); ZEPHIR_MM_RESTORE(); return; } +#define RETURN_MM_LONG(value) { RETVAL_LONG(value); return; } /* Return double */ -#define RETURN_MM_DOUBLE(value) { RETVAL_DOUBLE(value); ZEPHIR_MM_RESTORE(); return; } +#define RETURN_MM_DOUBLE(value) { RETVAL_DOUBLE(value); return; } /** * Returns a zval in an object member @@ -193,13 +190,12 @@ extern zend_string* i_self; #define RETURN_MM_ON_FAILURE(what) \ do { \ if (what == FAILURE) { \ - ZEPHIR_MM_RESTORE(); \ return; \ } \ } while (0) /** Return null restoring memory frame */ -#define RETURN_MM_NULL() { RETVAL_NULL(); ZEPHIR_MM_RESTORE(); return; } +#define RETURN_MM_NULL() { RETVAL_NULL(); return; } /* Globals functions */ int zephir_get_global(zval *arr, const char *global, unsigned int global_length); @@ -245,7 +241,6 @@ int zephir_is_iterable_ex(zval *arr, int duplicate); #define zephir_is_iterable(var, duplicate, file, line) \ if (!zephir_is_iterable_ex(var, duplicate)) { \ ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(zend_exception_get_default(), "The argument is not initialized or iterable()", file, line); \ - ZEPHIR_MM_RESTORE(); \ return; \ } diff --git a/kernel/memory.c b/kernel/memory.c index f0bf4326f3..bf47e5bc5a 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -52,9 +52,7 @@ void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const ch { if (g->active_memory == NULL) { zephir_memory_entry *active_memory; - active_memory = (zephir_memory_entry *) pecalloc(1, sizeof(zephir_memory_entry), 0); - active_memory->addresses = pecalloc(24, sizeof(zval*), 0); active_memory->capacity = 24; diff --git a/kernel/memory.h b/kernel/memory.h index 7da4ec47e2..d39c265f61 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -47,34 +47,28 @@ typedef struct _zephir_method_globals { void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func); void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func); -#define ZEPHIR_MM_RESTORE() \ - zephir_memory_restore_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__); \ - pefree(ZEPHIR_METHOD_GLOBALS_PTR, 0); \ - ZEPHIR_METHOD_GLOBALS_PTR = NULL; +#define ZEPHIR_MM_RESTORE() do { /* dummy code */ } while (0) void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); void zephir_deinitialize_memory(); void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g); -#define zephir_memory_observe(var) zephir_do_memory_observe(var, ZEPHIR_METHOD_GLOBALS_PTR); +#define zephir_memory_observe(var) do { /* dummy code */ } while (0) #define zephir_safe_zval_ptr_dtor(pzval) void zephir_create_symbol_table(zephir_method_globals *g); -#define ZEPHIR_CREATE_SYMBOL_TABLE() zephir_create_symbol_table(ZEPHIR_METHOD_GLOBALS_PTR); +#define ZEPHIR_CREATE_SYMBOL_TABLE() do { /* dummy code */ } while (0) int zephir_set_symbol(zval *key_name, zval *value); #define ZEPHIR_INIT_VAR(z) \ - zephir_memory_observe(z); \ ZVAL_NULL(z); #define ZEPHIR_INIT_NVAR(z) \ do { \ - if (Z_TYPE_P(z) == IS_UNDEF) { \ - zephir_memory_observe(z); \ - } else if (Z_REFCOUNTED_P(z) && !Z_ISREF_P(z)) { \ + if (Z_REFCOUNTED_P(z) && !Z_ISREF_P(z)) { \ if (Z_REFCOUNT_P(z) > 1) { \ Z_DELREF_P(z); \ } else { \ @@ -90,8 +84,6 @@ int zephir_set_symbol(zval *key_name, zval *value); if (Z_REFCOUNTED_P(d) && Z_REFCOUNT_P(d) > 0) { \ zval_ptr_dtor(d); \ } \ - } else { \ - zephir_memory_observe(d); \ } \ ZVAL_COPY_VALUE(d, v); @@ -104,9 +96,6 @@ int zephir_set_symbol(zval *key_name, zval *value); ZVAL_DUP(d, v); #define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ - if (Z_TYPE_P(z) == IS_UNDEF) { \ - zephir_memory_observe(z); \ - } \ ZVAL_COPY(z, v); #define ZEPHIR_HASH_COPY(z, v) \ @@ -122,8 +111,6 @@ int zephir_set_symbol(zval *key_name, zval *value); zval_ptr_dtor(z); \ ZVAL_NULL(z); \ } \ - } else { \ - zephir_memory_observe(z); \ } /* TODO: this might causes troubles, since we cannot observe here, since we aren't using double pointers @@ -135,8 +122,6 @@ int zephir_set_symbol(zval *key_name, zval *value); if (tmp_ != NULL) { \ if (Z_TYPE_P(tmp_) != IS_UNDEF) { \ zval_ptr_dtor(tmp_); \ - } else { \ - zephir_memory_observe(tmp_); \ } \ ZVAL_NULL(tmp_); \ } \ diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index dbc149fd01..7140170ceb 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1718,7 +1718,7 @@ public function compile(CompilationContext $compilationContext): void /** * Grow the stack if needed */ - if ($symbolTable->getMustGrownStack()) { + /*if ($symbolTable->getMustGrownStack()) { $compilationContext->headersManager->add('kernel/memory'); if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_METHOD_GLOBALS_PTR')) { $methodGlobals = new Variable('zephir_method_globals', 'ZEPHIR_METHOD_GLOBALS_PTR', $compilationContext->branchManager->getCurrentBranch()); @@ -1730,9 +1730,9 @@ public function compile(CompilationContext $compilationContext): void } // #define ZEPHIR_MM_GROW() - $codePrinter->preOutput("\t".'zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__);'); + $codePrinter->preOutput("\t".'zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__);'.PHP_EOL); $codePrinter->preOutput("\t".'ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0);'); - } + }*/ /** * Check if there are unused variables. @@ -1860,10 +1860,10 @@ public function compile(CompilationContext $compilationContext): void $lastType = $this->statements->getLastStatementType(); if ('return' !== $lastType && 'throw' !== $lastType && !$this->hasChildReturnStatementType($statement)) { - if ($symbolTable->getMustGrownStack()) { + /*if ($symbolTable->getMustGrownStack()) { $compilationContext->headersManager->add('kernel/memory'); $codePrinter->output("\t".'ZEPHIR_MM_RESTORE();'); - } + }*/ /** * If a method has return-type hints we need to ensure the last statement is a 'return' statement diff --git a/src/Statements/ThrowStatement.php b/src/Statements/ThrowStatement.php index 69bd0c7187..129cccfb35 100644 --- a/src/Statements/ThrowStatement.php +++ b/src/Statements/ThrowStatement.php @@ -123,7 +123,7 @@ public function compile(CompilationContext $compilationContext): void ); if (!$compilationContext->insideTryCatch) { - $codePrinter->output('ZEPHIR_MM_RESTORE();'); + // $codePrinter->output('ZEPHIR_MM_RESTORE();'); $codePrinter->output('return;'); } else { $codePrinter->output('goto try_end_'.$compilationContext->currentTryCatch.';'); From ef301aea5f43949ead8aa7ac4e98f2192a7786c4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 16:47:21 +0000 Subject: [PATCH 172/375] Adjust `kernel` directory name in box.json.dist --- box.json.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/box.json.dist b/box.json.dist index 918925ab2c..aa659e1d2b 100644 --- a/box.json.dist +++ b/box.json.dist @@ -8,7 +8,7 @@ "the LICENSE file that was distributed with this source code." ], "directories": [ - "kernels", + "kernel", "src", "prototypes", "templates", @@ -28,7 +28,7 @@ "name": "*.*" }, { - "in": "kernels", + "in": "kernel", "name": "*.*" }, { From cd8c02bace62b3a5d94b180b675aa1f68d844750 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 16:47:50 +0000 Subject: [PATCH 173/375] Add `false` check on `current()` call --- src/Expression/PropertyAccess.php | 2 +- src/Statements/Let/ObjectPropertyArrayIndex.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Expression/PropertyAccess.php b/src/Expression/PropertyAccess.php index 0d1600fca7..acc6654f59 100644 --- a/src/Expression/PropertyAccess.php +++ b/src/Expression/PropertyAccess.php @@ -122,7 +122,7 @@ public function compile($expression, CompilationContext $compilationContext) $classType = current($variableVariable->getClassTypes()); $compiler = $compilationContext->compiler; - if ($compiler->isClass($classType)) { + if ($classType !== false && $compiler->isClass($classType)) { $classDefinition = $compiler->getClassDefinition($classType); if (!$classDefinition) { throw new CompilerException('Cannot locate class definition for class: '.$classType, $expression); diff --git a/src/Statements/Let/ObjectPropertyArrayIndex.php b/src/Statements/Let/ObjectPropertyArrayIndex.php index b3a112a379..555abbdd7d 100644 --- a/src/Statements/Let/ObjectPropertyArrayIndex.php +++ b/src/Statements/Let/ObjectPropertyArrayIndex.php @@ -151,7 +151,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy throw new CompilerException("Class '".$classDefinition->getCompleteName()."' does not have a property called: '".$property."'", $statement); } } else { - /* + /** * If we know the class related to a variable we could check if the property * is defined on that class */ @@ -159,7 +159,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy $classType = current($symbolVariable->getClassTypes()); $compiler = $compilationContext->compiler; - if ($compiler->isClass($classType)) { + if ($classType !== false && $compiler->isClass($classType)) { $classDefinition = $compiler->getClassDefinition($classType); if (!$classDefinition) { throw new CompilerException('Cannot locate class definition for class: '.$classType, $statement); From 9ae4cc4ae4f332a81b49cc8cb2043778d0c53d3f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 16:49:22 +0000 Subject: [PATCH 174/375] Fix CS --- prototypes/apache.php | 1 - prototypes/apc.php | 1 - prototypes/fpm.php | 1 - prototypes/gd.php | 1 - prototypes/iconv.php | 1 - prototypes/igbinary.php | 1 - prototypes/imagick.php | 1 - prototypes/mcrypt.php | 1 - prototypes/memcache.php | 1 - prototypes/memcached.php | 1 - prototypes/mongo.php | 1 - prototypes/msgpack.php | 1 - prototypes/redis.php | 1 - prototypes/xcache.php | 1 - prototypes/yaml.php | 1 - src/Statements/IfStatement.php | 2 +- tests/Extension/Optimizers/IsPhpVersionTest.php | 4 ++-- 17 files changed, 3 insertions(+), 18 deletions(-) diff --git a/prototypes/apache.php b/prototypes/apache.php index 0cc5b90b54..09535638bf 100644 --- a/prototypes/apache.php +++ b/prototypes/apache.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (!function_exists('apache_child_terminate')) { /** * Terminate apache process after this request. diff --git a/prototypes/apc.php b/prototypes/apc.php index 71593b5234..5a00a5dd42 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (!class_exists('APCIterator', false)) { // See: https://github.com/php/pecl-caching-apc/blob/master/apc_bin.h defined('APC_BIN_VERIFY_CRC32') || define('APC_BIN_VERIFY_CRC32', 1 << 1); diff --git a/prototypes/fpm.php b/prototypes/fpm.php index 55ea6ef1fd..9758804d9b 100644 --- a/prototypes/fpm.php +++ b/prototypes/fpm.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (function_exists('fastcgi_finish_request')) { return false; } diff --git a/prototypes/gd.php b/prototypes/gd.php index a23b531cb4..7db13aec6e 100644 --- a/prototypes/gd.php +++ b/prototypes/gd.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (!function_exists('gd_info')) { /** * Retrieve information about the currently installed GD library. diff --git a/prototypes/iconv.php b/prototypes/iconv.php index 8f472161b9..154a95a551 100644 --- a/prototypes/iconv.php +++ b/prototypes/iconv.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - function iconv($in_charset, $out_charset, $str) { } diff --git a/prototypes/igbinary.php b/prototypes/igbinary.php index 2d401055ee..cf5c3819ab 100644 --- a/prototypes/igbinary.php +++ b/prototypes/igbinary.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - function igbinary_serialize($data) { } diff --git a/prototypes/imagick.php b/prototypes/imagick.php index 8ca7573c0d..d33d0b77cf 100644 --- a/prototypes/imagick.php +++ b/prototypes/imagick.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - class Imagick { public function setImageAlphaChannel($channel) diff --git a/prototypes/mcrypt.php b/prototypes/mcrypt.php index c8f973b65d..314060df72 100644 --- a/prototypes/mcrypt.php +++ b/prototypes/mcrypt.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - function mcrypt_list_algorithms() { } diff --git a/prototypes/memcache.php b/prototypes/memcache.php index ff110c767a..d0c31ef462 100644 --- a/prototypes/memcache.php +++ b/prototypes/memcache.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - define('MEMCACHE_HAVE_SESSION', 1); define('MEMCACHE_COMPRESSED', 2); diff --git a/prototypes/memcached.php b/prototypes/memcached.php index b0734977dc..1c1d4bde0c 100644 --- a/prototypes/memcached.php +++ b/prototypes/memcached.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - class Memcached { const OPT_COMPRESSION = -1001; diff --git a/prototypes/mongo.php b/prototypes/mongo.php index 2722d7f840..c61abfbd8d 100644 --- a/prototypes/mongo.php +++ b/prototypes/mongo.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - if (!class_exists('MongoRegex', false)) { class MongoRegex { diff --git a/prototypes/msgpack.php b/prototypes/msgpack.php index 97959bfa5e..f240502040 100644 --- a/prototypes/msgpack.php +++ b/prototypes/msgpack.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - define('MSGPACK_CLASS_OPT_PHPONLY', -1001); /** diff --git a/prototypes/redis.php b/prototypes/redis.php index 1797fac189..62ccb2f29f 100644 --- a/prototypes/redis.php +++ b/prototypes/redis.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - class redis { /** diff --git a/prototypes/xcache.php b/prototypes/xcache.php index 7a09b2d4c3..670b530e0b 100644 --- a/prototypes/xcache.php +++ b/prototypes/xcache.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - function xcache_get($name) { } diff --git a/prototypes/yaml.php b/prototypes/yaml.php index bbb597f1bd..344098f099 100644 --- a/prototypes/yaml.php +++ b/prototypes/yaml.php @@ -8,7 +8,6 @@ * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ - function yaml_parse_file($filename, $pos = 0, &$ndocs = 0, $callbacks = null) { } diff --git a/src/Statements/IfStatement.php b/src/Statements/IfStatement.php index 85a75d7718..763f519d43 100644 --- a/src/Statements/IfStatement.php +++ b/src/Statements/IfStatement.php @@ -74,7 +74,7 @@ public function compile(CompilationContext $compilationContext): void $symbolTable = $compilationContext->symbolTable; foreach ($skipVariantInit->getVariables() as $variable) { - if ($symbolTable->hasVariable((string)$variable)) { + if ($symbolTable->hasVariable((string) $variable)) { $symbolVariable = $symbolTable->getVariable($variable); if ('variable' === $symbolVariable->getType()) { if (!$readDetector->detect($variable, $exprRaw)) { diff --git a/tests/Extension/Optimizers/IsPhpVersionTest.php b/tests/Extension/Optimizers/IsPhpVersionTest.php index ea8cb6e590..d83731e2cf 100644 --- a/tests/Extension/Optimizers/IsPhpVersionTest.php +++ b/tests/Extension/Optimizers/IsPhpVersionTest.php @@ -243,9 +243,9 @@ protected function onNotSuccessfulTest(\Throwable $error): void * * @throws \Exception */ - private function isPhpVersion(float|int|string $version): bool + private function isPhpVersion(float | int | string $version): bool { - preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', (string)$version, $matches); + preg_match('/^(?\d+)(?:\.(?!?\d+))?(?:\.(?!?\d+))?(?:[^Ee0-9.]+.*)?$/', (string) $version, $matches); if (!\count($matches)) { throw new \Exception('Could not parse PHP version'); } From c801f629375ce600098a830c9bba3c6ee27a9a74 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:01:04 +0000 Subject: [PATCH 175/375] Remove `zephir_memory_observe(var)` macro --- kernel/memory.h | 1 - src/Variable/Variable.php | 2 -- 2 files changed, 3 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index d39c265f61..54991dc4af 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -53,7 +53,6 @@ void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); void zephir_deinitialize_memory(); void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g); -#define zephir_memory_observe(var) do { /* dummy code */ } while (0) #define zephir_safe_zval_ptr_dtor(pzval) diff --git a/src/Variable/Variable.php b/src/Variable/Variable.php index a83f38361c..f1e0c149b6 100644 --- a/src/Variable/Variable.php +++ b/src/Variable/Variable.php @@ -929,8 +929,6 @@ public function observeVariant(CompilationContext $compilationContext): void if ($this->variantInits > 0 || $compilationContext->insideCycle) { $this->mustInitNull = true; $compilationContext->codePrinter->output('ZEPHIR_OBS_NVAR('.$symbol.');'); - } else { - $compilationContext->codePrinter->output('zephir_memory_observe('.$symbol.');'); } ++$this->variantInits; From 1b2737c192823c4bc8bfc32e93417982e4647936 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:03:34 +0000 Subject: [PATCH 176/375] Remove `zephir_memory_grow_stack` function --- kernel/memory.c | 22 ---------------------- kernel/memory.h | 1 - 2 files changed, 23 deletions(-) diff --git a/kernel/memory.c b/kernel/memory.c index bf47e5bc5a..34b4fc666b 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -45,28 +45,6 @@ static zend_always_inline zend_execute_data* find_symbol_table(zend_execute_data return ex; } -/** - * Adds a memory frame in the current executed method - */ -void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func) -{ - if (g->active_memory == NULL) { - zephir_memory_entry *active_memory; - active_memory = (zephir_memory_entry *) pecalloc(1, sizeof(zephir_memory_entry), 0); - active_memory->addresses = pecalloc(24, sizeof(zval*), 0); - active_memory->capacity = 24; - - g->active_memory = active_memory; - } - - assert(g->active_memory != NULL); - assert(g->active_memory->pointer == 0); - -#ifndef ZEPHIR_RELEASE - g->active_memory->func = func; -#endif -} - void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func) { size_t i; diff --git a/kernel/memory.h b/kernel/memory.h index 54991dc4af..d7b11d6854 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -44,7 +44,6 @@ typedef struct _zephir_method_globals { } zephir_method_globals; /* Memory Frames */ -void ZEPHIR_FASTCALL zephir_memory_grow_stack(zephir_method_globals *g, const char *func); void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func); #define ZEPHIR_MM_RESTORE() do { /* dummy code */ } while (0) From 5c8365efebbcb87dd1ca21100dc40ca95492d634 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:03:45 +0000 Subject: [PATCH 177/375] Remove `zephir_memory_grow_stack` function gener --- src/Class/Method/Method.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 7140170ceb..6a9bcbf52f 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1715,25 +1715,6 @@ public function compile(CompilationContext $compilationContext): void } } - /** - * Grow the stack if needed - */ - /*if ($symbolTable->getMustGrownStack()) { - $compilationContext->headersManager->add('kernel/memory'); - if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_METHOD_GLOBALS_PTR')) { - $methodGlobals = new Variable('zephir_method_globals', 'ZEPHIR_METHOD_GLOBALS_PTR', $compilationContext->branchManager->getCurrentBranch()); - $methodGlobals->setMustInitNull(true); - $methodGlobals->increaseUses(); - $methodGlobals->setReusable(false); - $methodGlobals->setReadOnly(true); - $compilationContext->symbolTable->addRawVariable($methodGlobals); - } - - // #define ZEPHIR_MM_GROW() - $codePrinter->preOutput("\t".'zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__);'.PHP_EOL); - $codePrinter->preOutput("\t".'ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0);'); - }*/ - /** * Check if there are unused variables. */ From a627e0ad0c1a28cedd68d1a396cb0645ec5e1ea4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:07:57 +0000 Subject: [PATCH 178/375] Remove `zephir_memory_restore_stack()` function --- kernel/memory.c | 113 ------------------------------------------------ kernel/memory.h | 3 -- 2 files changed, 116 deletions(-) diff --git a/kernel/memory.c b/kernel/memory.c index 34b4fc666b..6f0f606b12 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -45,119 +45,6 @@ static zend_always_inline zend_execute_data* find_symbol_table(zend_execute_data return ex; } -void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func) -{ - size_t i; - zephir_memory_entry *active_memory; - zephir_symbol_table *active_symbol_table; - zval *ptr; -#ifndef ZEPHIR_RELEASE - int show_backtrace = 0; -#endif - -#ifndef ZEPHIR_RELEASE - if (UNEXPECTED(g->active_memory == NULL)) { - fprintf(stderr, "WARNING: calling zephir_memory_restore_stack() without an active memory frame!\n"); - fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); - fprintf(stderr, "Calling function: %s\n", func); - zephir_print_backtrace(); - return; - } - - if (UNEXPECTED(g->active_memory->func != func)) { - fprintf(stderr, "Trying to free someone else's memory frame!\n"); - fprintf(stderr, "The frame was created by %s\n", g->active_memory->func); - fprintf(stderr, "Calling function: %s\n", func); - zephir_print_backtrace(); - return; - } -#endif - - active_memory = g->active_memory; - assert(active_memory != NULL); - - if (EXPECTED(!CG(unclean_shutdown))) { - /* Clean active symbol table */ - if (g->active_symbol_table) { - active_symbol_table = g->active_symbol_table; - while (active_symbol_table && active_symbol_table->scope == active_memory) { - zend_execute_data *ex = find_symbol_table(EG(current_execute_data)); -#ifndef ZEPHIR_RELEASE - if (UNEXPECTED(!ex)) { - fprintf(stderr, "ERROR: unable to find a symbol table"); - zephir_print_backtrace(); - return; - } -#endif - zend_hash_destroy(ex->symbol_table); - efree(ex->symbol_table); - ex->symbol_table = active_symbol_table->symbol_table; - zend_attach_symbol_table(ex); - zend_rebuild_symbol_table(); - - g->active_symbol_table = active_symbol_table->prev; - efree(active_symbol_table); - active_symbol_table = g->active_symbol_table; - } - } - -#ifndef ZEPHIR_RELEASE - for (i = 0; i < active_memory->pointer; ++i) { - if (active_memory->addresses[i] != NULL) { - zval *var = active_memory->addresses[i]; - if (Z_TYPE_P(var) > IS_CALLABLE) { - fprintf(stderr, "%s: observed variable #%d (%p) has invalid type %u [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } - - if (!Z_REFCOUNTED_P(var)) { - continue; - } - - if (Z_REFCOUNT_P(var) == 0) { - fprintf(stderr, "%s: observed variable #%d (%p) has 0 references, type=%d [%s]\n", __func__, (int)i, var, Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } - else if (Z_REFCOUNT_P(var) >= 1000000) { - fprintf(stderr, "%s: observed variable #%d (%p) has too many references (%u), type=%d [%s]\n", __func__, (int)i, var, Z_REFCOUNT_P(var), Z_TYPE_P(var), active_memory->func); - show_backtrace = 1; - } - } - } -#endif - - /* Traverse all zvals allocated, reduce the reference counting or free them */ - for (i = 0; i < active_memory->pointer; ++i) { - ptr = active_memory->addresses[i]; - if (EXPECTED(ptr != NULL)) { - if (!Z_REFCOUNTED_P(ptr)) continue; - if (Z_REFCOUNT_P(ptr) == 1) { - zval_ptr_dtor(ptr); - } else { - Z_DELREF_P(ptr); - } - } - } - } - -#ifndef ZEPHIR_RELEASE - active_memory->func = NULL; -#endif - - if (active_memory->addresses != NULL) { - pefree(active_memory->addresses, 0); - } - - pefree(g->active_memory, 0); - g->active_memory = NULL; - -#ifndef ZEPHIR_RELEASE - if (show_backtrace == 1) { - zephir_print_backtrace(); - } -#endif -} - /** * Pre-allocates memory for further use in execution */ diff --git a/kernel/memory.h b/kernel/memory.h index d7b11d6854..12c56c53a6 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -43,9 +43,6 @@ typedef struct _zephir_method_globals { zephir_symbol_table *active_symbol_table; } zephir_method_globals; -/* Memory Frames */ -void ZEPHIR_FASTCALL zephir_memory_restore_stack(zephir_method_globals *g, const char *func); - #define ZEPHIR_MM_RESTORE() do { /* dummy code */ } while (0) void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); From 11b5e559b5b80b4614c4917948f71183b657934c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:11:06 +0000 Subject: [PATCH 179/375] Remove `ZEPHIR_MM_RESTORE()` macro --- kernel/memory.h | 2 -- src/Class/Method/Method.php | 7 ++----- src/Optimizers/FunctionCall/ExitOptimizer.php | 4 ---- src/Statements/ThrowStatement.php | 1 - 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 12c56c53a6..4c35d371fb 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -43,8 +43,6 @@ typedef struct _zephir_method_globals { zephir_symbol_table *active_symbol_table; } zephir_method_globals; -#define ZEPHIR_MM_RESTORE() do { /* dummy code */ } while (0) - void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); void zephir_deinitialize_memory(); diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 6a9bcbf52f..5de2fe4414 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -820,6 +820,8 @@ public function getCallGathererPass(): CallGathererPass /** * Replace macros. + * + * @deprecated */ public function removeMemoryStackReferences(SymbolTable $symbolTable, string $containerCode): string { @@ -1841,11 +1843,6 @@ public function compile(CompilationContext $compilationContext): void $lastType = $this->statements->getLastStatementType(); if ('return' !== $lastType && 'throw' !== $lastType && !$this->hasChildReturnStatementType($statement)) { - /*if ($symbolTable->getMustGrownStack()) { - $compilationContext->headersManager->add('kernel/memory'); - $codePrinter->output("\t".'ZEPHIR_MM_RESTORE();'); - }*/ - /** * If a method has return-type hints we need to ensure the last statement is a 'return' statement */ diff --git a/src/Optimizers/FunctionCall/ExitOptimizer.php b/src/Optimizers/FunctionCall/ExitOptimizer.php index d70ec8e2e7..233d8af3a0 100644 --- a/src/Optimizers/FunctionCall/ExitOptimizer.php +++ b/src/Optimizers/FunctionCall/ExitOptimizer.php @@ -20,8 +20,6 @@ use Zephir\Optimizers\OptimizerAbstract; /** - * ExitOptimizer. - * * Optimizes calls to 'exit' using internal function */ class ExitOptimizer extends OptimizerAbstract @@ -46,11 +44,9 @@ public function optimize(array $expression, Call $call, CompilationContext $cont // TODO: protect resolvedParams[0] from restore } if (!isset($expression['parameters'])) { - // $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); $context->codePrinter->output('zephir_exit_empty();'); } else { $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression); - // $context->codePrinter->output('ZEPHIR_MM_RESTORE();'); $context->codePrinter->output('zephir_exit('.$resolvedParams[0].');'); } diff --git a/src/Statements/ThrowStatement.php b/src/Statements/ThrowStatement.php index 129cccfb35..d4e4f2e43d 100644 --- a/src/Statements/ThrowStatement.php +++ b/src/Statements/ThrowStatement.php @@ -123,7 +123,6 @@ public function compile(CompilationContext $compilationContext): void ); if (!$compilationContext->insideTryCatch) { - // $codePrinter->output('ZEPHIR_MM_RESTORE();'); $codePrinter->output('return;'); } else { $codePrinter->output('goto try_end_'.$compilationContext->currentTryCatch.';'); From ecd769e0d069e7b198c140b4c67a9b399ac29dcc Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:14:52 +0000 Subject: [PATCH 180/375] Remove `ZEPHIR_CREATE_SYMBOL_TABLE()` macro --- .../FunctionCall/CreateSymbolTableOptimizer.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php b/src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php index 425dea6b43..8224396cfe 100644 --- a/src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php +++ b/src/Optimizers/FunctionCall/CreateSymbolTableOptimizer.php @@ -1,7 +1,5 @@ processExpectedReturn($context); @@ -59,11 +59,9 @@ public function optimize(array $expression, Call $call, CompilationContext $cont $symbolVariable->initVariant($context); } + // TODO: Still needed? $context->symbolTable->mustGrownStack(true); - $context->codePrinter->output('ZEPHIR_CREATE_SYMBOL_TABLE();'); - $context->codePrinter->output(''); - return new CompiledExpression('null', null, $expression); } } From 26e6b33e4e4a40fcdd38e7fc6e6f0b419cbae433 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:17:52 +0000 Subject: [PATCH 181/375] Remove `ZEPHIR_CREATE_SYMBOL_TABLE()` macro --- kernel/memory.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 4c35d371fb..d5ae07a1ce 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -52,8 +52,6 @@ void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_glo void zephir_create_symbol_table(zephir_method_globals *g); -#define ZEPHIR_CREATE_SYMBOL_TABLE() do { /* dummy code */ } while (0) - int zephir_set_symbol(zval *key_name, zval *value); #define ZEPHIR_INIT_VAR(z) \ From 86e516823a1ada60829f272215fabfc44250bcac Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:19:42 +0000 Subject: [PATCH 182/375] Replace `ZEPHIR_OBS_COPY_OR_DUP()` macro with `ZVAL_COPY()` --- kernel/memory.h | 3 --- src/Backend/Backend.php | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index d5ae07a1ce..ad785eb01a 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -86,9 +86,6 @@ int zephir_set_symbol(zval *key_name, zval *value); } \ ZVAL_DUP(d, v); -#define ZEPHIR_OBS_COPY_OR_DUP(z, v) \ - ZVAL_COPY(z, v); - #define ZEPHIR_HASH_COPY(z, v) \ if (Z_TYPE_P(z) == IS_ARRAY && Z_TYPE_P(v) == IS_ARRAY) { \ zend_hash_copy(Z_ARRVAL_P(z), Z_ARRVAL_P(v), (copy_ctor_func_t) zval_add_ref); \ diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index 3a55b08f96..35ad8b15ec 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -544,7 +544,7 @@ public function assignZval(Variable $variable, $code, CompilationContext $contex if (!$variable->isDoublePointer()) { $context->symbolTable->mustGrownStack(true); $symbolVariable = $this->getVariableCode($variable); - $context->codePrinter->output('ZEPHIR_OBS_COPY_OR_DUP('.$symbolVariable.', '.$code.');'); + $context->codePrinter->output('ZVAL_COPY('.$symbolVariable.', '.$code.');'); } else { $context->codePrinter->output($variable->getName().' = '.$code.';'); } From 3d0befe54010fce100b3f7e6b13b7481d2199802 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:23:43 +0000 Subject: [PATCH 183/375] Remove `zephir_create_symbol_table` function --- kernel/memory.c | 41 ----------------------------------------- kernel/memory.h | 2 -- 2 files changed, 43 deletions(-) diff --git a/kernel/memory.c b/kernel/memory.c index 6f0f606b12..4f1703dd85 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -75,47 +75,6 @@ void zephir_deinitialize_memory() zephir_globals_ptr->initialized = 0; } -/** - * Creates a virtual symbol tables dynamically - */ -void zephir_create_symbol_table(zephir_method_globals *gptr) -{ - zephir_symbol_table *entry; - zend_array *symbol_table; - -#ifndef ZEPHIR_RELEASE - if (!gptr->active_memory) { - fprintf(stderr, "ERROR: Trying to create a virtual symbol table without a memory frame"); - zephir_print_backtrace(); - return; - } -#endif - - zend_execute_data* ex = find_symbol_table(EG(current_execute_data)); -#ifndef ZEPHIR_RELEASE - if (UNEXPECTED(!ex)) { - fprintf(stderr, "ERROR: unable to find a symbol table"); - zephir_print_backtrace(); - return; - } -#endif - - zend_rebuild_symbol_table(); - zend_detach_symbol_table(ex); - - entry = (zephir_symbol_table*)emalloc(sizeof(zephir_symbol_table)); - entry->scope = gptr->active_memory; - entry->symbol_table = ex->symbol_table; - entry->prev = gptr->active_symbol_table; - - symbol_table = (zend_array*)emalloc(sizeof(zend_array)); - zend_hash_init(symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0); - zend_hash_real_init(symbol_table, 0); - - ex->symbol_table = symbol_table; - gptr->active_symbol_table = entry; -} - /** * Exports symbols to the active symbol table */ diff --git a/kernel/memory.h b/kernel/memory.h index ad785eb01a..beb0aa493d 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -50,8 +50,6 @@ void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_glo #define zephir_safe_zval_ptr_dtor(pzval) -void zephir_create_symbol_table(zephir_method_globals *g); - int zephir_set_symbol(zval *key_name, zval *value); #define ZEPHIR_INIT_VAR(z) \ From a0aebe51a38b8c2930fbf5fa6380178789066835 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:27:18 +0000 Subject: [PATCH 184/375] Remove `zephir_do_memory_observe()` function --- kernel/memory.c | 39 --------------------------------------- kernel/memory.h | 2 -- 2 files changed, 41 deletions(-) diff --git a/kernel/memory.c b/kernel/memory.c index 4f1703dd85..37bb2d0ddd 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -95,42 +95,3 @@ int zephir_set_symbol(zval *key_name, zval *value) return SUCCESS; } - -void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g) -{ - zephir_memory_entry *frame = g->active_memory; -#ifndef ZEPHIR_RELEASE - if (UNEXPECTED(frame == NULL)) { - fprintf(stderr, "ZEPHIR_MM_GROW() must be called before using any of MM functions or macros!"); - zephir_print_backtrace(); - abort(); - } -#endif - - if (UNEXPECTED(frame->pointer == frame->capacity)) { - void *buf = perealloc(frame->addresses, sizeof(zval *) * (frame->capacity + 16), 0); - if (EXPECTED(buf != NULL)) { - frame->capacity += 16; - frame->addresses = buf; - } else { - zend_error(E_CORE_ERROR, "Memory allocation failed"); - return; - } - } - -#ifndef ZEPHIR_RELEASE - { - size_t i; - for (i = 0; i < frame->pointer; ++i) { - if (frame->addresses[i] == var) { - fprintf(stderr, "Variable %p is already observed", var); - zephir_print_backtrace(); - abort(); - } - } - } -#endif - - frame->addresses[frame->pointer] = var; - ++frame->pointer; -} diff --git a/kernel/memory.h b/kernel/memory.h index beb0aa493d..9456a690d2 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -46,8 +46,6 @@ typedef struct _zephir_method_globals { void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); void zephir_deinitialize_memory(); -void ZEPHIR_FASTCALL zephir_do_memory_observe(zval *var, const zephir_method_globals *g); - #define zephir_safe_zval_ptr_dtor(pzval) int zephir_set_symbol(zval *key_name, zval *value); From 081ba057819ec24c37d6da05437b43baca63eb74 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:30:46 +0000 Subject: [PATCH 185/375] Remove `find_symbol_table()` function --- kernel/memory.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/kernel/memory.c b/kernel/memory.c index 37bb2d0ddd..964f9b91f7 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -36,15 +36,6 @@ * Not all methods must grow/restore the zephir_memory_entry. */ -static zend_always_inline zend_execute_data* find_symbol_table(zend_execute_data* ex) -{ - while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->common.type))) { - ex = ex->prev_execute_data; - } - - return ex; -} - /** * Pre-allocates memory for further use in execution */ From 1156682aef3fda59155e5904eecf36cbe29a72cb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:37:15 +0000 Subject: [PATCH 186/375] Remove `ZEPHIR_INIT_VAR()` macro with `ZVAL_NULL()` --- kernel/memory.h | 3 --- kernel/operators.h | 2 +- src/Backend/Backend.php | 2 +- src/Variable/Variable.php | 8 ++++---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 9456a690d2..a909482813 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -50,9 +50,6 @@ void zephir_deinitialize_memory(); int zephir_set_symbol(zval *key_name, zval *value); -#define ZEPHIR_INIT_VAR(z) \ - ZVAL_NULL(z); - #define ZEPHIR_INIT_NVAR(z) \ do { \ if (Z_REFCOUNTED_P(z) && !Z_ISREF_P(z)) { \ diff --git a/kernel/operators.h b/kernel/operators.h index 44351f897a..7659b62c8b 100644 --- a/kernel/operators.h +++ b/kernel/operators.h @@ -229,7 +229,7 @@ long zephir_safe_mod_double_zval(double op1, zval *op2); if (Z_TYPE_P(right) == IS_STRING) { \ ZEPHIR_CPY_WRT(left, right); \ } else if (Z_TYPE_P(right) == IS_NULL) { \ - ZEPHIR_INIT_VAR(left); \ + ZVAL_NULL(left); \ } else { \ use_copy_right = zephir_make_printable_zval(right, &right_tmp); \ if (use_copy_right) { \ diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index 35ad8b15ec..2859674ebe 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -102,7 +102,7 @@ public function declareVariables($method, $typeToVariables) public function initVar(Variable $variable, CompilationContext $context, bool $useCodePrinter = true, bool $second = false): string { - $macro = !$second ? 'ZEPHIR_INIT_VAR' : 'ZEPHIR_INIT_NVAR'; + $macro = !$second ? 'ZVAL_NULL' : 'ZEPHIR_INIT_NVAR'; $code = $macro.'('.$this->getVariableCode($variable).');'; if ($useCodePrinter) { $context->codePrinter->output($code); diff --git a/src/Variable/Variable.php b/src/Variable/Variable.php index f1e0c149b6..9f99eed808 100644 --- a/src/Variable/Variable.php +++ b/src/Variable/Variable.php @@ -776,7 +776,7 @@ public function initVariant(CompilationContext $compilationContext): void } /** - * Variables are allocated for the first time using ZEPHIR_INIT_VAR + * Variables are allocated for the first time using ZVAL_NULL * the second, third, etc. times are allocated using ZEPHIR_INIT_NVAR * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR */ @@ -809,7 +809,7 @@ public function initVariant(CompilationContext $compilationContext): void $this->mustInitNull = true; $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&'.$this->getName().');'); } else { - $compilationContext->codePrinter->output('ZEPHIR_INIT_VAR(&'.$this->getName().');'); + $compilationContext->codePrinter->output('ZVAL_NULL(&'.$this->getName().');'); } } @@ -832,7 +832,7 @@ public function trackVariant(CompilationContext $compilationContext): void } /** - * Variables are allocated for the first time using ZEPHIR_INIT_VAR + * Variables are allocated for the first time using ZVAL_NULL * the second, third, etc. times are allocated using ZEPHIR_INIT_NVAR * Variables initialized for the first time in a cycle are always initialized using ZEPHIR_INIT_NVAR */ @@ -895,7 +895,7 @@ public function initComplexLiteralVariant(CompilationContext $compilationContext $this->mustInitNull = true; $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&'.$this->getName().');'); } else { - $compilationContext->codePrinter->output('ZEPHIR_INIT_VAR(&'.$this->getName().');'); + $compilationContext->codePrinter->output('ZVAL_NULL(&'.$this->getName().');'); } } From 40e4e97be3516ac80aa8bc52ff49a69bb65c1d7a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:40:12 +0000 Subject: [PATCH 187/375] Remove `zephir_safe_zval_ptr_dtor()` macro --- kernel/memory.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index a909482813..17a6ce08c5 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -45,9 +45,6 @@ typedef struct _zephir_method_globals { void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); void zephir_deinitialize_memory(); - -#define zephir_safe_zval_ptr_dtor(pzval) - int zephir_set_symbol(zval *key_name, zval *value); #define ZEPHIR_INIT_NVAR(z) \ From 5a4fbc06e100193f0613e12a8c50e8637adabe3c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:45:13 +0000 Subject: [PATCH 188/375] Remove unused structs --- kernel/memory.h | 26 -------------------------- src/Backend/Backend.php | 5 ----- 2 files changed, 31 deletions(-) diff --git a/kernel/memory.h b/kernel/memory.h index 17a6ce08c5..800ccafb31 100644 --- a/kernel/memory.h +++ b/kernel/memory.h @@ -17,32 +17,6 @@ #include "php_ext.h" #include "kernel/globals.h" -/** Memory frame */ -typedef struct _zephir_memory_entry { - size_t pointer; - size_t capacity; - zval **addresses; -#ifndef ZEPHIR_RELEASE - int permanent; - const char *func; -#endif -} zephir_memory_entry; - -/** Virtual Symbol Table */ -typedef struct _zephir_symbol_table { - struct _zephir_memory_entry *scope; - zend_array *symbol_table; - struct _zephir_symbol_table *prev; -} zephir_symbol_table; - -typedef struct _zephir_method_globals { - /* Memory */ - zephir_memory_entry *active_memory; /**< The current memory frame */ - - /* Virtual Symbol Tables */ - zephir_symbol_table *active_symbol_table; -} zephir_method_globals; - void zephir_initialize_memory(zend_zephir_globals_def *zephir_globals_ptr); void zephir_deinitialize_memory(); int zephir_set_symbol(zval *key_name, zval *value); diff --git a/src/Backend/Backend.php b/src/Backend/Backend.php index 2859674ebe..605c486618 100644 --- a/src/Backend/Backend.php +++ b/src/Backend/Backend.php @@ -220,11 +220,6 @@ public function getTypeDefinition($type): array $code = 'zephir_fcall_cache_entry'; break; - case 'zephir_method_globals': - $pointer = '*'; - $code = 'zephir_method_globals'; - break; - default: throw new CompilerException('Unsupported type in declare: '.$type); } From 61e4f25d57bbc312945f4ab42be3c1fd4ccbfb45 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 17:48:47 +0000 Subject: [PATCH 189/375] Replace `RETURN_MM()` macro to `return` --- kernel/main.h | 5 +---- src/Class/Method/Method.php | 1 - src/Operators/Other/CloneOperator.php | 2 +- src/Statements/ReturnStatement.php | 6 +++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/kernel/main.h b/kernel/main.h index 513f670d88..a191372de5 100644 --- a/kernel/main.h +++ b/kernel/main.h @@ -157,9 +157,6 @@ extern zend_string* i_self; zephir_return_property(return_value, object, SL(member_name)); \ return; -/** Return without change return_value */ -#define RETURN_MM() { return; } - /** Return null restoring memory frame */ #define RETURN_MM_BOOL(value) { RETVAL_BOOL(value); return; } @@ -178,7 +175,7 @@ extern zend_string* i_self; */ #define RETURN_MM_MEMBER(object, member_name) \ zephir_return_property(return_value, object, SL(member_name)); \ - RETURN_MM(); + return; #define RETURN_ON_FAILURE(what) \ do { \ diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 5de2fe4414..72a504a19a 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -848,7 +848,6 @@ public function removeMemoryStackReferences(SymbolTable $symbolTable, string $co $containerCode = str_replace('RETURN_MM_EMPTY_STRING', 'RETURN_MM_EMPTY_STRING', $containerCode); $containerCode = str_replace('RETURN_MM_EMPTY_ARRAY', 'RETURN_EMPTY_ARRAY', $containerCode); $containerCode = str_replace('RETURN_MM_MEMBER', 'RETURN_MEMBER', $containerCode); - $containerCode = str_replace('RETURN_MM()', 'return', $containerCode); return preg_replace('/[ \t]+ZEPHIR_MM_RESTORE\(\);'.PHP_EOL.'/s', '', $containerCode); } diff --git a/src/Operators/Other/CloneOperator.php b/src/Operators/Other/CloneOperator.php index 56e1a91350..66a4bbe6b3 100644 --- a/src/Operators/Other/CloneOperator.php +++ b/src/Operators/Other/CloneOperator.php @@ -74,7 +74,7 @@ public function compile(array $expression, CompilationContext $compilationContex $clonedSymbol = $compilationContext->backend->getVariableCode($clonedVariable); $compilationContext->codePrinter->output('if (zephir_clone('.$symbol.', '.$clonedSymbol.') == FAILURE) {'); - $compilationContext->codePrinter->output("\t".'RETURN_MM();'); + $compilationContext->codePrinter->output("\t".'return;'); $compilationContext->codePrinter->output('}'); return new CompiledExpression('variable', $symbolVariable->getName(), $expression); diff --git a/src/Statements/ReturnStatement.php b/src/Statements/ReturnStatement.php index 10c72cd0bd..51bd7960a6 100644 --- a/src/Statements/ReturnStatement.php +++ b/src/Statements/ReturnStatement.php @@ -222,7 +222,7 @@ public function compile(CompilationContext $compilationContext): void if ('return_value' != $resolvedExpr->getCode()) { $codePrinter->output('RETURN_CTOR('.$resolvedExpr->getCode().');'); } else { - $codePrinter->output('RETURN_MM();'); + $codePrinter->output('return;'); } break; @@ -300,10 +300,10 @@ public function compile(CompilationContext $compilationContext): void $compilationContext->backend->getVariableCode($symbolVariable) ) ); - $codePrinter->output('RETURN_MM();'); + $codePrinter->output('return;'); } } else { - $codePrinter->output('RETURN_MM();'); + $codePrinter->output('return;'); } } if ($symbolVariable->isTemporal()) { From 042e6902b6cdaff0328d6013371e2a0df415b5b3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 18:44:01 +0000 Subject: [PATCH 190/375] Remove generation of redundant `ZVAL_NULL()` --- src/Variable/Variable.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Variable/Variable.php b/src/Variable/Variable.php index 9f99eed808..8ceab884d2 100644 --- a/src/Variable/Variable.php +++ b/src/Variable/Variable.php @@ -808,8 +808,6 @@ public function initVariant(CompilationContext $compilationContext): void if ($this->variantInits > 0 || $compilationContext->insideCycle) { $this->mustInitNull = true; $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&'.$this->getName().');'); - } else { - $compilationContext->codePrinter->output('ZVAL_NULL(&'.$this->getName().');'); } } @@ -894,8 +892,6 @@ public function initComplexLiteralVariant(CompilationContext $compilationContext if ($this->variantInits > 0 || $compilationContext->insideCycle) { $this->mustInitNull = true; $compilationContext->codePrinter->output('ZEPHIR_INIT_NVAR(&'.$this->getName().');'); - } else { - $compilationContext->codePrinter->output('ZVAL_NULL(&'.$this->getName().');'); } } From 8a7a20004e790ae34e41d2cc54309ae1111b3dac Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 22:57:14 +0000 Subject: [PATCH 191/375] Remove picking parameter value from `zephir_get_intval()` As it already filled in `Z_PARAM_LONG()` --- src/Class/Method/Method.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 72a504a19a..fe1f9f0855 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1231,7 +1231,8 @@ public function assignZvalValue(array $parameter, CompilationContext $compilatio case 'uint': case 'long': case 'ulong': - return "\t".$parameter['name'].' = zephir_get_intval('.$parameterCode.');'.PHP_EOL; + // Value already passed in `Z_PARAM_LONG()` + return ''; case 'char': return "\t".$parameter['name'].' = zephir_get_charval('.$parameterCode.');'.PHP_EOL; From 331b62cfab126f52eeb4b9e4007918167db809da Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 26 Nov 2023 23:12:01 +0000 Subject: [PATCH 192/375] Optimize imports --- src/Class/Method/Method.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index fe1f9f0855..fbc9ec23ed 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -32,7 +32,6 @@ use Zephir\Passes\StaticTypeInference; use Zephir\StatementsBlock; use Zephir\SymbolTable; -use Zephir\Variable\Variable; /** * Represents a class method From 9a9adbd263a39052a19761ff2bf28529543af984 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 10:55:32 -0600 Subject: [PATCH 193/375] sonarlint suggestions --- src/Class/Method/Method.php | 23 +++++++++++++---------- src/Statements/ReturnStatement.php | 11 +++++++---- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index fbc9ec23ed..1b68b3f966 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1841,16 +1841,19 @@ public function compile(CompilationContext $compilationContext): void */ $lastType = $this->statements->getLastStatementType(); - if ('return' !== $lastType && 'throw' !== $lastType && !$this->hasChildReturnStatementType($statement)) { - /** - * If a method has return-type hints we need to ensure the last statement is a 'return' statement - */ - if ($this->hasReturnTypes()) { - throw new CompilerException( - 'Reached end of the method without returning a valid type specified in the return-type hints', - $this->expression['return-type'] - ); - } + /** + * If a method has return-type hints we need to ensure the last + * statement is a 'return' statement + */ + if ( + 'return' !== $lastType && + 'throw' !== $lastType && !$this->hasChildReturnStatementType($statement) && + $this->hasReturnTypes() + ) { + throw new CompilerException( + 'Reached end of the method without returning a valid type specified in the return-type hints', + $this->expression['return-type'] + ); } } diff --git a/src/Statements/ReturnStatement.php b/src/Statements/ReturnStatement.php index 51bd7960a6..75a5567f7a 100644 --- a/src/Statements/ReturnStatement.php +++ b/src/Statements/ReturnStatement.php @@ -13,6 +13,7 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; @@ -26,11 +27,13 @@ */ final class ReturnStatement extends StatementAbstract { + private const RETURN_RETURN = 'return;'; + /** * @param CompilationContext $compilationContext * * @throws Exception - * @throws \ReflectionException + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -222,7 +225,7 @@ public function compile(CompilationContext $compilationContext): void if ('return_value' != $resolvedExpr->getCode()) { $codePrinter->output('RETURN_CTOR('.$resolvedExpr->getCode().');'); } else { - $codePrinter->output('return;'); + $codePrinter->output(self::RETURN_RETURN); } break; @@ -300,10 +303,10 @@ public function compile(CompilationContext $compilationContext): void $compilationContext->backend->getVariableCode($symbolVariable) ) ); - $codePrinter->output('return;'); + $codePrinter->output(self::RETURN_RETURN); } } else { - $codePrinter->output('return;'); + $codePrinter->output(self::RETURN_RETURN); } } if ($symbolVariable->isTemporal()) { From fed26de0e281a2b9271a31168b4196cbc7c2eb3d Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 11:17:33 -0600 Subject: [PATCH 194/375] phpcs --- src/Class/Method/Method.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 1b68b3f966..92a4c40c77 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1847,7 +1847,8 @@ public function compile(CompilationContext $compilationContext): void */ if ( 'return' !== $lastType && - 'throw' !== $lastType && !$this->hasChildReturnStatementType($statement) && + 'throw' !== $lastType && + !$this->hasChildReturnStatementType($statement) && $this->hasReturnTypes() ) { throw new CompilerException( From 8d9efee33ecb5f436cf6f102bfe72ee7db28d485 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 11:27:51 -0600 Subject: [PATCH 195/375] changing to PSR12 --- phpcs.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e70f4be573..5c0705400b 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -18,7 +18,7 @@ - + From f50ed69c12dfd00d5ee5083d753d564c15079846 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 11:51:22 -0600 Subject: [PATCH 196/375] reverting back to psr2 - psr12 in different pr --- phpcs.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 5c0705400b..e70f4be573 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -18,7 +18,7 @@ - + From 0c54d655b7c1751cb429970d9edd47a18615e334 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 11:57:37 -0600 Subject: [PATCH 197/375] phpcs changes --- src/Class/Method/Method.php | 3 +-- src/Statements/ReturnStatement.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index 92a4c40c77..d04e634342 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1845,8 +1845,7 @@ public function compile(CompilationContext $compilationContext): void * If a method has return-type hints we need to ensure the last * statement is a 'return' statement */ - if ( - 'return' !== $lastType && + if ('return' !== $lastType && 'throw' !== $lastType && !$this->hasChildReturnStatementType($statement) && $this->hasReturnTypes() diff --git a/src/Statements/ReturnStatement.php b/src/Statements/ReturnStatement.php index 75a5567f7a..2112ea0f8c 100644 --- a/src/Statements/ReturnStatement.php +++ b/src/Statements/ReturnStatement.php @@ -13,7 +13,6 @@ namespace Zephir\Statements; -use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; @@ -33,7 +32,7 @@ final class ReturnStatement extends StatementAbstract * @param CompilationContext $compilationContext * * @throws Exception - * @throws ReflectionException + * @throws \ReflectionException */ public function compile(CompilationContext $compilationContext): void { From 94042109d17f6f47ef435863a88f9f0de4721a48 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 12:00:22 -0600 Subject: [PATCH 198/375] more phpcs --- src/Class/Method/Method.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Class/Method/Method.php b/src/Class/Method/Method.php index d04e634342..f0ccf328a6 100644 --- a/src/Class/Method/Method.php +++ b/src/Class/Method/Method.php @@ -1845,10 +1845,10 @@ public function compile(CompilationContext $compilationContext): void * If a method has return-type hints we need to ensure the last * statement is a 'return' statement */ - if ('return' !== $lastType && - 'throw' !== $lastType && - !$this->hasChildReturnStatementType($statement) && - $this->hasReturnTypes() + if ('return' !== $lastType + && 'throw' !== $lastType + && !$this->hasChildReturnStatementType($statement) + && $this->hasReturnTypes() ) { throw new CompilerException( 'Reached end of the method without returning a valid type specified in the return-type hints', From 4d58e9ee033e1481c675c60cbf5169523df08a7a Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 12:34:54 -0600 Subject: [PATCH 199/375] updating GH workflow --- .github/workflows/build-win-ext/action.yml | 2 +- .github/workflows/main.yml | 4 ++-- .github/workflows/release.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index 128782e8bf..1816281a08 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -33,7 +33,7 @@ runs: using: 'composite' steps: - name: Setup Downloads Cache - uses: actions/cache@v2 + uses: actions/cache@v.3 with: path: ${{ env.CACHE_DIR }} key: ${{ runner.os }}-downloads-${{ hashFiles('**/.github/workflows/build-win-ext/actions.yml') }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7d46027c05..d64be7ad21 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -118,7 +118,7 @@ jobs: # run: echo "::set-output name=dir::$(composer config cache-files-dir)" # - name: Set Up Composer Cache -# uses: actions/cache@v2 +# uses: actions/cache@v3 # with: # path: ${{ steps.composer-cache.outputs.dir }} # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -190,7 +190,7 @@ jobs: make -j$(getconf _NPROCESSORS_ONLN) - name: Upload Code Coverage Report - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./tests/output/clover.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb9ff91f50..eca84a4562 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: run: echo ::set-output name=dir::$(composer config cache-files-dir) - name: Setup Composer Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} From dcf18d33eb47ab8158d2ca3cedbaff75e6e86c34 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 12:40:24 -0600 Subject: [PATCH 200/375] correcting typo --- .github/workflows/build-win-ext/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index 1816281a08..6a4db676b6 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -33,7 +33,7 @@ runs: using: 'composite' steps: - name: Setup Downloads Cache - uses: actions/cache@v.3 + uses: actions/cache@v3 with: path: ${{ env.CACHE_DIR }} key: ${{ runner.os }}-downloads-${{ hashFiles('**/.github/workflows/build-win-ext/actions.yml') }} From d5bbd896591aa3d00cde1c0d85e32136cefe3fd0 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 14:15:30 -0600 Subject: [PATCH 201/375] updated composer; added shortcut commands --- composer.json | 19 ++++++++++++-- composer.lock | 71 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 81 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 3cf66e6670..7971f1f043 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,8 @@ "ext-pdo_sqlite": "*", "ext-zip": "*", "phpunit/phpunit": "9.5.28", - "psr/log": "1.1.*" + "psr/log": "1.1.*", + "squizlabs/php_codesniffer": "^3.7" }, "config": { "optimize-autoloader": true, @@ -71,5 +72,19 @@ "source": "https://github.com/zephir-lang/zephir", "irc": "irc://irc.freenode.net/zephir", "docs": "https://docs.zephir-lang.com" - } + }, + "scripts": { + "cs": "./vendor/bin/phpcs --standard=phpcs.xml.dist", + "cs-fix": "./vendor/bin/phpcbf --standard=phpcs.xml.dist", + "test": "./vendor/bin/phpunit --testsuite Zephir", + "test-coverage": "./vendor/bin/phpunit --testsuite Zephir --coverage-html ./tests/output/coverage", + "test-coverage-html": "./vendor/bin/phpunit --testsuite Zephir --coverage-php ./tests/output/coverage/coverage.xml" + }, + "scripts-descriptions": { + "cs": "Run PHPCS", + "cs-fix": "Run PHPCBF", + "test": "Run all tests", + "test-coverage": "Run all tests with coverage (clover)", + "test-coverage-html": "Run all tests with coverage (HTML)" + } } diff --git a/composer.lock b/composer.lock index a42e55c631..66b21b4acb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "12ba06c84bf00534e75ea0d79e22a65b", + "content-hash": "b2471ed2d66bc4e86d3c83993063d763", "packages": [ { "name": "monolog/monolog", @@ -2933,18 +2933,75 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2023-02-22T23:07:41+00:00" + }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -2973,7 +3030,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -2981,7 +3038,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], From f686a017dcca8528baf999ab520645e8453f2b9f Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 14:16:13 -0600 Subject: [PATCH 202/375] switching to psr-12 --- phpcs.xml.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e70f4be573..9201b51f68 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -17,8 +17,8 @@ - - + + From 580ea0fdf9d273c41622a6076d57b103c7e879fe Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 27 Nov 2023 17:15:30 -0600 Subject: [PATCH 203/375] a lot of phpcs fixes --- phpcs.xml.dist | 1 + src/AliasManager.php | 71 +- src/Backend/Backend.php | 2637 +++++++------ src/Backend/FcallManager.php | 100 +- src/Backend/FcallManagerInterface.php | 10 +- src/Backend/StringsManager.php | 179 +- src/Backend/VariablesManager.php | 66 +- src/Branch.php | 85 +- src/BranchManager.php | 30 +- src/Builder/FunctionCallBuilder.php | 12 +- .../Operators/AbstractOperatorBuilder.php | 4 +- src/Builder/Operators/CastOperatorBuilder.php | 18 +- .../Operators/UnaryOperatorBuilder.php | 22 +- src/Builder/Statements/IfStatementBuilder.php | 4 +- .../Statements/LetStatementBuilder.php | 4 +- src/Cache/FunctionCache.php | 13 +- src/Cache/Manager.php | 24 +- src/Cache/MethodCache.php | 70 +- src/Cache/SlotsCache.php | 44 +- src/Cache/StaticMethodCache.php | 21 +- src/Call.php | 970 +++-- src/Class/Constant.php | 75 +- src/Class/Definition/Definition.php | 1934 ++++----- src/Class/Entry.php | 70 +- src/Class/Method/Method.php | 3449 +++++++++-------- src/Class/Method/Parameters.php | 101 +- src/Class/Property.php | 351 +- src/Code/ArgInfoDefinition.php | 423 +- src/Code/Builder/Struct.php | 67 +- src/Code/Printer.php | 158 +- src/CompilationContext.php | 138 +- src/CompiledExpression.php | 32 +- src/Compiler.php | 3214 +++++++-------- src/Compiler/FileInterface.php | 16 +- src/CompilerFile.php | 1375 +++---- src/CompilerFileAnonymous.php | 212 +- src/Config.php | 199 +- src/ConfigException.php | 2 +- src/Console/Application.php | 128 +- src/Console/Command/ApiCommand.php | 77 +- src/Console/Command/BuildCommand.php | 30 +- src/Console/Command/CleanCommand.php | 13 +- src/Console/Command/CompileCommand.php | 15 +- .../Command/DevelopmentModeAwareTrait.php | 4 +- src/Console/Command/FullCleanCommand.php | 11 +- src/Console/Command/GenerateCommand.php | 11 +- src/Console/Command/InitCommand.php | 111 +- src/Console/Command/InstallCommand.php | 11 +- src/Console/Command/ListCommand.php | 16 +- src/Console/Command/RemoveOptionsTrait.php | 8 +- src/Console/Command/StubsCommand.php | 13 +- src/Detectors/ReadDetector.php | 19 +- src/Detectors/WriteDetector.php | 159 +- src/Documentation.php | 269 +- src/Documentation/Annotation.php | 12 +- src/Documentation/Annotation/Link.php | 19 +- .../Annotation/ReturnAnnotation.php | 12 +- src/Documentation/Annotation/See.php | 2 +- src/Documentation/Docblock.php | 112 +- src/Documentation/DocblockParser.php | 151 +- src/Documentation/File/ClassFile.php | 26 +- src/Documentation/File/ClassesFile.php | 12 +- src/Documentation/File/IndexFile.php | 14 +- src/Documentation/File/NamespaceFile.php | 26 +- src/Documentation/File/NamespacesFile.php | 16 +- src/Documentation/File/Sitemap.php | 36 +- src/Documentation/File/SourceFile.php | 10 +- src/Documentation/FileInterface.php | 10 +- src/Documentation/NamespaceAccessor.php | 50 +- src/Documentation/NamespaceHelper.php | 31 +- src/Documentation/Template.php | 100 +- src/Documentation/Theme.php | 291 +- src/Exception.php | 4 +- src/Exception/CompilerException.php | 21 +- src/Exception/ExceptionExtraAwareTrait.php | 24 +- src/Exception/ExceptionInterface.php | 16 +- src/Exception/FileSystemException.php | 4 +- src/Exception/IllegalOperationException.php | 4 +- src/Exception/IllegalStateException.php | 4 +- src/Exception/InvalidArgumentException.php | 4 +- src/Exception/LogicException.php | 4 +- src/Exception/NotImplementedException.php | 4 +- src/Exception/ParseException.php | 21 +- src/Exception/RuntimeException.php | 4 +- src/Expression.php | 352 +- src/Expression/Builder/AbstractBuilder.php | 111 +- src/Expression/Builder/BuilderFactory.php | 60 +- .../Builder/Factory/OperatorsFactory.php | 71 +- .../Builder/Factory/StatementsFactory.php | 57 +- .../Builder/Operators/AbstractOperator.php | 4 +- .../Operators/AssignPropertyOperator.php | 18 +- .../Operators/AssignVariableOperator.php | 70 +- .../Builder/Operators/BinaryOperator.php | 110 +- .../Builder/Operators/RawOperator.php | 4 +- .../Builder/Operators/UnaryOperator.php | 63 +- src/Expression/Builder/RawExpression.php | 4 +- .../Builder/Statements/AbstractStatement.php | 4 +- .../Statements/CallFunctionStatement.php | 65 +- .../Statements/CallMethodStatement.php | 16 +- .../Statements/CallStaticStatement.php | 80 +- .../Builder/Statements/IfStatement.php | 53 +- .../Builder/Statements/LetStatement.php | 30 +- .../Builder/Statements/RawStatement.php | 4 +- .../Builder/Statements/StatementsBlock.php | 44 +- src/Expression/Closure.php | 113 +- src/Expression/ClosureArrow.php | 30 +- src/Expression/Constants.php | 100 +- src/Expression/NativeArray.php | 513 ++- src/Expression/NativeArrayAccess.php | 288 +- src/Expression/PropertyAccess.php | 185 +- src/Expression/PropertyDynamicAccess.php | 135 +- src/Expression/Reference.php | 98 +- src/Expression/StaticConstantAccess.php | 78 +- src/Expression/StaticPropertyAccess.php | 138 +- src/FileSystem/FileSystemInterface.php | 82 +- src/FileSystem/HardDisk.php | 246 +- src/FunctionCall.php | 729 ++-- src/FunctionDefinition.php | 26 +- src/HeadersManager.php | 14 +- src/LiteralCompiledExpression.php | 4 +- src/Logger/Formatter/CompilerFormatter.php | 81 +- src/MethodCall.php | 168 +- src/Name.php | 115 +- src/Operators/AbstractOperator.php | 199 +- src/Operators/Arithmetical/AddOperator.php | 10 +- .../Arithmetical/ArithmeticalBaseOperator.php | 568 ++- src/Operators/Arithmetical/DivOperator.php | 512 ++- src/Operators/Arithmetical/ModOperator.php | 533 ++- src/Operators/Arithmetical/MulOperator.php | 10 +- src/Operators/Arithmetical/SubOperator.php | 10 +- src/Operators/Bitwise/BitwiseAndOperator.php | 10 +- src/Operators/Bitwise/BitwiseBaseOperator.php | 555 ++- src/Operators/Bitwise/BitwiseNotOperator.php | 23 +- src/Operators/Bitwise/BitwiseOrOperator.php | 10 +- src/Operators/Bitwise/BitwiseXorOperator.php | 10 +- src/Operators/Bitwise/ShiftLeftOperator.php | 10 +- src/Operators/Bitwise/ShiftRightOperator.php | 10 +- .../Comparison/ComparisonBaseOperator.php | 764 ++-- src/Operators/Comparison/EqualsOperator.php | 34 +- .../Comparison/GreaterEqualOperator.php | 22 +- src/Operators/Comparison/GreaterOperator.php | 22 +- .../Comparison/IdenticalOperator.php | 34 +- .../Comparison/LessEqualOperator.php | 22 +- src/Operators/Comparison/LessOperator.php | 22 +- .../Comparison/NotEqualsOperator.php | 40 +- .../Comparison/NotIdenticalOperator.php | 37 +- src/Operators/Logical/AndOperator.php | 53 +- src/Operators/Logical/LogicalBaseOperator.php | 373 +- src/Operators/Logical/OrOperator.php | 50 +- src/Operators/Other/CastOperator.php | 55 +- src/Operators/Other/CloneOperator.php | 21 +- src/Operators/Other/ConcatOperator.php | 71 +- src/Operators/Other/EmptyOperator.php | 17 +- src/Operators/Other/FetchOperator.php | 114 +- src/Operators/Other/InstanceOfOperator.php | 44 +- src/Operators/Other/IssetOperator.php | 75 +- src/Operators/Other/LikelyOperator.php | 20 +- src/Operators/Other/NewInstanceOperator.php | 97 +- .../Other/RangeExclusiveOperator.php | 7 +- .../Other/RangeInclusiveOperator.php | 7 +- src/Operators/Other/RequireOnceOperator.php | 29 +- src/Operators/Other/RequireOperator.php | 32 +- src/Operators/Other/ShortTernaryOperator.php | 29 +- src/Operators/Other/TernaryOperator.php | 37 +- src/Operators/Other/TypeHintOperator.php | 3 +- src/Operators/Other/TypeOfOperator.php | 5 +- src/Operators/Other/UnlikelyOperator.php | 20 +- src/Operators/Unary/MinusOperator.php | 17 +- src/Operators/Unary/NotOperator.php | 19 +- src/Optimizers/EvalExpression.php | 152 +- src/Optimizers/FunctionCall/ACosOptimizer.php | 4 +- src/Optimizers/FunctionCall/ASinOptimizer.php | 4 +- .../FunctionCall/AddslashesOptimizer.php | 15 +- .../FunctionCall/ArrayKeyExistsOptimizer.php | 14 +- .../FunctionCall/ArrayKeysOptimizer.php | 15 +- .../FunctionCall/ArrayMergeOptimizer.php | 8 +- .../FunctionCall/BasenameOptimizer.php | 15 +- .../CallUserFuncArrayOptimizer.php | 17 +- .../FunctionCall/CallUserFuncOptimizer.php | 15 +- .../FunctionCall/CamelizeOptimizer.php | 19 +- src/Optimizers/FunctionCall/CeilOptimizer.php | 10 +- .../FunctionCall/ClassExistsOptimizer.php | 18 +- .../FunctionCall/CompareMtimeOptimizer.php | 14 +- src/Optimizers/FunctionCall/CosOptimizer.php | 4 +- .../FunctionCall/CountOptimizer.php | 10 +- .../FunctionCall/Crc32Optimizer.php | 15 +- .../FunctionCall/CreateArrayOptimizer.php | 19 +- .../FunctionCall/CreateInstanceOptimizer.php | 17 +- .../CreateInstanceParamsOptimizer.php | 17 +- .../CreateSymbolTableOptimizer.php | 9 +- src/Optimizers/FunctionCall/DieOptimizer.php | 4 +- .../FunctionCall/DoublevalOptimizer.php | 10 +- .../FunctionCall/EndsWithOptimizer.php | 28 +- src/Optimizers/FunctionCall/EvalOptimizer.php | 15 +- src/Optimizers/FunctionCall/ExitOptimizer.php | 10 +- .../FunctionCall/ExplodeOptimizer.php | 31 +- .../FunctionCall/FcloseOptimizer.php | 10 +- src/Optimizers/FunctionCall/FeofOptimizer.php | 10 +- .../FunctionCall/FileExistsOptimizer.php | 14 +- .../FunctionCall/FileGetContentsOptimizer.php | 17 +- .../FunctionCall/FilePutContentsOptimizer.php | 21 +- .../FunctionCall/FilemtimeOptimizer.php | 15 +- .../FunctionCall/FloorOptimizer.php | 10 +- .../FunctionCall/FuncGetArgOptimizer.php | 10 +- .../FunctionCall/FuncGetArgsOptimizer.php | 6 +- .../FunctionCall/FuncNumArgsOptimizer.php | 4 +- .../FunctionCall/FunctionExistsOptimizer.php | 8 +- .../FunctionCall/FwriteOptimizer.php | 21 +- .../FunctionCall/GetCalledClassOptimizer.php | 15 +- .../FunctionCall/GetClassLowerOptimizer.php | 15 +- .../FunctionCall/GetClassNsOptimizer.php | 19 +- .../FunctionCall/GetClassOptimizer.php | 15 +- .../FunctionCall/GetDefinedVarsOptimizer.php | 6 +- .../FunctionCall/GetNsClassOptimizer.php | 15 +- .../FunctionCall/GettypeOptimizer.php | 15 +- .../FunctionCall/GlobalsGetOptimizer.php | 13 +- .../FunctionCall/GlobalsSetOptimizer.php | 16 +- .../FunctionCall/HashEqualsOptimizer.php | 19 +- .../FunctionCall/ImplodeOptimizer.php | 21 +- .../FunctionCall/InArrayOptimizer.php | 14 +- .../FunctionCall/InterfaceExistsOptimizer.php | 28 +- .../FunctionCall/IntvalOptimizer.php | 10 +- .../FunctionCall/IsArrayOptimizer.php | 4 +- .../FunctionCall/IsBoolOptimizer.php | 4 +- .../FunctionCall/IsCallableOptimizer.php | 10 +- .../FunctionCall/IsIntOptimizer.php | 4 +- .../FunctionCall/IsNullOptimizer.php | 4 +- .../FunctionCall/IsNumericOptimizer.php | 10 +- .../FunctionCall/IsObjectOptimizer.php | 4 +- .../FunctionCall/IsPhpVersionOptimizer.php | 39 +- .../IsPrivatePropertyOptimizer.php | 10 +- .../FunctionCall/IsResourceOptimizer.php | 4 +- .../FunctionCall/IsScalarOptimizer.php | 10 +- .../FunctionCall/IsStringOptimizer.php | 4 +- src/Optimizers/FunctionCall/JoinOptimizer.php | 4 +- .../FunctionCall/JsonDecodeOptimizer.php | 14 +- .../FunctionCall/JsonEncodeOptimizer.php | 14 +- .../FunctionCall/LdexpOptimizer.php | 10 +- .../FunctionCall/LtrimOptimizer.php | 4 +- src/Optimizers/FunctionCall/Md5Optimizer.php | 15 +- .../FunctionCall/MemstrOptimizer.php | 24 +- .../FunctionCall/MergeAppendOptimizer.php | 10 +- .../FunctionCall/MethodExistsOptimizer.php | 14 +- .../FunctionCall/MicrotimeOptimizer.php | 17 +- src/Optimizers/FunctionCall/PowOptimizer.php | 17 +- .../FunctionCall/PregMatchAllOptimizer.php | 4 +- .../FunctionCall/PregMatchOptimizer.php | 133 +- .../PrepareVirtualPathOptimizer.php | 17 +- .../FunctionCall/RoundOptimizer.php | 27 +- .../FunctionCall/RtrimOptimizer.php | 4 +- src/Optimizers/FunctionCall/SinOptimizer.php | 4 +- src/Optimizers/FunctionCall/SqrtOptimizer.php | 4 +- .../FunctionCall/StartsWithOptimizer.php | 28 +- .../FunctionCall/StrReplaceOptimizer.php | 19 +- .../FunctionCall/StripcslashesOptimizer.php | 15 +- .../FunctionCall/StripslashesOptimizer.php | 15 +- .../FunctionCall/StrlenOptimizer.php | 10 +- .../FunctionCall/StrposOptimizer.php | 25 +- .../FunctionCall/StrtokOptimizer.php | 10 +- .../FunctionCall/StrtolowerOptimizer.php | 15 +- .../FunctionCall/StrtoupperOptimizer.php | 15 +- .../FunctionCall/SubstrOptimizer.php | 25 +- src/Optimizers/FunctionCall/TanOptimizer.php | 4 +- src/Optimizers/FunctionCall/TimeOptimizer.php | 11 +- src/Optimizers/FunctionCall/TrimOptimizer.php | 17 +- .../FunctionCall/UcfirstOptimizer.php | 15 +- .../FunctionCall/UncamelizeOptimizer.php | 19 +- .../FunctionCall/UniqueKeyOptimizer.php | 17 +- .../FunctionCall/UniquePathKeyOptimizer.php | 15 +- .../FunctionCall/VarDumpOptimizer.php | 28 +- .../FunctionCall/VarExportOptimizer.php | 37 +- .../ZephirStringToHexOptimizer.php | 15 +- src/Optimizers/IsTypeOptimizerAbstract.php | 6 +- src/Optimizers/MathOptimizer.php | 12 +- src/Os.php | 4 +- src/Parser/Manager.php | 6 +- src/Parser/Parser.php | 18 +- src/Passes/CallGathererPass.php | 76 +- src/Passes/LocalContextPass.php | 319 +- src/Passes/LoopBreakPass.php | 14 +- src/Passes/MutateGathererPass.php | 97 +- src/Passes/SkipVariantInit.php | 58 +- src/Passes/StaticTypeInference.php | 177 +- src/Statements/BreakStatement.php | 4 +- src/Statements/ContinueStatement.php | 4 +- src/Statements/DeclareStatement.php | 18 +- src/Statements/DoWhileStatement.php | 11 +- src/Statements/EchoStatement.php | 49 +- src/Statements/ForStatement.php | 1090 +++--- src/Statements/IfStatement.php | 30 +- src/Statements/Let/ArrayIndex.php | 435 ++- src/Statements/Let/ArrayIndexAppend.php | 68 +- src/Statements/Let/Decr.php | 30 +- src/Statements/Let/ExportSymbol.php | 43 +- src/Statements/Let/ExportSymbolString.php | 41 +- src/Statements/Let/Incr.php | 30 +- src/Statements/Let/ObjectDynamicProperty.php | 163 +- .../Let/ObjectDynamicStringProperty.php | 155 +- src/Statements/Let/ObjectProperty.php | 97 +- src/Statements/Let/ObjectPropertyAppend.php | 221 +- .../Let/ObjectPropertyArrayIndex.php | 453 ++- .../Let/ObjectPropertyArrayIndexAppend.php | 77 +- src/Statements/Let/ObjectPropertyDecr.php | 60 +- src/Statements/Let/ObjectPropertyIncr.php | 55 +- src/Statements/Let/StaticProperty.php | 204 +- src/Statements/Let/StaticPropertyAdd.php | 174 +- src/Statements/Let/StaticPropertyAppend.php | 55 +- .../Let/StaticPropertyArrayIndex.php | 62 +- .../Let/StaticPropertyArrayIndexAppend.php | 67 +- src/Statements/Let/StaticPropertySub.php | 174 +- src/Statements/Let/Variable.php | 1029 +++-- src/Statements/Let/VariableAppend.php | 215 +- src/Statements/LetStatement.php | 72 +- src/Statements/LoopStatement.php | 17 +- src/Statements/RequireStatement.php | 4 +- src/Statements/ReturnStatement.php | 35 +- src/Statements/StatementAbstract.php | 14 +- src/Statements/SwitchStatement.php | 68 +- src/Statements/ThrowStatement.php | 45 +- src/Statements/TryCatchStatement.php | 76 +- src/Statements/UnsetStatement.php | 77 +- src/Statements/WhileStatement.php | 14 +- src/StatementsBlock.php | 125 +- src/StaticCall.php | 541 ++- src/Stubs/DocBlock.php | 24 +- src/Stubs/Generator.php | 197 +- src/Stubs/MethodDocBlock.php | 227 +- src/SymbolTable.php | 1023 ++--- src/TypeAwareInterface.php | 4 +- src/Types/AbstractType.php | 36 +- src/Types/ArrayType.php | 100 +- src/Types/CharType.php | 14 +- src/Types/DoubleType.php | 26 +- src/Types/IntType.php | 26 +- src/Types/StringType.php | 48 +- src/Types/Types.php | 276 +- src/Variable/Globals.php | 24 +- src/Variable/Variable.php | 1126 +++--- src/Zephir.php | 5 +- 339 files changed, 22832 insertions(+), 16152 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 9201b51f68..fd2566c53f 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -29,6 +29,7 @@ + - + - - +