From 7402c4c903438c6928e3bced8fc41d8f24cc058f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 7 Aug 2021 22:08:32 +0100 Subject: [PATCH 001/128] #2255 - Add Dockerfile with PHP8.1 and update kernel files --- docker-compose.yml | 10 +++++++++ docker/8.1/Dockerfile | 39 +++++++++++++++++++++++++++++++++++ kernels/ZendEngine3/file.c | 8 +++++++ kernels/ZendEngine3/main.c | 6 +++--- kernels/ZendEngine3/require.c | 6 +++++- 5 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 docker/8.1/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 8e766f3026..65be0b1d4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,3 +22,13 @@ services: - "USER=Zephir" volumes: - .:/srv + + zephir-8.1: + container_name: phalcon-zephir-8.1 + hostname: zephir-81 + build: docker/8.1 + working_dir: /srv + environment: + - "USER=Zephir" + volumes: + - .:/srv diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile new file mode 100644 index 0000000000..fc684cbf71 --- /dev/null +++ b/docker/8.1/Dockerfile @@ -0,0 +1,39 @@ +FROM composer:2.0.8 as composer +FROM php:8.1-rc-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 + +RUN docker-php-ext-install zip gmp intl mysqli && \ + docker-php-ext-enable psr + +# Install Zephir parser +RUN PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" && \ + cd /opt && \ + git clone -b "development" \ + --depth 1 \ + -q https://github.com/phalcon/php-zephir-parser \ + php-zephir-parser && \ + cd php-zephir-parser || exit 1 && \ + phpize && \ + ./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser && \ + make -j"$(getconf _NPROCESSORS_ONLN)" && \ + sudo make install && \ + echo 'extension="zephir_parser.so"' |\ + sudo tee "$PHP_INI_DIR/zephir_parser.ini" && \ + php --ri "Zephir Parser" + +COPY --from=composer /usr/bin/composer /usr/local/bin/composer + +CMD ["php-fpm"] diff --git a/kernels/ZendEngine3/file.c b/kernels/ZendEngine3/file.c index a0540f7d83..cdf746d4e6 100755 --- a/kernels/ZendEngine3/file.c +++ b/kernels/ZendEngine3/file.c @@ -65,7 +65,11 @@ int zephir_file_exists(zval *filename) return FAILURE; } +#if PHP_VERSION_ID >= 80100 + php_stat(Z_STRVAL_P(filename), FS_EXISTS, &return_value); +#else php_stat(Z_STRVAL_P(filename), (php_stat_len) Z_STRLEN_P(filename), FS_EXISTS, &return_value); +#endif if (Z_TYPE(return_value) != IS_TRUE) { return FAILURE; @@ -288,7 +292,11 @@ void zephir_file_put_contents(zval *return_value, zval *filename, zval *data) void zephir_filemtime(zval *return_value, zval *path) { if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) { +#if PHP_VERSION_ID >= 80100 + php_stat(Z_STRVAL_P(path), FS_MTIME, return_value); +#else php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value); +#endif } else { ZVAL_FALSE(return_value); } diff --git a/kernels/ZendEngine3/main.c b/kernels/ZendEngine3/main.c index 8014a65145..95eba881d1 100755 --- a/kernels/ZendEngine3/main.c +++ b/kernels/ZendEngine3/main.c @@ -151,7 +151,7 @@ void zephir_fast_count(zval *result, zval *value) } } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { #if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); #else @@ -201,7 +201,7 @@ int zephir_fast_count_ev(zval *value) return (int) count > 0; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { #if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); #else @@ -249,7 +249,7 @@ int zephir_fast_count_int(zval *value) return (int) count; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { #if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); #else diff --git a/kernels/ZendEngine3/require.c b/kernels/ZendEngine3/require.c index 2bab5554c5..5f393e266f 100755 --- a/kernels/ZendEngine3/require.c +++ b/kernels/ZendEngine3/require.c @@ -45,7 +45,11 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } From c595467165d5723462204b22325e762def6f80a8 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 7 Sep 2021 23:29:01 +0100 Subject: [PATCH 002/128] #2255 - Update Dockerfile's --- docker/7.4/Dockerfile | 2 +- docker/8.0/Dockerfile | 2 +- docker/8.1/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/7.4/Dockerfile b/docker/7.4/Dockerfile index 6dd0d38a92..d4d1f0237c 100644 --- a/docker/7.4/Dockerfile +++ b/docker/7.4/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2.0.8 as composer +FROM composer:latest as composer FROM php:7.4-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; diff --git a/docker/8.0/Dockerfile b/docker/8.0/Dockerfile index e96b898804..e4dadd2716 100644 --- a/docker/8.0/Dockerfile +++ b/docker/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2.0.8 as composer +FROM composer:latest as composer FROM php:8.0-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile index fc684cbf71..f249a127a2 100644 --- a/docker/8.1/Dockerfile +++ b/docker/8.1/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2.0.8 as composer +FROM composer:latest as composer FROM php:8.1-rc-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; From 9195f24870e4ba1a6c6dd0d07bbb8cf7e49c4fb5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 7 Sep 2021 23:30:19 +0100 Subject: [PATCH 003/128] #2253 - Add ReturnTypeWillChange on required methods --- Library/Config.php | 17 +++++++++-------- .../DependencyInjection/ContainerFactory.php | 18 +++++++----------- prototypes/apc.php | 1 + 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Library/Config.php b/Library/Config.php index d2e0bcd678..c0ea97077b 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -226,25 +226,26 @@ public function offsetExists($key): bool /** * Gets a $key from the internal container. * - * @param mixed $key + * @param mixed $offset * * @return mixed|null */ - public function offsetGet($key) + #[ReturnTypeWillChange] + public function offsetGet($offset) { - if (!\is_array($key)) { - return $this->offsetExists($key) ? $this->container[$key] : null; + if (!\is_array($offset)) { + return $this->offsetExists($offset) ? $this->container[$offset] : null; } - $namespace = key($key); - $key = current($key); + $namespace = key($offset); + $offset = current($offset); if (!$this->offsetExists($namespace) || !\is_array($this->container[$namespace])) { return null; } - if (isset($this->container[$namespace][$key]) || \array_key_exists($key, $this->container[$namespace])) { - return $this->container[$namespace][$key]; + if (isset($this->container[$namespace][$offset]) || \array_key_exists($offset, $this->container[$namespace])) { + return $this->container[$namespace][$offset]; } return null; diff --git a/Library/DependencyInjection/ContainerFactory.php b/Library/DependencyInjection/ContainerFactory.php index 20fe40ff0a..6fc8ec7d31 100644 --- a/Library/DependencyInjection/ContainerFactory.php +++ b/Library/DependencyInjection/ContainerFactory.php @@ -9,12 +9,16 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\DependencyInjection; +use Symfony\Component\DependencyInjection\ContainerInterface; + final class ContainerFactory { - private $environment = '$kernel-environment$'; - private $debug = false; + private string $environment = '$kernel-environment$'; + private bool $debug = false; public function __construct() { @@ -32,19 +36,11 @@ public function __construct() } } - public function createWithConfigs(array $configs) + public function create(array $configs = []): ContainerInterface { $kernel = new ZephirKernel($this->environment, $this->debug, $configs); $kernel->boot(); return $kernel->getContainer(); } - - public function create() - { - $kernel = new ZephirKernel($this->environment, $this->debug); - $kernel->boot(); - - return $kernel->getContainer(); - } } diff --git a/prototypes/apc.php b/prototypes/apc.php index 9064a224a3..ccdfdedc28 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -54,6 +54,7 @@ public function valid() { } + #[ReturnTypeWillChange] public function current() { } From b0248e191a5d65b970efda2b13b756861e805671 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Wed, 8 Sep 2021 16:43:31 +0100 Subject: [PATCH 004/128] #2253 - Fix `zephir_file_exists()` C function in PHP8.1 https://github.com/php/php-src/commit/13e4ce386bb7257dbbe3167b070382ea959ec763 --- kernels/ZendEngine3/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernels/ZendEngine3/file.c b/kernels/ZendEngine3/file.c index cdf746d4e6..df70a7b628 100755 --- a/kernels/ZendEngine3/file.c +++ b/kernels/ZendEngine3/file.c @@ -66,7 +66,9 @@ int zephir_file_exists(zval *filename) } #if PHP_VERSION_ID >= 80100 - php_stat(Z_STRVAL_P(filename), FS_EXISTS, &return_value); + zend_string *file = zend_string_init(Z_STRVAL_P(filename), Z_STRLEN_P(filename), 0); + php_stat(file, FS_EXISTS, &return_value); + zval_ptr_dtor(file); #else php_stat(Z_STRVAL_P(filename), (php_stat_len) Z_STRLEN_P(filename), FS_EXISTS, &return_value); #endif From 27c2e712463ef58a7ecde0e4261b1dd4c0f0bab3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Wed, 8 Sep 2021 16:49:02 +0100 Subject: [PATCH 005/128] #2255 - Fix `zephir_filemtime()` C function in PHP8.1 https://github.com/php/php-src/commit/13e4ce386bb7257dbbe3167b070382ea959ec763 --- kernels/ZendEngine3/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernels/ZendEngine3/file.c b/kernels/ZendEngine3/file.c index df70a7b628..cf0c691d2c 100755 --- a/kernels/ZendEngine3/file.c +++ b/kernels/ZendEngine3/file.c @@ -295,7 +295,9 @@ void zephir_filemtime(zval *return_value, zval *path) { if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) { #if PHP_VERSION_ID >= 80100 - php_stat(Z_STRVAL_P(path), FS_MTIME, return_value); + zend_string *file = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), 0); + php_stat(file, FS_MTIME, &return_value); + zval_ptr_dtor(file); #else php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value); #endif From d5cb1a0863d67039ade89bd843a81f1ba8397f24 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 17:59:51 +0100 Subject: [PATCH 006/128] #2255 - Add PHP 8.1 to the matrix --- .github/workflows/build-unix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index a51c311d4f..578a7f3f6f 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -33,6 +33,7 @@ jobs: php: - '7.4' - '8.0' + - '8.1' steps: - name: Setup Prerequisites From 4070b12ea90b947ae3acc6ffaf35e29585225acf Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Sep 2021 22:04:30 +0100 Subject: [PATCH 007/128] #2255 - Fix `IsPhpVersionTest` test for PHP8.1 --- tests/Extension/Optimizers/IsPhpVersionTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Extension/Optimizers/IsPhpVersionTest.php b/tests/Extension/Optimizers/IsPhpVersionTest.php index 72467c7cef..c16c816b73 100644 --- a/tests/Extension/Optimizers/IsPhpVersionTest.php +++ b/tests/Extension/Optimizers/IsPhpVersionTest.php @@ -85,12 +85,15 @@ public function testOptimizerExceptionNegativeNumber(): void $this->isPhpVersion(-7); } - public function testOptimizerExceptionNull(): void + public function testOptimizerExceptionEmpty(): void { $this->expectException(Exception::class); $this->expectExceptionMessage('Could not parse PHP version'); - $this->isPhpVersion(null); + /** + * After PHP8.1 it is impossible to pass null value to preg_match() + */ + $this->isPhpVersion(''); } public function testZephirUsingInteger70000(): void From f1d67f9f1dd7dabbbfc391fcce2d6867ff190369 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Sep 2021 22:05:16 +0100 Subject: [PATCH 008/128] #2255 - Fix signature in method of Iterator classes and interfaces --- stub/arrayiterator.zep | 18 ++++++++++++------ stub/internalinterfaces.zep | 4 ++-- stub/oo/oonativeimplements.zep | 8 ++++---- stub/usetest.zep | 4 ++-- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/stub/arrayiterator.zep b/stub/arrayiterator.zep index e741a0a0bd..ae61ff62fd 100644 --- a/stub/arrayiterator.zep +++ b/stub/arrayiterator.zep @@ -5,7 +5,8 @@ class ArrayIterator implements \Iterator protected position = 0; protected test; - public function __construct() { + public function __construct() + { let this->test = [ "one", "two", @@ -14,23 +15,28 @@ class ArrayIterator implements \Iterator let this->position = 0; } - public function rewind() { + public function rewind() -> void + { let this->position = 0; } - public function current() { + public function current() + { return this->test[this->position]; } - public function key() { + public function key() + { return this->position; } - public function next() { + public function next() -> void + { let this->position++; } - public function valid() { + public function valid() + { return isset this->test[this->position]; } } diff --git a/stub/internalinterfaces.zep b/stub/internalinterfaces.zep index 50542a18f3..a3c60e2ea9 100644 --- a/stub/internalinterfaces.zep +++ b/stub/internalinterfaces.zep @@ -3,8 +3,8 @@ namespace Stub; class InternalInterfaces implements \Countable { - public function count() + public function count() -> int { - + return 0; } } diff --git a/stub/oo/oonativeimplements.zep b/stub/oo/oonativeimplements.zep index 47f51b7602..c97c4f72d2 100644 --- a/stub/oo/oonativeimplements.zep +++ b/stub/oo/oonativeimplements.zep @@ -30,11 +30,11 @@ class OoNativeImplements implements { } - public function next() + public function next() -> void { } - public function rewind() + public function rewind() -> void { } @@ -44,7 +44,7 @@ class OoNativeImplements implements /* OuterIterator */ - public function getInnerIterator() + public function getInnerIterator() -> <\Iterator>|null { } @@ -59,7 +59,7 @@ class OoNativeImplements implements /* SeekableIterator */ - public function seek (position) + public function seek(int position) -> void { } diff --git a/stub/usetest.zep b/stub/usetest.zep index 6cc7841ca4..8567f139cd 100644 --- a/stub/usetest.zep +++ b/stub/usetest.zep @@ -16,9 +16,9 @@ class UseTest implements Countable return new StandardClass(); } - public function count() + public function count() -> int { - + return 0; } public function testUseClass1() From 425702ee94ad55657dbfa6315a2892714cafce85 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Sep 2021 23:09:56 +0100 Subject: [PATCH 009/128] #2255 - Fix `zephir_require_ret()` C function in PHP8.1 --- kernels/ZendEngine3/require.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernels/ZendEngine3/require.c b/kernels/ZendEngine3/require.c index 5f393e266f..803f25b581 100755 --- a/kernels/ZendEngine3/require.c +++ b/kernels/ZendEngine3/require.c @@ -46,7 +46,12 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) #endif #if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); #else ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); #endif @@ -56,7 +61,6 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); if (new_op_array) { - if (file_handle.handle.stream.handle) { ZVAL_NULL(&dummy); if (!file_handle.opened_path) { From 417c147ae1002c495e45e0ddb8c4e3882324cb09 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Sep 2021 23:12:25 +0100 Subject: [PATCH 010/128] #2255 - Fix signature in method of Iterator classes and interfaces --- stub/arrayiterator.zep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stub/arrayiterator.zep b/stub/arrayiterator.zep index ae61ff62fd..f2b7b29dcb 100644 --- a/stub/arrayiterator.zep +++ b/stub/arrayiterator.zep @@ -35,7 +35,7 @@ class ArrayIterator implements \Iterator let this->position++; } - public function valid() + public function valid() -> bool { return isset this->test[this->position]; } From 1bc9d92db414ea33227189642d743bfe91e993a7 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 14 Sep 2021 21:42:41 +0100 Subject: [PATCH 011/128] Add services.php --- config/symfony/services.php | 94 +++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 config/symfony/services.php diff --git a/config/symfony/services.php b/config/symfony/services.php new file mode 100644 index 0000000000..f44b9e2964 --- /dev/null +++ b/config/symfony/services.php @@ -0,0 +1,94 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->private() + ->tag('monolog.logger', ['channel' => 'zephir']); + + $services + ->load('Zephir\\', '../../Library') + ->exclude('../../Library/{autoload.php,bootstrap.php,functions.php}'); + + $services + ->set(Application::class) + ->public(); + + $services + ->set(FileSystemInterface::class, HardDisk::class) + ->public() + ->lazy() + ->arg('$basePath', '%local_cache_path%'); + + $services + ->set(Config::class) + ->factory('Zephir\Config::fromServer') + ->public(); + + $services + ->set(BackendFactory::class) + ->public() + ->arg('$kernelsPath', param('kernels_path')) + ->arg('$templatesPath', param('templates_path')); + + $services + ->set(BaseBackend::class) + ->factory([service(BackendFactory::class), 'createBackend']) + ->public(); + + $services + ->set('compiler_log_formatter', CompilerFormatter::class); + + $services + ->set(Compiler::class) + ->public() + ->call('setPrototypesPath', ['%prototypes_path%']) + ->call('setOptimizersPath', ['%optimizers_path%']) + ->call('setTemplatesPath', ['%templates_path%']) + ->call('setLogger', [tagged_locator('monolog.logger')]); + + $configurator + ->parameters() + ->set('prototypes_path', '%kernel.project_dir%/prototypes') + ->set('optimizers_path', '%kernel.project_dir%/Library/Optimizers') + ->set('kernels_path', '%kernel.project_dir%/kernels') + ->set('templates_path', '%kernel.project_dir%/templates') + ->set('local_cache_path', '%kernel.local_cache_dir%'); + + $configurator->extension('monolog', [ + 'handlers' => [ + 'console_stderr' => [ + 'type' => 'stream', + 'path' => 'php://stderr', + 'process_psr_3_messages' => true, + 'bubble' => false, + 'level' => 'warning', + 'formatter' => 'compiler_log_formatter', + ], + 'console_stdout' => [ + 'type' => 'stream', + 'path' => 'php://stdout', + 'process_psr_3_messages' => true, + 'bubble' => false, + 'level' => 'info', + 'formatter' => 'compiler_log_formatter', + ], + ] + ]); +}; From 68776a719fd5a80360453e86669792675bc592fd Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 1 Oct 2021 22:16:19 +0100 Subject: [PATCH 012/128] #2255 - Review Dockerfile for PHP8.1 --- docker/8.1/.bashrc | 5 +++++ docker/8.1/Dockerfile | 22 ++++------------------ 2 files changed, 9 insertions(+), 18 deletions(-) create mode 100644 docker/8.1/.bashrc diff --git a/docker/8.1/.bashrc b/docker/8.1/.bashrc new file mode 100644 index 0000000000..fd3a636e58 --- /dev/null +++ b/docker/8.1/.bashrc @@ -0,0 +1,5 @@ +#!/bin/bash + +alias test-ext='php -d extension=ext/modules/stub.so vendor/bin/phpunit --bootstrap tests/ext-bootstrap.php --testsuite Extension' +alias test-zephir='php vendor/bin/phpunit --colors=always --testsuite Zephir' +alias test-all='test-ext; test-zephir' diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile index f249a127a2..dcf5aa67b6 100644 --- a/docker/8.1/Dockerfile +++ b/docker/8.1/Dockerfile @@ -13,27 +13,13 @@ RUN apt update -y && apt install -y \ libicu-dev \ libgmp-dev \ libzip-dev && \ - pecl install psr + pecl install psr zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr - -# Install Zephir parser -RUN PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" && \ - cd /opt && \ - git clone -b "development" \ - --depth 1 \ - -q https://github.com/phalcon/php-zephir-parser \ - php-zephir-parser && \ - cd php-zephir-parser || exit 1 && \ - phpize && \ - ./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser && \ - make -j"$(getconf _NPROCESSORS_ONLN)" && \ - sudo make install && \ - echo 'extension="zephir_parser.so"' |\ - sudo tee "$PHP_INI_DIR/zephir_parser.ini" && \ - php --ri "Zephir Parser" + 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 6e4cfd428e95030ae23a3713bbb8e8d3ea5fb364 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 1 Oct 2021 22:37:51 +0100 Subject: [PATCH 013/128] #2255 - Review Dockerfile for PHP8.1 --- docker/8.1/Dockerfile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile index dcf5aa67b6..41f3775828 100644 --- a/docker/8.1/Dockerfile +++ b/docker/8.1/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest as composer -FROM php:8.1-rc-fpm +FROM php:8.1.0RC3-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" @@ -16,7 +16,23 @@ RUN apt update -y && apt install -y \ pecl install psr zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr zephir_parser + docker-php-ext-enable psr + +# Install Zephir parser +RUN PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" && \ + cd /opt && \ + git clone -b "development" \ + --depth 1 \ + -q https://github.com/phalcon/php-zephir-parser \ + php-zephir-parser && \ + cd php-zephir-parser || exit 1 && \ + phpize && \ + ./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser && \ + make -j"$(getconf _NPROCESSORS_ONLN)" && \ + sudo make install && \ + echo 'extension="zephir_parser.so"' |\ + sudo tee "$PHP_INI_DIR/zephir_parser.ini" && \ + php --ri "zephir_parser" COPY --from=composer /usr/bin/composer /usr/local/bin/composer # Bash script with helper aliases From d6abd40a6fee2d08d58b1f4537e20b8f6729f742 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 19:00:03 +0100 Subject: [PATCH 014/128] #2295 - Remove next dependencies: * `symfony/framework-bundle` * `symfony/monolog-bridge` * `symfony/monolog-bundle` * `symfony/yaml` --- Library/Config.php | 4 +- Library/Console/Application.php | 12 +- Library/Console/Command/ApiCommand.php | 4 +- Library/Console/Command/GenerateCommand.php | 1 + Library/DependencyInjection/ZephirKernel.php | 2 +- composer.json | 6 +- composer.lock | 1962 ++--------------- .../CompilerFile/CheckDependenciesTest.php | 35 +- tests/Zephir/KernelTestCase.php | 94 - zephir | 64 +- 10 files changed, 283 insertions(+), 1901 deletions(-) delete mode 100644 tests/Zephir/KernelTestCase.php diff --git a/Library/Config.php b/Library/Config.php index d7f278630a..8bb290bc01 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -124,15 +124,13 @@ public function __toString() /** * Factory method to create a Config instance from the $_SERVER['argv']. * - * @throws Exception - * * @return Config */ public static function fromServer(): self { $config = new self(); - /* + /** * Change configurations flags */ if ($_SERVER['argc'] >= 2) { diff --git a/Library/Console/Application.php b/Library/Console/Application.php index d8674b38db..32cfa2d96d 100644 --- a/Library/Console/Application.php +++ b/Library/Console/Application.php @@ -39,18 +39,8 @@ public function __construct() { parent::__construct('Zephir', Zephir::VERSION); - $this->setupEventDispatcher(); - } - - protected function setupEventDispatcher(): void - { $dispatcher = new EventDispatcher(); - $consoleErrorListener = new ConsoleErrorListener(); - - $dispatcher->addListener( - ConsoleEvents::ERROR, - [$consoleErrorListener, 'onCommandError'] - ); + $dispatcher->addListener(ConsoleEvents::ERROR, [new ConsoleErrorListener(), 'onCommandError']); $this->setDispatcher($dispatcher); } diff --git a/Library/Console/Command/ApiCommand.php b/Library/Console/Command/ApiCommand.php index ebe32e9d0c..e19477ac6b 100644 --- a/Library/Console/Command/ApiCommand.php +++ b/Library/Console/Command/ApiCommand.php @@ -24,9 +24,7 @@ use function in_array; /** - * API Command - * - * Generates a HTML API based on the classes exposed in the extension. + * Generates an HTML API based on the classes exposed in the extension. */ final class ApiCommand extends AbstractCommand { diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index c08c863245..d23b0214e7 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -22,6 +22,7 @@ use Zephir\Exception; use Zephir\Exception\ExceptionInterface; use Zephir\Exception\InvalidArgumentException; + use function extension_loaded; /** diff --git a/Library/DependencyInjection/ZephirKernel.php b/Library/DependencyInjection/ZephirKernel.php index 62ea6851e1..097fe67fd5 100644 --- a/Library/DependencyInjection/ZephirKernel.php +++ b/Library/DependencyInjection/ZephirKernel.php @@ -68,7 +68,7 @@ public function registerBundles(): array */ public function registerContainerConfiguration(LoaderInterface $loader) { - $loader->load(__DIR__.'/../config/config.yml'); + $loader->load(__DIR__.'/../../config/symfony/services.php'); foreach ($this->extraConfigFiles as $configFile) { $loader->load($configFile); diff --git a/composer.json b/composer.json index a74c92dc83..86ed1142e4 100644 --- a/composer.json +++ b/composer.json @@ -29,11 +29,9 @@ "ext-pcre": "*", "ext-xml": "*", "ext-zlib": "*", + "monolog/monolog": "^2.3", "symfony/console": "^5.2", - "symfony/framework-bundle": "^5.2", - "symfony/monolog-bridge": "^5.2", - "symfony/monolog-bundle": "^3.7", - "symfony/yaml": "^5.2" + "symfony/event-dispatcher": "^5.3" }, "require-dev": { "ext-gmp": "*", diff --git a/composer.lock b/composer.lock index ad1c1436cb..89d4d6efe7 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": "c88e23f00ee31cde884e4ffb1331ddbc", + "content-hash": "df940a5a2884459b1dc66d8212fbcd85", "packages": [ { "name": "monolog/monolog", @@ -105,55 +105,6 @@ ], "time": "2021-10-01T21:08:31+00:00" }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "support": { - "source": "https://github.com/php-fig/cache/tree/master" - }, - "time": "2016-08-06T20:24:11+00:00" - }, { "name": "psr/container", "version": "1.1.1", @@ -302,261 +253,6 @@ }, "time": "2021-05-03T11:20:27+00:00" }, - { - "name": "symfony/cache", - "version": "v5.3.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/cache.git", - "reference": "945bcebfef0aeef105de61843dd14105633ae38f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/945bcebfef0aeef105de61843dd14105633ae38f", - "reference": "945bcebfef0aeef105de61843dd14105633ae38f", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0", - "psr/log": "^1.1|^2|^3", - "symfony/cache-contracts": "^1.1.7|^2", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" - }, - "conflict": { - "doctrine/dbal": "<2.10", - "symfony/dependency-injection": "<4.4", - "symfony/http-kernel": "<4.4", - "symfony/var-dumper": "<4.4" - }, - "provide": { - "psr/cache-implementation": "1.0|2.0", - "psr/simple-cache-implementation": "1.0", - "symfony/cache-implementation": "1.0|2.0" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/cache": "^1.6|^2.0", - "doctrine/dbal": "^2.10|^3.0", - "predis/predis": "^1.1", - "psr/simple-cache": "^1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/filesystem": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Cache\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an extended PSR-6, PSR-16 (and tags) implementation", - "homepage": "https://symfony.com", - "keywords": [ - "caching", - "psr6" - ], - "support": { - "source": "https://github.com/symfony/cache/tree/v5.3.8" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-26T18:29:18+00:00" - }, - { - "name": "symfony/cache-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/cache-contracts.git", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/c0446463729b89dd4fa62e9aeecc80287323615d", - "reference": "c0446463729b89dd4fa62e9aeecc80287323615d", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0|^3.0" - }, - "suggest": { - "symfony/cache-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Cache\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to caching", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/config", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "4268f3059c904c61636275182707f81645517a37" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4268f3059c904c61636275182707f81645517a37", - "reference": "4268f3059c904c61636275182707f81645517a37", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/filesystem": "^4.4|^5.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.22" - }, - "conflict": { - "symfony/finder": "<4.4" - }, - "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^4.4|^5.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/config/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-21T12:40:44+00:00" - }, { "name": "symfony/console", "version": "v5.3.7", @@ -603,1029 +299,13 @@ "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-25T20:02:16+00:00" - }, - { - "name": "symfony/dependency-injection", - "version": "v5.3.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e39c344e06a3ceab531ebeb6c077e6652c4a0829", - "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/container": "^1.1.1", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1.6|^2" - }, - "conflict": { - "ext-psr": "<1.1|>=2", - "symfony/config": "<5.3", - "symfony/finder": "<4.4", - "symfony/proxy-manager-bridge": "<4.4", - "symfony/yaml": "<4.4" - }, - "provide": { - "psr/container-implementation": "1.0", - "symfony/service-implementation": "1.0|2.0" - }, - "require-dev": { - "symfony/config": "^5.3", - "symfony/expression-language": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows you to standardize and centralize the way objects are constructed in your application", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v5.3.8" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-21T20:52:44+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/error-handler", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/error-handler.git", - "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", - "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/log": "^1|^2|^3", - "symfony/var-dumper": "^4.4|^5.0" - }, - "require-dev": { - "symfony/deprecation-contracts": "^2.1", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\ErrorHandler\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to manage errors and ease debugging PHP code", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-28T15:07:08+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ce7b20d69c66a20939d8952b617506a44d102130" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ce7b20d69c66a20939d8952b617506a44d102130", - "reference": "ce7b20d69c66a20939d8952b617506a44d102130", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/dependency-injection": "<4.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-04T21:20:46+00:00" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/event-dispatcher": "^1" - }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v5.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/343f4fe324383ca46792cae728a3b6e2f708fb32", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides basic utilities for the filesystem", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.4" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-21T12:40:44+00:00" - }, - { - "name": "symfony/finder", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/a10000ada1e600d109a6c7632e9ac42e8bf2fb93", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Finds files and directories via an intuitive fluent interface", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-04T21:20:46+00:00" - }, - { - "name": "symfony/framework-bundle", - "version": "v5.3.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/framework-bundle.git", - "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", - "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", - "shasum": "" - }, - "require": { - "ext-xml": "*", - "php": ">=7.2.5", - "symfony/cache": "^5.2", - "symfony/config": "^5.3", - "symfony/dependency-injection": "^5.3", - "symfony/deprecation-contracts": "^2.1", - "symfony/error-handler": "^4.4.1|^5.0.1", - "symfony/event-dispatcher": "^5.1", - "symfony/filesystem": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/http-foundation": "^5.3", - "symfony/http-kernel": "^5.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/routing": "^5.3" - }, - "conflict": { - "doctrine/persistence": "<1.3", - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "phpunit/phpunit": "<5.4.3", - "symfony/asset": "<5.3", - "symfony/browser-kit": "<4.4", - "symfony/console": "<5.2.5", - "symfony/dom-crawler": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/form": "<5.2", - "symfony/http-client": "<4.4", - "symfony/lock": "<4.4", - "symfony/mailer": "<5.2", - "symfony/messenger": "<4.4", - "symfony/mime": "<4.4", - "symfony/property-access": "<5.3", - "symfony/property-info": "<4.4", - "symfony/security-core": "<5.3", - "symfony/security-csrf": "<5.3", - "symfony/serializer": "<5.2", - "symfony/stopwatch": "<4.4", - "symfony/translation": "<5.3", - "symfony/twig-bridge": "<4.4", - "symfony/twig-bundle": "<4.4", - "symfony/validator": "<5.2", - "symfony/web-profiler-bundle": "<4.4", - "symfony/workflow": "<5.2" - }, - "require-dev": { - "doctrine/annotations": "^1.10.4", - "doctrine/cache": "^1.0|^2.0", - "doctrine/persistence": "^1.3|^2.0", - "paragonie/sodium_compat": "^1.8", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/asset": "^5.3", - "symfony/browser-kit": "^4.4|^5.0", - "symfony/console": "^5.2", - "symfony/css-selector": "^4.4|^5.0", - "symfony/dom-crawler": "^4.4.30|^5.3.7", - "symfony/dotenv": "^5.1", - "symfony/expression-language": "^4.4|^5.0", - "symfony/form": "^5.2", - "symfony/http-client": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/mailer": "^5.2", - "symfony/messenger": "^5.2", - "symfony/mime": "^4.4|^5.0", - "symfony/notifier": "^5.3", - "symfony/phpunit-bridge": "^5.3", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/process": "^4.4|^5.0", - "symfony/property-info": "^4.4|^5.0", - "symfony/rate-limiter": "^5.2", - "symfony/security-bundle": "^5.3", - "symfony/serializer": "^5.2", - "symfony/stopwatch": "^4.4|^5.0", - "symfony/string": "^5.0", - "symfony/translation": "^5.3", - "symfony/twig-bundle": "^4.4|^5.0", - "symfony/validator": "^5.2", - "symfony/web-link": "^4.4|^5.0", - "symfony/workflow": "^5.2", - "symfony/yaml": "^4.4|^5.0", - "twig/twig": "^2.10|^3.0" - }, - "suggest": { - "ext-apcu": "For best performance of the system caches", - "symfony/console": "For using the console commands", - "symfony/form": "For using forms", - "symfony/property-info": "For using the property_info service", - "symfony/serializer": "For using the serializer service", - "symfony/validator": "For using validation", - "symfony/web-link": "For using web links, features such as preloading, prefetching or prerendering", - "symfony/yaml": "For using the debug:config and lint:yaml commands" - }, - "type": "symfony-bundle", - "autoload": { - "psr-4": { - "Symfony\\Bundle\\FrameworkBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v5.3.8" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-28T07:17:01+00:00" - }, - { - "name": "symfony/http-client-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "shasum": "" - }, - "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/http-client-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to HTTP clients", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-04-11T23:07:08+00:00" - }, - { - "name": "symfony/http-foundation", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", - "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "predis/predis": "~1.0", - "symfony/cache": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/mime": "^4.4|^5.0" - }, - "suggest": { - "symfony/mime": "To use the file extension guesser" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Defines an object-oriented layer for the HTTP specification", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.3.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-27T11:20:35+00:00" - }, - { - "name": "symfony/http-kernel", - "version": "v5.3.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "ceaf46a992f60e90645e7279825a830f733a17c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ceaf46a992f60e90645e7279825a830f733a17c5", - "reference": "ceaf46a992f60e90645e7279825a830f733a17c5", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/log": "^1|^2", - "symfony/deprecation-contracts": "^2.1", - "symfony/error-handler": "^4.4|^5.0", - "symfony/event-dispatcher": "^5.0", - "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^5.3.7", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "symfony/browser-kit": "<4.4", - "symfony/cache": "<5.0", - "symfony/config": "<5.0", - "symfony/console": "<4.4", - "symfony/dependency-injection": "<5.3", - "symfony/doctrine-bridge": "<5.0", - "symfony/form": "<5.0", - "symfony/http-client": "<5.0", - "symfony/mailer": "<5.0", - "symfony/messenger": "<5.0", - "symfony/translation": "<5.0", - "symfony/twig-bridge": "<5.0", - "symfony/validator": "<5.0", - "twig/twig": "<2.13" - }, - "provide": { - "psr/log-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^4.4|^5.0", - "symfony/config": "^5.0", - "symfony/console": "^4.4|^5.0", - "symfony/css-selector": "^4.4|^5.0", - "symfony/dependency-injection": "^5.3", - "symfony/dom-crawler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/routing": "^4.4|^5.0", - "symfony/stopwatch": "^4.4|^5.0", - "symfony/translation": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "twig/twig": "^2.13|^3.0.4" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a structured process for converting a Request into a Response", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.3.9" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-28T10:25:11+00:00" - }, - { - "name": "symfony/monolog-bridge", - "version": "v5.3.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "4ace41087254f099b6743333155071438bfb12c3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/4ace41087254f099b6743333155071438bfb12c3", - "reference": "4ace41087254f099b6743333155071438bfb12c3", - "shasum": "" - }, - "require": { - "monolog/monolog": "^1.25.1|^2", - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/http-kernel": "^5.3", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2" - }, - "conflict": { - "symfony/console": "<4.4", - "symfony/http-foundation": "<5.3" - }, - "require-dev": { - "symfony/console": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/mailer": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/mime": "^4.4|^5.0", - "symfony/security-core": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "suggest": { - "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings.", - "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", - "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." + "symfony/lock": "", + "symfony/process": "" }, - "type": "symfony-bridge", + "type": "library", "autoload": { "psr-4": { - "Symfony\\Bridge\\Monolog\\": "" + "Symfony\\Component\\Console\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1645,10 +325,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides integration for Monolog with various Symfony components", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v5.3.7" }, "funding": [ { @@ -1664,47 +350,38 @@ "type": "tidelift" } ], - "time": "2021-08-13T15:54:02+00:00" + "time": "2021-08-25T20:02:16+00:00" }, { - "name": "symfony/monolog-bundle", - "version": "v3.7.0", + "name": "symfony/deprecation-contracts", + "version": "v2.4.0", "source": { "type": "git", - "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "4054b2e940a25195ae15f0a49ab0c51718922eb4" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/4054b2e940a25195ae15f0a49ab0c51718922eb4", - "reference": "4054b2e940a25195ae15f0a49ab0c51718922eb4", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", "shasum": "" }, "require": { - "monolog/monolog": "~1.22 || ~2.0", - "php": ">=7.1.3", - "symfony/config": "~4.4 || ^5.0", - "symfony/dependency-injection": "^4.4 || ^5.0", - "symfony/http-kernel": "~4.4 || ^5.0", - "symfony/monolog-bridge": "~4.4 || ^5.0" - }, - "require-dev": { - "symfony/console": "~4.4 || ^5.0", - "symfony/phpunit-bridge": "^5.1", - "symfony/yaml": "~4.4 || ^5.0" + "php": ">=7.1" }, - "type": "symfony-bundle", + "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-main": "2.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "psr-4": { - "Symfony\\Bundle\\MonologBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1713,23 +390,18 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony MonologBundle", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "keywords": [ - "log", - "logging" - ], "support": { - "issues": "https://github.com/symfony/monolog-bundle/issues", - "source": "https://github.com/symfony/monolog-bundle/tree/v3.7.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" }, "funding": [ { @@ -1745,44 +417,56 @@ "type": "tidelift" } ], - "time": "2021-03-31T07:20:47+00:00" + "time": "2021-03-23T23:28:01+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "name": "symfony/event-dispatcher", + "version": "v5.3.7", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "ce7b20d69c66a20939d8952b617506a44d102130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ce7b20d69c66a20939d8952b617506a44d102130", + "reference": "ce7b20d69c66a20939d8952b617506a44d102130", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/event-dispatcher-contracts": "^2", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^4.4|^5.0" }, "suggest": { - "ext-ctype": "For best performance" + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" + "Symfony\\Component\\EventDispatcher\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1791,24 +475,18 @@ ], "authors": [ { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for ctype functions", + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.7" }, "funding": [ { @@ -1824,45 +502,43 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-08-04T21:20:46+00:00" }, { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "name": "symfony/event-dispatcher-contracts", + "version": "v2.4.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", + "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" }, "suggest": { - "ext-intl": "For best performance" + "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "2.4-dev" }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Contracts\\EventDispatcher\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1878,18 +554,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's grapheme_* functions", + "description": "Generic abstractions related to dispatching event", "homepage": "https://symfony.com", "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" }, "funding": [ { @@ -1905,27 +581,27 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-03-23T23:28:01+00:00" }, { - "name": "symfony/polyfill-intl-normalizer", + "name": "symfony/polyfill-ctype", "version": "v1.23.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { "php": ">=7.1" }, "suggest": { - "ext-intl": "For best performance" + "ext-ctype": "For best performance" }, "type": "library", "extra": { @@ -1939,13 +615,10 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + "Symfony\\Polyfill\\Ctype\\": "" }, "files": [ "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1954,26 +627,24 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "intl", - "normalizer", + "ctype", "polyfill", - "portable", - "shim" + "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" }, "funding": [ { @@ -1992,24 +663,24 @@ "time": "2021-02-19T12:13:01+00:00" }, { - "name": "symfony/polyfill-mbstring", + "name": "symfony/polyfill-intl-grapheme", "version": "v1.23.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", "shasum": "" }, "require": { "php": ">=7.1" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { @@ -2023,7 +694,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" }, "files": [ "bootstrap.php" @@ -2043,17 +714,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "grapheme", + "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" }, "funding": [ { @@ -2072,22 +744,25 @@ "time": "2021-05-27T12:26:48+00:00" }, { - "name": "symfony/polyfill-php73", + "name": "symfony/polyfill-intl-normalizer", "version": "v1.23.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { "php": ">=7.1" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -2100,7 +775,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, "files": [ "bootstrap.php" @@ -2123,16 +798,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "intl", + "normalizer", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" }, "funding": [ { @@ -2151,22 +828,25 @@ "time": "2021-02-19T12:13:01+00:00" }, { - "name": "symfony/polyfill-php80", + "name": "symfony/polyfill-mbstring", "version": "v1.23.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", "shasum": "" }, "require": { "php": ">=7.1" }, + "suggest": { + "ext-mbstring": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -2179,24 +859,17 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" + "Symfony\\Polyfill\\Mbstring\\": "" }, "files": [ "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, + "authors": [ { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2206,16 +879,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "mbstring", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" }, "funding": [ { @@ -2231,20 +905,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2021-05-27T12:26:48+00:00" }, { - "name": "symfony/polyfill-php81", + "name": "symfony/polyfill-php73", "version": "v1.23.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "e66119f3de95efc359483f810c4c3e6436279436" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436", - "reference": "e66119f3de95efc359483f810c4c3e6436279436", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", "shasum": "" }, "require": { @@ -2262,7 +936,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" + "Symfony\\Polyfill\\Php73\\": "" }, "files": [ "bootstrap.php" @@ -2285,7 +959,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2294,7 +968,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" }, "funding": [ { @@ -2310,55 +984,44 @@ "type": "tidelift" } ], - "time": "2021-05-21T13:25:03+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { - "name": "symfony/routing", - "version": "v5.3.7", + "name": "symfony/polyfill-php80", + "version": "v1.23.1", "source": { "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "be865017746fe869007d94220ad3f5297951811b" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/be865017746fe869007d94220ad3f5297951811b", - "reference": "be865017746fe869007d94220ad3f5297951811b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "doctrine/annotations": "<1.12", - "symfony/config": "<5.3", - "symfony/dependency-injection": "<4.4", - "symfony/yaml": "<4.4" - }, - "require-dev": { - "doctrine/annotations": "^1.12", - "psr/log": "^1|^2|^3", - "symfony/config": "^5.3", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0" - }, - "suggest": { - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" + "php": ">=7.1" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, "autoload": { "psr-4": { - "Symfony\\Component\\Routing\\": "" + "Symfony\\Polyfill\\Php80\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2367,24 +1030,28 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Maps an HTTP request to a set of configuration variables", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ - "router", - "routing", - "uri", - "url" + "compatibility", + "polyfill", + "portable", + "shim" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.3.7" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" }, "funding": [ { @@ -2400,7 +1067,7 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:42:42+00:00" + "time": "2021-07-28T13:41:28+00:00" }, { "name": "symfony/service-contracts", @@ -2563,242 +1230,6 @@ } ], "time": "2021-08-26T08:00:08+00:00" - }, - { - "name": "symfony/var-dumper", - "version": "v5.3.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eaaea4098be1c90c8285543e1356a09c8aa5c8da", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "phpunit/phpunit": "<5.4.3", - "symfony/console": "<4.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "twig/twig": "^2.13|^3.0.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "bin": [ - "Resources/bin/var-dump-server" - ], - "type": "library", - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides mechanisms for walking through any arbitrary PHP variable", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.8" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-24T15:59:58+00:00" - }, - { - "name": "symfony/var-exporter", - "version": "v5.3.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-exporter.git", - "reference": "a7604de14bcf472fe8e33f758e9e5b7bf07d3b91" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/a7604de14bcf472fe8e33f758e9e5b7bf07d3b91", - "reference": "a7604de14bcf472fe8e33f758e9e5b7bf07d3b91", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "symfony/var-dumper": "^4.4.9|^5.0.9" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\VarExporter\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows exporting any serializable PHP data structure to plain PHP code", - "homepage": "https://symfony.com", - "keywords": [ - "clone", - "construct", - "export", - "hydrate", - "instantiate", - "serialize" - ], - "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.3.8" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-08-31T12:49:16+00:00" - }, - { - "name": "symfony/yaml", - "version": "v5.3.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<4.4" - }, - "require-dev": { - "symfony/console": "^4.4|^5.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "bin": [ - "Resources/bin/yaml-lint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Loads and dumps YAML files", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v5.3.6" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-29T06:20:01+00:00" } ], "packages-dev": [ @@ -3151,16 +1582,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -3171,7 +1602,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -3201,9 +1633,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", diff --git a/tests/Zephir/CompilerFile/CheckDependenciesTest.php b/tests/Zephir/CompilerFile/CheckDependenciesTest.php index 5b3ed38953..184b6215af 100644 --- a/tests/Zephir/CompilerFile/CheckDependenciesTest.php +++ b/tests/Zephir/CompilerFile/CheckDependenciesTest.php @@ -1,7 +1,5 @@ [__DIR__.'/../../config.yml']]); - $logger = new TestLogger(); + $config = new Config(); + $backend = new Backend($config, 'kernels', 'templates');; + $disk = new HardDisk(realpath('..').'/tests/output'); + $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); - /** - * @var Compiler - * @var Config $config - * @var FileSystemInterface $fs - */ - $compiler = self::$kernel->getContainer()->get(Compiler::class); - $config = self::$kernel->getContainer()->get(Config::class); - $fs = self::$kernel->getContainer()->get(FileSystemInterface::class); - - $compilerFile = new CompilerFile($config, new AliasManager(), $fs); + $compiler = new Compiler($config, $backend, new Manager(new Parser()), $disk, $compilerFactory); + $compilerFile = new CompilerFile($config, new AliasManager(), $disk); $compilerFile->setClassName('myClass'); $compilerFile->setFilePath('myClass.zep'); $compilerFile->setLogger($logger); diff --git a/tests/Zephir/KernelTestCase.php b/tests/Zephir/KernelTestCase.php deleted file mode 100644 index 8e06d606bc..0000000000 --- a/tests/Zephir/KernelTestCase.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Test; - -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase as BaseTestCase; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\HttpKernel\KernelInterface; -use Zephir\Config; -use Zephir\DependencyInjection\ZephirKernel; - -class KernelTestCase extends BaseTestCase -{ - /** - * Creates a Kernel. - * - * Available options: - * - * * environment - * * debug - * * config_files - * - * @param array $options Kernel configuration - * - * @return KernelInterface A KernelInterface instance - * - * @throws \RuntimeException - */ - protected static function createKernel(array $options = []): KernelInterface - { - if (null === static::$class) { - static::$class = static::getKernelClass(); - } - - if (isset($options['environment'])) { - $env = $options['environment']; - } elseif (isset($_ENV['APP_ENV'])) { - $env = $_ENV['APP_ENV']; - } elseif (isset($_SERVER['APP_ENV'])) { - $env = $_SERVER['APP_ENV']; - } else { - $env = 'test'; - } - - if (isset($options['debug'])) { - $debug = $options['debug']; - } elseif (isset($_ENV['APP_DEBUG'])) { - $debug = $_ENV['APP_DEBUG']; - } elseif (isset($_SERVER['APP_DEBUG'])) { - $debug = $_SERVER['APP_DEBUG']; - } else { - $debug = true; - } - - if (ZephirKernel::class === static::$class) { - $configFiles = []; - if (isset($options['config_files']) && \is_array($options['config_files'])) { - $configFiles = $options['config_files']; - } - - return new static::$class($env, $debug, $configFiles); - } else { - return new static::$class($env, $debug); - } - } - - /** - * Do not output messages from the Zephir compiler. - * - * @param ContainerInterface $container - */ - protected function muteOutput(ContainerInterface $container): void - { - try { - $container->get(Config::class)->set('silent', true); - } catch (ServiceCircularReferenceException $e) { - $this->fail($e->getMessage()); - } catch (ServiceNotFoundException $e) { - $this->fail($e->getMessage()); - } - } -} diff --git a/zephir b/zephir index a7ead4c04c..492ec78f51 100755 --- a/zephir +++ b/zephir @@ -10,13 +10,71 @@ * the LICENSE file that was distributed with this source code. */ +use Monolog\Handler\StreamHandler; +use Monolog\Logger; +use Zephir\Backends\ZendEngine3\Backend; +use Zephir\Compiler; +use Zephir\Config; use Zephir\Console\Application; -use Zephir\DependencyInjection\ContainerFactory; +use Zephir\Console\Command\ApiCommand; +use Zephir\Console\Command\BuildCommand; +use Zephir\Console\Command\CleanCommand; +use Zephir\Console\Command\CompileCommand; +use Zephir\Console\Command\FullCleanCommand; +use Zephir\Console\Command\GenerateCommand; +use Zephir\Console\Command\InitCommand; +use Zephir\Console\Command\InstallCommand; +use Zephir\Console\Command\ListCommand; +use Zephir\Console\Command\StubsCommand; +use Zephir\FileSystem\HardDisk; +use Zephir\Logger\Formatter\CompilerFormatter; +use Zephir\Parser\Manager; +use Zephir\Parser\Parser; require __DIR__ . '/Library/autoload.php'; require __DIR__ . '/Library/bootstrap.php'; -$container = (new ContainerFactory())->create(); +$config = Config::fromServer(); + +/** + * Logger + */ +$formatter = new CompilerFormatter($config); + +$consoleStdErrorHandler = new StreamHandler('php://stderr', Logger::WARNING, false); +$consoleStdErrorHandler->setFormatter($formatter); + +$consoleStdOutHandler = new StreamHandler('php://stdout', Logger::INFO, false); +$consoleStdOutHandler->setFormatter($formatter); + +$handlers = [ + $consoleStdErrorHandler, + $consoleStdOutHandler, +]; + +$disk = new HardDisk(realpath('.').DIRECTORY_SEPARATOR.'.zephir'); + +$parser = new Parser(); +$logger = new Logger('zephir', $handlers); +$compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); +$zendBackend3 = new Backend($config, 'kernels', 'templates'); + +$compiler = new Compiler($config, $zendBackend3, new Manager($parser), $disk, $compilerFactory); +$compiler->setPrototypesPath('prototypes'); +$compiler->setOptimizersPath('Library/Optimizers'); +$compiler->setTemplatesPath('templates'); +$compiler->setLogger($logger); + +$application = new Application(); +$application->add(new ApiCommand($compiler, $config)); +$application->add(new BuildCommand()); +$application->add(new CleanCommand($disk)); +$application->add(new CompileCommand($compiler)); +$application->add(new FullCleanCommand()); +$application->add(new GenerateCommand($compiler)); +$application->add(new InitCommand($zendBackend3, $config, $logger)); +$application->add(new InstallCommand($compiler, $config)); +$application->add(new ListCommand()); +$application->add(new StubsCommand($compiler)); -$application = $container->get(Application::class); $application->run(); From ea7743c0f464339d577053fa196042845a1ffb13 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 19:19:21 +0100 Subject: [PATCH 015/128] #2295 - Make paths absolute --- zephir | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/zephir b/zephir index 492ec78f51..b62435629f 100755 --- a/zephir +++ b/zephir @@ -31,8 +31,10 @@ use Zephir\Logger\Formatter\CompilerFormatter; use Zephir\Parser\Manager; use Zephir\Parser\Parser; -require __DIR__ . '/Library/autoload.php'; -require __DIR__ . '/Library/bootstrap.php'; +$rootPath = realpath(dirname(__FILE__)); + +require $rootPath.'/Library/autoload.php'; +require $rootPath.'/Library/bootstrap.php'; $config = Config::fromServer(); @@ -52,17 +54,17 @@ $handlers = [ $consoleStdOutHandler, ]; -$disk = new HardDisk(realpath('.').DIRECTORY_SEPARATOR.'.zephir'); +$disk = new HardDisk($rootPath.'/.zephir'); $parser = new Parser(); $logger = new Logger('zephir', $handlers); $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); -$zendBackend3 = new Backend($config, 'kernels', 'templates'); +$zendBackend3 = new Backend($config, $rootPath.'/kernels', $rootPath.'/templates'); $compiler = new Compiler($config, $zendBackend3, new Manager($parser), $disk, $compilerFactory); -$compiler->setPrototypesPath('prototypes'); -$compiler->setOptimizersPath('Library/Optimizers'); -$compiler->setTemplatesPath('templates'); +$compiler->setPrototypesPath($rootPath.'/prototypes'); +$compiler->setOptimizersPath($rootPath.'/Library/Optimizers'); +$compiler->setTemplatesPath($rootPath.'/templates'); $compiler->setLogger($logger); $application = new Application(); From 85c676625cba74d1e24c790107d21b0ba68bfd3c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 19:20:34 +0100 Subject: [PATCH 016/128] #2295 - Remove Symfony's configuration files --- Library/config/config.yml | 27 ----------- Library/config/services.yml | 55 ---------------------- config/symfony/services.php | 94 ------------------------------------- tests/config.yml | 2 - tests/services.yml | 8 ---- 5 files changed, 186 deletions(-) delete mode 100644 Library/config/config.yml delete mode 100644 Library/config/services.yml delete mode 100644 config/symfony/services.php delete mode 100644 tests/config.yml delete mode 100644 tests/services.yml diff --git a/Library/config/config.yml b/Library/config/config.yml deleted file mode 100644 index e94b79e591..0000000000 --- a/Library/config/config.yml +++ /dev/null @@ -1,27 +0,0 @@ -imports: - - { resource: 'services.yml' } - -parameters: - prototypes_path: "%kernel.project_dir%/prototypes" - optimizers_path: "%kernel.project_dir%/Library/Optimizers" - kernels_path: "%kernel.project_dir%/kernels" - templates_path: "%kernel.project_dir%/templates" - local_cache_path: "%kernel.local_cache_dir%" - -monolog: - handlers: - console_stderr: - type: stream - path: 'php://stderr' - process_psr_3_messages: true - bubble: false - level: WARNING - formatter: compiler_log_formatter - console_stdout: - type: stream - path: 'php://stdout' - process_psr_3_messages: true - bubble: false - level: INFO - formatter: compiler_log_formatter - diff --git a/Library/config/services.yml b/Library/config/services.yml deleted file mode 100644 index c9a09b8ae6..0000000000 --- a/Library/config/services.yml +++ /dev/null @@ -1,55 +0,0 @@ -services: - _defaults: - autowire: true - autoconfigure: true - public: false - tags: - - { name: monolog.logger, channel: zephir } - - Zephir\: - resource: '..' - exclude: '../{autoload.php,bootstrap.php,functions.php}' - - Zephir\Console\Application: - public: true - - Zephir\FileSystem\FileSystemInterface: - class: Zephir\FileSystem\HardDisk - public: true - lazy: true - arguments: - $basePath: '%local_cache_path%' - - Zephir\Config: - factory: 'Zephir\Config::fromServer' - class: Zephir\Config - public: true - - Zephir\Backends\BackendFactory: - public: true - arguments: - $kernelsPath: '%kernels_path%' - $templatesPath: '%templates_path%' - - Zephir\BaseBackend: - factory: ['@Zephir\Backends\BackendFactory', 'createBackend'] - public: true - - Zephir\Compiler: - public: true - calls: - - method: setPrototypesPath - arguments: - - '%prototypes_path%' - - method: setOptimizersPath - arguments: - - '%optimizers_path%' - - method: setTemplatesPath - arguments: - - '%templates_path%' - - method: setLogger - arguments: - - '@monolog.logger' - - compiler_log_formatter: - class: Zephir\Logger\Formatter\CompilerFormatter diff --git a/config/symfony/services.php b/config/symfony/services.php deleted file mode 100644 index f44b9e2964..0000000000 --- a/config/symfony/services.php +++ /dev/null @@ -1,94 +0,0 @@ -services() - ->defaults() - ->autowire() - ->autoconfigure() - ->private() - ->tag('monolog.logger', ['channel' => 'zephir']); - - $services - ->load('Zephir\\', '../../Library') - ->exclude('../../Library/{autoload.php,bootstrap.php,functions.php}'); - - $services - ->set(Application::class) - ->public(); - - $services - ->set(FileSystemInterface::class, HardDisk::class) - ->public() - ->lazy() - ->arg('$basePath', '%local_cache_path%'); - - $services - ->set(Config::class) - ->factory('Zephir\Config::fromServer') - ->public(); - - $services - ->set(BackendFactory::class) - ->public() - ->arg('$kernelsPath', param('kernels_path')) - ->arg('$templatesPath', param('templates_path')); - - $services - ->set(BaseBackend::class) - ->factory([service(BackendFactory::class), 'createBackend']) - ->public(); - - $services - ->set('compiler_log_formatter', CompilerFormatter::class); - - $services - ->set(Compiler::class) - ->public() - ->call('setPrototypesPath', ['%prototypes_path%']) - ->call('setOptimizersPath', ['%optimizers_path%']) - ->call('setTemplatesPath', ['%templates_path%']) - ->call('setLogger', [tagged_locator('monolog.logger')]); - - $configurator - ->parameters() - ->set('prototypes_path', '%kernel.project_dir%/prototypes') - ->set('optimizers_path', '%kernel.project_dir%/Library/Optimizers') - ->set('kernels_path', '%kernel.project_dir%/kernels') - ->set('templates_path', '%kernel.project_dir%/templates') - ->set('local_cache_path', '%kernel.local_cache_dir%'); - - $configurator->extension('monolog', [ - 'handlers' => [ - 'console_stderr' => [ - 'type' => 'stream', - 'path' => 'php://stderr', - 'process_psr_3_messages' => true, - 'bubble' => false, - 'level' => 'warning', - 'formatter' => 'compiler_log_formatter', - ], - 'console_stdout' => [ - 'type' => 'stream', - 'path' => 'php://stdout', - 'process_psr_3_messages' => true, - 'bubble' => false, - 'level' => 'info', - 'formatter' => 'compiler_log_formatter', - ], - ] - ]); -}; diff --git a/tests/config.yml b/tests/config.yml deleted file mode 100644 index 72cd084301..0000000000 --- a/tests/config.yml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: 'services.yml' } diff --git a/tests/services.yml b/tests/services.yml deleted file mode 100644 index a2a3c3217c..0000000000 --- a/tests/services.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - - Zephir\CompilerFile: - public: true - arguments: - $config: '@Zephir\Config' - $aliasManager: '@Zephir\AliasManager' - $filesystem: '@Zephir\FileSystem\FileSystemInterface' From c6aedbf67eb4c23bc6e4e4ae1058b17cacc1d7fc Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 19:21:48 +0100 Subject: [PATCH 017/128] #2295 - Remove double `;` --- tests/Zephir/CompilerFile/CheckDependenciesTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Zephir/CompilerFile/CheckDependenciesTest.php b/tests/Zephir/CompilerFile/CheckDependenciesTest.php index 184b6215af..1201582e70 100644 --- a/tests/Zephir/CompilerFile/CheckDependenciesTest.php +++ b/tests/Zephir/CompilerFile/CheckDependenciesTest.php @@ -34,7 +34,7 @@ public function testExtendsClassThatDoesNotExist(): void { $logger = new TestLogger(); $config = new Config(); - $backend = new Backend($config, 'kernels', 'templates');; + $backend = new Backend($config, 'kernels', 'templates'); $disk = new HardDisk(realpath('..').'/tests/output'); $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); From 1504175e5651260180c4feff8d6f919fb00e8e9a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 19:34:35 +0100 Subject: [PATCH 018/128] #2295 - Change to `BackendFactory` --- Library/Backends/BackendFactory.php | 25 ++++++++++++------------- zephir | 9 +++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Library/Backends/BackendFactory.php b/Library/Backends/BackendFactory.php index ed3e9ccbf7..837481a1bb 100644 --- a/Library/Backends/BackendFactory.php +++ b/Library/Backends/BackendFactory.php @@ -9,9 +9,10 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Backends; -use Psr\Container\ContainerInterface; use Symfony\Component\Console\Input\ArgvInput; use Zephir\BaseBackend; use Zephir\Config; @@ -19,13 +20,13 @@ final class BackendFactory { - private $container; - private $kernelsPath; - private $templatesPath; + private Config $config; + private string $kernelsPath; + private string $templatesPath; - public function __construct(ContainerInterface $container, $kernelsPath, $templatesPath) + public function __construct(Config $config, string $kernelsPath, string $templatesPath) { - $this->container = $container; + $this->config = $config; $this->kernelsPath = $kernelsPath; $this->templatesPath = $templatesPath; } @@ -35,7 +36,7 @@ public function createBackend() $backendClassName = $this->resolveBackendClass(); return new $backendClassName( - $this->container->get(Config::class), + $this->config, $this->kernelsPath, $this->templatesPath ); @@ -48,7 +49,7 @@ public function createBackend() * * @return string */ - private function resolveBackendClass() + private function resolveBackendClass(): string { $parser = new ArgvInput(); $backend = $parser->getParameterOption('--backend', null); @@ -59,9 +60,7 @@ private function resolveBackendClass() // testing purposes and may be removed in the future. // You SHOULD NOT rely on this possibility. if (getenv('ZEPHIR_BACKEND')) { - $backend = $backend = getenv('ZEPHIR_BACKEND'); - } elseif ($this->container->has('ZEPHIR_BACKEND')) { - $backend = $this->container->get('ZEPHIR_BACKEND'); + $backend = getenv('ZEPHIR_BACKEND'); } } @@ -71,8 +70,8 @@ private function resolveBackendClass() $className = "Zephir\\Backends\\{$backend}\\Backend"; - if (!class_exists($className) || 'ZendEngine2' == $backend) { - throw new IllegalStateException(sprintf('Backend class "%s" doesn\'t exist.', $backend)); + if (!class_exists($className) || 'ZendEngine2' === $backend) { + throw new IllegalStateException(sprintf('Backend class "%s" does not exist.', $backend)); } return $className; diff --git a/zephir b/zephir index b62435629f..9847073ec2 100755 --- a/zephir +++ b/zephir @@ -12,7 +12,7 @@ use Monolog\Handler\StreamHandler; use Monolog\Logger; -use Zephir\Backends\ZendEngine3\Backend; +use Zephir\Backends\BackendFactory; use Zephir\Compiler; use Zephir\Config; use Zephir\Console\Application; @@ -59,9 +59,10 @@ $disk = new HardDisk($rootPath.'/.zephir'); $parser = new Parser(); $logger = new Logger('zephir', $handlers); $compilerFactory = new Compiler\CompilerFileFactory($config, $disk, $logger); -$zendBackend3 = new Backend($config, $rootPath.'/kernels', $rootPath.'/templates'); +$backend = (new BackendFactory($config, $rootPath.'/kernels', $rootPath.'/templates')) + ->createBackend(); -$compiler = new Compiler($config, $zendBackend3, new Manager($parser), $disk, $compilerFactory); +$compiler = new Compiler($config, $backend, new Manager($parser), $disk, $compilerFactory); $compiler->setPrototypesPath($rootPath.'/prototypes'); $compiler->setOptimizersPath($rootPath.'/Library/Optimizers'); $compiler->setTemplatesPath($rootPath.'/templates'); @@ -74,7 +75,7 @@ $application->add(new CleanCommand($disk)); $application->add(new CompileCommand($compiler)); $application->add(new FullCleanCommand()); $application->add(new GenerateCommand($compiler)); -$application->add(new InitCommand($zendBackend3, $config, $logger)); +$application->add(new InitCommand($backend, $config, $logger)); $application->add(new InstallCommand($compiler, $config)); $application->add(new ListCommand()); $application->add(new StubsCommand($compiler)); From 5846be5829077aa85ec13cd49466646793177ff7 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 19:54:36 +0100 Subject: [PATCH 019/128] #2295 - Change `basePath` in `HardDisk` class --- zephir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zephir b/zephir index 9847073ec2..76ce16a525 100755 --- a/zephir +++ b/zephir @@ -54,7 +54,7 @@ $handlers = [ $consoleStdOutHandler, ]; -$disk = new HardDisk($rootPath.'/.zephir'); +$disk = new HardDisk(getcwd().'/.zephir'); $parser = new Parser(); $logger = new Logger('zephir', $handlers); From e26a6d1c0273924860662caab532cd45c726d287 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 19:55:56 +0100 Subject: [PATCH 020/128] #2295 - Remove `DependencyInjection/` directory --- ...llectCommandsToApplicationCompilerPass.php | 43 ---- .../DependencyInjection/ContainerFactory.php | 50 ----- Library/DependencyInjection/ZephirKernel.php | 211 ------------------ 3 files changed, 304 deletions(-) delete mode 100644 Library/DependencyInjection/CompilerPass/CollectCommandsToApplicationCompilerPass.php delete mode 100644 Library/DependencyInjection/ContainerFactory.php delete mode 100644 Library/DependencyInjection/ZephirKernel.php diff --git a/Library/DependencyInjection/CompilerPass/CollectCommandsToApplicationCompilerPass.php b/Library/DependencyInjection/CompilerPass/CollectCommandsToApplicationCompilerPass.php deleted file mode 100644 index c70f721fa8..0000000000 --- a/Library/DependencyInjection/CompilerPass/CollectCommandsToApplicationCompilerPass.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\DependencyInjection\CompilerPass; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Zephir\Console\Application; - -final class CollectCommandsToApplicationCompilerPass implements CompilerPassInterface -{ - public function process(ContainerBuilder $containerBuilder) - { - $applicationDefinition = $containerBuilder->getDefinition(Application::class); - - foreach ($containerBuilder->getDefinitions() as $name => $definition) { - if (null === $definition->getClass()) { - continue; - } - - /* - * TODO: Deal with SelfUpdateCommand. - * - * if (\substr(__FILE__, 0, 5) === 'phar:') { - * // ... - * } - */ - if (is_a($definition->getClass(), Command::class, true)) { - $applicationDefinition->addMethodCall('add', [new Reference($name)]); - } - } - } -} diff --git a/Library/DependencyInjection/ContainerFactory.php b/Library/DependencyInjection/ContainerFactory.php deleted file mode 100644 index 20fe40ff0a..0000000000 --- a/Library/DependencyInjection/ContainerFactory.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\DependencyInjection; - -final class ContainerFactory -{ - private $environment = '$kernel-environment$'; - private $debug = false; - - public function __construct() - { - /* - * Please do not concatenate the string bellow. - * The final version of this string is used to prepare release PHAR file. - * For more see box.json.dist file at the project root. - */ - if ('$'.'kernel-environment'.'$' === $this->environment) { - $this->environment = 'dev'; - } - - if ('dev' === $this->environment) { - $this->debug = true; - } - } - - public function createWithConfigs(array $configs) - { - $kernel = new ZephirKernel($this->environment, $this->debug, $configs); - $kernel->boot(); - - return $kernel->getContainer(); - } - - public function create() - { - $kernel = new ZephirKernel($this->environment, $this->debug); - $kernel->boot(); - - return $kernel->getContainer(); - } -} diff --git a/Library/DependencyInjection/ZephirKernel.php b/Library/DependencyInjection/ZephirKernel.php deleted file mode 100644 index 097fe67fd5..0000000000 --- a/Library/DependencyInjection/ZephirKernel.php +++ /dev/null @@ -1,211 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Zephir\DependencyInjection; - -use Exception; -use RuntimeException; -use Symfony\Bundle\MonologBundle\MonologBundle; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\Kernel; -use Throwable; -use Zephir\DependencyInjection\CompilerPass\CollectCommandsToApplicationCompilerPass; -use Zephir\Zephir; - -use function dirname; -use function Zephir\is_macos; -use function Zephir\is_windows; - -use const DIRECTORY_SEPARATOR; - -final class ZephirKernel extends Kernel -{ - private array $extraConfigFiles; - private $startedDir; - - /** - * AppKernel constructor. - * - * @param string $environment The environment - * @param bool $debug Whether to enable debugging or not - * @param string[] $configFiles Optional Zephir configuration files - */ - public function __construct(string $environment, bool $debug, array $configFiles = []) - { - $this->startedDir = getcwd(); - $this->extraConfigFiles = $configFiles; - - parent::__construct($environment, $debug); - } - - /** - * @return array - */ - public function registerBundles(): array - { - return [ - new MonologBundle(), - ]; - } - - /** - * {@inheritdoc} - * - * @param LoaderInterface $loader - * - * @throws Exception|Throwable - */ - public function registerContainerConfiguration(LoaderInterface $loader) - { - $loader->load(__DIR__.'/../../config/symfony/services.php'); - - foreach ($this->extraConfigFiles as $configFile) { - $loader->load($configFile); - } - } - - /** - * @return string - */ - public function getCacheDir(): string - { - $home = getenv('HOME') ?: (getenv('HOMEDRIVE').DIRECTORY_SEPARATOR.getenv('HOMEPATH')); - - if (is_macos()) { - $cacheDir = getenv('XDG_CACHE_HOME') ?: $home.'/Library/Caches'; - $cacheDir .= '/Zephir'; - } elseif (is_windows()) { - $cacheDir = getenv('LOCALAPPDATA') ?: $home; - $cacheDir .= '\\Zephir\\Cache'; - } else { - $cacheDir = getenv('XDG_CACHE_HOME') ?: $home.'/.cache'; - $cacheDir .= '/zephir'; - } - - $path = $cacheDir.DIRECTORY_SEPARATOR.$this->getPathSalt(); - if (!is_dir($path) && !mkdir($path, 0755, true) && !is_dir($path)) { - throw new RuntimeException( - sprintf('Unable to create cache directory: "%s"', $path) - ); - } - - return $path; - } - - /** - * Allows container rebuild when config or version changes. - * This also used to get unique path to kernel logs. - * - * @return string - */ - private function getPathSalt(): string - { - $prefix = - Zephir::VERSION. - $this->environment. - serialize($this->extraConfigFiles); - - $localConfig = $this->startedDir.DIRECTORY_SEPARATOR.'config.json'; - $suffix = $this->startedDir; - if (file_exists($localConfig)) { - $suffix = md5_file($localConfig); - } - - return substr(md5("{$prefix}{$suffix}"), 0, 16); - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getLogDir(): string - { - $home = getenv('HOME') ?: (getenv('HOMEDRIVE').DIRECTORY_SEPARATOR.getenv('HOMEPATH')); - - if (is_macos()) { - $stateDir = getenv('XDG_STATE_HOME') ?: $home.'/Library'; - $stateDir .= '/Zephir/State'; - } elseif (is_windows()) { - $stateDir = getenv('LOCALAPPDATA') ?: $home; - $stateDir .= '\\Zephir\\State'; - } else { - // See: https://stackoverflow.com/a/27965014/1661465 - $stateDir = getenv('XDG_STATE_HOME') ?: $home.'/.local/state'; - $stateDir .= '/zephir'; - } - - $path = $stateDir.DIRECTORY_SEPARATOR.$this->getPathSalt(); - if (!is_dir($path) && !mkdir($path, 0755, true) && !is_dir($path)) { - throw new RuntimeException( - sprintf('Unable to create logs directory: "%s"', $path) - ); - } - - return $path; - } - - /** - * {@inheritdoc} - * - * @return string The project root dir - */ - public function getProjectDir(): string - { - return dirname(__DIR__, 2); - } - - /** - * {@inheritdoc} - * - * @return string - */ - public function getRootDir(): string - { - return dirname(__DIR__); - } - - /** - * Gets the local cache directory used internally by zephir. - * - * @return string The local cache dir - */ - public function getStartedDir(): string - { - return $this->startedDir.'/.zephir'; - } - - /** - * {@inheritdoc} - * - * @param ContainerBuilder $container - */ - protected function build(ContainerBuilder $container) - { - $container->addCompilerPass(new CollectCommandsToApplicationCompilerPass()); - } - - /** - * {@inheritdoc} - * - * @return array An array of kernel parameters - */ - protected function getKernelParameters(): array - { - $parameters = parent::getKernelParameters(); - $parameters['kernel.local_cache_dir'] = $this->getStartedDir(); - - return $parameters; - } -} From cba92031d84e15ea52e47a19f5540c7c5e5d630d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 20:32:41 +0100 Subject: [PATCH 021/128] #2255 - Fix `php_stream_open_for_zend_ex` for 8.1 in `zephir_require_once_ret` --- kernels/ZendEngine3/require.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernels/ZendEngine3/require.c b/kernels/ZendEngine3/require.c index 88bca65109..98125c9384 100755 --- a/kernels/ZendEngine3/require.c +++ b/kernels/ZendEngine3/require.c @@ -118,7 +118,16 @@ int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } From c3212d4bc4341709a0b637bdd0db2beb2eba68ae Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 20:32:55 +0100 Subject: [PATCH 022/128] #2255 - Add `*.dep` to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 47b158cc97..6bf4875669 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ doc vendor # Compilation artifacts. +*.dep *.gch *.lo *.la From e32a0f76f72a473560f4821a5ef181c13b7d1067 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 20:39:20 +0100 Subject: [PATCH 023/128] #2255 - Fix deprecation notices --- Library/BaseBackend.php | 12 ++--- Library/ClassMethodParameters.php | 9 ++++ Library/Config.php | 6 ++- .../FunctionLike/ReturnType/Collection.php | 54 ++++++++++--------- 4 files changed, 47 insertions(+), 34 deletions(-) diff --git a/Library/BaseBackend.php b/Library/BaseBackend.php index d9a8b72b21..17d32e3840 100644 --- a/Library/BaseBackend.php +++ b/Library/BaseBackend.php @@ -66,7 +66,7 @@ public function getName() * * @return string */ - public function getInternalKernelPath() + public function getInternalKernelPath(): string { return "$this->kernelsPath/{$this->name}"; } @@ -76,7 +76,7 @@ public function getInternalKernelPath() * * @return string */ - public function getInternalTemplatePath() + public function getInternalTemplatePath(): string { return "$this->templatesPath/{$this->name}"; } @@ -88,16 +88,14 @@ public function getInternalTemplatePath() * * @return string */ - public function getTemplateFileContents($filename) + public function getTemplateFileContents(string $filename): string { - $templatePath = rtrim($this->config->get('templatepath', 'backend'), '\\/'); + $templatePath = rtrim((string)$this->config->get('templatepath', 'backend'), '\\/'); if (empty($templatepath)) { $templatePath = $this->templatesPath; } - return file_get_contents( - "{$templatePath}/{$this->name}/{$filename}" - ); + return file_get_contents("{$templatePath}/{$this->name}/{$filename}"); } /** diff --git a/Library/ClassMethodParameters.php b/Library/ClassMethodParameters.php index 13e54efb5d..9337d68128 100644 --- a/Library/ClassMethodParameters.php +++ b/Library/ClassMethodParameters.php @@ -142,46 +142,55 @@ public function count(): int return count($this->parameters); } + #[\ReturnTypeWillChange] public function rewind() { $this->position = 0; } + #[\ReturnTypeWillChange] public function key() { return $this->position; } + #[\ReturnTypeWillChange] public function valid() { return isset($this->parameters[$this->position]); } + #[\ReturnTypeWillChange] public function current() { return $this->parameters[$this->position]; } + #[\ReturnTypeWillChange] public function next() { ++$this->position; } + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->parameters[$offset]); } + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->parameters[$offset]; } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->parameters[$offset] = $value; } + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->parameters[$offset]); diff --git a/Library/Config.php b/Library/Config.php index 21040cfb81..73aeaf59b0 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use ArrayAccess; @@ -226,7 +228,7 @@ public function offsetExists($key): bool * * @return mixed|null */ - #[ReturnTypeWillChange] + #[\ReturnTypeWillChange] public function offsetGet($offset) { if (!\is_array($offset)) { @@ -253,6 +255,7 @@ public function offsetGet($offset) * @param mixed $key * @param mixed $value */ + #[\ReturnTypeWillChange] public function offsetSet($key, $value) { if (!\is_array($key)) { @@ -278,6 +281,7 @@ public function offsetSet($key, $value) * * @param mixed $key */ + #[\ReturnTypeWillChange] public function offsetUnset($key) { unset($this->container[$key]); diff --git a/Library/FunctionLike/ReturnType/Collection.php b/Library/FunctionLike/ReturnType/Collection.php index 943b2ff268..b1198d1e6e 100644 --- a/Library/FunctionLike/ReturnType/Collection.php +++ b/Library/FunctionLike/ReturnType/Collection.php @@ -9,11 +9,15 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\FunctionLike\ReturnType; use SplObjectStorage; use Zephir\Exception\InvalidArgumentException; +use function count; + final class Collection extends SplObjectStorage { /** @@ -23,6 +27,7 @@ final class Collection extends SplObjectStorage * * @return string */ + #[\ReturnTypeWillChange] public function getHash($returnType) { return $returnType->getDataType(); @@ -38,6 +43,7 @@ public function getHash($returnType) * * @throws InvalidArgumentException */ + #[\ReturnTypeWillChange] public function attach($returnType, $definition = null) { if (!$returnType instanceof TypeInterface) { @@ -58,13 +64,9 @@ public function attach($returnType, $definition = null) * * @return bool */ - public function hasReturnTypes() + public function hasReturnTypes(): bool { - if (0 == $this->count()) { - return false; - } - - if ($this->onlyVoid()) { + if (0 === $this->count() || $this->onlyVoid()) { return false; } @@ -78,7 +80,7 @@ public function hasReturnTypes() * * @return TypeInterface[] */ - public function getTypesBySpecification(SpecificationInterface $spec) + public function getTypesBySpecification(SpecificationInterface $spec): array { $types = []; @@ -97,7 +99,7 @@ public function getTypesBySpecification(SpecificationInterface $spec) * * @return bool */ - public function areReturnTypesNullCompatible() + public function areReturnTypesNullCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IsNull()); } @@ -107,7 +109,7 @@ public function areReturnTypesNullCompatible() * * @return bool */ - public function areReturnTypesIntCompatible() + public function areReturnTypesIntCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IntCompatible()); } @@ -117,7 +119,7 @@ public function areReturnTypesIntCompatible() * * @return bool */ - public function areReturnTypesDoubleCompatible() + public function areReturnTypesDoubleCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IsDouble()); } @@ -127,7 +129,7 @@ public function areReturnTypesDoubleCompatible() * * @return bool */ - public function areReturnTypesBoolCompatible() + public function areReturnTypesBoolCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\IsBool()); } @@ -137,7 +139,7 @@ public function areReturnTypesBoolCompatible() * * @return bool */ - public function areReturnTypesStringCompatible() + public function areReturnTypesStringCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\StringCompatible()); } @@ -147,7 +149,7 @@ public function areReturnTypesStringCompatible() * * @return bool */ - public function areReturnTypesArrayCompatible() + public function areReturnTypesArrayCompatible(): bool { return $this->isSatisfiedByTypeSpec(new Specification\ArrayCompatible()); } @@ -157,9 +159,9 @@ public function areReturnTypesArrayCompatible() * * @return bool */ - public function areReturnTypesObjectCompatible() + public function areReturnTypesObjectCompatible(): bool { - return \count($this->getObjectLikeReturnTypes()) > 0; + return count($this->getObjectLikeReturnTypes()) > 0; } /** @@ -191,7 +193,7 @@ public function onlySpecial() $found = $this->getTypesBySpecification(new Specification\IsSpecial()); - return \count($found) == $this->count(); + return count($found) == $this->count(); } /** @@ -199,9 +201,9 @@ public function onlySpecial() * * @return bool */ - public function areReturnTypesWellKnown() + public function areReturnTypesWellKnown(): bool { - if (0 == $this->count() || $this->isSatisfiedByTypeSpec(new Specification\IsSpecial())) { + if (0 === $this->count() || $this->isSatisfiedByTypeSpec(new Specification\IsSpecial())) { return false; } @@ -218,7 +220,7 @@ public function areReturnTypesWellKnown() $found = $this->getTypesBySpecification($spec); - return \count($found) == $this->count(); + return count($found) == $this->count(); } /** @@ -226,7 +228,7 @@ public function areReturnTypesWellKnown() * * @return bool */ - public function areReturnTypesCompatible() + public function areReturnTypesCompatible(): bool { $numberOfReturnTypes = $this->count(); @@ -239,7 +241,7 @@ public function areReturnTypesCompatible() // | | | ... | $collections = $this->getTypesBySpecification(new Specification\IsCollection()); - if (\count($collections) > 0 && $this->areReturnTypesObjectCompatible()) { + if (count($collections) > 0 && $this->areReturnTypesObjectCompatible()) { return false; } @@ -292,7 +294,7 @@ public function areReturnTypesCompatible() * * @return TypeInterface[] */ - public function getCastHintedReturnTypes() + public function getCastHintedReturnTypes(): array { return $this->getTypesBySpecification(new Not(new Specification\IsReal())); } @@ -302,19 +304,19 @@ public function getCastHintedReturnTypes() * * @return TypeInterface[] */ - public function getRealReturnTypes() + public function getRealReturnTypes(): array { return $this->getTypesBySpecification(new Specification\IsReal()); } - private function isSatisfiedByTypeSpec(SpecificationInterface $spec) + private function isSatisfiedByTypeSpec(SpecificationInterface $spec): bool { - if (0 == $this->count()) { + if (0 === $this->count()) { return false; } $found = $this->getTypesBySpecification($spec); - return \count($found) > 0; + return count($found) > 0; } } From a38a556e92f1b136c31758229fe248c9b82d4984 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 21:10:16 +0100 Subject: [PATCH 024/128] #2255 - Add support of `mixed` in arrays --- Library/Backends/ZendEngine2/Backend.php | 6 ++++-- Library/Call.php | 2 ++ Library/Statements/Let/ObjectPropertyAppend.php | 1 + Library/Statements/Let/ObjectPropertyArrayIndex.php | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php index 1612743bf3..3f104c3c21 100644 --- a/Library/Backends/ZendEngine2/Backend.php +++ b/Library/Backends/ZendEngine2/Backend.php @@ -444,6 +444,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA /* Types which map to the same */ case 'variable': + case 'mixed': case 'string': $type = $index->getType(); break; @@ -454,7 +455,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA $arrayAccess['right'] ); } - if ($isVariable && \in_array($index->getType(), ['variable', 'string'])) { + if ($isVariable && \in_array($index->getType(), ['variable', 'string', 'mixed'])) { $output = 'zephir_array_fetch('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; } else { if ($isVariable) { @@ -487,7 +488,7 @@ public function arrayIsset(Variable $var, $resolvedExpr, $expression, Compilatio if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); - } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType()) { + } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType() || 'mixed' === $resolvedExpr->getType()) { return new CompiledExpression('bool', 'zephir_array_isset('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression); } @@ -550,6 +551,7 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo case 'string': case 'variable': + case 'mixed': $context->codePrinter->output('zephir_array_unset('.$variableCode.', '.$indexCode.', '.$flags.');'); break; diff --git a/Library/Call.php b/Library/Call.php index ba5aff04f5..3e03402521 100644 --- a/Library/Call.php +++ b/Library/Call.php @@ -454,6 +454,7 @@ public function getResolvedParams(array $parameters, CompilationContext $compila break; case 'variable': + case 'mixed': $params[] = $compilationContext->backend->getVariableCode($parameterVariable); $types[] = $parameterVariable->getType(); $dynamicTypes = array_merge( @@ -636,6 +637,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext case 'string': case 'variable': + case 'mixed': case 'array': $params[] = $compilationContext->backend->getVariableCode($parameterVariable); $dynamicTypes[] = $parameterVariable->getType(); diff --git a/Library/Statements/Let/ObjectPropertyAppend.php b/Library/Statements/Let/ObjectPropertyAppend.php index 80e85557f7..8c11838ee2 100644 --- a/Library/Statements/Let/ObjectPropertyAppend.php +++ b/Library/Statements/Let/ObjectPropertyAppend.php @@ -175,6 +175,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'variable': + case 'mixed': case 'string': case 'array': case 'resource': diff --git a/Library/Statements/Let/ObjectPropertyArrayIndex.php b/Library/Statements/Let/ObjectPropertyArrayIndex.php index b572f17d88..9c221543b1 100644 --- a/Library/Statements/Let/ObjectPropertyArrayIndex.php +++ b/Library/Statements/Let/ObjectPropertyArrayIndex.php @@ -98,6 +98,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy case 'ulong': case 'long': case 'variable': + case 'mixed': break; default: throw new CompilerException('Variable: '.$indexVariable->getType().' cannot be used as index without cast', $statement); @@ -171,6 +172,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy switch ($indexVariable->getType()) { case 'variable': + case 'mixed': case 'string': switch ($resolvedExpr->getType()) { case 'null': @@ -238,6 +240,7 @@ protected function _assignPropertyArraySingleIndex($variable, ZephirVariable $sy break; case 'variable': + case 'mixed': case 'string': case 'array': $compilationContext->backend->assignArrayProperty($symbolVariable, $property, $indexVariable, $variableExpr, $compilationContext); From a37a15805c16707577e8d13c14a6f1fe5c569b2c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 21:10:33 +0100 Subject: [PATCH 025/128] #2255 - Fix deprecation notices --- prototypes/apc.php | 7 +++++-- stub/arrayaccessobj.zep | 16 ++++++++-------- stub/arrayiterator.zep | 4 ++-- stub/oo/oonativeimplements.zep | 4 ++-- stub/strings.zep | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/prototypes/apc.php b/prototypes/apc.php index c90ad3f889..9acecb9172 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -46,24 +46,27 @@ public function __construct($cache, $search = null, $format = APC_ITER_ALL, $chu { } + #[\ReturnTypeWillChange] public function rewind() { } + #[\ReturnTypeWillChange] public function valid() { } - #[ReturnTypeWillChange] + #[\ReturnTypeWillChange] public function current() { } + #[\ReturnTypeWillChange] public function key() { } - #[ReturnTypeWillChange] + #[\ReturnTypeWillChange] public function next() { } diff --git a/stub/arrayaccessobj.zep b/stub/arrayaccessobj.zep index 99535addf5..d81b9d20c6 100644 --- a/stub/arrayaccessobj.zep +++ b/stub/arrayaccessobj.zep @@ -12,8 +12,8 @@ class ArrayAccessObj implements \ArrayAccess "three":3 ]; } - - public function offsetSet(offset, value) + + public function offsetSet(mixed offset, mixed value) -> void { if is_null(offset) { let this->test[] = value; @@ -21,18 +21,18 @@ class ArrayAccessObj implements \ArrayAccess let this->test[offset] = value; } } - - public function offsetExists(offset) + + public function offsetExists(mixed offset) -> bool { return isset this->test[offset]; } - - public function offsetUnset(offset) + + public function offsetUnset(mixed offset) -> void { unset this->test[offset]; } - - public function offsetGet(offset) + + public function offsetGet(mixed offset) -> mixed { return isset this->test[offset] ? this->test[offset] : null; } diff --git a/stub/arrayiterator.zep b/stub/arrayiterator.zep index f2b7b29dcb..d6d9998df7 100644 --- a/stub/arrayiterator.zep +++ b/stub/arrayiterator.zep @@ -20,12 +20,12 @@ class ArrayIterator implements \Iterator let this->position = 0; } - public function current() + public function current() -> mixed { return this->test[this->position]; } - public function key() + public function key() -> mixed { return this->position; } diff --git a/stub/oo/oonativeimplements.zep b/stub/oo/oonativeimplements.zep index c97c4f72d2..f25939e351 100644 --- a/stub/oo/oonativeimplements.zep +++ b/stub/oo/oonativeimplements.zep @@ -22,11 +22,11 @@ class OoNativeImplements implements /* Iterator */ - public function current() + public function current() -> mixed { } - public function key() + public function key() -> mixed { } diff --git a/stub/strings.zep b/stub/strings.zep index 59ddae79e2..569be78695 100644 --- a/stub/strings.zep +++ b/stub/strings.zep @@ -166,7 +166,7 @@ class Strings { var x; let value = str_replace(["\\", "\"", "'"], "", value); - let value = filter_var(value, FILTER_SANITIZE_STRING); + let value = filter_var(value, FILTER_UNSAFE_RAW); let x = trim(stripslashes(strip_tags(value))); return trim(stripcslashes(strip_tags(value))); } From 70a7bfdeaeadab45cf2c2c8156ff7f6569a54ee8 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 21:28:24 +0100 Subject: [PATCH 026/128] #2255 - Update `ext/` directory --- ext/kernel/file.c | 12 ++++++++ ext/kernel/main.c | 6 ++-- ext/kernel/require.c | 23 +++++++++++++-- ext/stub.c | 2 +- ext/stub/arrayaccessobj.zep.c | 12 +++++--- ext/stub/arrayaccessobj.zep.h | 14 ++++++--- ext/stub/arrayiterator.zep.c | 2 +- ext/stub/arrayiterator.zep.h | 38 +++++++++--------------- ext/stub/internalinterfaces.zep.c | 1 + ext/stub/internalinterfaces.zep.h | 6 +--- ext/stub/mcall.zep.c | 7 ++--- ext/stub/oo/oonativeimplements.zep.c | 11 +++---- ext/stub/oo/oonativeimplements.zep.h | 43 +++++++++++----------------- ext/stub/strings.zep.c | 2 +- ext/stub/usetest.zep.c | 1 + ext/stub/usetest.zep.h | 6 +--- 16 files changed, 97 insertions(+), 89 deletions(-) diff --git a/ext/kernel/file.c b/ext/kernel/file.c index a0540f7d83..cf0c691d2c 100644 --- a/ext/kernel/file.c +++ b/ext/kernel/file.c @@ -65,7 +65,13 @@ int zephir_file_exists(zval *filename) return FAILURE; } +#if PHP_VERSION_ID >= 80100 + zend_string *file = zend_string_init(Z_STRVAL_P(filename), Z_STRLEN_P(filename), 0); + php_stat(file, FS_EXISTS, &return_value); + zval_ptr_dtor(file); +#else php_stat(Z_STRVAL_P(filename), (php_stat_len) Z_STRLEN_P(filename), FS_EXISTS, &return_value); +#endif if (Z_TYPE(return_value) != IS_TRUE) { return FAILURE; @@ -288,7 +294,13 @@ void zephir_file_put_contents(zval *return_value, zval *filename, zval *data) void zephir_filemtime(zval *return_value, zval *path) { if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) { +#if PHP_VERSION_ID >= 80100 + zend_string *file = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), 0); + php_stat(file, FS_MTIME, &return_value); + zval_ptr_dtor(file); +#else php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value); +#endif } else { ZVAL_FALSE(return_value); } diff --git a/ext/kernel/main.c b/ext/kernel/main.c index 8014a65145..95eba881d1 100644 --- a/ext/kernel/main.c +++ b/ext/kernel/main.c @@ -151,7 +151,7 @@ void zephir_fast_count(zval *result, zval *value) } } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { #if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); #else @@ -201,7 +201,7 @@ int zephir_fast_count_ev(zval *value) return (int) count > 0; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { #if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); #else @@ -249,7 +249,7 @@ int zephir_fast_count_int(zval *value) return (int) count; } - if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) { + if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) { #if PHP_VERSION_ID >= 80000 zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval); #else diff --git a/ext/kernel/require.c b/ext/kernel/require.c index 96160ba4ef..98125c9384 100644 --- a/ext/kernel/require.c +++ b/ext/kernel/require.c @@ -45,14 +45,22 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); if (new_op_array) { - if (file_handle.handle.stream.handle) { ZVAL_NULL(&dummy); if (!file_handle.opened_path) { @@ -110,7 +118,16 @@ int zephir_require_once_ret(zval *return_value_ptr, const char *require_path) } #endif - ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#if PHP_VERSION_ID >= 80100 + zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0); + + zend_stream_init_filename_ex(&file_handle, zend_string_path); + ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); + + zval_ptr_dtor(zend_string_path); +#else + ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); +#endif if (ret != SUCCESS) { return FAILURE; } diff --git a/ext/stub.c b/ext/stub.c index 7fd9c1cdff..a588a308ea 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -580,7 +580,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/arrayaccessobj.zep.c b/ext/stub/arrayaccessobj.zep.c index 9c6ea823ca..62a0fe59c6 100644 --- a/ext/stub/arrayaccessobj.zep.c +++ b/ext/stub/arrayaccessobj.zep.c @@ -48,7 +48,8 @@ PHP_METHOD(Stub_ArrayAccessObj, __construct) PHP_METHOD(Stub_ArrayAccessObj, offsetSet) { - zval *offset, offset_sub, *value, value_sub; + zval offset_sub, value_sub; + zval *offset, *value; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); @@ -74,7 +75,8 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetSet) PHP_METHOD(Stub_ArrayAccessObj, offsetExists) { - zval *offset, offset_sub, _0; + zval offset_sub, _0; + zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); @@ -96,7 +98,8 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetExists) PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) { - zval *offset, offset_sub, _0; + zval offset_sub, _0; + zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); @@ -120,7 +123,8 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) PHP_METHOD(Stub_ArrayAccessObj, offsetGet) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *offset, offset_sub, _0, _1, _2; + zval offset_sub, _0, _1, _2; + zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); diff --git a/ext/stub/arrayaccessobj.zep.h b/ext/stub/arrayaccessobj.zep.h index 874fa613ef..7dae75e741 100644 --- a/ext/stub/arrayaccessobj.zep.h +++ b/ext/stub/arrayaccessobj.zep.h @@ -12,20 +12,26 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetGet); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj___construct, 0, 0, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetset, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetset, 0, 2, IS_VOID, 0) + ZEND_ARG_INFO(0, offset) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetexists, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetexists, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetunset, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetunset, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 0, 1) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessobj_offsetget, 0, 1, IS_NULL, 0) +#endif ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() diff --git a/ext/stub/arrayiterator.zep.c b/ext/stub/arrayiterator.zep.c index 4becbeabd5..6845cdb52f 100644 --- a/ext/stub/arrayiterator.zep.c +++ b/ext/stub/arrayiterator.zep.c @@ -89,7 +89,7 @@ PHP_METHOD(Stub_ArrayIterator, current) zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); ZEPHIR_OBS_VAR(&_2); zephir_read_property(&_2, this_ptr, ZEND_STRL("position"), PH_NOISY_CC); - zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "stub/arrayiterator.zep", 22); + zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "stub/arrayiterator.zep", 25); RETURN_CTOR(&_1); } diff --git a/ext/stub/arrayiterator.zep.h b/ext/stub/arrayiterator.zep.h index ff88eff86f..9ca6da0926 100644 --- a/ext/stub/arrayiterator.zep.h +++ b/ext/stub/arrayiterator.zep.h @@ -13,19 +13,27 @@ PHP_METHOD(Stub_ArrayIterator, valid); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator___construct, 0, 0, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_rewind, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_current, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_key, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_next, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_next, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayiterator_valid, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayiterator_valid, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_arrayiterator_method_entry) { @@ -34,30 +42,10 @@ ZEPHIR_INIT_FUNCS(stub_arrayiterator_method_entry) { #else PHP_ME(Stub_ArrayIterator, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) #endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, rewind, arginfo_stub_arrayiterator_rewind, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, rewind, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, current, arginfo_stub_arrayiterator_current, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, current, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, key, arginfo_stub_arrayiterator_key, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, key, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, next, arginfo_stub_arrayiterator_next, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, next, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_ArrayIterator, valid, arginfo_stub_arrayiterator_valid, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_ArrayIterator, valid, NULL, ZEND_ACC_PUBLIC) -#endif PHP_FE_END }; diff --git a/ext/stub/internalinterfaces.zep.c b/ext/stub/internalinterfaces.zep.c index 38cb313888..807b0cab46 100644 --- a/ext/stub/internalinterfaces.zep.c +++ b/ext/stub/internalinterfaces.zep.c @@ -29,5 +29,6 @@ PHP_METHOD(Stub_InternalInterfaces, count) + RETURN_LONG(0); } diff --git a/ext/stub/internalinterfaces.zep.h b/ext/stub/internalinterfaces.zep.h index 3083366114..3084946afb 100644 --- a/ext/stub/internalinterfaces.zep.h +++ b/ext/stub/internalinterfaces.zep.h @@ -5,14 +5,10 @@ ZEPHIR_INIT_CLASS(Stub_InternalInterfaces); PHP_METHOD(Stub_InternalInterfaces, count); -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_internalinterfaces_count, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_internalinterfaces_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_internalinterfaces_method_entry) { -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_InternalInterfaces, count, arginfo_stub_internalinterfaces_count, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_InternalInterfaces, count, NULL, ZEND_ACC_PUBLIC) -#endif PHP_FE_END }; diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index bc706450cc..4c277c33e6 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -1208,11 +1208,8 @@ PHP_METHOD(Stub_Mcall, issue1136) if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); object_init_ex(&_finfo, zephir_get_internal_ce(SL("finfo"))); - if (zephir_has_constructor(&_finfo)) { - ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); - zephir_check_call_status(); - } - + ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); + zephir_check_call_status(); } else { ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 59); zephir_check_call_status(); diff --git a/ext/stub/oo/oonativeimplements.zep.c b/ext/stub/oo/oonativeimplements.zep.c index c41012bc71..abf3956e9c 100644 --- a/ext/stub/oo/oonativeimplements.zep.c +++ b/ext/stub/oo/oonativeimplements.zep.c @@ -14,8 +14,8 @@ #include "kernel/main.h" #include "ext/spl/spl_iterators.h" #include "kernel/object.h" -#include "kernel/memory.h" #include "kernel/operators.h" +#include "kernel/memory.h" /** @@ -107,19 +107,20 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, hasChildren) PHP_METHOD(Stub_Oo_OoNativeImplements, seek) { - zval *position, position_sub; + zval *position_param = NULL; + zend_long position; zval *this_ptr = getThis(); - ZVAL_UNDEF(&position_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(position) + Z_PARAM_LONG(position) ZEND_PARSE_PARAMETERS_END(); #endif - zephir_fetch_params_without_memory_grow(1, 0, &position); + zephir_fetch_params_without_memory_grow(1, 0, &position_param); + position = zephir_get_intval(position_param); } diff --git a/ext/stub/oo/oonativeimplements.zep.h b/ext/stub/oo/oonativeimplements.zep.h index 0c454ba069..342e9f26cd 100644 --- a/ext/stub/oo/oonativeimplements.zep.h +++ b/ext/stub/oo/oonativeimplements.zep.h @@ -24,22 +24,30 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, unserialize); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_current, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_key, 0, 0, IS_NULL, 0) +#endif ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_next, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_next, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_rewind, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_valid, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_getinneriterator, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_oo_oonativeimplements_getinneriterator, 0, 0, Iterator, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_oo_oonativeimplements_getchildren, 0, 0, RecursiveIterator, 0) @@ -48,8 +56,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_haschildren, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_seek, 0, 0, 1) - ZEND_ARG_INFO(0, position) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_seek, 0, 1, IS_VOID, 0) + + ZEND_ARG_TYPE_INFO(0, position, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_stub_oo_oonativeimplements_getiterator, 0, 0, Traversable, 0) @@ -81,32 +90,12 @@ ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oonativeimplements_method_entry) { PHP_ME(Stub_Oo_OoNativeImplements, count, arginfo_stub_oo_oonativeimplements_count, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, current, arginfo_stub_oo_oonativeimplements_current, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, current, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, key, arginfo_stub_oo_oonativeimplements_key, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, key, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, next, arginfo_stub_oo_oonativeimplements_next, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, next, NULL, ZEND_ACC_PUBLIC) -#endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, rewind, arginfo_stub_oo_oonativeimplements_rewind, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, rewind, NULL, ZEND_ACC_PUBLIC) -#endif PHP_ME(Stub_Oo_OoNativeImplements, valid, arginfo_stub_oo_oonativeimplements_valid, ZEND_ACC_PUBLIC) -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_Oo_OoNativeImplements, getInnerIterator, arginfo_stub_oo_oonativeimplements_getinneriterator, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_Oo_OoNativeImplements, getInnerIterator, NULL, ZEND_ACC_PUBLIC) -#endif PHP_ME(Stub_Oo_OoNativeImplements, getChildren, arginfo_stub_oo_oonativeimplements_getchildren, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, hasChildren, arginfo_stub_oo_oonativeimplements_haschildren, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, seek, arginfo_stub_oo_oonativeimplements_seek, ZEND_ACC_PUBLIC) diff --git a/ext/stub/strings.zep.c b/ext/stub/strings.zep.c index eb862bf39e..4b69b36bcc 100644 --- a/ext/stub/strings.zep.c +++ b/ext/stub/strings.zep.c @@ -736,7 +736,7 @@ PHP_METHOD(Stub_Strings, issue1267) ZVAL_STRING(&_2, ""); zephir_fast_str_replace(&_0, &_1, &_2, value); ZEPHIR_CPY_WRT(value, &_0); - ZVAL_LONG(&_3, 513); + ZVAL_LONG(&_3, 516); ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 42, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); diff --git a/ext/stub/usetest.zep.c b/ext/stub/usetest.zep.c index 9fed7d6939..880dd6aedc 100644 --- a/ext/stub/usetest.zep.c +++ b/ext/stub/usetest.zep.c @@ -41,6 +41,7 @@ PHP_METHOD(Stub_UseTest, count) + RETURN_LONG(0); } PHP_METHOD(Stub_UseTest, testUseClass1) diff --git a/ext/stub/usetest.zep.h b/ext/stub/usetest.zep.h index d0a0d0fa0e..6c32b08e57 100644 --- a/ext/stub/usetest.zep.h +++ b/ext/stub/usetest.zep.h @@ -12,7 +12,7 @@ PHP_METHOD(Stub_UseTest, testUseNamespaceAlias); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_createinstance, 0, 0, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_count, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_usetest_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_usetest_testuseclass1, 0, 0, 0) @@ -30,11 +30,7 @@ ZEPHIR_INIT_FUNCS(stub_usetest_method_entry) { #else PHP_ME(Stub_UseTest, createInstance, NULL, ZEND_ACC_PUBLIC) #endif -#if PHP_VERSION_ID >= 80000 PHP_ME(Stub_UseTest, count, arginfo_stub_usetest_count, ZEND_ACC_PUBLIC) -#else - PHP_ME(Stub_UseTest, count, NULL, ZEND_ACC_PUBLIC) -#endif #if PHP_VERSION_ID >= 80000 PHP_ME(Stub_UseTest, testUseClass1, arginfo_stub_usetest_testuseclass1, ZEND_ACC_PUBLIC) #else From 0432d28ef469f11d0d8241f106d12ac9db0cea77 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 21:32:43 +0100 Subject: [PATCH 027/128] #2255 - Update `Dockerfile` for PHP8.1 --- docker/8.1/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile index 41f3775828..1f24a92ecc 100644 --- a/docker/8.1/Dockerfile +++ b/docker/8.1/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest as composer -FROM php:8.1.0RC3-fpm +FROM php:8.1.0RC4-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" From bf51599e275985706dc7f7ef1444ccfb1ac71445 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 21:35:11 +0100 Subject: [PATCH 028/128] #2255 - Add `8.1` to the CI matrix --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f0ea57a358..73306e64a6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,7 +63,7 @@ jobs: fail-fast: false matrix: - php: ['7.4', '8.0'] + php: ['7.4', '8.0', '8.1'] build_type: ['ts', 'nts'] arch: ['x64'] @@ -102,6 +102,9 @@ jobs: - name: win2016-vc15 php: '8.0' + - name: win2016-vc15 + php: '8.1' + steps: - uses: actions/checkout@v2 with: From ac612e32085f6ca673d42c0108b4c7cb53e9cb7a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 21:54:27 +0100 Subject: [PATCH 029/128] #2255 - Ignore Windows builds for 8.1 --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73306e64a6..7639cc0861 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -105,6 +105,10 @@ jobs: - name: win2016-vc15 php: '8.1' + # Ignore 8.1 until its release date + - name: win2016-vs16 + php: '8.1' + steps: - uses: actions/checkout@v2 with: From aa50a54495825cb9a0a7ca53cb453f7d718eed71 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 21:54:46 +0100 Subject: [PATCH 030/128] #2255 - Fix CS --- Library/BaseBackend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/BaseBackend.php b/Library/BaseBackend.php index 17d32e3840..cebe1eba59 100644 --- a/Library/BaseBackend.php +++ b/Library/BaseBackend.php @@ -90,7 +90,7 @@ public function getInternalTemplatePath(): string */ public function getTemplateFileContents(string $filename): string { - $templatePath = rtrim((string)$this->config->get('templatepath', 'backend'), '\\/'); + $templatePath = rtrim((string) $this->config->get('templatepath', 'backend'), '\\/'); if (empty($templatepath)) { $templatePath = $this->templatesPath; } From baab26c46383c5dcd4a5a5625ce5b6b9379b0ee7 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 22:00:14 +0100 Subject: [PATCH 031/128] #2255 - Ignore Windows builds for 8.1 --- .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 7639cc0861..07568a5990 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,8 +106,8 @@ jobs: php: '8.1' # Ignore 8.1 until its release date - - name: win2016-vs16 - php: '8.1' + - php: '8.1' + name: win2016-vs16 steps: - uses: actions/checkout@v2 From fea7349ecaeb58c792b22d3078b4580a21ad1a37 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 22:09:08 +0100 Subject: [PATCH 032/128] #2255 - Ignore Windows builds for 8.1 --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07568a5990..6e49b48586 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -108,6 +108,13 @@ jobs: # Ignore 8.1 until its release date - php: '8.1' name: win2016-vs16 + build_type: 'ts' + arch: 'x64' + + - php: '8.1' + name: win2016-vs16 + build_type: 'nts' + arch: 'x64' steps: - uses: actions/checkout@v2 From fcb4484c139e146f94efff15e846381f13c632ed Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 24 Oct 2021 22:13:48 +0100 Subject: [PATCH 033/128] #2255 - Ignore Windows builds for 8.1 --- .github/workflows/main.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e49b48586..28359a7714 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,15 +106,8 @@ jobs: php: '8.1' # Ignore 8.1 until its release date - - php: '8.1' - name: win2016-vs16 - build_type: 'ts' - arch: 'x64' - - - php: '8.1' - name: win2016-vs16 - build_type: 'nts' - arch: 'x64' + - name: win2019-vs16 + php: '8.1' steps: - uses: actions/checkout@v2 From e1ba21e1153d9df25757912d730b3a33465b69ae Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Fri, 5 Nov 2021 15:03:48 +0200 Subject: [PATCH 034/128] Remove autogenerated release notes --- .gitignore | 3 +++ release-notes.md | 13 ------------- 2 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 release-notes.md diff --git a/.gitignore b/.gitignore index 47b158cc97..264edee84f 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,9 @@ box.phar *.gcno *.gcda +# Ignore CI autogenerated release-notes.md +release-notes.md + # Use this as your own wish list or a temporary buffer LATER php-zephir-parser/ diff --git a/release-notes.md b/release-notes.md deleted file mode 100644 index 86fb4d259f..0000000000 --- a/release-notes.md +++ /dev/null @@ -1,13 +0,0 @@ -### Fixed -- Fixed multiple return types in stubs [#2283](https://github.com/zephir-lang/zephir/issues/2283) -- Fixed `bool` return type in stubs [#2272](https://github.com/zephir-lang/zephir/issues/2272) - -### Changed -- Removed `.zep` from stubs filenames [#2273](https://github.com/zephir-lang/zephir/issues/2273) - -## [0.14.0] - 2021-09-18 -### Added -- Added support for `require_once` [#2253](https://github.com/zephir-lang/zephir/issues/2253) - -### Changed -- Bumped minimal version of Zephir Parser to `1.4.1`. [#2284](https://github.com/zephir-lang/zephir/issues/2284) From 23b4d91a5dbd4b64a2017d3fe3156c9505dfc8a4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 7 Nov 2021 15:44:58 +0000 Subject: [PATCH 035/128] #2299 - Fix left `null` with `string` condition --- .../Comparison/ComparisonBaseOperator.php | 10 ++++-- ext/stub/strings.zep.c | 35 +++++++++++++++++++ ext/stub/strings.zep.h | 6 ++++ stub/strings.zep | 12 +++++++ tests/Extension/StringTest.php | 10 ++++++ 5 files changed, 71 insertions(+), 2 deletions(-) diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index 0fadf8073b..75c0db3b20 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -13,8 +13,10 @@ namespace Zephir\Operators\Comparison; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Operators\BaseOperator; @@ -169,10 +171,13 @@ public function optimizeTypeOf($expr, CompilationContext $compilationContext) /** * Compile the expression. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext + * @return bool|CompiledExpression + * @throws ReflectionException + * @throws Exception */ - public function compile($expression, CompilationContext $compilationContext) + public function compile(array $expression, CompilationContext $compilationContext) { $conditions = $this->optimizeTypeOf($expression, $compilationContext); if (false !== $conditions) { @@ -227,6 +232,7 @@ public function compile($expression, CompilationContext $compilationContext) return new CompiledExpression('bool', '0 '.$this->operator.' '.$variableRight->getName(), $expression); case 'variable': + case 'string': $compilationContext->headersManager->add('kernel/operators'); $condition = $compilationContext->backend->getTypeofCondition($variableRight, $this->operator, 'null', $compilationContext); diff --git a/ext/stub/strings.zep.c b/ext/stub/strings.zep.c index eb862bf39e..272c689f01 100644 --- a/ext/stub/strings.zep.c +++ b/ext/stub/strings.zep.c @@ -1083,3 +1083,38 @@ PHP_METHOD(Stub_Strings, nullableStringReturnType) RETURN_MM_NULL(); } +/** + * @issue https://github.com/zephir-lang/zephir/issues/2299 + */ +PHP_METHOD(Stub_Strings, issue2299NullableStringCondition) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *roleName_param = NULL; + zval roleName; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&roleName); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(0, 1) + Z_PARAM_OPTIONAL + Z_PARAM_STR_OR_NULL(roleName) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 1, &roleName_param); + if (!roleName_param) { + ZEPHIR_INIT_VAR(&roleName); + } else { + zephir_get_strval(&roleName, roleName_param); + } + + + if (Z_TYPE_P(&roleName) != IS_NULL) { + RETURN_CTOR(&roleName); + } + RETURN_MM_NULL(); +} + diff --git a/ext/stub/strings.zep.h b/ext/stub/strings.zep.h index 8b665b3b10..7c4fb6c8ed 100644 --- a/ext/stub/strings.zep.h +++ b/ext/stub/strings.zep.h @@ -42,6 +42,7 @@ PHP_METHOD(Stub_Strings, issue2234Strict); PHP_METHOD(Stub_Strings, issue2234StrictParent); PHP_METHOD(Stub_Strings, issue2234StrictChild); PHP_METHOD(Stub_Strings, nullableStringReturnType); +PHP_METHOD(Stub_Strings, issue2299NullableStringCondition); ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_strings_camelize, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) @@ -208,6 +209,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_strings_nullablestringretur ZEND_ARG_TYPE_INFO(0, val, IS_STRING, 1) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_strings_issue2299nullablestringcondition, 0, 0, IS_STRING, 1) + ZEND_ARG_TYPE_INFO(0, roleName, IS_STRING, 1) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, camelize, arginfo_stub_strings_camelize, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, uncamelize, arginfo_stub_strings_uncamelize, ZEND_ACC_PUBLIC) @@ -272,5 +277,6 @@ ZEPHIR_INIT_FUNCS(stub_strings_method_entry) { PHP_ME(Stub_Strings, issue2234StrictParent, arginfo_stub_strings_issue2234strictparent, ZEND_ACC_PUBLIC) PHP_ME(Stub_Strings, issue2234StrictChild, arginfo_stub_strings_issue2234strictchild, ZEND_ACC_PROTECTED) PHP_ME(Stub_Strings, nullableStringReturnType, arginfo_stub_strings_nullablestringreturntype, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Strings, issue2299NullableStringCondition, arginfo_stub_strings_issue2299nullablestringcondition, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/stub/strings.zep b/stub/strings.zep index 59ddae79e2..4516bae281 100644 --- a/stub/strings.zep +++ b/stub/strings.zep @@ -241,4 +241,16 @@ class Strings return null; } + + /** + * @issue https://github.com/zephir-lang/zephir/issues/2299 + */ + public function issue2299NullableStringCondition(string roleName = null) -> string | null + { + if null !== roleName { + return roleName; + } + + return null; + } } diff --git a/tests/Extension/StringTest.php b/tests/Extension/StringTest.php index 580bc40aba..c5ae82f92a 100644 --- a/tests/Extension/StringTest.php +++ b/tests/Extension/StringTest.php @@ -330,6 +330,16 @@ public function testNullableStringReturnType(): void $this->assertSame('string', $this->test->nullableStringReturnType('string')); } + /** + * @issue https://github.com/zephir-lang/zephir/issues/2299 + */ + public function testIssue2299NullableStringCondition(): void + { + $this->assertSame(null, $this->test->issue2299NullableStringCondition()); + $this->assertSame('not-null', $this->test->issue2299NullableStringCondition('not-null')); + $this->assertSame('test', $this->test->issue2299NullableStringCondition('test')); + } + public function providerHashEquals(): array { return [ From e371caed85e3887a49a7dd1dcac3e0b870d7a5a5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 7 Nov 2021 15:46:27 +0000 Subject: [PATCH 036/128] #2299 - Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9db343b05..548cc88b45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] +### Fixed +- Fixed left `null` with `string` condition [#2299](https://github.com/zephir-lang/zephir/issues/2299) ## [0.15.2] - 2021-10-24 ### Fixed From e90f0f58d8e17255037074a83beb3456452f1116 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 7 Nov 2021 16:03:44 +0000 Subject: [PATCH 037/128] #2299 - Refactor `ComparisonBaseOperator` class --- .../Comparison/ComparisonBaseOperator.php | 258 ++++++++---------- 1 file changed, 118 insertions(+), 140 deletions(-) diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index 75c0db3b20..c9f1b7f82e 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -22,150 +22,143 @@ use Zephir\Operators\BaseOperator; /** - * BaseOperator. - * * This is the base operator for comparison operators */ class ComparisonBaseOperator extends BaseOperator { - protected bool $literalOnly = true; - protected bool $commutative = false; /** - * @param $expr + * @param array $expr * @param CompilationContext $compilationContext * - * @throws CompilerException - * - * @return bool|CompiledExpression + * @return null|CompiledExpression + * @throws Exception + * @throws ReflectionException */ - public function optimizeTypeOf($expr, CompilationContext $compilationContext) + public function optimizeTypeOf(array $expr, CompilationContext $compilationContext): ?CompiledExpression { if (!isset($expr['left'])) { - return false; + return null; } if (!isset($expr['right']) && !isset($expr['right']['value'])) { - return false; + return null; } - if ('typeof' == $expr['left']['type']) { - if ('string' != $expr['right']['type']) { - $compilationContext->logger->warning( - "Possible invalid comparison for 'typeof' operator with non-string", - ['invalid-typeof-comparison', $expr['right']] - ); + if ('typeof' !== $expr['left']['type']) { + return null; + } + + if ('string' !== $expr['right']['type']) { + $compilationContext->logger->warning( + "Possible invalid comparison for 'typeof' operator with non-string", + ['invalid-typeof-comparison', $expr['right']] + ); + + return null; + } - return false; - } + switch ($expr['type']) { + case 'identical': + case 'equals': + $operator = '=='; + break; - if (isset($expr['type'])) { - switch ($expr['type']) { - case 'identical': - case 'equals': - $operator = '=='; + case 'not-identical': + case 'not-equals': + $operator = '!='; + break; + + default: + return null; + } + + $code = (new Expression($expr['left']['left']))->compile($compilationContext)->getCode(); + $variableVariable = $compilationContext->symbolTable->getVariableForRead($code, $compilationContext, $expr); + + if ('string' !== $expr['right']['type']) { + throw new CompilerException('Right expression of typeof operator must be "string" type', $expr['right']); + } + + $value = strtolower($expr['right']['value']); + + switch ($variableVariable->getType()) { + case 'double': + switch ($value) { + case 'double': + case 'float': + $condition = '1 '.$operator.' 1'; break; - case 'not-identical': - case 'not-equals': - $operator = '!='; + default: + $condition = '1 '.$operator.' 0'; + break; + } + break; + + case 'int': + case 'integer': + case 'long': + switch ($value) { + case 'int': + case 'integer': + case 'long': + $condition = '1 '.$operator.' 1'; + break; + + default: + $condition = '1 '.$operator.' 0'; + break; + } + break; + + case 'bool': + switch ($value) { + case 'bool': + case 'boolean': + $condition = '1 '.$operator.' 1'; break; default: - return false; + $condition = '1 '.$operator.' 0'; + break; } - } - - $expression = new Expression($expr['left']['left']); - $condition = $expression->compile($compilationContext); - $variableVariable = $compilationContext->symbolTable->getVariableForRead($condition->getCode(), $compilationContext, $expr); - - if ('string' != $expr['right']['type']) { - throw new CompilerException('Right expression of typeof operator must be "string" type', $expr['right']); - } - - $value = strtolower($expr['right']['value']); - - switch ($variableVariable->getType()) { - case 'double': - switch ($value) { - case 'double': - case 'float': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'int': - case 'integer': - case 'long': - switch ($value) { - case 'int': - case 'integer': - case 'long': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'bool': - switch ($value) { - case 'bool': - case 'boolean': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'array': - switch ($value) { - case 'array': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'string': - switch ($value) { - case 'string': - $condition = '1 '.$operator.' 1'; - break; - - default: - $condition = '1 '.$operator.' 0'; - break; - } - break; - - case 'variable': - $condition = $compilationContext->backend->getTypeofCondition($variableVariable, $operator, $value, $compilationContext); - break; - - default: - return false; - } - - return new CompiledExpression('bool', $condition, $expr); + break; + + case 'array': + switch ($value) { + case 'array': + $condition = '1 '.$operator.' 1'; + break; + + default: + $condition = '1 '.$operator.' 0'; + break; + } + break; + + case 'string': + switch ($value) { + case 'string': + $condition = '1 '.$operator.' 1'; + break; + + default: + $condition = '1 '.$operator.' 0'; + break; + } + break; + + case 'variable': + $condition = $compilationContext->backend->getTypeofCondition($variableVariable, $operator, $value, $compilationContext); + break; + + default: + return null; } - return false; + return new CompiledExpression('bool', $condition, $expr); } /** @@ -173,14 +166,14 @@ public function optimizeTypeOf($expr, CompilationContext $compilationContext) * * @param array $expression * @param CompilationContext $compilationContext - * @return bool|CompiledExpression + * @return CompiledExpression * @throws ReflectionException * @throws Exception */ public function compile(array $expression, CompilationContext $compilationContext) { $conditions = $this->optimizeTypeOf($expression, $compilationContext); - if (false !== $conditions) { + if (null !== $conditions) { return $conditions; } @@ -555,23 +548,21 @@ public function compile(array $expression, CompilationContext $compilationContex break; case 'string': + $compilationContext->headersManager->add('kernel/operators'); + switch ($right->getType()) { case 'null': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalNullOperator.'('.$variableCode.')', $expression['left']); case 'string': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableCode.', "'.$right->getCode().'")', $expression['left']); case 'variable': $variableRight = $compilationContext->symbolTable->getVariableForRead($right->getCode(), $compilationContext, $expression['left']); + switch ($variableRight->getType()) { case 'string': case 'variable': - $compilationContext->headersManager->add('kernel/operators'); $variableRight = $compilationContext->backend->getVariableCode($variableRight); return new CompiledExpression('bool', $this->zvalOperator.'('.$variableCode.', '.$variableRight.')', $expression); @@ -587,9 +578,10 @@ public function compile(array $expression, CompilationContext $compilationContex break; case 'variable': + $compilationContext->headersManager->add('kernel/operators'); + switch ($right->getType()) { case 'null': - $compilationContext->headersManager->add('kernel/operators'); $condition = $compilationContext->backend->getTypeofCondition($variable, $this->operator, 'null', $compilationContext); return new CompiledExpression('bool', $condition, $expression['left']); @@ -599,25 +591,18 @@ public function compile(array $expression, CompilationContext $compilationContex case 'long': case 'ulong': case 'double': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', '.$right->getCode().')', $expression['left']); case 'char': case 'uchar': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', \''.$right->getCode().'\')', $expression['left']); case 'bool': - $compilationContext->headersManager->add('kernel/operators'); - $zvalBoolOperator = 'true' == $right->getCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; + $zvalBoolOperator = 'true' === $right->getCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; return new CompiledExpression('bool', $zvalBoolOperator.'('.$variableCode.')', $expression['left']); case 'string': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalStringOperator.'('.$variableCode.', "'.$right->getCode().'")', $expression['left']); case 'variable': @@ -627,24 +612,17 @@ public function compile(array $expression, CompilationContext $compilationContex case 'uint': case 'long': case 'ulong': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalLongOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); case 'double': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalDoubleOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); case 'bool': - $compilationContext->headersManager->add('kernel/operators'); - return new CompiledExpression('bool', $this->zvalBoolOperator.'('.$variableCode.', '.$variableRight->getName().')', $expression); case 'string': case 'variable': case 'array': - $compilationContext->headersManager->add('kernel/operators'); $variableRight = $compilationContext->backend->getVariableCode($variableRight); return new CompiledExpression('bool', $this->zvalOperator.'('.$variableCode.', '.$variableRight.')', $expression); From 67aa4e68a4893e1cd651f27d78dadae6965bc01b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 7 Nov 2021 16:14:46 +0000 Subject: [PATCH 038/128] #2299 - Rename `BaseOperator` to `AbstractOperator` --- ...{BaseOperator.php => AbstractOperator.php} | 35 +++++++++---------- .../Operators/Arithmetical/AddOperator.php | 2 -- .../Arithmetical/ArithmeticalBaseOperator.php | 6 ++-- .../Operators/Arithmetical/DivOperator.php | 2 -- .../Operators/Arithmetical/ModOperator.php | 2 -- .../Operators/Arithmetical/MulOperator.php | 2 -- .../Operators/Arithmetical/SubOperator.php | 2 -- .../Operators/Bitwise/BitwiseBaseOperator.php | 6 ++-- .../Operators/Bitwise/BitwiseNotOperator.php | 4 +-- .../Comparison/ComparisonBaseOperator.php | 13 ++++--- .../Operators/Logical/LogicalBaseOperator.php | 4 +-- Library/Operators/Other/CastOperator.php | 6 ++-- Library/Operators/Other/CloneOperator.php | 6 ++-- Library/Operators/Other/ConcatOperator.php | 6 ++-- Library/Operators/Other/EmptyOperator.php | 6 ++-- Library/Operators/Other/FetchOperator.php | 4 +-- .../Operators/Other/InstanceOfOperator.php | 6 ++-- Library/Operators/Other/IssetOperator.php | 6 ++-- Library/Operators/Other/LikelyOperator.php | 6 ++-- .../Operators/Other/NewInstanceOperator.php | 6 ++-- .../Other/NewInstanceTypeOperator.php | 6 ++-- .../Other/RangeExclusiveOperator.php | 6 ++-- .../Other/RangeInclusiveOperator.php | 6 ++-- .../Operators/Other/RequireOnceOperator.php | 6 ++-- Library/Operators/Other/RequireOperator.php | 6 ++-- .../Operators/Other/ShortTernaryOperator.php | 6 ++-- Library/Operators/Other/TernaryOperator.php | 6 ++-- Library/Operators/Other/TypeHintOperator.php | 7 ++-- Library/Operators/Other/TypeOfOperator.php | 10 +++--- Library/Operators/Other/UnlikelyOperator.php | 8 ++--- Library/Operators/Unary/MinusOperator.php | 6 ++-- Library/Operators/Unary/NotOperator.php | 6 ++-- Library/Operators/Unary/PlusOperator.php | 6 ++-- 33 files changed, 87 insertions(+), 128 deletions(-) rename Library/Operators/{BaseOperator.php => AbstractOperator.php} (88%) diff --git a/Library/Operators/BaseOperator.php b/Library/Operators/AbstractOperator.php similarity index 88% rename from Library/Operators/BaseOperator.php rename to Library/Operators/AbstractOperator.php index 0616ddba9e..50e49f3c5b 100644 --- a/Library/Operators/BaseOperator.php +++ b/Library/Operators/AbstractOperator.php @@ -16,10 +16,7 @@ use Zephir\CompilationContext; use Zephir\Variable; -/** - * TODO: Make it abstract - */ -class BaseOperator +abstract class AbstractOperator { protected string $operator; @@ -52,26 +49,28 @@ public function setExpectReturn(bool $expecting, ?Variable $expectingVariable = * @param array $expression * @param bool $init * - * @return Variable + * @return Variable|null */ public function getExpectedNonLiteral(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable { - $isExpecting = $this->expecting; $symbolVariable = $this->expectingVariable; - if ($isExpecting) { - if (\is_object($symbolVariable)) { - if ('variable' == $symbolVariable->getType() && !$symbolVariable->isLocalOnly()) { - if (!$init) { - return $symbolVariable; - } - $symbolVariable->initVariant($compilationContext); - } else { - $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); + if (!$this->expecting) { + return $symbolVariable; + } + + if ($symbolVariable !== null) { + if ('variable' === $symbolVariable->getType() && !$symbolVariable->isLocalOnly()) { + if (!$init) { + return $symbolVariable; } + + $symbolVariable->initVariant($compilationContext); } else { $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); } + } else { + $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression); } return $symbolVariable; @@ -89,10 +88,9 @@ public function getExpectedNonLiteral(CompilationContext $compilationContext, ar */ public function getExpected(CompilationContext $compilationContext, array $expression, bool $init = true): ?Variable { - $isExpecting = $this->expecting; $symbolVariable = $this->expectingVariable; - if ($isExpecting) { + if ($this->expecting) { if (\is_object($symbolVariable)) { if ('variable' === $symbolVariable->getType()) { if (!$init) { @@ -138,10 +136,9 @@ public function getExpected(CompilationContext $compilationContext, array $expre */ public function getExpectedComplexLiteral(CompilationContext $compilationContext, string $type = 'variable'): ?Variable { - $isExpecting = $this->expecting; $symbolVariable = $this->expectingVariable; - if ($isExpecting) { + if ($this->expecting) { if (\is_object($symbolVariable)) { if ($symbolVariable->getType() === $type || 'return_value' === $symbolVariable->getName()) { $symbolVariable->initVariant($compilationContext); diff --git a/Library/Operators/Arithmetical/AddOperator.php b/Library/Operators/Arithmetical/AddOperator.php index 36c293c8bb..5fadff453d 100644 --- a/Library/Operators/Arithmetical/AddOperator.php +++ b/Library/Operators/Arithmetical/AddOperator.php @@ -12,8 +12,6 @@ namespace Zephir\Operators\Arithmetical; /** - * AddOperator. - * * Generates an arithmetical operation according to the operands */ class AddOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php index d8f52ed1ce..f19b2b9ac9 100644 --- a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php +++ b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php @@ -16,16 +16,14 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Variable; /** - * BaseOperator. - * * This is the base operator for commutative, associative and distributive * arithmetic operators */ -class ArithmeticalBaseOperator extends BaseOperator +class ArithmeticalBaseOperator extends AbstractOperator { protected bool $literalOnly = true; diff --git a/Library/Operators/Arithmetical/DivOperator.php b/Library/Operators/Arithmetical/DivOperator.php index 7c1be697fe..bdb56058f6 100644 --- a/Library/Operators/Arithmetical/DivOperator.php +++ b/Library/Operators/Arithmetical/DivOperator.php @@ -17,8 +17,6 @@ use Zephir\Expression; /** - * DivOperator. - * * Generates an arithmetical operation according to the operands */ class DivOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/ModOperator.php b/Library/Operators/Arithmetical/ModOperator.php index 5a1f25ce50..a82bb4718a 100644 --- a/Library/Operators/Arithmetical/ModOperator.php +++ b/Library/Operators/Arithmetical/ModOperator.php @@ -17,8 +17,6 @@ use Zephir\Expression; /** - * ModOperator. - * * Generates an arithmetical operation according to the operands */ class ModOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/MulOperator.php b/Library/Operators/Arithmetical/MulOperator.php index f7a4fe7547..7e96db1a69 100644 --- a/Library/Operators/Arithmetical/MulOperator.php +++ b/Library/Operators/Arithmetical/MulOperator.php @@ -12,8 +12,6 @@ namespace Zephir\Operators\Arithmetical; /** - * MulOperator. - * * Generates an arithmetical operation according to the operands */ class MulOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Arithmetical/SubOperator.php b/Library/Operators/Arithmetical/SubOperator.php index 91cd3baa40..413f5a2990 100644 --- a/Library/Operators/Arithmetical/SubOperator.php +++ b/Library/Operators/Arithmetical/SubOperator.php @@ -12,8 +12,6 @@ namespace Zephir\Operators\Arithmetical; /** - * SubOperator. - * * Generates an arithmetical operation according to the operands */ class SubOperator extends ArithmeticalBaseOperator diff --git a/Library/Operators/Bitwise/BitwiseBaseOperator.php b/Library/Operators/Bitwise/BitwiseBaseOperator.php index 864c616a7f..957c3cf3d0 100644 --- a/Library/Operators/Bitwise/BitwiseBaseOperator.php +++ b/Library/Operators/Bitwise/BitwiseBaseOperator.php @@ -15,15 +15,13 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * BaseOperator. - * * This is the base operator for commutative, associative and distributive * arithmetic operators */ -class BitwiseBaseOperator extends BaseOperator +class BitwiseBaseOperator extends AbstractOperator { protected bool $literalOnly = true; diff --git a/Library/Operators/Bitwise/BitwiseNotOperator.php b/Library/Operators/Bitwise/BitwiseNotOperator.php index a4920aa017..b0b9782350 100644 --- a/Library/Operators/Bitwise/BitwiseNotOperator.php +++ b/Library/Operators/Bitwise/BitwiseNotOperator.php @@ -15,9 +15,9 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; -class BitwiseNotOperator extends BaseOperator +class BitwiseNotOperator extends AbstractOperator { /** * @param $expression diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index c9f1b7f82e..4c79a84e02 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -19,20 +19,21 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** * This is the base operator for comparison operators */ -class ComparisonBaseOperator extends BaseOperator +class ComparisonBaseOperator extends AbstractOperator { protected bool $commutative = false; /** - * @param array $expr + * @param array $expr * @param CompilationContext $compilationContext * - * @return null|CompiledExpression + * @return CompiledExpression|null + * * @throws Exception * @throws ReflectionException */ @@ -164,9 +165,11 @@ public function optimizeTypeOf(array $expr, CompilationContext $compilationConte /** * Compile the expression. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext + * * @return CompiledExpression + * * @throws ReflectionException * @throws Exception */ diff --git a/Library/Operators/Logical/LogicalBaseOperator.php b/Library/Operators/Logical/LogicalBaseOperator.php index f01bcb80ae..b6d91e9879 100644 --- a/Library/Operators/Logical/LogicalBaseOperator.php +++ b/Library/Operators/Logical/LogicalBaseOperator.php @@ -17,12 +17,12 @@ use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** * This is the base operator for logical operators */ -class LogicalBaseOperator extends BaseOperator +class LogicalBaseOperator extends AbstractOperator { public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/CastOperator.php b/Library/Operators/Other/CastOperator.php index c38ab4def1..6b1bfcc211 100644 --- a/Library/Operators/Other/CastOperator.php +++ b/Library/Operators/Other/CastOperator.php @@ -19,16 +19,14 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Statements\Let\Variable as LetVariable; use Zephir\Types; /** - * Cast operator - * * Converts a value into another of a different type */ -class CastOperator extends BaseOperator +class CastOperator extends AbstractOperator { /** * Compiles a type cast operation. diff --git a/Library/Operators/Other/CloneOperator.php b/Library/Operators/Other/CloneOperator.php index 97011cd5bb..742430d903 100644 --- a/Library/Operators/Other/CloneOperator.php +++ b/Library/Operators/Other/CloneOperator.php @@ -18,14 +18,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Clone. - * * Clones an object into another one */ -class CloneOperator extends BaseOperator +class CloneOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/ConcatOperator.php b/Library/Operators/Other/ConcatOperator.php index 11bf3ec7ec..3f5ab4b7b5 100644 --- a/Library/Operators/Other/ConcatOperator.php +++ b/Library/Operators/Other/ConcatOperator.php @@ -18,15 +18,13 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use function Zephir\add_slashes; /** - * ConcatOperator. - * * Perform concatenations and optimizations */ -class ConcatOperator extends BaseOperator +class ConcatOperator extends AbstractOperator { /** * Performs concat compilation. diff --git a/Library/Operators/Other/EmptyOperator.php b/Library/Operators/Other/EmptyOperator.php index 6dcb7aad23..a2499d599a 100644 --- a/Library/Operators/Other/EmptyOperator.php +++ b/Library/Operators/Other/EmptyOperator.php @@ -18,14 +18,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Empty. - * * Checks if a variable is empty string or null */ -class EmptyOperator extends BaseOperator +class EmptyOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/FetchOperator.php b/Library/Operators/Other/FetchOperator.php index 656862e368..4bb93c1f57 100644 --- a/Library/Operators/Other/FetchOperator.php +++ b/Library/Operators/Other/FetchOperator.php @@ -18,7 +18,7 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** * FetchOperator. @@ -26,7 +26,7 @@ * Fetch is a special operator that checks if an expression 'isset' and then obtain the value * without calculating the hash key twice */ -class FetchOperator extends BaseOperator +class FetchOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/InstanceOfOperator.php b/Library/Operators/Other/InstanceOfOperator.php index 3da4177c58..1a7bc683e0 100644 --- a/Library/Operators/Other/InstanceOfOperator.php +++ b/Library/Operators/Other/InstanceOfOperator.php @@ -20,16 +20,14 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use function Zephir\escape_class; /** - * InstanceOf. - * * Checks if a variable is an instance of a class */ -class InstanceOfOperator extends BaseOperator +class InstanceOfOperator extends AbstractOperator { /** * @param $expression diff --git a/Library/Operators/Other/IssetOperator.php b/Library/Operators/Other/IssetOperator.php index 39017b1334..fa8fbc6c84 100644 --- a/Library/Operators/Other/IssetOperator.php +++ b/Library/Operators/Other/IssetOperator.php @@ -18,14 +18,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * IssetOperator. - * * Checks if a array offset or a property is defined on a polymorphic variable */ -class IssetOperator extends BaseOperator +class IssetOperator extends AbstractOperator { /** * Compiles an 'isset' operator. diff --git a/Library/Operators/Other/LikelyOperator.php b/Library/Operators/Other/LikelyOperator.php index b691ef3266..25412ecc13 100644 --- a/Library/Operators/Other/LikelyOperator.php +++ b/Library/Operators/Other/LikelyOperator.php @@ -18,14 +18,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Likely. - * * Adds a branch prediction hint when evaluating an expression */ -class LikelyOperator extends BaseOperator +class LikelyOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/NewInstanceOperator.php b/Library/Operators/Other/NewInstanceOperator.php index d1f189ca0b..f459fbab66 100644 --- a/Library/Operators/Other/NewInstanceOperator.php +++ b/Library/Operators/Other/NewInstanceOperator.php @@ -22,16 +22,14 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\MethodCall; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use function Zephir\escape_class; /** - * NewInstance. - * * Creates a new instance of a class */ -class NewInstanceOperator extends BaseOperator +class NewInstanceOperator extends AbstractOperator { protected bool $literalOnly = false; diff --git a/Library/Operators/Other/NewInstanceTypeOperator.php b/Library/Operators/Other/NewInstanceTypeOperator.php index 47be886329..3583042c3c 100644 --- a/Library/Operators/Other/NewInstanceTypeOperator.php +++ b/Library/Operators/Other/NewInstanceTypeOperator.php @@ -20,14 +20,12 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * NewTypeInstance. - * * Creates a value of the specified type with parameters */ -class NewInstanceTypeOperator extends BaseOperator +class NewInstanceTypeOperator extends AbstractOperator { protected bool $literalOnly = false; diff --git a/Library/Operators/Other/RangeExclusiveOperator.php b/Library/Operators/Other/RangeExclusiveOperator.php index c22617dd44..c98ec91d09 100644 --- a/Library/Operators/Other/RangeExclusiveOperator.php +++ b/Library/Operators/Other/RangeExclusiveOperator.php @@ -19,14 +19,12 @@ use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * RangeExclusive. - * * Exclusive range operator */ -class RangeExclusiveOperator extends BaseOperator +class RangeExclusiveOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/RangeInclusiveOperator.php b/Library/Operators/Other/RangeInclusiveOperator.php index 5e41a30422..e8a1815260 100644 --- a/Library/Operators/Other/RangeInclusiveOperator.php +++ b/Library/Operators/Other/RangeInclusiveOperator.php @@ -18,15 +18,13 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Types; /** - * RangeInclusive. - * * Inclusive range operator */ -class RangeInclusiveOperator extends BaseOperator +class RangeInclusiveOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/RequireOnceOperator.php b/Library/Operators/Other/RequireOnceOperator.php index c459b6e8eb..d68f38b7d2 100644 --- a/Library/Operators/Other/RequireOnceOperator.php +++ b/Library/Operators/Other/RequireOnceOperator.php @@ -17,14 +17,12 @@ use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Require once. - * * Includes once a plain PHP file */ -class RequireOnceOperator extends BaseOperator +class RequireOnceOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/RequireOperator.php b/Library/Operators/Other/RequireOperator.php index bf8139a012..29ce296d2c 100644 --- a/Library/Operators/Other/RequireOperator.php +++ b/Library/Operators/Other/RequireOperator.php @@ -17,14 +17,12 @@ use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Require. - * * Includes a plain PHP file */ -class RequireOperator extends BaseOperator +class RequireOperator extends AbstractOperator { /** * @param array $expression diff --git a/Library/Operators/Other/ShortTernaryOperator.php b/Library/Operators/Other/ShortTernaryOperator.php index 9714649691..2efa139671 100644 --- a/Library/Operators/Other/ShortTernaryOperator.php +++ b/Library/Operators/Other/ShortTernaryOperator.php @@ -19,17 +19,15 @@ use Zephir\Builder\StatementsBlockBuilder; use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Statements\IfStatement; /** - * ShortTernary. - * * a ?: b * * Compiles short ternary expressions */ -class ShortTernaryOperator extends BaseOperator +class ShortTernaryOperator extends AbstractOperator { /** * Compile ternary operator. diff --git a/Library/Operators/Other/TernaryOperator.php b/Library/Operators/Other/TernaryOperator.php index 561492aac6..e3d0054aae 100644 --- a/Library/Operators/Other/TernaryOperator.php +++ b/Library/Operators/Other/TernaryOperator.php @@ -15,16 +15,14 @@ use Zephir\CompilationContext; use Zephir\CompiledExpression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; use Zephir\Optimizers\EvalExpression; use Zephir\Statements\LetStatement; /** - * Ternary. - * * Compiles ternary expressions */ -class TernaryOperator extends BaseOperator +class TernaryOperator extends AbstractOperator { /** * Compile ternary operator. diff --git a/Library/Operators/Other/TypeHintOperator.php b/Library/Operators/Other/TypeHintOperator.php index 6b472b2abc..a9ffeb9cd7 100644 --- a/Library/Operators/Other/TypeHintOperator.php +++ b/Library/Operators/Other/TypeHintOperator.php @@ -18,12 +18,9 @@ use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; -/** - * Zephir\Operators\Other\TypeHintOperator. - */ -class TypeHintOperator extends BaseOperator +class TypeHintOperator extends AbstractOperator { private bool $strict = false; diff --git a/Library/Operators/Other/TypeOfOperator.php b/Library/Operators/Other/TypeOfOperator.php index 0d64644184..6ac240678e 100644 --- a/Library/Operators/Other/TypeOfOperator.php +++ b/Library/Operators/Other/TypeOfOperator.php @@ -13,20 +13,19 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; use Zephir\Expression\Builder\BuilderFactory; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * TypeOf. - * - * Obtains the type of a dynamic variable + * Obtains the type of dynamic variable. */ -class TypeOfOperator extends BaseOperator +class TypeOfOperator extends AbstractOperator { /** * @param $expression @@ -35,6 +34,7 @@ class TypeOfOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Other/UnlikelyOperator.php b/Library/Operators/Other/UnlikelyOperator.php index 27854b74dc..587d0b060f 100644 --- a/Library/Operators/Other/UnlikelyOperator.php +++ b/Library/Operators/Other/UnlikelyOperator.php @@ -13,19 +13,18 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; /** - * Unlikely. - * * Adds a branch prediction hint when evaluating an expression */ -class UnlikelyOperator extends BaseOperator +class UnlikelyOperator extends AbstractOperator { /** * Compile unlikely operator @@ -36,6 +35,7 @@ class UnlikelyOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Unary/MinusOperator.php b/Library/Operators/Unary/MinusOperator.php index e9deb251a6..5532bba95c 100644 --- a/Library/Operators/Unary/MinusOperator.php +++ b/Library/Operators/Unary/MinusOperator.php @@ -13,14 +13,15 @@ namespace Zephir\Operators\Unary; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; -class MinusOperator extends BaseOperator +class MinusOperator extends AbstractOperator { /** * Compile expression. @@ -31,6 +32,7 @@ class MinusOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Unary/NotOperator.php b/Library/Operators/Unary/NotOperator.php index c701f4ec6d..916ad6c5ed 100644 --- a/Library/Operators/Unary/NotOperator.php +++ b/Library/Operators/Unary/NotOperator.php @@ -13,14 +13,15 @@ namespace Zephir\Operators\Unary; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; -class NotOperator extends BaseOperator +class NotOperator extends AbstractOperator { /** * @param $expression @@ -29,6 +30,7 @@ class NotOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { diff --git a/Library/Operators/Unary/PlusOperator.php b/Library/Operators/Unary/PlusOperator.php index 2b5a077027..134d058e9e 100644 --- a/Library/Operators/Unary/PlusOperator.php +++ b/Library/Operators/Unary/PlusOperator.php @@ -13,14 +13,15 @@ namespace Zephir\Operators\Unary; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Expression; -use Zephir\Operators\BaseOperator; +use Zephir\Operators\AbstractOperator; -class PlusOperator extends BaseOperator +class PlusOperator extends AbstractOperator { /** * Compile expression. @@ -31,6 +32,7 @@ class PlusOperator extends BaseOperator * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile($expression, CompilationContext $compilationContext): CompiledExpression { From 88e76dcee90b198710ecef0498b36e763565b1dc Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 7 Nov 2021 18:53:32 +0000 Subject: [PATCH 039/128] #2255 - Bump PHP8.1 docker image to `RC5` --- docker/8.1/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile index 1f24a92ecc..db79de4111 100644 --- a/docker/8.1/Dockerfile +++ b/docker/8.1/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest as composer -FROM php:8.1.0RC4-fpm +FROM php:8.1.0RC5-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" From 24cf1a8bc16d94a0881f6b0e01a1f9b5b0bb3ca3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 7 Nov 2021 19:02:30 +0000 Subject: [PATCH 040/128] #2255 - Bump PSR extension version to `1.1.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 28359a7714..7c30d5a2b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -118,7 +118,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-1.1.0, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 From ff7dcf087d621d9205000f4c37950fde8ee8eac6 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 10:06:36 +0200 Subject: [PATCH 041/128] Refactor build matrix, fix artifact name --- .github/workflows/build-linux-ext/action.yml | 3 ++ .github/workflows/build-macos-ext/action.yml | 3 ++ .github/workflows/build-win-ext/action.yml | 2 +- .github/workflows/main.yml | 53 ++++++-------------- 4 files changed, 22 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build-linux-ext/action.yml b/.github/workflows/build-linux-ext/action.yml index 68c66ca96c..bc60380a86 100644 --- a/.github/workflows/build-linux-ext/action.yml +++ b/.github/workflows/build-linux-ext/action.yml @@ -1,14 +1,17 @@ name: 'Zephir Stub PHP Extension Build' description: 'Build Stub extension for Linux according to various php versions.' + inputs: compiler: description: 'compiler name' required: false default: 'gcc' + cflags: description: 'CFLAGS for GCC compiler' required: false default: '' + ldflags: description: 'LDFLAGS for Linker' required: false diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index c530e117b4..38bcfcf7e0 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -1,14 +1,17 @@ name: 'Zephir Stub PHP Extension Build' description: 'Build Stub extension for macOS according to various php versions.' + inputs: compiler: description: 'compiler name' required: false default: 'clang' + cflags: description: 'CFLAGS for GCC compiler' required: false default: '' + ldflags: description: 'LDFLAGS for Linker' required: false diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index bb8601d409..4c2e1f9d2e 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -58,7 +58,7 @@ runs: } Write-Output "::endgroup::" - - name: Setup PHP SDK tool kit + - name: Setup PHP SDK Tool Kit uses: zephir-lang/setup-php-sdk@v1 with: php_version: ${{ inputs.php_version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f0ea57a358..0e13a76c0e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,55 +52,32 @@ jobs: run: shellcheck .ci/*.sh build-and-test: - # To prevent build a particular commit use - # git commit -m "......... [ci skip]" - if: "!contains(github.event.head_commit.message, '[ci skip]')" + name: "PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }}" - name: "PHP-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.arch }}" runs-on: ${{ matrix.os }} - strategy: fail-fast: false - matrix: - php: ['7.4', '8.0'] - build_type: ['ts', 'nts'] - arch: ['x64'] + php: [ '7.4', '8.0' ] + ts: [ 'ts', 'nts' ] + arch: [ 'x64' ] name: - ubuntu-gcc - macos-clang - - win2016-vc15 - - win2019-vs16 # matrix names should be in next format: # {php}-{ts}-{os.name}-{compiler}-{arch} include: # Linux - - name: ubuntu-gcc - os: ubuntu-18.04 - compiler: gcc - + - { name: ubuntu-gcc, os: ubuntu-18.04, compiler: gcc } # macOS - - name: macos-clang - os: macos-10.15 - compiler: clang - + - { name: macos-clang, os: macos-10.15, compiler: clang } # Windows - - name: win2016-vc15 - os: windows-2016 - compiler: vc15 - - - name: win2019-vs16 - os: windows-2019 - compiler: vs16 - - exclude: - - name: win2019-vs16 - php: '7.4' - - - name: win2016-vc15 - php: '8.0' + - { php: '7.4', ts: 'ts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' } + - { php: '7.4', ts: 'nts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' } + - { php: '8.0', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } + - { php: '8.0', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } steps: - uses: actions/checkout@v2 @@ -127,7 +104,7 @@ jobs: date.timezone=UTC, xdebug.max_nesting_level=256 env: - PHPTS: ${{ matrix.build_type }} + PHPTS: ${{ matrix.ts }} COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get composer cache directory @@ -170,7 +147,7 @@ jobs: uses: ./.github/workflows/build-win-ext with: php_version: ${{ matrix.php }} - ts: ${{ matrix.build_type }} + ts: ${{ matrix.ts }} msvc: ${{ matrix.compiler }} arch: ${{ matrix.arch }} env: @@ -216,14 +193,14 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: ./tests/output/clover.xml - flags: unittests,${{ matrix.name }},php-${{ matrix.php }} + flags: unittests,${{ runner.os }},php-${{ matrix.php }} name: codecov-umbrella - name: Upload build artifacts after Failure if: failure() uses: actions/upload-artifact@v2 with: - name: debug-${{ matrix.name }}-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }} + name: debug-PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }} path: | ${{ github.workspace }}/*.log ${{ github.workspace }}/ext/ @@ -231,4 +208,4 @@ jobs: !${{ github.workspace }}/ext/stub/ !${{ github.workspace }}/ext/Release/ !${{ github.workspace }}/ext/x64/Release/ - retention-days: 1 + retention-days: 7 From 5e12252691e082756b39225e78bde04873981b3a Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 10:19:10 +0200 Subject: [PATCH 042/128] Simplify action commands --- .github/workflows/build-linux-ext/action.yml | 9 ++++++++- .github/workflows/build-macos-ext/action.yml | 8 +++++++- .github/workflows/main.yml | 12 ++---------- .github/workflows/nightly.yml | 18 ++++++++---------- .github/workflows/release.yml | 2 +- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-linux-ext/action.yml b/.github/workflows/build-linux-ext/action.yml index bc60380a86..ea22b878d3 100644 --- a/.github/workflows/build-linux-ext/action.yml +++ b/.github/workflows/build-linux-ext/action.yml @@ -60,5 +60,12 @@ runs: cd ./ext phpize ./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" - make + make -j$(getconf _NPROCESSORS_ONLN) echo "::endgroup::" + + - name: Enable Stub Extension + shell: bash + run: | + sudo cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" + echo "extension=stub.so" > ./ext-stub.ini + sudo cp ./ext-stub.ini /etc/php/${{ matrix.php }}/cli/conf.d/20-stub.ini diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index 38bcfcf7e0..8f48a31d0c 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -52,5 +52,11 @@ runs: cd ./ext phpize ./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" - make + make -j$(getconf _NPROCESSORS_ONLN) echo "::endgroup::" + + - name: Enable Stub Extension + shell: bash + run: | + cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" + echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/ext-stub.ini diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e13a76c0e..1b063b9dc7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -157,11 +157,7 @@ jobs: - name: Stub Extension Info shell: pwsh run: | - if ("${{ runner.os }}" -eq "Windows") { - php --ri stub - } else { - php -d extension=./ext/modules/stub.so --ri stub - } + php --ri stub - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" @@ -169,11 +165,7 @@ jobs: - name: Unit Tests (Stub Extension) shell: pwsh run: | - if ("${{ runner.os }}" -eq "Windows") { - php vendor/bin/phpunit -c phpunit.ext.xml - } else { - php -d extension=./ext/modules/stub.so vendor/bin/phpunit -c phpunit.ext.xml - } + php vendor/bin/phpunit -c phpunit.ext.xml - name: Unit Tests (Zephir) if: always() diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4a1577d53a..a5bf9d72a8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,24 +12,22 @@ env: jobs: nightly: - name: "PHP-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.arch }}" - runs-on: ${{ matrix.os }} + name: "PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }}" + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: php: [ '8.1', '8.2' ] - build_type: [ 'ts', 'nts' ] + ts: [ 'ts', 'nts' ] arch: [ 'x64' ] # matrix names should be in next format: # {php}-{ts}-{os.name}-{compiler}-{arch} include: # Linux - - name: ubuntu-gcc - os: ubuntu-20.04 - compiler: gcc + - { name: ubuntu-gcc, os: ubuntu-20.04, compiler: gcc } steps: - name: Checkout Code @@ -57,7 +55,7 @@ jobs: date.timezone=UTC, xdebug.max_nesting_level=256 env: - PHPTS: ${{ matrix.build_type }} + PHPTS: ${{ matrix.ts }} COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get composer cache directory @@ -89,14 +87,14 @@ jobs: - name: Stub Extension Info run: | - php -d extension=./ext/modules/stub.so --ri stub + php --ri stub - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Unit Tests (Stub Extension) run: | - php -d extension=./ext/modules/stub.so vendor/bin/phpunit -c phpunit.ext.xml + php vendor/bin/phpunit -c phpunit.ext.xml - name: Unit Tests (Zephir) run: vendor/bin/phpunit --testsuite Zephir @@ -112,7 +110,7 @@ jobs: if: failure() uses: actions/upload-artifact@v2 with: - name: debug-${{ matrix.name }}-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }} + name: debug-PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }} path: | ${{ github.workspace }}/*.log ${{ github.workspace }}/ext/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a8adc41b4..bb10bd963a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Upload Release Asset +name: Upload Release Assets on: push: From 92ba3838911b9876652c32a39600cb552276d9cb Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 10:35:08 +0200 Subject: [PATCH 043/128] Fix build for PHP 7.4 on win2019, fix macos ext inlude order --- .github/workflows/build-macos-ext/action.yml | 2 +- .github/workflows/build-win-ext/action.yml | 10 ++++++++++ .github/workflows/main.yml | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index 8f48a31d0c..ba55a4ecea 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -59,4 +59,4 @@ runs: shell: bash run: | cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" - echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/ext-stub.ini + echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/99-ext-stub.ini diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index 4c2e1f9d2e..0e42746941 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -73,6 +73,16 @@ runs: with: arch: ${{ inputs.arch }} + # Workaround for Windows-2019 and PHP 7.4 with old msvc version + # PHP Warning: PHP Startup: Can't load module 'C:\tools\php\ext\php_stub.dll' + # as it's linked with 14.29, but the core is linked with 14.16 in Unknown on line 0 + - name: Configure Developer Command Prompt for MSVC compiler + uses: ilammy/msvc-dev-cmd@v1.10.0 + if: ${{ inputs.php_version }} == '7.4' + with: + arch: ${{ inputs.arch }} + toolset: 14.16 + - name: Generate C code shell: powershell run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1b063b9dc7..8ea213c9b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -157,7 +157,8 @@ jobs: - name: Stub Extension Info shell: pwsh run: | - php --ri stub + php --ini + php --ri stub - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" From a03bdb83720075dd4214b9e2c690adf700e9fa47 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 11:30:38 +0200 Subject: [PATCH 044/128] Check for PSR extension before tests --- .github/workflows/build-linux-ext/action.yml | 2 +- .github/workflows/build-macos-ext/action.yml | 6 +++++- tests/ext-bootstrap.php | 21 ++++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-linux-ext/action.yml b/.github/workflows/build-linux-ext/action.yml index ea22b878d3..2054a6582b 100644 --- a/.github/workflows/build-linux-ext/action.yml +++ b/.github/workflows/build-linux-ext/action.yml @@ -68,4 +68,4 @@ runs: run: | sudo cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" echo "extension=stub.so" > ./ext-stub.ini - sudo cp ./ext-stub.ini /etc/php/${{ matrix.php }}/cli/conf.d/20-stub.ini + sudo cp ./ext-stub.ini /etc/php/${{ matrix.php }}/cli/conf.d/99-stub.ini diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index ba55a4ecea..6c3fb9e57e 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -59,4 +59,8 @@ runs: shell: bash run: | cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" - echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/99-ext-stub.ini + echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/99-stub.ini + + echo "::group::List Extensions config files" + php --ini + echo "::endgroup::" diff --git a/tests/ext-bootstrap.php b/tests/ext-bootstrap.php index 9726282c91..375c262f97 100644 --- a/tests/ext-bootstrap.php +++ b/tests/ext-bootstrap.php @@ -11,19 +11,32 @@ require_once __DIR__.'/../Library/autoload.php'; +/** + * Draw message in the Box + */ +function messageBox(string $message): string { + $line = str_repeat('━', strlen($message) + 2); + $topline = "┏{$line}┓"; + $bottomline = "┗{$line}┛"; + + return sprintf("%s\n┃ %s ┃\n%s\n\n", $topline, $message, $bottomline); +} + if (!extension_loaded('phalcon')) { include_once __DIR__.'/../prototypes/phalcon.php'; } +if (!extension_loaded('psr')) { + $message = messageBox("The 'psr' extension is not loaded; Cannot run tests without it."); + exit($message); +} + if (!extension_loaded('stub')) { if ('1' == ini_get('enable_dl')) { $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; dl($prefix.'stub.'.PHP_SHLIB_SUFFIX); } else { - $message = "The 'stub' extension not loaded; cannot run tests without it"; - $line = str_repeat('-', strlen($message) + 4); - - $message = sprintf("%s\n| %s |\n%s\n\n", $line, $message, $line); + $message = messageBox("The 'stub' extension is not loaded; Cannot run tests without it."); exit($message); } } From a217d10ac90ef5dd4d25ee3095211c8e5be3eac2 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 11:44:18 +0200 Subject: [PATCH 045/128] Use PSR v1.1.0 --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8ea213c9b9..eeb96ec5ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,7 @@ on: env: RE2C_VERSION: 2.2 ZEPHIR_PARSER_VERSION: 1.4.1 + PSR_VERSION: 1.1.0 CACHE_DIR: .cache jobs: @@ -88,7 +89,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-${{ env.PSR_VERSION }}, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 From 30f74f9124ac9b5ba5355c814f595ffeec0f5af1 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 15:34:58 +0200 Subject: [PATCH 046/128] Remove dynamic extension load inside test --- .github/workflows/nightly.yml | 3 ++- tests/Extension/ExitDieTest.php | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a5bf9d72a8..e8377845b5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -8,6 +8,7 @@ on: env: RE2C_VERSION: 2.2 ZEPHIR_PARSER_VERSION: 1.4.1 + PSR_VERSION: 1.1.0 CACHE_DIR: .cache jobs: @@ -39,7 +40,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-${{ env.PSR_VERSION }}, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 diff --git a/tests/Extension/ExitDieTest.php b/tests/Extension/ExitDieTest.php index 0ebb1ff900..c704df77fc 100644 --- a/tests/Extension/ExitDieTest.php +++ b/tests/Extension/ExitDieTest.php @@ -33,13 +33,6 @@ protected function setUp(): void $this->phpBinary .= ' -qrr'; } - $this->phpBinary .= " -d 'enable_dl=true'"; - $extension = realpath(__DIR__.'/../../ext/modules/stub.so'); - - if ($extension !== false && file_exists($extension)) { - $this->phpBinary .= sprintf(" -d 'extension=%s'", $extension); - } - parent::setUp(); } From b4424b015736f1a8c1407f2a0feb314d5c35210c Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 15:51:38 +0200 Subject: [PATCH 047/128] Remove php ini check --- .github/workflows/build-macos-ext/action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index 6c3fb9e57e..468c6b65cc 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -60,7 +60,3 @@ runs: run: | cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so" echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/99-stub.ini - - echo "::group::List Extensions config files" - php --ini - echo "::endgroup::" From 6251d4793eab57445dc9b98547d00251217d250c Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 15:56:37 +0200 Subject: [PATCH 048/128] Fix typo in main CI, ignore some yml --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eeb96ec5ac..520ec2d525 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,10 +8,12 @@ on: - '**.md' - '**.txt' - '**/nightly.yml' + - '**/release.yml' + - '**/FUNDING.yml' pull_request: branches: - master - - develoment + - development env: RE2C_VERSION: 2.2 From 857877ee807a64c5b2030554795c9c37280c4d1c Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 16:39:36 +0200 Subject: [PATCH 049/128] Move compiler flags from configure inputs to ENV --- .github/workflows/build-linux-ext/action.yml | 16 ++++++---------- .github/workflows/build-macos-ext/action.yml | 15 ++++++--------- .github/workflows/build-win-ext/action.yml | 9 ++++++--- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-linux-ext/action.yml b/.github/workflows/build-linux-ext/action.yml index 2054a6582b..638288a375 100644 --- a/.github/workflows/build-linux-ext/action.yml +++ b/.github/workflows/build-linux-ext/action.yml @@ -38,16 +38,12 @@ runs: - name: Compile Stub Extension shell: bash + env: + CC: ${{ inputs.compiler }} + CFLAGS: ${{ inputs.cflags }} + CXXFLAGS: ${{ inputs.cflags }} + LDFLAGS: ${{ inputs.ldflags }} run: | - echo "::group::Configure compiler" - CC=${{ inputs.compiler }} - CFLAGS="${{ inputs.cflags }}" - CXXFLAGS="${{ inputs.cflags }}" - LDFLAGS="${{ inputs.ldflags }}" - - export CC CFLAGS CXXFLAGS LDFLAGS - echo "::endgroup::" - echo "::group::Init stage" php zephir fullclean echo "::endgroup::" @@ -59,7 +55,7 @@ runs: echo "::group::Compile stage" cd ./ext phpize - ./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" + ./configure --enable-stub make -j$(getconf _NPROCESSORS_ONLN) echo "::endgroup::" diff --git a/.github/workflows/build-macos-ext/action.yml b/.github/workflows/build-macos-ext/action.yml index 468c6b65cc..f379ed0fe8 100644 --- a/.github/workflows/build-macos-ext/action.yml +++ b/.github/workflows/build-macos-ext/action.yml @@ -31,15 +31,12 @@ runs: - name: Compile Stub Extension shell: bash + env: + CC: ${{ inputs.compiler }} + CFLAGS: ${{ inputs.cflags }} + CXXFLAGS: ${{ inputs.cflags }} + LDFLAGS: ${{ inputs.ldflags }} run: | - echo "::group::Configure compiler" - CFLAGS="${{ inputs.cflags }}" - CXXFLAGS="${{ inputs.cflags }}" - LDFLAGS="${{ inputs.ldflags }}" - - export CFLAGS CXXFLAGS LDFLAGS - echo "::endgroup::" - echo "::group::Init stage" php zephir fullclean echo "::endgroup::" @@ -51,7 +48,7 @@ runs: echo "::group::Compile stage" cd ./ext phpize - ./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" + ./configure --enable-stub make -j$(getconf _NPROCESSORS_ONLN) echo "::endgroup::" diff --git a/.github/workflows/build-win-ext/action.yml b/.github/workflows/build-win-ext/action.yml index 0e42746941..113c334a48 100644 --- a/.github/workflows/build-win-ext/action.yml +++ b/.github/workflows/build-win-ext/action.yml @@ -77,8 +77,8 @@ runs: # PHP Warning: PHP Startup: Can't load module 'C:\tools\php\ext\php_stub.dll' # as it's linked with 14.29, but the core is linked with 14.16 in Unknown on line 0 - name: Configure Developer Command Prompt for MSVC compiler + if: inputs.php_version == '7.4' uses: ilammy/msvc-dev-cmd@v1.10.0 - if: ${{ inputs.php_version }} == '7.4' with: arch: ${{ inputs.arch }} toolset: 14.16 @@ -98,10 +98,13 @@ runs: - name: Configure shell: powershell working-directory: ext + env: + CFLAGS: ${{ inputs.cflags }} + CXXFLAGS: ${{ inputs.cflags }} + LDFLAGS: ${{ inputs.ldflags }} run: | Write-Output "::group::Configure" - .\configure.bat --enable-stub --with-prefix=${{ env.PHP_ROOT }} ` - CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}" + .\configure.bat --enable-stub --with-prefix=${{ env.PHP_ROOT }} Write-Output "::endgroup::" - name: Zephir compile From 0a7bdbc625eed04478c8a876f3f762a7989cb33d Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 17:00:21 +0200 Subject: [PATCH 050/128] Pass compiler flags for Windows explicitly --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 520ec2d525..65eda00d3d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -153,6 +153,8 @@ jobs: ts: ${{ matrix.ts }} msvc: ${{ matrix.compiler }} arch: ${{ matrix.arch }} + cflags: '/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL' + ldflags: '/LTCG' env: CACHE_DIR: 'C:\Downloads' PHP_ROOT: 'C:\tools\php' From 810cef920228f0c70375e322e51e43fb0e4b1d90 Mon Sep 17 00:00:00 2001 From: AlexNDRmac Date: Tue, 7 Dec 2021 17:20:07 +0200 Subject: [PATCH 051/128] Fix tests run cmd --- .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 65eda00d3d..adc7fb1832 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -175,7 +175,7 @@ jobs: - name: Unit Tests (Zephir) if: always() - run: vendor/bin/phpunit --testsuite Zephir + run: php vendor/bin/phpunit --testsuite Zephir env: XDEBUG_MODE: coverage From 3a7a34f32f295f6500a24c9c096abcd6f516cbbb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 19:43:18 +0000 Subject: [PATCH 052/128] #2255 - Bump PSR extension version to `1.2.0` --- .github/workflows/main.yml | 2 +- .github/workflows/nightly.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c30d5a2b3..403a2cc44f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -118,7 +118,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-1.1.0, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-1.2.0, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4a1577d53a..e38691abf3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -41,7 +41,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '${{ matrix.php }}' - extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-1.2.0, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} tools: phpize, php-config coverage: xdebug # variables_order: https://github.com/zephir-lang/zephir/pull/1537 From 896ba4503d468baa381470c66238bffe952ca71d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 19:48:17 +0000 Subject: [PATCH 053/128] #2255 - Update docker image of PHP8.1 --- docker/8.1/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile index db79de4111..7cc20a6c40 100644 --- a/docker/8.1/Dockerfile +++ b/docker/8.1/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest as composer -FROM php:8.1.0RC5-fpm +FROM php:8.1.0-fpm RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)"; ENV MAKEFLAGS="-j${CPU_CORES}" From 0efa65c036bdb003d361c0ffc84416e48df023dd Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 20:04:51 +0000 Subject: [PATCH 054/128] #2255 - Update composer dependencies --- composer.lock | 209 ++++++++++++++++++++++++++------------------------ 1 file changed, 108 insertions(+), 101 deletions(-) diff --git a/composer.lock b/composer.lock index 89d4d6efe7..b358aafa2d 100644 --- a/composer.lock +++ b/composer.lock @@ -107,20 +107,20 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -149,9 +149,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/event-dispatcher", @@ -255,26 +255,26 @@ }, { "name": "symfony/console", - "version": "v5.3.7", + "version": "v5.4.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/console/zipball/9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", + "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { "psr/log": ">=3", @@ -289,12 +289,12 @@ }, "require-dev": { "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -334,7 +334,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v5.4.1" }, "funding": [ { @@ -350,20 +350,20 @@ "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2021-12-09T11:22:43+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", "shasum": "" }, "require": { @@ -372,7 +372,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -401,7 +401,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.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" }, "funding": [ { @@ -417,26 +417,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.3.7", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ce7b20d69c66a20939d8952b617506a44d102130" + "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ce7b20d69c66a20939d8952b617506a44d102130", - "reference": "ce7b20d69c66a20939d8952b617506a44d102130", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/27d39ae126352b9fa3be5e196ccf4617897be3eb", + "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", "symfony/polyfill-php80": "^1.16" }, "conflict": { @@ -448,13 +448,13 @@ }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -486,7 +486,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.3.7" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.0" }, "funding": [ { @@ -502,20 +502,20 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:20:46+00:00" + "time": "2021-11-23T10:19:22+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", "shasum": "" }, "require": { @@ -528,7 +528,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -565,7 +565,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0" }, "funding": [ { @@ -581,7 +581,7 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1071,21 +1071,25 @@ }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -1093,7 +1097,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -1130,7 +1134,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" }, "funding": [ { @@ -1146,20 +1150,20 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2021-11-04T16:48:04+00:00" }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", + "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", "shasum": "" }, "require": { @@ -1170,11 +1174,14 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "~1.15" }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", + "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" + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -1213,7 +1220,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v5.4.0" }, "funding": [ { @@ -1229,7 +1236,7 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2021-11-24T10:02:00+00:00" } ], "packages-dev": [ @@ -1362,16 +1369,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.0", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -1412,9 +1419,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2021-09-20T12:20:58+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", @@ -1689,16 +1696,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { @@ -1750,29 +1757,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-09-10T09:02:12+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1821,7 +1828,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" }, "funding": [ { @@ -1829,20 +1836,20 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2021-12-05T09:12:13+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -1881,7 +1888,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -1889,7 +1896,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -2604,16 +2611,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -2662,14 +2669,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -2677,7 +2684,7 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", From f45391b26c54f7578c637b68052a935e5beb28ad Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 20:17:36 +0000 Subject: [PATCH 055/128] #2255 - Adapt unit test for PHP8.1 --- tests/Extension/NewInstanceOperatorTest.php | 26 ++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/Extension/NewInstanceOperatorTest.php b/tests/Extension/NewInstanceOperatorTest.php index 2c1f44c89b..f35793aa3d 100644 --- a/tests/Extension/NewInstanceOperatorTest.php +++ b/tests/Extension/NewInstanceOperatorTest.php @@ -21,8 +21,8 @@ final class NewInstanceOperatorTest extends TestCase public Operator $test; protected array $autoloadMap = [ - 'Fixture\ThrowException' => ZEPHIRPATH.'/tests/fixtures/throw-exception.php', - 'Fixture\EmptyClass' => ZEPHIRPATH.'/tests/fixtures/class-empty.php', + 'Fixture\ThrowException' => 'tests/fixtures/throw-exception.php', + 'Fixture\EmptyClass' => 'tests/fixtures/class-empty.php', ]; protected function setUp(): void @@ -38,15 +38,29 @@ protected function tearDown(): void public function autoload(string $className): void { - if (isset($this->autoloadMap[$className])) { - include $this->autoloadMap[$className]; + if (version_compare(PHP_VERSION, '8.1.0', '>=')) { + try { + if (isset($this->autoloadMap[$className])) { + include $this->autoloadMap[$className]; + } + } catch (\Throwable $exception) { + // Ignore, as since PHP8.1 all exceptions are thrown during file include. + } + } else { + if (isset($this->autoloadMap[$className])) { + include $this->autoloadMap[$className]; + } } } public function testException(): void { - $this->expectException(\Exception::class); - $this->test->testNewInstanceOperator('Fixture\ThrowException'); + if (version_compare(PHP_VERSION, '8.1.0', '<')) { + $this->expectException(\Exception::class); + $this->test->testNewInstanceOperator('Fixture\ThrowException'); + } else { + $this->markTestSkipped('spl_autoload_register() now can only register with valid class inside included file.'); + } } public function testNewInstance(): void From 096d5256d0fec39c8a64f0eee1a3b6edd400888e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 20:23:57 +0000 Subject: [PATCH 056/128] #2255 - Minor code cleanup --- Library/CompilerFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 9364c2d0f2..675d64599f 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir; use Psr\Log\LoggerAwareTrait; @@ -24,8 +26,6 @@ use function is_array; /** - * Zephir\CompilerFile. - * * This class represents every file compiled in a project. * Every file may contain a class or an interface. */ From d68e118f13cb38f69fb8717809a1a5d4bd0e6775 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 20:30:05 +0000 Subject: [PATCH 057/128] #2255 - Adapt php:8.1 with new matrix syntax --- .github/workflows/main.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5beb607c0f..355d07aa9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,13 +81,8 @@ jobs: - { 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' } - - - name: win2016-vc15 - php: '8.1' - - # Ignore 8.1 until its release date - - name: win2019-vs16 - php: '8.1' + - { php: '8.1', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } + - { php: '8.1', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' } steps: - uses: actions/checkout@v2 From 916c8b539e3279fe12c8a7ea33a2f064b6a0138f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 20:36:04 +0000 Subject: [PATCH 058/128] #2255 - Cast `int` to `bool` --- Library/CompilerFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 675d64599f..6fdb60b85a 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -364,11 +364,11 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa } if (isset($topStatement['abstract'])) { - $classDefinition->setIsAbstract($topStatement['abstract']); + $classDefinition->setIsAbstract((bool)$topStatement['abstract']); } if (isset($topStatement['final'])) { - $classDefinition->setIsFinal($topStatement['final']); + $classDefinition->setIsFinal((bool)$topStatement['final']); } if (is_array($docblock)) { From db11ab73fd79be276119f5b9fb9c5f349ab972d4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 20:36:53 +0000 Subject: [PATCH 059/128] #2255 - Simplify `ClassDefinition:hasProperty()` method --- Library/ClassDefinition.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index 3204a2ae82..eb375b4a58 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -580,11 +580,8 @@ public function hasProperty(string $name): bool } $extendsClassDefinition = $this->getExtendsClassDefinition(); - if ($extendsClassDefinition instanceof self && $extendsClassDefinition->hasProperty($name)) { - return true; - } - return false; + return $extendsClassDefinition instanceof self && $extendsClassDefinition->hasProperty($name); } /** From 2cb019be58776f6cb8842890bcdbffd38750ee3b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 20:39:27 +0000 Subject: [PATCH 060/128] #2255 - Fix CS --- Library/CompilerFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/CompilerFile.php b/Library/CompilerFile.php index 6fdb60b85a..e634da6fd8 100644 --- a/Library/CompilerFile.php +++ b/Library/CompilerFile.php @@ -364,11 +364,11 @@ public function preCompileClass(CompilationContext $compilationContext, $namespa } if (isset($topStatement['abstract'])) { - $classDefinition->setIsAbstract((bool)$topStatement['abstract']); + $classDefinition->setIsAbstract((bool) $topStatement['abstract']); } if (isset($topStatement['final'])) { - $classDefinition->setIsFinal((bool)$topStatement['final']); + $classDefinition->setIsFinal((bool) $topStatement['final']); } if (is_array($docblock)) { From 2995a5651d519f5e0d461808983cb5149f517eb5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 11 Dec 2021 21:37:31 +0000 Subject: [PATCH 061/128] #2255 - Bump Zephir parser extension version to `1.4.2` --- .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 355d07aa9d..f1d3cbf80e 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.4.1 + ZEPHIR_PARSER_VERSION: 1.4.2 PSR_VERSION: 1.2.0 CACHE_DIR: .cache From 3db80dc82616e73888cb0f203f2b761d6e81b376 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 12 Dec 2021 09:35:23 +0000 Subject: [PATCH 062/128] #2255 - Remove `8.1` from nightly.yml workflow --- .github/workflows/nightly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 62925c455e..cb0e7d731e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,7 +7,7 @@ on: env: RE2C_VERSION: 2.2 - ZEPHIR_PARSER_VERSION: 1.4.1 + ZEPHIR_PARSER_VERSION: 1.4.2 PSR_VERSION: 1.2.0 CACHE_DIR: .cache @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: - php: [ '8.1', '8.2' ] + php: [ '8.2' ] ts: [ 'ts', 'nts' ] arch: [ 'x64' ] From 2d0d692d876399a82b9dac6cff874fe34d30a405 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 18 Dec 2021 21:58:42 +0000 Subject: [PATCH 063/128] Bump BOX_VERSION to `3.14.0` --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb10bd963a..c4007eecca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 env: - BOX_VERSION: 3.12.2 + BOX_VERSION: 3.14.0 steps: - name: Checkout Code From 64deaebc5072669409e0e2c6912ac596d2a34694 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 19 Dec 2021 18:58:02 +0000 Subject: [PATCH 064/128] #2330 - Rename class --- stub/{arrayaccessobj.zep => arrayaccessarr.zep} | 2 +- stub/arrayaccesstest.zep | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename stub/{arrayaccessobj.zep => arrayaccessarr.zep} (93%) diff --git a/stub/arrayaccessobj.zep b/stub/arrayaccessarr.zep similarity index 93% rename from stub/arrayaccessobj.zep rename to stub/arrayaccessarr.zep index d81b9d20c6..ca4946972a 100644 --- a/stub/arrayaccessobj.zep +++ b/stub/arrayaccessarr.zep @@ -1,6 +1,6 @@ namespace Stub; -class ArrayAccessObj implements \ArrayAccess +class ArrayAccessArr implements \ArrayAccess { protected test; diff --git a/stub/arrayaccesstest.zep b/stub/arrayaccesstest.zep index 4ddc9ab1bf..8efd0eef8a 100644 --- a/stub/arrayaccesstest.zep +++ b/stub/arrayaccesstest.zep @@ -17,7 +17,7 @@ class ArrayAccessTest { var arr; - let arr = new ArrayAccessObj(); + let arr = new ArrayAccessArr(); return isset arr["one"]; } @@ -25,7 +25,7 @@ class ArrayAccessTest { var arr; - let arr = new ArrayAccessObj(); + let arr = new ArrayAccessArr(); return arr["two"]; } From 9e2cdd3d53c1c957585356ffe032463a061973bb Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 19 Dec 2021 21:04:24 +0000 Subject: [PATCH 065/128] #2330 - Improve support of `mixed` type in object properties --- Library/Operators/Other/IssetOperator.php | 24 ++++----- Library/Passes/StaticTypeInference.php | 39 +++----------- .../Statements/Let/ObjectDynamicProperty.php | 20 +++---- .../Let/ObjectDynamicStringProperty.php | 12 ++--- Library/Statements/Let/ObjectProperty.php | 5 +- Library/Statements/UnsetStatement.php | 9 ++-- Library/Variable.php | 20 +++++++ stub/arrayaccessobj.zep | 51 ++++++++++++++++++ tests/Extension/ArrayAccessObjTest.php | 52 +++++++++++++++++++ 9 files changed, 168 insertions(+), 64 deletions(-) create mode 100644 stub/arrayaccessobj.zep create mode 100644 tests/Extension/ArrayAccessObjTest.php diff --git a/Library/Operators/Other/IssetOperator.php b/Library/Operators/Other/IssetOperator.php index fa8fbc6c84..852d8ed490 100644 --- a/Library/Operators/Other/IssetOperator.php +++ b/Library/Operators/Other/IssetOperator.php @@ -13,6 +13,7 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception; @@ -21,27 +22,24 @@ use Zephir\Operators\AbstractOperator; /** - * Checks if a array offset or a property is defined on a polymorphic variable + * Checks if an array offset or a property is defined on a polymorphic variable */ class IssetOperator extends AbstractOperator { /** * Compiles an 'isset' operator. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression * * @throws Exception + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { - if ('list' === $expression['left']['type']) { - $left = $expression['left']['left']; - } else { - $left = $expression['left']; - } + $left = 'list' === $expression['left']['type'] ? $expression['left']['left'] : $expression['left']; switch ($left['type']) { case 'array-access': @@ -52,7 +50,7 @@ public function compile(array $expression, CompilationContext $compilationContex $exprVariable->setNoisy(false); $exprCompiledVariable = $exprVariable->compile($compilationContext); - if ('variable' != $exprCompiledVariable->getType() && 'array' != $exprCompiledVariable->getType()) { + if (!in_array($exprCompiledVariable->getType(), ['variable', 'array'], true)) { throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as array', $left['left']); } @@ -67,7 +65,7 @@ public function compile(array $expression, CompilationContext $compilationContex break; } - if ('variable' == $variable->getType()) { + if ('variable' === $variable->getType()) { if ($variable->hasDifferentDynamicType(['undefined', 'array', 'null'])) { $compilationContext->logger->warning( 'Possible attempt to use non array in isset operator', @@ -88,6 +86,7 @@ public function compile(array $expression, CompilationContext $compilationContex return $compilationContext->backend->arrayIsset($variable, $resolvedExpr, $left['right'], $compilationContext); case 'variable': + case 'mixed': $indexVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $left['right']); return $compilationContext->backend->arrayIsset($variable, $indexVariable, $left['right'], $compilationContext); @@ -106,12 +105,12 @@ public function compile(array $expression, CompilationContext $compilationContex $exprVariable->setReadOnly(true); $exprCompiledVariable = $exprVariable->compile($compilationContext); - if ('variable' != $exprCompiledVariable->getType()) { + if ('variable' !== $exprCompiledVariable->getType()) { throw new CompilerException('Expression type: '.$exprCompiledVariable->getType().' cannot be used as object', $left['left']); } $variable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $left['left']); - if ('variable' != $variable->getType()) { + if ('variable' !== $variable->getType()) { throw new CompilerException('Variable type: '.$variable->getType().' cannot be used as object', $left['left']); } @@ -123,7 +122,7 @@ public function compile(array $expression, CompilationContext $compilationContex } $variableCode = $compilationContext->backend->getVariableCode($variable); - if ('property-access' == $left['type']) { + if ('property-access' === $left['type']) { return $compilationContext->backend->propertyIsset($variable, $left['right']['value'], $compilationContext); } @@ -137,6 +136,7 @@ public function compile(array $expression, CompilationContext $compilationContex $indexVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $left['right']); switch ($indexVariable->getType()) { case 'variable': + case 'mixed': case 'string': $indexVariableCode = $compilationContext->backend->getVariableCode($indexVariable); diff --git a/Library/Passes/StaticTypeInference.php b/Library/Passes/StaticTypeInference.php index 1861012de6..d377e88f85 100644 --- a/Library/Passes/StaticTypeInference.php +++ b/Library/Passes/StaticTypeInference.php @@ -14,16 +14,14 @@ use Zephir\StatementsBlock; /** - * StaticTypeInference. - * * This pass try to infer typing on dynamic variables so the compiler * can replace them by low level types automatically */ class StaticTypeInference { - protected $variables = []; + protected array $variables = []; - protected $infered = []; + protected array $infered = []; /** * Do the compilation pass. @@ -156,6 +154,7 @@ public function markVariable($variable, $type) break; case 'variable': + case 'mixed': $this->variables[$variable] = 'undefined'; break; @@ -243,11 +242,7 @@ public function passCall(array $expression) { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { - if ('variable' == $parameter['parameter']['type']) { - //$this->markVariable($parameter['value']); - } else { - $this->passExpression($parameter['parameter']); - } + $this->passExpression($parameter['parameter']); } } } @@ -255,11 +250,7 @@ public function passCall(array $expression) public function passArray(array $expression) { foreach ($expression['left'] as $item) { - if ('variable' == $item['value']['type']) { - //$this->markVariable($item['value']['value'], 'dynamical'); - } else { - $this->passExpression($item['value']); - } + $this->passExpression($item['value']); } } @@ -267,11 +258,7 @@ public function passNew(array $expression) { if (isset($expression['parameters'])) { foreach ($expression['parameters'] as $parameter) { - if ('variable' == $parameter['parameter']['type']) { - //$this->markVariable($parameter['value'], 'dynamical'); - } else { - $this->passExpression($parameter['parameter']); - } + $this->passExpression($parameter['parameter']); } } } @@ -561,30 +548,20 @@ public function passStatementBlock(array $statements) } break; + case 'throw': case 'return': if (isset($statement['expr'])) { $this->passExpression($statement['expr']); } break; - case 'loop': - if (isset($statement['statements'])) { - $this->passStatementBlock($statement['statements']); - } - break; - case 'try-catch': + case 'loop': if (isset($statement['statements'])) { $this->passStatementBlock($statement['statements']); } break; - case 'throw': - if (isset($statement['expr'])) { - $this->passExpression($statement['expr']); - } - break; - case 'fetch': $this->passExpression($statement['expr']); break; diff --git a/Library/Statements/Let/ObjectDynamicProperty.php b/Library/Statements/Let/ObjectDynamicProperty.php index e5f4aed7c1..73628b9b31 100644 --- a/Library/Statements/Let/ObjectDynamicProperty.php +++ b/Library/Statements/Let/ObjectDynamicProperty.php @@ -9,16 +9,17 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; +use Exception; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Exception\CompilerException; use Zephir\Variable as ZephirVariable; /** - * ObjectDynamicProperty. - * * Updates object properties dynamically */ class ObjectDynamicProperty @@ -26,16 +27,16 @@ class ObjectDynamicProperty /** * Compiles foo->{x} = {expr}. * - * @param string $variable + * @param string $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext * @param array $statement * * @throws CompilerException - * @throws \Exception + * @throws Exception */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); @@ -48,7 +49,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres $propertyName = $statement['property']; $propertyVariable = $compilationContext->symbolTable->getVariableForRead($propertyName, $compilationContext, $statement); - if ($propertyVariable->isNotVariableAndString()) { + if ($propertyVariable->isNotVariableAndMixedAndString()) { throw new CompilerException("Cannot use variable type '".$propertyVariable->getType()."' to update object property", $statement); } @@ -64,7 +65,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres throw new CompilerException('Cannot use non-initialized variable as an object', $statement); } - /* + /** * Trying to use a non-object dynamic variable as object */ if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { @@ -98,14 +99,14 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'bool': - $value = null; if ('1' == $resolvedExpr->getBooleanCode()) { $value = 'true'; } elseif ('0' == $resolvedExpr->getBooleanCode()) { $value = 'false'; } else { - throw new \Exception('?'); + throw new Exception('?'); } + $compilationContext->backend->updateProperty($symbolVariable, $propertyVariableName, $value, $compilationContext); break; @@ -143,6 +144,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres case 'string': case 'variable': case 'array': + case 'mixed': $compilationContext->backend->updateProperty($symbolVariable, $propertyVariable, $resolvedExpr, $compilationContext); if ($symbolVariable->isTemporal()) { $symbolVariable->setIdle(true); diff --git a/Library/Statements/Let/ObjectDynamicStringProperty.php b/Library/Statements/Let/ObjectDynamicStringProperty.php index f7b36b8064..50f0968e4b 100644 --- a/Library/Statements/Let/ObjectDynamicStringProperty.php +++ b/Library/Statements/Let/ObjectDynamicStringProperty.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; use Zephir\CompilationContext; @@ -17,8 +19,6 @@ use Zephir\Variable as ZephirVariable; /** - * ObjectDynamicProperty. - * * Updates object properties dynamically */ class ObjectDynamicStringProperty @@ -26,7 +26,7 @@ class ObjectDynamicStringProperty /** * Compiles foo->{"x"} = {expr}. * - * @param string $variable + * @param string $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext @@ -35,13 +35,13 @@ class ObjectDynamicStringProperty * @throws CompilerException * @throws \Exception */ - public function assign($variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) + public function assign(string $variable, ZephirVariable $symbolVariable, CompiledExpression $resolvedExpr, CompilationContext $compilationContext, array $statement) { if (!$symbolVariable->isInitialized()) { throw new CompilerException("Cannot mutate variable '".$variable."' because it is not initialized", $statement); } - if ('variable' != $symbolVariable->getType()) { + if ('variable' !== $symbolVariable->getType()) { throw new CompilerException("Variable type '".$symbolVariable->getType()."' cannot be used as object", $statement); } @@ -63,7 +63,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres throw new CompilerException('Cannot use non-initialized variable as an object', $statement); } - /* + /** * Trying to use a non-object dynamic variable as object */ if ($symbolVariable->hasDifferentDynamicType(['undefined', 'object', 'null'])) { diff --git a/Library/Statements/Let/ObjectProperty.php b/Library/Statements/Let/ObjectProperty.php index 60de74e51d..e7e8dc9e8c 100644 --- a/Library/Statements/Let/ObjectProperty.php +++ b/Library/Statements/Let/ObjectProperty.php @@ -9,6 +9,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Statements\Let; use Zephir\CompilationContext as Context; @@ -17,8 +19,6 @@ use Zephir\Variable as ZephirVariable; /** - * ObjectProperty. - * * Adds/Updates an array index */ class ObjectProperty @@ -285,6 +285,7 @@ public function assign( case 'array': case 'string': case 'variable': + case 'mixed': $context->backend->updateProperty($symbolVariable, $propertyName, $variableVariable, $context); if ($symbolVariable->isTemporal()) { $symbolVariable->setIdle(true); diff --git a/Library/Statements/UnsetStatement.php b/Library/Statements/UnsetStatement.php index 3dd7e4bc7d..26ed21f914 100644 --- a/Library/Statements/UnsetStatement.php +++ b/Library/Statements/UnsetStatement.php @@ -13,6 +13,7 @@ namespace Zephir\Statements; +use ReflectionException; use Zephir\CompilationContext; use Zephir\Exception; use Zephir\Exception\CompilerException; @@ -29,6 +30,7 @@ class UnsetStatement extends StatementAbstract * @param CompilationContext $compilationContext * * @throws Exception + * @throws ReflectionException */ public function compile(CompilationContext $compilationContext): void { @@ -61,6 +63,7 @@ public function compile(CompilationContext $compilationContext): void break; case 'property-access': + case 'property-dinamic-access': $expr = new Expression($expression['left']); $expr->setReadOnly(true); $exprVar = $expr->compile($compilationContext); @@ -72,9 +75,6 @@ public function compile(CompilationContext $compilationContext): void return; - case 'property-dynamic-access': - //TODO: fix it - default: throw new CompilerException('Cannot use expression type: '.$expression['type'].' in "unset"', $expression); } @@ -94,12 +94,13 @@ public function compile(CompilationContext $compilationContext): void } /** - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompilationContext * * @throws Exception + * @throws ReflectionException */ private function generateUnsetPropertyFromObject(array $expression, CompilationContext $compilationContext): CompilationContext { diff --git a/Library/Variable.php b/Library/Variable.php index 77d2370e94..f0abe51c91 100644 --- a/Library/Variable.php +++ b/Library/Variable.php @@ -1072,6 +1072,16 @@ public function isVariable() return 'variable' == $this->type; } + /** + * Shortcut is type mixed? + * + * @return bool + */ + public function isMixed(): bool + { + return 'mixed' === $this->type; + } + /** * Shortcut is type bool? * @@ -1142,6 +1152,16 @@ public function isNotVariableAndString() return !$this->isVariable() && !$this->isString(); } + /** + * Shortcut is type variable or mixed or string? + * + * @return bool + */ + public function isNotVariableAndMixedAndString() + { + return !$this->isVariable() && !$this->isMixed() && !$this->isString(); + } + /** * Shortcut is type variable or array? * diff --git a/stub/arrayaccessobj.zep b/stub/arrayaccessobj.zep new file mode 100644 index 0000000000..ff09814fcd --- /dev/null +++ b/stub/arrayaccessobj.zep @@ -0,0 +1,51 @@ +namespace Stub; + +class ArrayAccessObj implements \ArrayAccess +{ + protected test; + + public function __construct() + { + var obj; + + let obj = new \stdClass(); + let obj->key1 = "val1"; + let obj->key2 = "val2"; + let obj->key3 = "val3"; + + let this->test = obj; + } + + public function offsetSet(mixed offset, mixed value) -> void + { + var obj = this->test; + + if !is_null(offset) { + let obj->{offset} = value; + } + + let this->test = obj; + } + + public function offsetExists(mixed offset) -> bool + { + var obj = this->test; + + return isset obj->{offset}; + } + + public function offsetUnset(mixed offset) -> void + { + var obj = this->test; + let obj = (array)obj; + + unset obj[offset]; + + let this->test = (object)obj; + } + + public function offsetGet(mixed offset) -> mixed + { + return isset this->test->{offset} ? this->test->{offset} : null; + } +} diff --git a/tests/Extension/ArrayAccessObjTest.php b/tests/Extension/ArrayAccessObjTest.php new file mode 100644 index 0000000000..e635821cff --- /dev/null +++ b/tests/Extension/ArrayAccessObjTest.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Extension; + +use PHPUnit\Framework\TestCase; +use Stub\ArrayAccessObj; + +final class ArrayAccessObjTest extends TestCase +{ + public function testOffsetSetAndOffsetExists(): void + { + $class = new ArrayAccessObj(); + + $class->offsetSet('newKey', 'new value'); + $this->assertTrue($class->offsetExists('newKey')); + } + + public function testOffsetGet(): void + { + $class = new ArrayAccessObj(); + + $class->offsetSet('newKey', 'new value'); + $this->assertSame('new value', $class->offsetGet('newKey')); + + $class->offsetSet('newKey', 1); + $this->assertSame(1, $class->offsetGet('newKey')); + + $class->offsetSet('boolean', true); + $this->assertSame(true, $class->offsetGet('boolean')); + } + + public function testOffsetUnset(): void + { + $class = new ArrayAccessObj(); + + $class->offsetSet('newKey', 'new value'); + $this->assertTrue($class->offsetExists('newKey')); + $class->offsetUnset('newKey'); + $this->assertFalse($class->offsetExists('newKey')); + } +} From 5b095f77737f63a9eb9c7f6db8188343389bfb1c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 19 Dec 2021 21:05:50 +0000 Subject: [PATCH 066/128] #2330 - Adjust CS --- Library/Operators/Other/IssetOperator.php | 2 +- Library/Statements/Let/ObjectDynamicProperty.php | 2 +- Library/Statements/Let/ObjectDynamicStringProperty.php | 2 +- Library/Statements/UnsetStatement.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Library/Operators/Other/IssetOperator.php b/Library/Operators/Other/IssetOperator.php index 852d8ed490..061ce042a4 100644 --- a/Library/Operators/Other/IssetOperator.php +++ b/Library/Operators/Other/IssetOperator.php @@ -29,7 +29,7 @@ class IssetOperator extends AbstractOperator /** * Compiles an 'isset' operator. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression diff --git a/Library/Statements/Let/ObjectDynamicProperty.php b/Library/Statements/Let/ObjectDynamicProperty.php index 73628b9b31..b691089380 100644 --- a/Library/Statements/Let/ObjectDynamicProperty.php +++ b/Library/Statements/Let/ObjectDynamicProperty.php @@ -27,7 +27,7 @@ class ObjectDynamicProperty /** * Compiles foo->{x} = {expr}. * - * @param string $variable + * @param string $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext diff --git a/Library/Statements/Let/ObjectDynamicStringProperty.php b/Library/Statements/Let/ObjectDynamicStringProperty.php index 50f0968e4b..7d54d71dcb 100644 --- a/Library/Statements/Let/ObjectDynamicStringProperty.php +++ b/Library/Statements/Let/ObjectDynamicStringProperty.php @@ -26,7 +26,7 @@ class ObjectDynamicStringProperty /** * Compiles foo->{"x"} = {expr}. * - * @param string $variable + * @param string $variable * @param ZephirVariable $symbolVariable * @param CompiledExpression $resolvedExpr * @param CompilationContext $compilationContext diff --git a/Library/Statements/UnsetStatement.php b/Library/Statements/UnsetStatement.php index 26ed21f914..e8eda65fcd 100644 --- a/Library/Statements/UnsetStatement.php +++ b/Library/Statements/UnsetStatement.php @@ -94,7 +94,7 @@ public function compile(CompilationContext $compilationContext): void } /** - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompilationContext From a6d12a26a9591b7e839f6544cf7054c43d93e721 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 19 Dec 2021 21:09:53 +0000 Subject: [PATCH 067/128] #2330 - Adjust CS --- tests/Extension/ArrayAccessObjTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Extension/ArrayAccessObjTest.php b/tests/Extension/ArrayAccessObjTest.php index e635821cff..40a08367ce 100644 --- a/tests/Extension/ArrayAccessObjTest.php +++ b/tests/Extension/ArrayAccessObjTest.php @@ -37,7 +37,7 @@ public function testOffsetGet(): void $this->assertSame(1, $class->offsetGet('newKey')); $class->offsetSet('boolean', true); - $this->assertSame(true, $class->offsetGet('boolean')); + $this->assertTrue($class->offsetGet('boolean')); } public function testOffsetUnset(): void From 1c113caf73f5ef23c4a52c37ed282802fd2faed5 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 19 Dec 2021 21:11:20 +0000 Subject: [PATCH 068/128] #2330 - Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 548cc88b45..083800d164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] ### Fixed - Fixed left `null` with `string` condition [#2299](https://github.com/zephir-lang/zephir/issues/2299) +- Improved support of `mixed` type [#2330](https://github.com/zephir-lang/zephir/issues/2330) ## [0.15.2] - 2021-10-24 ### Fixed From 6441e6875642ef8c8c18391b835aed72d5ccff48 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 19 Dec 2021 21:12:22 +0000 Subject: [PATCH 069/128] #2330 - Minor code cleanup --- Library/Types/ArrayType.php | 2 -- Library/Types/DoubleType.php | 2 -- Library/Types/IntType.php | 2 -- Library/Types/IstringType.php | 2 -- Library/Types/StringType.php | 2 -- 5 files changed, 10 deletions(-) diff --git a/Library/Types/ArrayType.php b/Library/Types/ArrayType.php index 8e64d2cc00..4b2882bff8 100644 --- a/Library/Types/ArrayType.php +++ b/Library/Types/ArrayType.php @@ -18,8 +18,6 @@ use Zephir\Types; /** - * ArrayType. - * * Defines methods of the built-in array type */ class ArrayType extends AbstractType diff --git a/Library/Types/DoubleType.php b/Library/Types/DoubleType.php index 85d3b55b99..b9c0003027 100644 --- a/Library/Types/DoubleType.php +++ b/Library/Types/DoubleType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * DoubleType. - * * Defines methods of the built-in double type */ class DoubleType extends AbstractType diff --git a/Library/Types/IntType.php b/Library/Types/IntType.php index c8dcb8ee3c..6feb53d059 100644 --- a/Library/Types/IntType.php +++ b/Library/Types/IntType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * IntType. - * * Defines methods of the built-in int type */ class IntType extends AbstractType diff --git a/Library/Types/IstringType.php b/Library/Types/IstringType.php index 9ec29efe29..ad4ad03c32 100644 --- a/Library/Types/IstringType.php +++ b/Library/Types/IstringType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * IstringType. - * * Encapsulates built-in methods for the "istring" type */ class IstringType extends StringType diff --git a/Library/Types/StringType.php b/Library/Types/StringType.php index e7a70f3f82..bd2cd40ecb 100644 --- a/Library/Types/StringType.php +++ b/Library/Types/StringType.php @@ -14,8 +14,6 @@ use Zephir\Types; /** - * StringType. - * * Encapsulates built-in methods for the "string" type * * TODO: explode, join, replace From c20f40912d143c09243158cf7b6b3c97f72b85c3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 19 Dec 2021 21:14:31 +0000 Subject: [PATCH 070/128] #2330 - Add comment about specific logic --- stub/arrayaccessobj.zep | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stub/arrayaccessobj.zep b/stub/arrayaccessobj.zep index ff09814fcd..0245c3b6b1 100644 --- a/stub/arrayaccessobj.zep +++ b/stub/arrayaccessobj.zep @@ -37,6 +37,8 @@ class ArrayAccessObj implements \ArrayAccess public function offsetUnset(mixed offset) -> void { var obj = this->test; + + // It is not possible to unset dynamic property via Zend API. let obj = (array)obj; unset obj[offset]; From b8d79356aea24e6b2972be0a75d7d852fce22c3c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 23 Dec 2021 23:46:04 +0000 Subject: [PATCH 071/128] Merge `autoload.php` and `bootstrap.php` into `zephir` file --- Library/autoload.php | 58 ------------------------------------------- Library/bootstrap.php | 30 ---------------------- zephir | 53 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 50 insertions(+), 91 deletions(-) delete mode 100644 Library/autoload.php delete mode 100644 Library/bootstrap.php diff --git a/Library/autoload.php b/Library/autoload.php deleted file mode 100644 index 3308474f55..0000000000 --- a/Library/autoload.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -use const PHP_BINARY; -use const PHP_EOL; -use const PHP_SAPI; -use const PHP_VERSION; -use const STDERR; - -if (version_compare('7.0.0', PHP_VERSION, '>')) { - fprintf( - STDERR, - 'This Zephir version is supported on PHP >= 7.0.0.'.PHP_EOL. - 'You are using PHP %s (%s).'.PHP_EOL, - PHP_VERSION, - PHP_BINARY - ); - - exit(1); -} - -if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { - fprintf( - STDERR, - 'Zephir should be invoked via the CLI version of PHP, not the %s SAPI.'.PHP_EOL, - PHP_SAPI - ); - - exit(1); -} - -$autoloaders = [ - __DIR__.'/../vendor/autoload.php', // Is installed locally - __DIR__.'/../../../autoload.php', // Is installed via Composer -]; - -foreach ($autoloaders as $file) { - if (file_exists($file)) { - include_once $file; - break; - } -} - -if (false == class_exists('Composer\Autoload\ClassLoader', false)) { - fwrite(STDERR, 'Unable to find the Composer autoloader.'.PHP_EOL); - - exit(1); -} diff --git a/Library/bootstrap.php b/Library/bootstrap.php deleted file mode 100644 index af05b775f9..0000000000 --- a/Library/bootstrap.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir; - -set_error_handler( - static function ($code, $message, $file = '', $line = -1) { - if (error_reporting() & $code) { - throw new \ErrorException($message, 0, $code, (string) $file, $line); - } - } -); - -if (filter_var(getenv('ZEPHIR_DEBUG'), \FILTER_VALIDATE_BOOLEAN)) { - set_exception_handler( - static function (\Throwable $t) { - fwrite(\STDERR, "[ERROR] {$t->getMessage()}".\PHP_EOL); - - exit(1); - } - ); -} diff --git a/zephir b/zephir index 76ce16a525..64905b3c4a 100755 --- a/zephir +++ b/zephir @@ -10,6 +10,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + use Monolog\Handler\StreamHandler; use Monolog\Logger; use Zephir\Backends\BackendFactory; @@ -31,11 +33,56 @@ use Zephir\Logger\Formatter\CompilerFormatter; use Zephir\Parser\Manager; use Zephir\Parser\Parser; -$rootPath = realpath(dirname(__FILE__)); +if (version_compare('7.0.0', PHP_VERSION, '>')) { + fprintf( + STDERR, + 'This Zephir version is supported on PHP >= 7.0.0.'.PHP_EOL. + 'You are using PHP %s (%s).'.PHP_EOL, + PHP_VERSION, + PHP_BINARY + ); + + exit(1); +} + +if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { + fprintf( + STDERR, + 'Zephir should be invoked via the CLI version of PHP, not the %s SAPI.'.PHP_EOL, + PHP_SAPI + ); + + exit(1); +} + +foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) { + if (file_exists($file)) { + include_once $file; + break; + } +} -require $rootPath.'/Library/autoload.php'; -require $rootPath.'/Library/bootstrap.php'; +if (!class_exists('Composer\Autoload\ClassLoader', false)) { + fwrite(STDERR, 'Unable to find the Composer autoloader.'.PHP_EOL); + exit(1); +} + +set_error_handler(static function ($code, $message, $file = '', $line = -1) { + if (error_reporting() & $code) { + throw new ErrorException($message, 0, $code, (string) $file, $line); + } +}); + +if (filter_var(getenv('ZEPHIR_DEBUG'), FILTER_VALIDATE_BOOLEAN)) { + set_exception_handler(static function (Throwable $t) { + fwrite(STDERR, "[ERROR] {$t->getMessage()}". PHP_EOL); + + exit(1); + }); +} + +$rootPath = realpath(dirname(__FILE__)); $config = Config::fromServer(); /** From 9dbecb2c958272ba4912ea41dfaab75f23f9cb37 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 23 Dec 2021 23:51:28 +0000 Subject: [PATCH 072/128] Remove call of `Library/autoload.php` file --- phpunit.xml.dist | 2 +- tests/ext-bootstrap.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fcdc56b0d6..1929afb12a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ diff --git a/tests/ext-bootstrap.php b/tests/ext-bootstrap.php index 375c262f97..ecdfacba0b 100644 --- a/tests/ext-bootstrap.php +++ b/tests/ext-bootstrap.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -require_once __DIR__.'/../Library/autoload.php'; +declare(strict_types=1); /** * Draw message in the Box From 334b5688a9676c397b43e55b377bdc0adbe2d494 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 23 Dec 2021 23:55:02 +0000 Subject: [PATCH 073/128] Remove PHPUnit XML files --- phpunit.ext.xml | 2 -- phpunit.xml.dist | 4 ---- 2 files changed, 6 deletions(-) diff --git a/phpunit.ext.xml b/phpunit.ext.xml index b31dadeedc..72f9e1aa8c 100644 --- a/phpunit.ext.xml +++ b/phpunit.ext.xml @@ -14,8 +14,6 @@ - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1929afb12a..22bdcbfddf 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -22,7 +22,6 @@ tests/Zephir - tests/Zephir/KernelTestCase.php @@ -34,11 +33,8 @@ - - - From 96487d9a77d9591031b22c57d6ff41fa71616733 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 23 Dec 2021 23:55:10 +0000 Subject: [PATCH 074/128] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 94290e9cb0..826d92a25a 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ phpunit.xml # Build artefact zephir.phar box.phar +php-cs-fixer.phar # Ignore codecoverage stuff. *.profraw From b2e54bd574549291572678e3e283d848bf3b122a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 24 Dec 2021 14:52:35 +0000 Subject: [PATCH 075/128] #2330 - Add support of `mixed` type casting --- Library/Operators/Other/CastOperator.php | 72 ++++++++---------------- Library/Passes/StaticTypeInference.php | 5 +- stub/types/mixedtype.zep | 20 +++++++ tests/Extension/Types/MixedTypeTest.php | 32 +++++++++++ 4 files changed, 76 insertions(+), 53 deletions(-) diff --git a/Library/Operators/Other/CastOperator.php b/Library/Operators/Other/CastOperator.php index 6b1bfcc211..ef827e54ba 100644 --- a/Library/Operators/Other/CastOperator.php +++ b/Library/Operators/Other/CastOperator.php @@ -13,6 +13,7 @@ namespace Zephir\Operators\Other; +use ReflectionException; use Zephir\CompilationContext; use Zephir\CompiledExpression; use Zephir\Detectors\ReadDetector; @@ -31,12 +32,11 @@ class CastOperator extends AbstractOperator /** * Compiles a type cast operation. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * - * @throws CompilerException - * * @return CompiledExpression + * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression { @@ -79,9 +79,11 @@ public function compile(array $expression, CompilationContext $compilationContex 'string', $compilationContext ); - $let = new LetVariable(); + $original = $resolved->getOriginal(); $original['operator'] = 'assign'; + + $let = new LetVariable(); $let->assign( $symbolVariable->getName(), $symbolVariable, @@ -132,6 +134,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_ARRAY: case Types::T_VARIABLE: + case Types::T_MIXED: case Types::T_STRING: $symbol = $compilationContext->backend->getVariableCode($symbolVariable); @@ -156,11 +159,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -220,6 +219,7 @@ public function compile(array $expression, CompilationContext $compilationContex ); case Types::T_VARIABLE: + case Types::T_MIXED: $symbol = $compilationContext->backend->getVariableCode($symbolVariable); return new CompiledExpression( @@ -243,11 +243,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -317,6 +313,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_ARRAY: case Types::T_VARIABLE: + case Types::T_MIXED: $symbol = $compilationContext->backend->getVariableCode($symbolVariable); return new CompiledExpression( @@ -340,11 +337,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -393,6 +386,7 @@ public function compile(array $expression, CompilationContext $compilationContex ); case Types::T_VARIABLE: + case Types::T_MIXED: return new CompiledExpression( 'bool', sprintf('zephir_get_boolval(%s)', $symbol), @@ -414,11 +408,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -433,6 +423,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('char', "'{$resolved->getCode()}'", $expression); case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $symbolVariable = $compilationContext->symbolTable->getVariableForRead( $resolved->getCode(), @@ -466,11 +457,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('variable', $tempVariable->getName(), $expression); default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -483,6 +470,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('string', $resolved->getCode(), $expression); case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $compilationContext->symbolTable->mustGrownStack(true); @@ -544,11 +532,7 @@ public function compile(array $expression, CompilationContext $compilationContex break; default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -557,6 +541,7 @@ public function compile(array $expression, CompilationContext $compilationContex case Types::T_ARRAY: switch ($resolved->getType()) { case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $compilationContext->symbolTable->mustGrownStack(true); @@ -587,11 +572,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -634,6 +615,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('variable', $symbolVariable->getName(), $expression); case Types::T_VARIABLE: + case Types::T_MIXED: $compilationContext->headersManager->add('kernel/operators'); $symbolVariable = $compilationContext->symbolTable->getVariableForRead( $resolved->getCode(), @@ -651,11 +633,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } @@ -663,11 +641,7 @@ public function compile(array $expression, CompilationContext $compilationContex default: throw new CompilerException( - sprintf( - 'Cannot cast: %s to %s', - $resolved->getType(), - $expression['left'] - ), + sprintf('Cannot cast: %s to %s', $resolved->getType(), $expression['left']), $expression ); } diff --git a/Library/Passes/StaticTypeInference.php b/Library/Passes/StaticTypeInference.php index d377e88f85..0b58a7ba90 100644 --- a/Library/Passes/StaticTypeInference.php +++ b/Library/Passes/StaticTypeInference.php @@ -154,11 +154,8 @@ public function markVariable($variable, $type) break; case 'variable': - case 'mixed': - $this->variables[$variable] = 'undefined'; - break; - case 'array': + case 'mixed': $this->variables[$variable] = 'undefined'; break; diff --git a/stub/types/mixedtype.zep b/stub/types/mixedtype.zep index 182e3d8f41..fb216c0016 100644 --- a/stub/types/mixedtype.zep +++ b/stub/types/mixedtype.zep @@ -84,4 +84,24 @@ class MixedType { return val; } + + public function castToStringMixedAndReturnMixed(mixed val) -> mixed + { + return (string)val; + } + + public function castToIntMixedAndReturnMixed(mixed val) -> mixed + { + return (int)val; + } + + public function castToBoolMixedAndReturnMixed(mixed val) -> mixed + { + return (bool)val; + } + + public function castToFloatMixedAndReturnMixed(mixed val) -> mixed + { + return (float)val; + } } diff --git a/tests/Extension/Types/MixedTypeTest.php b/tests/Extension/Types/MixedTypeTest.php index fc198c5b69..66fc86c720 100644 --- a/tests/Extension/Types/MixedTypeTest.php +++ b/tests/Extension/Types/MixedTypeTest.php @@ -83,4 +83,36 @@ public function testParamsAndReturnsOfMixedType(): void $this->assertTrue($returns->paramAndReturnMixed(true)); $this->assertNull($returns->paramAndReturnMixed(null)); } + + public function testCastMixedType(): void + { + $returns = new MixedType(); + + /** + * string + */ + $this->assertSame('123', $returns->castToStringMixedAndReturnMixed(123)); + $this->assertSame('123', $returns->castToStringMixedAndReturnMixed('123')); + $this->assertSame('string', $returns->castToStringMixedAndReturnMixed('string')); + $this->assertSame('', $returns->castToStringMixedAndReturnMixed(false)); + $this->assertSame('1', $returns->castToStringMixedAndReturnMixed(true)); + + /** + * int + */ + $this->assertSame(123, $returns->castToIntMixedAndReturnMixed('123')); + $this->assertSame(1, $returns->castToIntMixedAndReturnMixed(1.5)); + + /** + * bool + */ + $this->assertSame(true, $returns->castToBoolMixedAndReturnMixed(1)); + $this->assertSame(false, $returns->castToBoolMixedAndReturnMixed(0)); + + /** + * float + */ + $this->assertSame(1.0, $returns->castToFloatMixedAndReturnMixed(1)); + $this->assertSame(1.5, $returns->castToFloatMixedAndReturnMixed(1.5)); + } } From 00d254e543bdeb90ad1db805654073b013cb951c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 24 Dec 2021 14:56:11 +0000 Subject: [PATCH 076/128] #2330 - Fix CS --- Library/Operators/Other/CastOperator.php | 3 ++- tests/Extension/Types/MixedTypeTest.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Operators/Other/CastOperator.php b/Library/Operators/Other/CastOperator.php index ef827e54ba..26b8ac9724 100644 --- a/Library/Operators/Other/CastOperator.php +++ b/Library/Operators/Other/CastOperator.php @@ -32,10 +32,11 @@ class CastOperator extends AbstractOperator /** * Compiles a type cast operation. * - * @param array $expression + * @param array $expression * @param CompilationContext $compilationContext * * @return CompiledExpression + * * @throws ReflectionException */ public function compile(array $expression, CompilationContext $compilationContext): CompiledExpression diff --git a/tests/Extension/Types/MixedTypeTest.php b/tests/Extension/Types/MixedTypeTest.php index 66fc86c720..71e7539685 100644 --- a/tests/Extension/Types/MixedTypeTest.php +++ b/tests/Extension/Types/MixedTypeTest.php @@ -106,8 +106,8 @@ public function testCastMixedType(): void /** * bool */ - $this->assertSame(true, $returns->castToBoolMixedAndReturnMixed(1)); - $this->assertSame(false, $returns->castToBoolMixedAndReturnMixed(0)); + $this->assertTrue($returns->castToBoolMixedAndReturnMixed(1)); + $this->assertFalse($returns->castToBoolMixedAndReturnMixed(0)); /** * float From 2a9e10a281279b10fb976b2102d87fb67ce8af3c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 24 Dec 2021 17:55:39 +0000 Subject: [PATCH 077/128] #2330 - Improve support of `mixed` type casting --- Library/Statements/Let/Variable.php | 1 + stub/types/mixedtype.zep | 28 ++++++++++++++++++++ tests/Extension/Types/MixedTypeTest.php | 34 ++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/Library/Statements/Let/Variable.php b/Library/Statements/Let/Variable.php index 00c0b67ce0..bddda28802 100644 --- a/Library/Statements/Let/Variable.php +++ b/Library/Statements/Let/Variable.php @@ -100,6 +100,7 @@ public function assign( break; case 'variable': + case 'mixed': $this->doVariableAssignment($codePrinter, $resolvedExpr, $symbolVariable, $variable, $statement, $compilationContext, $readDetector); break; diff --git a/stub/types/mixedtype.zep b/stub/types/mixedtype.zep index fb216c0016..95c964c6c1 100644 --- a/stub/types/mixedtype.zep +++ b/stub/types/mixedtype.zep @@ -90,18 +90,46 @@ class MixedType return (string)val; } + public function castToStringInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (string)val; + + return val; + } + public function castToIntMixedAndReturnMixed(mixed val) -> mixed { return (int)val; } + public function castToIntInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (int)val; + + return val; + } + public function castToBoolMixedAndReturnMixed(mixed val) -> mixed { return (bool)val; } + public function castToBoolInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (bool)val; + + return val; + } + public function castToFloatMixedAndReturnMixed(mixed val) -> mixed { return (float)val; } + + public function castToFloatInternallyMixedAndReturnMixed(mixed val) -> mixed + { + let val = (float)val; + + return val; + } } diff --git a/tests/Extension/Types/MixedTypeTest.php b/tests/Extension/Types/MixedTypeTest.php index 71e7539685..162edba89c 100644 --- a/tests/Extension/Types/MixedTypeTest.php +++ b/tests/Extension/Types/MixedTypeTest.php @@ -84,7 +84,7 @@ public function testParamsAndReturnsOfMixedType(): void $this->assertNull($returns->paramAndReturnMixed(null)); } - public function testCastMixedType(): void + public function testReturnCastedMixedType(): void { $returns = new MixedType(); @@ -115,4 +115,36 @@ public function testCastMixedType(): void $this->assertSame(1.0, $returns->castToFloatMixedAndReturnMixed(1)); $this->assertSame(1.5, $returns->castToFloatMixedAndReturnMixed(1.5)); } + + public function testReturnInternallyCastedCastMixedType(): void + { + $returns = new MixedType(); + + /** + * string + */ + $this->assertSame('123', $returns->castToStringInternallyMixedAndReturnMixed(123)); + $this->assertSame('123', $returns->castToStringInternallyMixedAndReturnMixed('123')); + $this->assertSame('string', $returns->castToStringInternallyMixedAndReturnMixed('string')); + $this->assertSame('', $returns->castToStringInternallyMixedAndReturnMixed(false)); + $this->assertSame('1', $returns->castToStringInternallyMixedAndReturnMixed(true)); + + /** + * int + */ + $this->assertSame(123, $returns->castToIntInternallyMixedAndReturnMixed('123')); + $this->assertSame(1, $returns->castToIntInternallyMixedAndReturnMixed(1.5)); + + /** + * bool + */ + $this->assertTrue($returns->castToBoolInternallyMixedAndReturnMixed(1)); + $this->assertFalse($returns->castToBoolInternallyMixedAndReturnMixed(0)); + + /** + * float + */ + $this->assertSame(1.0, $returns->castToFloatInternallyMixedAndReturnMixed(1)); + $this->assertSame(1.5, $returns->castToFloatInternallyMixedAndReturnMixed(1.5)); + } } From 13bbd46dc64e15da21386ef3ee7f1b58dfeada75 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 24 Dec 2021 18:40:16 +0000 Subject: [PATCH 078/128] #2330 - Improve support of `mixed` type casting --- .../Operators/Bitwise/BitwiseNotOperator.php | 1 + .../Comparison/ComparisonBaseOperator.php | 11 ++++++++++ Library/Operators/Unary/NotOperator.php | 1 + Library/Statements/EchoStatement.php | 1 + Library/Statements/Let/Variable.php | 4 ++++ Library/Statements/Let/VariableAppend.php | 3 +++ stub/types/mixedtype.zep | 20 +++++++++++++++++++ 7 files changed, 41 insertions(+) diff --git a/Library/Operators/Bitwise/BitwiseNotOperator.php b/Library/Operators/Bitwise/BitwiseNotOperator.php index b0b9782350..b40be4dc06 100644 --- a/Library/Operators/Bitwise/BitwiseNotOperator.php +++ b/Library/Operators/Bitwise/BitwiseNotOperator.php @@ -55,6 +55,7 @@ public function compile($expression, CompilationContext $compilationContext) return new CompiledExpression('int', '~'.$variable->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); return new CompiledExpression('int', '~zephir_get_intval('.$variable->getName().')', $expression); diff --git a/Library/Operators/Comparison/ComparisonBaseOperator.php b/Library/Operators/Comparison/ComparisonBaseOperator.php index 4c79a84e02..d9c49f3113 100644 --- a/Library/Operators/Comparison/ComparisonBaseOperator.php +++ b/Library/Operators/Comparison/ComparisonBaseOperator.php @@ -228,6 +228,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('bool', '0 '.$this->operator.' '.$variableRight->getName(), $expression); case 'variable': + case 'mixed': case 'string': $compilationContext->headersManager->add('kernel/operators'); $condition = $compilationContext->backend->getTypeofCondition($variableRight, $this->operator, 'null', $compilationContext); @@ -281,6 +282,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('bool', $left->getCode().' '.$this->operator.' '.$variableRight->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $variableCode = $compilationContext->backend->getVariableCode($variableRight); @@ -330,6 +332,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('bool', $left->getBooleanCode().' '.$this->operator.' '.$variableRight->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $boolOperator = '1' == $left->getBooleanCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; $variableRight = $compilationContext->backend->getVariableCode($variableRight); @@ -370,6 +373,7 @@ public function compile(array $expression, CompilationContext $compilationContex switch ($variableRight->getType()) { case 'string': case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $variableRight = $compilationContext->backend->getVariableCode($variableRight); @@ -424,6 +428,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('bool', $variable->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); $variableCode = $compilationContext->backend->getVariableCode($variable); @@ -468,6 +473,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('bool', $variable->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); $variableCode = $compilationContext->backend->getVariableCode($variable); @@ -508,6 +514,7 @@ public function compile(array $expression, CompilationContext $compilationContex return new CompiledExpression('bool', $variable->getName().' '.$this->operator.' '.$variableRight->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $boolOperator = '1' == $left->getBooleanCode() ? $this->zvalBoolTrueOperator : $this->zvalBoolFalseOperator; $variableRightCode = $compilationContext->backend->getVariableCode($variableRight); @@ -534,6 +541,7 @@ public function compile(array $expression, CompilationContext $compilationContex switch ($variableRight->getType()) { case 'string': case 'variable': + case 'mixed': case 'array': $compilationContext->headersManager->add('kernel/operators'); $variableRight = $compilationContext->backend->getVariableCode($variableRight); @@ -566,6 +574,7 @@ public function compile(array $expression, CompilationContext $compilationContex switch ($variableRight->getType()) { case 'string': case 'variable': + case 'mixed': $variableRight = $compilationContext->backend->getVariableCode($variableRight); return new CompiledExpression('bool', $this->zvalOperator.'('.$variableCode.', '.$variableRight.')', $expression); @@ -581,6 +590,7 @@ public function compile(array $expression, CompilationContext $compilationContex break; case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); switch ($right->getType()) { @@ -625,6 +635,7 @@ public function compile(array $expression, CompilationContext $compilationContex case 'string': case 'variable': + case 'mixed': case 'array': $variableRight = $compilationContext->backend->getVariableCode($variableRight); diff --git a/Library/Operators/Unary/NotOperator.php b/Library/Operators/Unary/NotOperator.php index 916ad6c5ed..2d5eee5b57 100644 --- a/Library/Operators/Unary/NotOperator.php +++ b/Library/Operators/Unary/NotOperator.php @@ -60,6 +60,7 @@ public function compile($expression, CompilationContext $compilationContext): Co return new CompiledExpression('bool', '!'.$variable->getName(), $expression); case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $symbol = $compilationContext->backend->getVariableCode($variable); diff --git a/Library/Statements/EchoStatement.php b/Library/Statements/EchoStatement.php index 4beaf8a75d..216efe6032 100644 --- a/Library/Statements/EchoStatement.php +++ b/Library/Statements/EchoStatement.php @@ -93,6 +93,7 @@ public function compile(CompilationContext $compilationContext) case 'string': case 'variable': + case 'mixed': $compilationContext->codePrinter->output('zend_print_zval('.$compilationContext->backend->getVariableCode($variable).', 0);'); break; diff --git a/Library/Statements/Let/Variable.php b/Library/Statements/Let/Variable.php index bddda28802..479446029f 100644 --- a/Library/Statements/Let/Variable.php +++ b/Library/Statements/Let/Variable.php @@ -312,6 +312,7 @@ private function doNumericAssignment( break; case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $exprVariable = $compilationContext->symbolTable->getVariableForWrite($resolvedExpr->resolve(null, $compilationContext), $compilationContext); $exprVariableCode = $compilationContext->backend->getVariableCode($exprVariable); @@ -503,6 +504,7 @@ private function doDoubleAssignment( break; case 'variable': + case 'mixed': $compilationContext->headersManager->add('kernel/operators'); $exprVariableCode = $compilationContext->backend->getVariableCode($itemVariable); switch ($statement['operator']) { @@ -691,6 +693,7 @@ private function doStringAssignment( break; case 'variable': + case 'mixed': switch ($statement['operator']) { case 'assign': $symbolVariable->setMustInitNull(true); @@ -879,6 +882,7 @@ private function doBoolAssignment( break; case 'variable': + case 'mixed': case 'string': case 'array': switch ($statement['operator']) { diff --git a/Library/Statements/Let/VariableAppend.php b/Library/Statements/Let/VariableAppend.php index 157b913dcd..42595d41c7 100644 --- a/Library/Statements/Let/VariableAppend.php +++ b/Library/Statements/Let/VariableAppend.php @@ -70,6 +70,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres switch ($type) { case 'array': case 'variable': + case 'mixed': switch ($resolvedExpr->getType()) { case 'null': $compilationContext->backend->addArrayEntry($symbolVariable, null, 'null', $compilationContext, $statement); @@ -112,6 +113,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'variable': + case 'mixed': $exprVariable = $compilationContext->symbolTable->getVariableForRead($resolvedExpr->getCode(), $compilationContext, $statement); switch ($exprVariable->getType()) { case 'int': @@ -138,6 +140,7 @@ public function assign($variable, ZephirVariable $symbolVariable, CompiledExpres break; case 'variable': + case 'mixed': case 'string': case 'array': $compilationContext->backend->addArrayEntry($symbolVariable, null, $exprVariable, $compilationContext, $statement); diff --git a/stub/types/mixedtype.zep b/stub/types/mixedtype.zep index 95c964c6c1..059953560e 100644 --- a/stub/types/mixedtype.zep +++ b/stub/types/mixedtype.zep @@ -132,4 +132,24 @@ class MixedType return val; } + + /** + * Only used during generation + */ + public function mixedInCondition(mixed val) -> void + { + if unlikely val { + // OK + } + + if val === 1 { + // OK + } + + if 1 === val { + + } + + echo val; + } } From 31d9f3cf9d20be06a4cb1476cf2d9157e9073f37 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 24 Dec 2021 18:40:41 +0000 Subject: [PATCH 079/128] Change error message output --- Library/Console/Command/GenerateCommand.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index d23b0214e7..1543662c22 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -85,12 +85,9 @@ protected function execute(InputInterface $input, OutputInterface $output) ); return 1; - } catch (ExceptionInterface $e) { - $io->getErrorStyle()->error($e->getMessage()); - - return 1; - } catch (Exception $e) { - $io->getErrorStyle()->error($e->getMessage()); + } catch (ExceptionInterface | Exception $e) { + $io->getErrorStyle()->error($e->getMessage() . sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine())); + $io->getErrorStyle()->error($e->getTraceAsString()); return 1; } From 4f76415193347452c898fe85db3927c40b1db9e2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 24 Dec 2021 18:52:08 +0000 Subject: [PATCH 080/128] #2330 - Improve support of `mixed` type in arrays --- Library/Backends/ZendEngine2/Backend.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php index 3f104c3c21..5bfb5e00d9 100644 --- a/Library/Backends/ZendEngine2/Backend.php +++ b/Library/Backends/ZendEngine2/Backend.php @@ -1047,6 +1047,7 @@ public function checkStrictType($type, $var, CompilationContext $context) case 'object': case 'resource': case 'callable': + case 'mixed': break; default: throw new CompilerException('Unknown type: '.$type); From 32f5f30e64302f8fea76414fd5463310d4cae2cd Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 24 Dec 2021 18:57:58 +0000 Subject: [PATCH 081/128] #2330 - Improve support of `mixed` type in arrays --- Library/Backends/ZendEngine2/Backend.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Library/Backends/ZendEngine2/Backend.php b/Library/Backends/ZendEngine2/Backend.php index 5bfb5e00d9..e317542532 100644 --- a/Library/Backends/ZendEngine2/Backend.php +++ b/Library/Backends/ZendEngine2/Backend.php @@ -21,9 +21,9 @@ use Zephir\GlobalConstant; use Zephir\Variable; +use function in_array; + /** - * Zephir\Backends\ZendEngine2\Backend. - * * NOTE: ZendEngine2 backend is no longer supported * and this class will be removed in the future. */ @@ -300,7 +300,7 @@ public function addArrayEntry(Variable $variable, $key, $value, CompilationConte $var = $context->symbolTable->getVariableForRead($key->getCode(), $context); $typeKey = $var->getType(); } - if (\in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { + if (in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { $keyType = 'index'; } } @@ -455,7 +455,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->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');'; } else { if ($isVariable) { @@ -500,20 +500,21 @@ public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr, $code = $this->getVariableCodePointer($target).', '.$this->getVariableCode($var); if (!($resolvedExpr instanceof Variable)) { - if ('string' == $resolvedExpr->getType()) { + if ('string' === $resolvedExpr->getType()) { return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression); - } elseif (\in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { + } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression); } else { $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context); } } - if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { + if (in_array($resolvedExpr->getType(), ['int', 'long'])) { return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); - } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType()) { + } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression); } + throw new CompilerException('arrayIssetFetch ['.$resolvedExpr->getType().']', $expression); } From 914984b669b905dd60d88a470bb4be1cd2113cfa Mon Sep 17 00:00:00 2001 From: Fenikkusu Date: Sat, 1 Jan 2022 15:53:56 -0500 Subject: [PATCH 082/128] Adding Interface Check --- CHANGELOG.md | 1 + Library/Classes/Entry.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 083800d164..96427988fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). ### Fixed - Fixed left `null` with `string` condition [#2299](https://github.com/zephir-lang/zephir/issues/2299) - Improved support of `mixed` type [#2330](https://github.com/zephir-lang/zephir/issues/2330) +- Fixed Interfaces Breaking Child Projects Of Same Root Level Namespace [#2334](https://github.com/zephir-lang/zephir/issues/2334) ## [0.15.2] - 2021-10-24 ### Fixed diff --git a/Library/Classes/Entry.php b/Library/Classes/Entry.php index 31ae696ac7..a1f8f548f1 100644 --- a/Library/Classes/Entry.php +++ b/Library/Classes/Entry.php @@ -98,7 +98,7 @@ public function get(): string return $this->classEntries[$className][0]; } - if (class_exists($this->classname)) { + if (class_exists($this->classname) || interface_exists($this->classname)) { $reflection = new ReflectionClass($this->classname); $className = $reflection->getName(); From d39c98cce3146d8d626c1baac3055a0b86c9ea8f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 2 Jan 2022 23:45:36 +0000 Subject: [PATCH 083/128] Fix CS --- Library/Console/Command/GenerateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index 1543662c22..0be418bd98 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } catch (ExceptionInterface | Exception $e) { - $io->getErrorStyle()->error($e->getMessage() . sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine())); + $io->getErrorStyle()->error($e->getMessage().sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine())); $io->getErrorStyle()->error($e->getTraceAsString()); return 1; From ed1f65e185575d5bf402f262b5377b2edb3ff15e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 2 Jan 2022 23:49:50 +0000 Subject: [PATCH 084/128] Add more folders to failed upload artifacts --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f1d3cbf80e..ca5983c334 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -208,4 +208,5 @@ jobs: !${{ github.workspace }}/ext/stub/ !${{ github.workspace }}/ext/Release/ !${{ github.workspace }}/ext/x64/Release/ + ${{ github.workspace }}/tests/output/ retention-days: 7 From c2541108c2932330c0b036615adb61491d7cc481 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 3 Jan 2022 00:15:39 +0000 Subject: [PATCH 085/128] Add `--trace` option in Generate Command --- Library/Console/Command/GenerateCommand.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index 0be418bd98..d8eb491b9e 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -49,6 +49,7 @@ protected function configure() ->setName('generate') ->setDescription('Generates C code from the Zephir code without compiling it') ->setDefinition($this->createDefinition()) + ->addOption('trace', 't', InputOption::VALUE_NONE, 'Show trace message output (in case of exception error)') ->setHelp(sprintf('%s.', $this->getDescription()).PHP_EOL.PHP_EOL.$this->getZflagsHelp()); } @@ -56,6 +57,8 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); + $trace = $input->hasOption('trace'); + if (extension_loaded('timecop') && 1 == ini_get('timecop.func_override')) { $io->getErrorStyle()->warning( <<getErrorStyle()->error($e->getMessage().sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine())); - $io->getErrorStyle()->error($e->getTraceAsString()); + if ($trace) { + $io->getErrorStyle()->error($e->getMessage().sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine())); + $io->getErrorStyle()->error($e->getTraceAsString()); + } else { + $io->getErrorStyle()->error($e->getMessage()); + } return 1; } From ac9a720eb91d32af2425a00037d3b9c436809d38 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 3 Jan 2022 00:23:19 +0000 Subject: [PATCH 086/128] Change usage from `hasOption()` to `getOption()` --- Library/Console/Command/GenerateCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index d8eb491b9e..8ca92df7e3 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); - $trace = $input->hasOption('trace'); + $trace = $input->getOption('trace'); if (extension_loaded('timecop') && 1 == ini_get('timecop.func_override')) { $io->getErrorStyle()->warning( @@ -89,7 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } catch (ExceptionInterface | Exception $e) { - if ($trace) { + if ($trace === true) { $io->getErrorStyle()->error($e->getMessage().sprintf(' (Zephir file: %s#%d)', $e->getFile(), $e->getLine())); $io->getErrorStyle()->error($e->getTraceAsString()); } else { From 6dce39b5cb021b282475b4f6cffcde8a278be592 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 13 Jan 2022 23:56:36 +0000 Subject: [PATCH 087/128] #2339 - Remove call by reference from `return_value` --- kernels/ZendEngine3/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernels/ZendEngine3/file.c b/kernels/ZendEngine3/file.c index cf0c691d2c..83237c4fae 100755 --- a/kernels/ZendEngine3/file.c +++ b/kernels/ZendEngine3/file.c @@ -296,7 +296,7 @@ void zephir_filemtime(zval *return_value, zval *path) if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) { #if PHP_VERSION_ID >= 80100 zend_string *file = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), 0); - php_stat(file, FS_MTIME, &return_value); + php_stat(file, FS_MTIME, return_value); zval_ptr_dtor(file); #else php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value); From 268744863aad5fe50402cb211b4e63c5f5eb21c6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 15 Jan 2022 10:31:23 +0000 Subject: [PATCH 088/128] Add `--ignore-platform-reqs` flag for nightly.yml workflow --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cb0e7d731e..3f1e619b98 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -73,7 +73,7 @@ jobs: - name: Install Project Dependencies run: | echo "::group::Install composer dependencies" - composer install --prefer-dist --no-interaction --no-ansi --no-progress + composer install --prefer-dist --no-interaction --no-ansi --no-progress --ignore-platform-reqs echo "::endgroup::" - name: Fast Commands Test From ade3e4eedc5945b76da3d80215163d746604942e Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 16 Jan 2022 21:36:59 +0000 Subject: [PATCH 089/128] Remove unused classes inside `Builder/` directory --- Library/Builder/LiteralBuilder.php | 38 ----------- .../Operators/BinaryOperatorBuilder.php | 65 ------------------- .../Operators/NewInstanceOperatorBuilder.php | 65 ------------------- .../Operators/TypeOfOperatorBuilder.php | 52 --------------- Library/Builder/ParameterBuilder.php | 39 ----------- Library/Builder/RawExpressionBuilder.php | 32 --------- .../Statements/ReturnStatementBuilder.php | 43 ------------ .../Statements/ThrowStatementBuilder.php | 43 ------------ Library/Builder/VariableBuilder.php | 40 ------------ 9 files changed, 417 deletions(-) delete mode 100644 Library/Builder/LiteralBuilder.php delete mode 100644 Library/Builder/Operators/BinaryOperatorBuilder.php delete mode 100644 Library/Builder/Operators/NewInstanceOperatorBuilder.php delete mode 100644 Library/Builder/Operators/TypeOfOperatorBuilder.php delete mode 100644 Library/Builder/ParameterBuilder.php delete mode 100644 Library/Builder/RawExpressionBuilder.php delete mode 100644 Library/Builder/Statements/ReturnStatementBuilder.php delete mode 100644 Library/Builder/Statements/ThrowStatementBuilder.php delete mode 100644 Library/Builder/VariableBuilder.php diff --git a/Library/Builder/LiteralBuilder.php b/Library/Builder/LiteralBuilder.php deleted file mode 100644 index d10c8a50f3..0000000000 --- a/Library/Builder/LiteralBuilder.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder; - -/** - * LiteralBuilder. - * - * Allows to manually build a literal expressions AST nodes - */ -class LiteralBuilder -{ - protected $type; - - protected $value; - - public function __construct($type, $value) - { - $this->type = $type; - $this->value = $value; - } - - public function get() - { - return [ - 'type' => $this->type, - 'value' => $this->value, - ]; - } -} diff --git a/Library/Builder/Operators/BinaryOperatorBuilder.php b/Library/Builder/Operators/BinaryOperatorBuilder.php deleted file mode 100644 index 8bb9bc497c..0000000000 --- a/Library/Builder/Operators/BinaryOperatorBuilder.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Operators; - -/** - * BinaryOperatorBuilder. - * - * Allows to manually build a binary operator AST node - */ -class BinaryOperatorBuilder extends AbstractOperatorBuilder -{ - protected $operator; - - protected $file; - - protected $line; - - protected $char; - - /** - * BinaryOperatorBuilder constructor. - * - * @param string $operator - * @param Builder $leftExpression - * @param Builder $rightExpression - * @param string $file - * @param int $line - * @param string $char - */ - public function __construct($operator, $leftExpression, $rightExpression, $file = null, $line = 0, $char = 0) - { - $this->operator = $operator; - $this->leftExpression = $leftExpression; - $this->rightExpression = $rightExpression; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'type' => $this->operator, - 'left' => $this->leftExpression->get(), - 'right' => $this->rightExpression->get(), - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Builder/Operators/NewInstanceOperatorBuilder.php b/Library/Builder/Operators/NewInstanceOperatorBuilder.php deleted file mode 100644 index 5efcc1f903..0000000000 --- a/Library/Builder/Operators/NewInstanceOperatorBuilder.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Operators; - -/** - * NewInstanceOperatorBuilder. - * - * Allows to manually build a 'new instance' operator AST node - */ -class NewInstanceOperatorBuilder extends AbstractOperatorBuilder -{ - protected $type; - - protected $className; - - protected $dynamic; - - protected $file; - - protected $line; - - protected $char; - - public function __construct($className, array $parameters, $dynamic = false, $file = null, $line = 0, $char = 0) - { - $this->className = $className; - $this->parameters = $parameters; - $this->dynamic = $dynamic; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - $parameters = []; - foreach ($this->parameters as $parameter) { - $parameters[] = $parameter->get(); - } - - return [ - 'type' => 'new', - 'class' => $this->className, - 'parameters' => $parameters, - 'dynamic' => $this->dynamic, - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Builder/Operators/TypeOfOperatorBuilder.php b/Library/Builder/Operators/TypeOfOperatorBuilder.php deleted file mode 100644 index c73fc8a180..0000000000 --- a/Library/Builder/Operators/TypeOfOperatorBuilder.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Operators; - -/** - * TypeOfOperatorBuilder. - * - * Allows to manually build a 'typeof' operator AST node - */ -class TypeOfOperatorBuilder extends AbstractOperatorBuilder -{ - protected $leftOperand; - - /** - * @param $left - * @param null $file - * @param int $line - * @param int $char - */ - public function __construct($left, $file = null, $line = 0, $char = 0) - { - $this->leftOperand = $left; - $this->file = $file; - $this->line = $line; - $this->char = $char; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'type' => 'typeof', - 'left' => $this->leftOperand->get(), - 'file' => $this->file, - 'line' => $this->line, - 'char' => $this->char, - ]; - } -} diff --git a/Library/Builder/ParameterBuilder.php b/Library/Builder/ParameterBuilder.php deleted file mode 100644 index 3a594a0778..0000000000 --- a/Library/Builder/ParameterBuilder.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder; - -/** - * ParameterBuilder. - * - * Allows to manually build a call parameters AST nodes - */ -class ParameterBuilder -{ - protected $value; - - public function __construct($value) - { - $this->value = $value; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'parameter' => $this->value->get(), - ]; - } -} diff --git a/Library/Builder/RawExpressionBuilder.php b/Library/Builder/RawExpressionBuilder.php deleted file mode 100644 index c906e6cffd..0000000000 --- a/Library/Builder/RawExpressionBuilder.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder; - -/** - * RawExpressionBuilder. - * - * Allows to use a raw expression in a builder - */ -class RawExpressionBuilder -{ - protected $expr; - - public function __construct($expr) - { - $this->expr = $expr; - } - - public function get() - { - return $this->expr; - } -} diff --git a/Library/Builder/Statements/ReturnStatementBuilder.php b/Library/Builder/Statements/ReturnStatementBuilder.php deleted file mode 100644 index 6d14635027..0000000000 --- a/Library/Builder/Statements/ReturnStatementBuilder.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Statements; - -/** - * ReturnStatementBuilder. - * - * Allows to manually build a 'return' statement AST node - */ -class ReturnStatementBuilder extends AbstractStatementBuilder -{ - private $expr; - - /** - * ReturnStatementBuilder constructor. - * - * @param mixed $expr - */ - public function __construct($expr) - { - $this->expr = $expr; - } - - /** - * {@inheritdoc} - */ - public function get() - { - return [ - 'type' => 'return', - 'expr' => $this->expr->get(), - ]; - } -} diff --git a/Library/Builder/Statements/ThrowStatementBuilder.php b/Library/Builder/Statements/ThrowStatementBuilder.php deleted file mode 100644 index 8007dbbee1..0000000000 --- a/Library/Builder/Statements/ThrowStatementBuilder.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder\Statements; - -/** - * ThrowStatementBuilder. - * - * Allows to manually build a 'throw' statement AST node - */ -class ThrowStatementBuilder extends AbstractStatementBuilder -{ - private $expr; - - /** - * ThrowStatementBuilder constructor. - * - * @param mixed $expr - */ - public function __construct($expr) - { - $this->expr = $expr; - } - - /** - * {@inheritdoc} - */ - public function get() - { - return [ - 'type' => 'throw', - 'expr' => $this->expr->get(), - ]; - } -} diff --git a/Library/Builder/VariableBuilder.php b/Library/Builder/VariableBuilder.php deleted file mode 100644 index 33e0b8c282..0000000000 --- a/Library/Builder/VariableBuilder.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view - * the LICENSE file that was distributed with this source code. - */ - -namespace Zephir\Builder; - -/** - * VariableBuilder. - * - * Allows to manually build a variable AST node - */ -class VariableBuilder -{ - protected $name; - - public function __construct($name) - { - $this->name = $name; - } - - /** - * Returns a builder definition. - * - * @return array - */ - public function get() - { - return [ - 'type' => 'variable', - 'value' => $this->name, - ]; - } -} From e21875b6e9988eb5c411a678542f058519813725 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 16 Jan 2022 21:38:37 +0000 Subject: [PATCH 090/128] Update property types in classes inside `Builder/` directory --- Library/Builder/FunctionCallBuilder.php | 34 +++++++++---------- .../Operators/AbstractOperatorBuilder.php | 17 ++++++++-- .../Builder/Operators/CastOperatorBuilder.php | 24 +++++++------ .../Operators/UnaryOperatorBuilder.php | 30 +++++++++------- .../Statements/AbstractStatementBuilder.php | 9 ++--- .../Builder/Statements/IfStatementBuilder.php | 24 ++++++------- .../Statements/LetStatementBuilder.php | 24 +++++++++---- Library/Builder/StatementsBlockBuilder.php | 27 +++++++-------- 8 files changed, 109 insertions(+), 80 deletions(-) diff --git a/Library/Builder/FunctionCallBuilder.php b/Library/Builder/FunctionCallBuilder.php index 7fdf053a52..a06def7b3a 100644 --- a/Library/Builder/FunctionCallBuilder.php +++ b/Library/Builder/FunctionCallBuilder.php @@ -9,38 +9,36 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder; /** - * FunctionCallBuilder. - * * Allows to manually build a function call AST node */ class FunctionCallBuilder { - protected $name; + protected string $name; - protected $parameters; + protected array $parameters; - protected $type; + protected int $type; - protected $file; + protected ?string $file; - protected $line; + protected int $line = 0; - protected $char; + protected int $char = 0; /** - * FunctionCallBuilder construct. - * - * @param string $name - * @param array $parameters - * @param int $type - * @param string $file - * @param int $line - * @param int $char + * @param string $name + * @param array $parameters + * @param int $type + * @param string|null $file + * @param int $line + * @param int $char */ - public function __construct($name, $parameters, $type = 1, $file = null, $line = 0, $char = 0) + public function __construct(string $name, array $parameters, int $type = 1, ?string $file = null, int $line = 0, int $char = 0) { $this->name = $name; $this->parameters = $parameters; @@ -53,7 +51,7 @@ public function __construct($name, $parameters, $type = 1, $file = null, $line = /** * @return array */ - public function get() + public function get(): array { return [ 'type' => 'fcall', diff --git a/Library/Builder/Operators/AbstractOperatorBuilder.php b/Library/Builder/Operators/AbstractOperatorBuilder.php index 28fc7a208a..4fad1c2726 100644 --- a/Library/Builder/Operators/AbstractOperatorBuilder.php +++ b/Library/Builder/Operators/AbstractOperatorBuilder.php @@ -9,12 +9,25 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Operators; /** - * Abstract class for builders. + * Abstract class for builders */ abstract class AbstractOperatorBuilder { - abstract public function get(); + protected ?string $file = null; + + protected int $line = 0; + + protected int $char = 0; + + /** + * Returns a builder definition. + * + * @return array + */ + abstract public function get(): array; } diff --git a/Library/Builder/Operators/CastOperatorBuilder.php b/Library/Builder/Operators/CastOperatorBuilder.php index 064e5586bc..714d089497 100644 --- a/Library/Builder/Operators/CastOperatorBuilder.php +++ b/Library/Builder/Operators/CastOperatorBuilder.php @@ -9,27 +9,29 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Operators; +use Zephir\Builder\FunctionCallBuilder; + /** - * CastOperatorBuilder. - * * Allows to manually build a 'cast' operator AST node */ class CastOperatorBuilder extends AbstractOperatorBuilder { - protected $leftOperand; + protected string $leftOperand; - protected $rightOperand; + protected FunctionCallBuilder $rightOperand; /** - * @param $left - * @param $right - * @param null $file - * @param int $line - * @param int $char + * @param string $left + * @param FunctionCallBuilder $right + * @param string|null $file + * @param int $line + * @param int $char */ - public function __construct($left, $right, $file = null, $line = 0, $char = 0) + public function __construct(string $left, FunctionCallBuilder $right, ?string $file = null, int $line = 0, int $char = 0) { $this->leftOperand = $left; $this->rightOperand = $right; @@ -43,7 +45,7 @@ public function __construct($left, $right, $file = null, $line = 0, $char = 0) * * @return array */ - public function get() + public function get(): array { return [ 'type' => 'cast', diff --git a/Library/Builder/Operators/UnaryOperatorBuilder.php b/Library/Builder/Operators/UnaryOperatorBuilder.php index 21f46e35dd..b893e9904f 100644 --- a/Library/Builder/Operators/UnaryOperatorBuilder.php +++ b/Library/Builder/Operators/UnaryOperatorBuilder.php @@ -9,26 +9,32 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Operators; +use function is_object; + /** - * UnaryOperatorBuilder. - * * Allows to manually build a unary operator AST node */ class UnaryOperatorBuilder extends AbstractOperatorBuilder { - protected $operator; + /** + * Operator name + * + * @var string + */ + protected string $operator; + /** + * Left Expression + * + * @var mixed + */ protected $leftExpression; - protected $file; - - protected $line; - - protected $char; - - public function __construct($operator, $leftExpression, $file = null, $line = 0, $char = 0) + public function __construct(string $operator, $leftExpression, ?string $file = null, int $line = 0, int $char = 0) { $this->operator = $operator; $this->leftExpression = $leftExpression; @@ -42,9 +48,9 @@ public function __construct($operator, $leftExpression, $file = null, $line = 0, * * @return array */ - public function get() + public function get(): array { - if (\is_object($this->leftExpression) && method_exists($this->leftExpression, 'get')) { + if (is_object($this->leftExpression) && method_exists($this->leftExpression, 'get')) { $expr = $this->leftExpression->get(); } else { $expr = $this->leftExpression; diff --git a/Library/Builder/Statements/AbstractStatementBuilder.php b/Library/Builder/Statements/AbstractStatementBuilder.php index 1cc9073658..a788fbc70e 100644 --- a/Library/Builder/Statements/AbstractStatementBuilder.php +++ b/Library/Builder/Statements/AbstractStatementBuilder.php @@ -9,15 +9,16 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Statements; -/** - * Class AbstractStatementBuilder. - */ abstract class AbstractStatementBuilder { /** + * Returns a builder definition. + * * @return array */ - abstract public function get(); + abstract public function get(): array; } diff --git a/Library/Builder/Statements/IfStatementBuilder.php b/Library/Builder/Statements/IfStatementBuilder.php index 6864f67e0c..ae469a1291 100644 --- a/Library/Builder/Statements/IfStatementBuilder.php +++ b/Library/Builder/Statements/IfStatementBuilder.php @@ -9,30 +9,28 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder\Statements; use Zephir\Builder\Operators\AbstractOperatorBuilder; use Zephir\Builder\StatementsBlockBuilder; /** - * IfStatementBuilder. - * * Allows to manually build a 'if' statement AST node */ class IfStatementBuilder extends AbstractStatementBuilder { - private $evalExpr; + private AbstractOperatorBuilder $evalExpr; - private $ifBlock; + private StatementsBlockBuilder $ifBlock; - private $elseBlock; + private ?StatementsBlockBuilder $elseBlock; /** - * IfStatementBuilder constructor. - * - * @param AbstractOperatorBuilder $evalExpr - * @param StatementsBlockBuilder $ifBlock - * @param StatementsBlockBuilder $elseBlock + * @param AbstractOperatorBuilder $evalExpr + * @param StatementsBlockBuilder $ifBlock + * @param StatementsBlockBuilder|null $elseBlock */ public function __construct(AbstractOperatorBuilder $evalExpr, StatementsBlockBuilder $ifBlock, StatementsBlockBuilder $elseBlock = null) { @@ -42,9 +40,11 @@ public function __construct(AbstractOperatorBuilder $evalExpr, StatementsBlockBu } /** - * {@inheritdoc} + * Returns a builder definition. + * + * @return array */ - public function get() + public function get(): array { $expression = [ 'type' => 'if', diff --git a/Library/Builder/Statements/LetStatementBuilder.php b/Library/Builder/Statements/LetStatementBuilder.php index 718e906cb0..9be3905c97 100644 --- a/Library/Builder/Statements/LetStatementBuilder.php +++ b/Library/Builder/Statements/LetStatementBuilder.php @@ -12,26 +12,36 @@ namespace Zephir\Builder\Statements; /** - * IfStatementBuilder. - * * Allows to manually build a 'let' statement AST node */ class LetStatementBuilder extends AbstractStatementBuilder { - private $expr; + /** + * List of assignments + * + * @var array + */ + private array $assignments; - private $assignments; + /** + * Expression + * + * @var mixed + */ + private $expr; - public function __construct($assignments, $expr) + public function __construct(array $assignments, $expr) { $this->assignments = $assignments; $this->expr = $expr; } /** - * {@inheritdoc} + * Returns a builder definition. + * + * @return array */ - public function get() + public function get(): array { return [ 'type' => 'let', diff --git a/Library/Builder/StatementsBlockBuilder.php b/Library/Builder/StatementsBlockBuilder.php index 886a5ea61e..b0a02bfb44 100644 --- a/Library/Builder/StatementsBlockBuilder.php +++ b/Library/Builder/StatementsBlockBuilder.php @@ -9,20 +9,20 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Zephir\Builder; /** - * StatementsBlockBuilder. - * * Allows to manually build a statements block AST node */ class StatementsBlockBuilder { - protected $statements; + protected array $statements; - protected $raw; + protected bool $raw; - public function __construct(array $statements, $raw = false) + public function __construct(array $statements, bool $raw = false) { $this->statements = $statements; $this->raw = $raw; @@ -33,18 +33,17 @@ public function __construct(array $statements, $raw = false) * * @return array */ - public function get() + public function get(): array { - if (!$this->raw) { - $statements = []; - - foreach ($this->statements as $statement) { - $statements[] = $statement->get(); - } + if ($this->raw) { + return $this->statements; + } - return $statements; + $statements = []; + foreach ($this->statements as $statement) { + $statements[] = $statement->get(); } - return $this->statements; + return $statements; } } From 83ad60cc87daea265c931d3e72b60d397b917d08 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 16 Jan 2022 21:50:53 +0000 Subject: [PATCH 091/128] Remove the literal boolean value --- Library/ArgInfoDefinition.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 1531074818..b2eb69d5c0 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -13,6 +13,9 @@ namespace Zephir; +use function array_key_exists; +use function count; + class ArgInfoDefinition { /** @@ -102,11 +105,11 @@ public function render(): void ) { $this->richRenderStart(); - if (false == $this->hasParameters() && false == $this->functionLike->isVoid()) { + if (!$this->hasParameters() && !$this->functionLike->isVoid()) { $this->codePrinter->output('ZEND_END_ARG_INFO()'); $this->codePrinter->outputBlankLine(); } - } elseif (true == $this->hasParameters()) { + } elseif ($this->hasParameters()) { $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', @@ -150,7 +153,7 @@ public function render(): void $this->codePrinter->outputBlankLine(); } - if (true == $this->hasParameters()) { + if ($this->hasParameters()) { $this->renderEnd(); $this->codePrinter->output('ZEND_END_ARG_INFO()'); @@ -160,10 +163,10 @@ public function render(): void private function richRenderStart(): void { - if (\array_key_exists('object', $this->functionLike->getReturnTypes())) { + if (array_key_exists('object', $this->functionLike->getReturnTypes())) { $class = 'NULL'; - if (1 == \count($this->functionLike->getReturnClassTypes())) { + if (1 === count($this->functionLike->getReturnClassTypes())) { $class = key($this->functionLike->getReturnClassTypes()); $class = escape_class($this->compilationContext->getFullName($class)); } @@ -374,7 +377,7 @@ private function renderEnd(): void private function hasParameters(): bool { - return null !== $this->parameters && \count($this->parameters->getParameters()) > 0; + return null !== $this->parameters && count($this->parameters->getParameters()) > 0; } private function defaultArrayValue(array $parameter): string @@ -441,7 +444,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'; } From 177b6e5d252822c4037cc5c312d861f6d00a3193 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 22 Jan 2022 22:43:16 +0000 Subject: [PATCH 092/128] #2341 - Implement custom list of arg info defenition --- Library/ArgInfoDefinition.php | 58 ++++++++++++++++++++++++++++++-- config/compatibility-headers.php | 48 ++++++++++++++++++++++++++ stub/oo/oonativeimplements.zep | 5 +-- 3 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 config/compatibility-headers.php diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index b2eb69d5c0..ca64ac175d 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -58,6 +58,13 @@ class ArgInfoDefinition */ private bool $richFormat = true; + /** + * Declared in config/compatibility-headers.php file + * + * @var array + */ + private array $compatibilityClasses = []; + /** * @param string $name * @param ClassMethod $functionLike @@ -80,6 +87,8 @@ public function __construct( $this->parameters = $this->functionLike->getParameters(); $this->returnByRef = $returnByRef; + + $this->compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/compatibility-headers.php'; } public function setBooleanDefinition(string $definition): void @@ -99,6 +108,11 @@ public function setRichFormat(bool $flag): void */ public function render(): void { + if ($this->renderCompatible()) { + $this->codePrinter->outputBlankLine(); + return; + } + if ($this->richFormat && $this->functionLike->isReturnTypesHintDetermined() && $this->functionLike->areReturnTypesCompatible() @@ -132,7 +146,6 @@ public function render(): void ); $this->codePrinter->output('#else'); - $this->codePrinter->output( sprintf( 'ZEND_BEGIN_ARG_INFO_EX(%s, 0, %d, %d)', @@ -141,7 +154,6 @@ public function render(): void $this->functionLike->getNumberOfRequiredParameters() ) ); - $this->codePrinter->output('#endif'); } else { $this->codePrinter->output( @@ -197,7 +209,7 @@ private function richRenderStart(): void ) ); - if (false == $this->hasParameters()) { + if (!$this->hasParameters()) { $this->codePrinter->output('ZEND_END_ARG_INFO()'); } @@ -450,4 +462,44 @@ private function getReturnType(): string return 'IS_NULL'; } + + /** + * Find from $compatibilityClasses and render specific + * hardcoded arg info for with specific PHP version + * conditions. + * + * @return bool + */ + private function renderCompatible(): bool + { + $classDefinition = $this->functionLike->getClassDefinition(); + $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; + + if (empty($implementedInterfaces)) { + return false; + } + + $found = false; + $methodName = $this->functionLike->getName(); + + foreach ($this->functionLike->getClassDefinition()->getImplementedInterfaces() as $implementedInterface) { + if (!isset($this->compatibilityClasses[$implementedInterface][$methodName])) { + continue; + } + + $found = true; + foreach ($this->compatibilityClasses[$implementedInterface][$methodName] as $condition => $args) { + $this->codePrinter->output($condition); + foreach ($args as $arg) { + $this->codePrinter->output( + str_replace(['__ce__'], [$this->name], $arg) + ); + } + } + + $this->codePrinter->output('#endif'); + } + + return $found; + } } diff --git a/config/compatibility-headers.php b/config/compatibility-headers.php new file mode 100644 index 0000000000..1b74b94b20 --- /dev/null +++ b/config/compatibility-headers.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +declare(strict_types=1); + +/** + * Custom ArgInfo definitions for cross PHP versions support. + * These code blocks will be used inside `.zep.h` files. + */ +return [ + 'Serializable' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()' + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()' + ] + ], + ], + + 'SessionHandlerInterface' => [ + 'gc' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_INFO(0, maxlifetime)', + 'ZEND_END_ARG_INFO()', + ] + ] + ], +]; diff --git a/stub/oo/oonativeimplements.zep b/stub/oo/oonativeimplements.zep index f25939e351..c15804e483 100644 --- a/stub/oo/oonativeimplements.zep +++ b/stub/oo/oonativeimplements.zep @@ -10,7 +10,8 @@ class OoNativeImplements implements \Iterator, \OuterIterator, \RecursiveIterator, - \SeekableIterator + \SeekableIterator, + \Serializable // \IteratorAggregate { @@ -90,7 +91,7 @@ class OoNativeImplements implements { } - public function unserialize(string serialized) + public function unserialize(string serialized) -> void { } } From 0555963ae7c06a66992645f4384ca8362dcc4b8b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 22 Jan 2022 22:44:56 +0000 Subject: [PATCH 093/128] #2341 - Fix CS --- Library/ArgInfoDefinition.php | 1 + config/compatibility-headers.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index ca64ac175d..ec35aa2b14 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -110,6 +110,7 @@ public function render(): void { if ($this->renderCompatible()) { $this->codePrinter->outputBlankLine(); + return; } diff --git a/config/compatibility-headers.php b/config/compatibility-headers.php index 1b74b94b20..af4fe09d93 100644 --- a/config/compatibility-headers.php +++ b/config/compatibility-headers.php @@ -21,13 +21,13 @@ '#if PHP_VERSION_ID >= 80000' => [ 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', - 'ZEND_END_ARG_INFO()' + 'ZEND_END_ARG_INFO()', ], '#else' => [ 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', ' ZEND_ARG_INFO(0, serialized)', - 'ZEND_END_ARG_INFO()' - ] + 'ZEND_END_ARG_INFO()', + ], ], ], @@ -42,7 +42,7 @@ 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', ' ZEND_ARG_INFO(0, maxlifetime)', 'ZEND_END_ARG_INFO()', - ] - ] + ], + ], ], ]; From 8304a74a20a89b72aeacd65c5bb34e153a6c7622 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 22 Jan 2022 22:54:08 +0000 Subject: [PATCH 094/128] #2341 - Add required methods `__serialize()` and `__unserialize()` for PHP8.1 --- stub/oo/oonativeimplements.zep | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stub/oo/oonativeimplements.zep b/stub/oo/oonativeimplements.zep index c15804e483..c65e2c99cc 100644 --- a/stub/oo/oonativeimplements.zep +++ b/stub/oo/oonativeimplements.zep @@ -94,4 +94,13 @@ class OoNativeImplements implements public function unserialize(string serialized) -> void { } + + public function __serialize() -> array + { + return []; + } + + public function __unserialize(array data) -> void + { + } } From eba028ed9e47c5ac6df44472d07c09dfa8b0b038 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 15:45:04 +0000 Subject: [PATCH 095/128] #2341 - Rename headers file --- Library/ArgInfoDefinition.php | 54 +++++++++++-------- ....php => phalcon-compatibility-headers.php} | 30 +++++++++++ 2 files changed, 61 insertions(+), 23 deletions(-) rename config/{compatibility-headers.php => phalcon-compatibility-headers.php} (58%) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index ec35aa2b14..3d39e7e179 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -58,13 +58,6 @@ class ArgInfoDefinition */ private bool $richFormat = true; - /** - * Declared in config/compatibility-headers.php file - * - * @var array - */ - private array $compatibilityClasses = []; - /** * @param string $name * @param ClassMethod $functionLike @@ -87,8 +80,6 @@ public function __construct( $this->parameters = $this->functionLike->getParameters(); $this->returnByRef = $returnByRef; - - $this->compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/compatibility-headers.php'; } public function setBooleanDefinition(string $definition): void @@ -108,7 +99,7 @@ public function setRichFormat(bool $flag): void */ public function render(): void { - if ($this->renderCompatible()) { + if ($this->renderPhalconCompatible()) { $this->codePrinter->outputBlankLine(); return; @@ -469,14 +460,19 @@ private function getReturnType(): string * hardcoded arg info for with specific PHP version * conditions. * + * This is temporary solution designed specifically for Phalcon project. + * + * @deprecated Used as MVP solution for cross PHP versions support. * @return bool */ - private function renderCompatible(): bool + private function renderPhalconCompatible(): bool { + $compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/compatibility-headers.php'; $classDefinition = $this->functionLike->getClassDefinition(); $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; + $extendsClass = $classDefinition->getExtendsClass() ?? null; - if (empty($implementedInterfaces)) { + if (empty($implementedInterfaces) && $extendsClass === null) { return false; } @@ -484,21 +480,33 @@ private function renderCompatible(): bool $methodName = $this->functionLike->getName(); foreach ($this->functionLike->getClassDefinition()->getImplementedInterfaces() as $implementedInterface) { - if (!isset($this->compatibilityClasses[$implementedInterface][$methodName])) { - continue; + if (isset($compatibilityClasses[$implementedInterface][$methodName])) { + $found = true; + foreach ($compatibilityClasses[$implementedInterface][$methodName] as $condition => $args) { + $this->codePrinter->output($condition); + foreach ($args as $arg) { + $this->codePrinter->output( + str_replace(['__ce__'], [$this->name], $arg) + ); + } + } + + $this->codePrinter->output('#endif'); } - $found = true; - foreach ($this->compatibilityClasses[$implementedInterface][$methodName] as $condition => $args) { - $this->codePrinter->output($condition); - foreach ($args as $arg) { - $this->codePrinter->output( - str_replace(['__ce__'], [$this->name], $arg) - ); + if (isset($compatibilityClasses[$extendsClass][$methodName])) { + $found = true; + foreach ($compatibilityClasses[$extendsClass][$methodName] as $condition => $args) { + $this->codePrinter->output($condition); + foreach ($args as $arg) { + $this->codePrinter->output( + str_replace(['__ce__'], [$this->name], $arg) + ); + } } - } - $this->codePrinter->output('#endif'); + $this->codePrinter->output('#endif'); + } } return $found; diff --git a/config/compatibility-headers.php b/config/phalcon-compatibility-headers.php similarity index 58% rename from config/compatibility-headers.php rename to config/phalcon-compatibility-headers.php index af4fe09d93..6430216617 100644 --- a/config/compatibility-headers.php +++ b/config/phalcon-compatibility-headers.php @@ -31,6 +31,21 @@ ], ], + 'AbstractSerializer' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + 'SessionHandlerInterface' => [ 'gc' => [ '#if PHP_VERSION_ID >= 80000' => [ @@ -45,4 +60,19 @@ ], ], ], + + 'Noop' => [ + 'gc' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', + ' ZEND_ARG_INFO(0, maxlifetime)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], ]; From 6bc75b2726efbb2be5aa2f14e1d4dd05b243e6c0 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 15:45:26 +0000 Subject: [PATCH 096/128] #2341 - Rename headers file --- Library/ArgInfoDefinition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 3d39e7e179..06fdd652b2 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -467,7 +467,7 @@ private function getReturnType(): string */ private function renderPhalconCompatible(): bool { - $compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/compatibility-headers.php'; + $compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/phalcon-compatibility-headers.php'; $classDefinition = $this->functionLike->getClassDefinition(); $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; $extendsClass = $classDefinition->getExtendsClass() ?? null; From 86911a748003ca71b73cee20a0bf289c501e084f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 15:47:12 +0000 Subject: [PATCH 097/128] #2341 - Fix CS --- Library/ArgInfoDefinition.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 06fdd652b2..22cce151a3 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -462,7 +462,8 @@ private function getReturnType(): string * * This is temporary solution designed specifically for Phalcon project. * - * @deprecated Used as MVP solution for cross PHP versions support. + * @deprecated used as MVP solution for cross PHP versions support + * * @return bool */ private function renderPhalconCompatible(): bool From 7ba67e101cb48ffc0e6f7778d7e48d730dd24388 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 15:55:44 +0000 Subject: [PATCH 098/128] #2341 - Correct null check --- Library/ArgInfoDefinition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 22cce151a3..5e66340fd9 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -471,7 +471,7 @@ private function renderPhalconCompatible(): bool $compatibilityClasses = require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config/phalcon-compatibility-headers.php'; $classDefinition = $this->functionLike->getClassDefinition(); $implementedInterfaces = $classDefinition !== null ? $classDefinition->getImplementedInterfaces() : []; - $extendsClass = $classDefinition->getExtendsClass() ?? null; + $extendsClass = $classDefinition !== null ? $classDefinition->getExtendsClass() : null; if (empty($implementedInterfaces) && $extendsClass === null) { return false; From dfae4180b6adf3747eed997c48693067e061c003 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 16:26:21 +0000 Subject: [PATCH 099/128] #2341 - Change to full class with namespace --- Library/ArgInfoDefinition.php | 6 +- config/phalcon-compatibility-headers.php | 2 +- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/kernel/file.c | 2 +- ext/stub.c | 4 +- ext/stub.h | 1 + ext/stub/arrayaccessobj.zep.c | 79 ++++-- ext/stub/arrayaccesstest.zep.c | 4 +- ext/stub/integration/psr/extendexternal.zep.c | 2 +- .../psr/http/message/messageinterfaceex.zep.c | 2 +- ext/stub/mcall.zep.c | 7 +- ext/stub/oo/oonativeimplements.zep.c | 34 +++ ext/stub/oo/oonativeimplements.zep.h | 22 +- ext/stub/types/mixedtype.zep.c | 231 ++++++++++++++++++ ext/stub/types/mixedtype.zep.h | 87 +++++++ 16 files changed, 447 insertions(+), 39 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 5e66340fd9..6614f2cbd4 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -480,7 +480,11 @@ private function renderPhalconCompatible(): bool $found = false; $methodName = $this->functionLike->getName(); - foreach ($this->functionLike->getClassDefinition()->getImplementedInterfaces() as $implementedInterface) { + if ($extendsClass !== null) { + $implementedInterfaces = array_merge($implementedInterfaces, [$extendsClass]); + } + + foreach ($implementedInterfaces as $implementedInterface) { if (isset($compatibilityClasses[$implementedInterface][$methodName])) { $found = true; foreach ($compatibilityClasses[$implementedInterface][$methodName] as $condition => $args) { diff --git a/config/phalcon-compatibility-headers.php b/config/phalcon-compatibility-headers.php index 6430216617..fa1422ebed 100644 --- a/config/phalcon-compatibility-headers.php +++ b/config/phalcon-compatibility-headers.php @@ -61,7 +61,7 @@ ], ], - 'Noop' => [ + 'Phalcon\Session\Adapter\Noop' => [ 'gc' => [ '#if PHP_VERSION_ID >= 80000' => [ 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', diff --git a/ext/config.m4 b/ext/config.m4 index 8552cc50ac..0239a40805 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -31,6 +31,7 @@ if test "$PHP_STUB" = "yes"; then stub/ooimpl/zbeginning.zep.c stub/properties/publicproperties.zep.c stub/arithmetic.zep.c + stub/arrayaccessarr.zep.c stub/arrayaccessobj.zep.c stub/arrayaccesstest.zep.c stub/arrayiterator.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index 7cc2da4067..9eabe07921 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -11,7 +11,7 @@ if (PHP_STUB != "no") { } ADD_SOURCES(configure_module_dirname + "/stub/invokes", "abstractprotected.zep.c abstractinvoker.zep.c abstractinvokercomplex.zep.c invokeprotected.zep.c invokeprotectedcomplex.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub", "testinterface.zep.c scallparent.zep.c constantsparent.zep.c methodinterface.zep.c arithmetic.zep.c arrayaccessarr.zep.c arrayaccessobj.zep.c arrayaccesstest.zep.c arrayiterator.zep.c arrayiteratortest.zep.c arraymanipulation.zep.c arrayobject.zep.c arraysearch.zep.c assign.zep.c bitwise.zep.c branchprediction.zep.c cast.zep.c cblock.zep.c chars.zep.c closures.zep.c compare.zep.c concat.zep.c constants.zep.c constantsinterface.zep.c constantsinterfacea.zep.c constantsinterfaceb.zep.c declaretest.zep.c diinterface.zep.c echoes.zep.c emptytest.zep.c evaltest.zep.c exception.zep.c exceptions.zep.c exists.zep.c exitdie.zep.c extendedinterface.zep.c factorial.zep.c fannkuch.zep.c fasta.zep.c fcall.zep.c fetchtest.zep.c fibonnaci.zep.c flow.zep.c fortytwo.zep.c functional.zep.c functionexists.zep.c functions.zep.c geometry.zep.c globals.zep.c instance.zep.c instanceoff.zep.c internalclasses.zep.c internalinterfaces.zep.c invoke.zep.c issettest.zep.c issue1134.zep.c issue1404.zep.c issue1521.zep.c issue663.zep.c issue887.zep.c issue893.zep.c issue914.zep.c issues.zep.c json.zep.c logical.zep.c mcall.zep.c mcallchained.zep.c mcalldynamic.zep.c mcallinternal.zep.c methodabstract.zep.c methodargs.zep.c nativearray.zep.c oo.zep.c operator.zep.c pdostatement.zep.c pregmatch.zep.c quantum.zep.c range.zep.c references.zep.c reflection.zep.c regexdna.zep.c requires.zep.c resourcetest.zep.c returns.zep.c router.zep.c scall.zep.c scalldynamic.zep.c scallexternal.zep.c scalllateconstruct.zep.c scope.zep.c sort.zep.c spectralnorm.zep.c spl.zep.c spropertyaccess.zep.c statements.zep.c strings.zep.c stubs.zep.c ternary.zep.c trytest.zep.c typeinstances.zep.c typeoff.zep.c unknownclass.zep.c unsettest.zep.c usetest.zep.c vars.zep.c 0__closure.zep.c 1__closure.zep.c 2__closure.zep.c 3__closure.zep.c 4__closure.zep.c 5__closure.zep.c 6__closure.zep.c 7__closure.zep.c 8__closure.zep.c 9__closure.zep.c 10__closure.zep.c 11__closure.zep.c 12__closure.zep.c 13__closure.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend", "exception.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/issue2165", "issueextendinterface.zep.c issueinterface.zep.c issue.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/oo/extend/db", "exception.zep.c", "stub"); diff --git a/ext/kernel/file.c b/ext/kernel/file.c index cf0c691d2c..83237c4fae 100644 --- a/ext/kernel/file.c +++ b/ext/kernel/file.c @@ -296,7 +296,7 @@ void zephir_filemtime(zval *return_value, zval *path) if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) { #if PHP_VERSION_ID >= 80100 zend_string *file = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), 0); - php_stat(file, FS_MTIME, &return_value); + php_stat(file, FS_MTIME, return_value); zval_ptr_dtor(file); #else php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value); diff --git a/ext/stub.c b/ext/stub.c index a588a308ea..ba694c7e7e 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -64,6 +64,7 @@ zend_class_entry *stub_7__closure_ce; zend_class_entry *stub_8__closure_ce; zend_class_entry *stub_9__closure_ce; zend_class_entry *stub_arithmetic_ce; +zend_class_entry *stub_arrayaccessarr_ce; zend_class_entry *stub_arrayaccessobj_ce; zend_class_entry *stub_arrayaccesstest_ce; zend_class_entry *stub_arrayiterator_ce; @@ -292,6 +293,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_Oo_Scopes_HasPrivateMethod); ZEPHIR_INIT(Stub_Properties_PublicProperties); ZEPHIR_INIT(Stub_Arithmetic); + ZEPHIR_INIT(Stub_ArrayAccessArr); ZEPHIR_INIT(Stub_ArrayAccessObj); ZEPHIR_INIT(Stub_ArrayAccessTest); ZEPHIR_INIT(Stub_ArrayIterator); @@ -580,7 +582,7 @@ static PHP_MINFO_FUNCTION(stub) php_info_print_table_start(); php_info_print_table_header(2, "Test Extension support", "Value"); php_info_print_table_row(2, "Lifecycle hooks", "PHP provides several lifecycle events, which extensions can use to perform common initialization or shutdown tasks."); - php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); + php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); php_info_print_table_end(); php_info_print_table_start(); php_info_print_table_header(2, "Test variable", "Value"); diff --git a/ext/stub.h b/ext/stub.h index cf7b456b20..2e49dd8007 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -26,6 +26,7 @@ #include "stub/ooimpl/zbeginning.zep.h" #include "stub/properties/publicproperties.zep.h" #include "stub/arithmetic.zep.h" +#include "stub/arrayaccessarr.zep.h" #include "stub/arrayaccessobj.zep.h" #include "stub/arrayaccesstest.zep.h" #include "stub/arrayiterator.zep.h" diff --git a/ext/stub/arrayaccessobj.zep.c b/ext/stub/arrayaccessobj.zep.c index 62a0fe59c6..5c7fa4dd25 100644 --- a/ext/stub/arrayaccessobj.zep.c +++ b/ext/stub/arrayaccessobj.zep.c @@ -13,8 +13,9 @@ #include "kernel/main.h" #include "kernel/memory.h" -#include "kernel/array.h" #include "kernel/object.h" +#include "kernel/operators.h" +#include "kernel/array.h" ZEPHIR_INIT_CLASS(Stub_ArrayAccessObj) @@ -28,32 +29,42 @@ ZEPHIR_INIT_CLASS(Stub_ArrayAccessObj) PHP_METHOD(Stub_ArrayAccessObj, __construct) { - zval _0; + zval obj, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); + ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); + ZEPHIR_INIT_VAR(&obj); + object_init(&obj); ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 3, 0); - add_assoc_long_ex(&_0, SL("one"), 1); - add_assoc_long_ex(&_0, SL("two"), 2); - add_assoc_long_ex(&_0, SL("three"), 3); - zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "val1"); + zephir_update_property_zval(&obj, ZEND_STRL("key1"), &_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "val2"); + zephir_update_property_zval(&obj, ZEND_STRL("key2"), &_0); + ZEPHIR_INIT_NVAR(&_0); + ZVAL_STRING(&_0, "val3"); + zephir_update_property_zval(&obj, ZEND_STRL("key3"), &_0); + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &obj); ZEPHIR_MM_RESTORE(); } PHP_METHOD(Stub_ArrayAccessObj, offsetSet) { - zval offset_sub, value_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, value_sub, obj; zval *offset, *value; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&obj); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -63,24 +74,28 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetSet) #endif - zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &offset, &value); - if (Z_TYPE_P(offset) == IS_NULL) { - zephir_update_property_array_append(this_ptr, SL("test"), value); - } else { - zephir_update_property_array(this_ptr, SL("test"), offset, value); + ZEPHIR_OBS_VAR(&obj); + zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + if (!(Z_TYPE_P(offset) == IS_NULL)) { + zephir_update_property_zval_zval(&obj, offset, value); } + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &obj); + ZEPHIR_MM_RESTORE(); } PHP_METHOD(Stub_ArrayAccessObj, offsetExists) { - zval offset_sub, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, obj; zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&obj); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) @@ -89,20 +104,25 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetExists) #endif - zephir_fetch_params_without_memory_grow(1, 0, &offset); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &offset); - zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - RETURN_BOOL(zephir_array_isset(&_0, offset)); + ZEPHIR_OBS_VAR(&obj); + zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + RETURN_MM_BOOL(zephir_isset_property_zval(&obj, offset)); } PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) { - zval offset_sub, _0; + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, obj; zval *offset; zval *this_ptr = getThis(); ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&obj); ZVAL_UNDEF(&_0); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; @@ -112,12 +132,18 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetUnset) #endif - zephir_fetch_params_without_memory_grow(1, 0, &offset); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &offset); - zephir_unset_property_array(this_ptr, ZEND_STRL("test"), offset); - zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - zephir_array_unset(&_0, offset, PH_SEPARATE); + ZEPHIR_OBS_VAR(&obj); + zephir_read_property(&obj, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + zephir_get_arrval(&_0, &obj); + ZEPHIR_CPY_WRT(&obj, &_0); + zephir_array_unset(&obj, offset, PH_SEPARATE); + zephir_convert_to_object(&obj); + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &obj); + ZEPHIR_MM_RESTORE(); } PHP_METHOD(Stub_ArrayAccessObj, offsetGet) @@ -145,9 +171,10 @@ PHP_METHOD(Stub_ArrayAccessObj, offsetGet) ZEPHIR_INIT_VAR(&_0); zephir_read_property(&_1, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset(&_1, offset)) { - zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_0, &_2, offset, PH_NOISY, "stub/arrayaccessobj.zep", 37); + if (zephir_isset_property_zval(&_1, offset)) { + ZEPHIR_OBS_VAR(&_2); + zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC); + zephir_read_property_zval(&_0, &_2, offset, PH_NOISY_CC); } else { ZVAL_NULL(&_0); } diff --git a/ext/stub/arrayaccesstest.zep.c b/ext/stub/arrayaccesstest.zep.c index db6e536e27..c1df0c7072 100644 --- a/ext/stub/arrayaccesstest.zep.c +++ b/ext/stub/arrayaccesstest.zep.c @@ -46,7 +46,7 @@ PHP_METHOD(Stub_ArrayAccessTest, exits) ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&arr); - object_init_ex(&arr, stub_arrayaccessobj_ce); + object_init_ex(&arr, stub_arrayaccessarr_ce); ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 3); zephir_check_call_status(); RETURN_MM_BOOL(zephir_array_isset_string(&arr, SL("one"))); @@ -66,7 +66,7 @@ PHP_METHOD(Stub_ArrayAccessTest, get) ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&arr); - object_init_ex(&arr, stub_arrayaccessobj_ce); + object_init_ex(&arr, stub_arrayaccessarr_ce); ZEPHIR_CALL_METHOD(NULL, &arr, "__construct", NULL, 3); zephir_check_call_status(); zephir_array_fetch_string(&_0, &arr, SL("two"), PH_NOISY | PH_READONLY, "stub/arrayaccesstest.zep", 29); diff --git a/ext/stub/integration/psr/extendexternal.zep.c b/ext/stub/integration/psr/extendexternal.zep.c index 4c078f95ee..4087ddd029 100644 --- a/ext/stub/integration/psr/extendexternal.zep.c +++ b/ext/stub/integration/psr/extendexternal.zep.c @@ -16,7 +16,7 @@ ZEPHIR_INIT_CLASS(Stub_Integration_Psr_ExtendExternal) { - ZEPHIR_REGISTER_CLASS_EX(Stub\\Integration\\Psr, ExtendExternal, stub, integration_psr_extendexternal, zephir_get_internal_ce(SL("psr\\log\\abstractlogger")), NULL, 0); + ZEPHIR_REGISTER_CLASS_EX(Stub\\Integration\\Psr, ExtendExternal, stub, integration_psr_extendexternal, zephir_get_internal_ce(SL("psrext\\log\\abstractlogger")), NULL, 0); return SUCCESS; } diff --git a/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c b/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c index 5efbdf1672..151f9c67d2 100644 --- a/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c +++ b/ext/stub/integration/psr/http/message/messageinterfaceex.zep.c @@ -16,7 +16,7 @@ ZEPHIR_INIT_CLASS(Stub_Integration_Psr_Http_Message_MessageInterfaceEx) { ZEPHIR_REGISTER_INTERFACE(Stub\\Integration\\Psr\\Http\\Message, MessageInterfaceEx, stub, integration_psr_http_message_messageinterfaceex, NULL); - zend_class_implements(stub_integration_psr_http_message_messageinterfaceex_ce, 1, zephir_get_internal_ce(SL("psr\\http\\message\\messageinterface"))); + zend_class_implements(stub_integration_psr_http_message_messageinterfaceex_ce, 1, zephir_get_internal_ce(SL("psrext\\http\\message\\messageinterface"))); return SUCCESS; } diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index 4c277c33e6..bc706450cc 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -1208,8 +1208,11 @@ PHP_METHOD(Stub_Mcall, issue1136) if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); object_init_ex(&_finfo, zephir_get_internal_ce(SL("finfo"))); - ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); - zephir_check_call_status(); + if (zephir_has_constructor(&_finfo)) { + ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); + zephir_check_call_status(); + } + } else { ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 59); zephir_check_call_status(); diff --git a/ext/stub/oo/oonativeimplements.zep.c b/ext/stub/oo/oonativeimplements.zep.c index abf3956e9c..ca47fe0c27 100644 --- a/ext/stub/oo/oonativeimplements.zep.c +++ b/ext/stub/oo/oonativeimplements.zep.c @@ -30,6 +30,7 @@ ZEPHIR_INIT_CLASS(Stub_Oo_OoNativeImplements) zend_class_implements(stub_oo_oonativeimplements_ce, 1, spl_ce_OuterIterator); zend_class_implements(stub_oo_oonativeimplements_ce, 1, spl_ce_RecursiveIterator); zend_class_implements(stub_oo_oonativeimplements_ce, 1, spl_ce_SeekableIterator); + zend_class_implements(stub_oo_oonativeimplements_ce, 1, zend_ce_serializable); return SUCCESS; } @@ -242,3 +243,36 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, unserialize) } +PHP_METHOD(Stub_Oo_OoNativeImplements, __serialize) +{ + zval *this_ptr = getThis(); + + + + array_init(return_value); + return; +} + +PHP_METHOD(Stub_Oo_OoNativeImplements, __unserialize) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *data_param = NULL; + zval data; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&data); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY(data) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &data_param); + zephir_get_arrval(&data, data_param); + + +} + diff --git a/ext/stub/oo/oonativeimplements.zep.h b/ext/stub/oo/oonativeimplements.zep.h index 342e9f26cd..8ab4351a97 100644 --- a/ext/stub/oo/oonativeimplements.zep.h +++ b/ext/stub/oo/oonativeimplements.zep.h @@ -20,6 +20,8 @@ PHP_METHOD(Stub_Oo_OoNativeImplements, offsetSet); PHP_METHOD(Stub_Oo_OoNativeImplements, offsetUnset); PHP_METHOD(Stub_Oo_OoNativeImplements, serialize); PHP_METHOD(Stub_Oo_OoNativeImplements, unserialize); +PHP_METHOD(Stub_Oo_OoNativeImplements, __serialize); +PHP_METHOD(Stub_Oo_OoNativeImplements, __unserialize); ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_count, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -84,8 +86,22 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_serialize, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) +ZEND_END_ARG_INFO() +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_oo_oonativeimplements___unserialize, 0, 1, IS_VOID, 0) + + ZEND_ARG_ARRAY_INFO(0, data, 0) ZEND_END_ARG_INFO() ZEPHIR_INIT_FUNCS(stub_oo_oonativeimplements_method_entry) { @@ -106,5 +122,7 @@ ZEPHIR_INIT_FUNCS(stub_oo_oonativeimplements_method_entry) { PHP_ME(Stub_Oo_OoNativeImplements, offsetUnset, arginfo_stub_oo_oonativeimplements_offsetunset, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, serialize, arginfo_stub_oo_oonativeimplements_serialize, ZEND_ACC_PUBLIC) PHP_ME(Stub_Oo_OoNativeImplements, unserialize, arginfo_stub_oo_oonativeimplements_unserialize, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Oo_OoNativeImplements, __serialize, arginfo_stub_oo_oonativeimplements___serialize, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Oo_OoNativeImplements, __unserialize, arginfo_stub_oo_oonativeimplements___unserialize, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/stub/types/mixedtype.zep.c b/ext/stub/types/mixedtype.zep.c index 7ec1a3d8ee..c7d26b7c01 100644 --- a/ext/stub/types/mixedtype.zep.c +++ b/ext/stub/types/mixedtype.zep.c @@ -245,3 +245,234 @@ PHP_METHOD(Stub_Types_MixedType, paramAndReturnMixed) return; } +PHP_METHOD(Stub_Types_MixedType, castToStringMixedAndReturnMixed) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval val_sub; + zval *val; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &val); + + + zephir_cast_to_string(&_0, val); + RETURN_CTOR(&_0); +} + +PHP_METHOD(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval val_sub; + zval *val = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &val); + + + zephir_cast_to_string(&_0, val); + ZEPHIR_CPY_WRT(val, &_0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +PHP_METHOD(Stub_Types_MixedType, castToIntMixedAndReturnMixed) +{ + zval val_sub; + zval *val; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &val); + + + RETURN_LONG(zephir_get_intval(val)); +} + +PHP_METHOD(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed) +{ + zend_long _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval val_sub; + zval *val = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &val); + + + _0 = zephir_get_intval(val); + ZEPHIR_INIT_NVAR(val); + ZVAL_LONG(val, _0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +PHP_METHOD(Stub_Types_MixedType, castToBoolMixedAndReturnMixed) +{ + zval val_sub; + zval *val; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &val); + + + RETURN_BOOL(zephir_get_boolval(val)); +} + +PHP_METHOD(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed) +{ + double _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval val_sub; + zval *val = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &val); + + + _0 = zephir_get_boolval(val); + ZEPHIR_INIT_NVAR(val); + ZVAL_BOOL(val, _0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +PHP_METHOD(Stub_Types_MixedType, castToFloatMixedAndReturnMixed) +{ + zval val_sub; + zval *val; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &val); + + + RETURN_DOUBLE(zephir_get_doubleval(val)); +} + +PHP_METHOD(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed) +{ + double _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval val_sub; + zval *val = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &val); + + + _0 = zephir_get_doubleval(val); + ZEPHIR_INIT_NVAR(val); + ZVAL_DOUBLE(val, _0); + RETVAL_ZVAL(val, 1, 0); + RETURN_MM(); +} + +/** + * Only used during generation + */ +PHP_METHOD(Stub_Types_MixedType, mixedInCondition) +{ + zval val_sub; + zval *val; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&val_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(val) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &val); + + + if (UNEXPECTED(zephir_is_true(val))) { + } + if (ZEPHIR_IS_LONG_IDENTICAL(val, 1)) { + } + if (ZEPHIR_IS_LONG_IDENTICAL(val, 1)) { + } + zend_print_zval(val, 0); +} + diff --git a/ext/stub/types/mixedtype.zep.h b/ext/stub/types/mixedtype.zep.h index 641da1d00f..afd003e4b2 100644 --- a/ext/stub/types/mixedtype.zep.h +++ b/ext/stub/types/mixedtype.zep.h @@ -16,6 +16,15 @@ PHP_METHOD(Stub_Types_MixedType, paramMixed); PHP_METHOD(Stub_Types_MixedType, paramMixedTwo); PHP_METHOD(Stub_Types_MixedType, paramMixedWithMulti); PHP_METHOD(Stub_Types_MixedType, paramAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToStringMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToIntMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToBoolMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToFloatMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed); +PHP_METHOD(Stub_Types_MixedType, mixedInCondition); #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_returnmixedobject, 0, 0, IS_MIXED, 0) @@ -100,6 +109,75 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_paramandret ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_mixedtype_mixedincondition, 0, 1, IS_VOID, 0) + + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + ZEPHIR_INIT_FUNCS(stub_types_mixedtype_method_entry) { PHP_ME(Stub_Types_MixedType, returnMixedObject, arginfo_stub_types_mixedtype_returnmixedobject, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, returnMixedArray, arginfo_stub_types_mixedtype_returnmixedarray, ZEND_ACC_PUBLIC) @@ -118,5 +196,14 @@ ZEPHIR_INIT_FUNCS(stub_types_mixedtype_method_entry) { PHP_ME(Stub_Types_MixedType, paramMixedTwo, arginfo_stub_types_mixedtype_parammixedtwo, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramMixedWithMulti, arginfo_stub_types_mixedtype_parammixedwithmulti, ZEND_ACC_PUBLIC) PHP_ME(Stub_Types_MixedType, paramAndReturnMixed, arginfo_stub_types_mixedtype_paramandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToStringMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttostringmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToStringInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttostringinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToIntMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttointmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToIntInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttointinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToBoolMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttoboolmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToBoolInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttoboolinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToFloatMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttofloatmixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, castToFloatInternallyMixedAndReturnMixed, arginfo_stub_types_mixedtype_casttofloatinternallymixedandreturnmixed, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MixedType, mixedInCondition, arginfo_stub_types_mixedtype_mixedincondition, ZEND_ACC_PUBLIC) PHP_FE_END }; From 17d7722de30629bf379d35cfe5c8b8bd56cfa789 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 17:51:43 +0000 Subject: [PATCH 100/128] #2341 - Refactor `renderPhalconCompatible()` method --- Library/ArgInfoDefinition.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 6614f2cbd4..63df30b689 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -477,7 +477,6 @@ private function renderPhalconCompatible(): bool return false; } - $found = false; $methodName = $this->functionLike->getName(); if ($extendsClass !== null) { @@ -486,7 +485,6 @@ private function renderPhalconCompatible(): bool foreach ($implementedInterfaces as $implementedInterface) { if (isset($compatibilityClasses[$implementedInterface][$methodName])) { - $found = true; foreach ($compatibilityClasses[$implementedInterface][$methodName] as $condition => $args) { $this->codePrinter->output($condition); foreach ($args as $arg) { @@ -497,10 +495,11 @@ private function renderPhalconCompatible(): bool } $this->codePrinter->output('#endif'); + + return true; } if (isset($compatibilityClasses[$extendsClass][$methodName])) { - $found = true; foreach ($compatibilityClasses[$extendsClass][$methodName] as $condition => $args) { $this->codePrinter->output($condition); foreach ($args as $arg) { @@ -511,9 +510,11 @@ private function renderPhalconCompatible(): bool } $this->codePrinter->output('#endif'); + + return true; } } - return $found; + return false; } } From b080d7579fc8c64c728065c79b695dddc5316c6b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 18:05:28 +0000 Subject: [PATCH 101/128] #2341 - Update list in phalcon-compatibility-headers.php --- config/phalcon-compatibility-headers.php | 90 ++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/config/phalcon-compatibility-headers.php b/config/phalcon-compatibility-headers.php index fa1422ebed..e7550e18e4 100644 --- a/config/phalcon-compatibility-headers.php +++ b/config/phalcon-compatibility-headers.php @@ -31,6 +31,96 @@ ], ], + 'Phalcon\Storage\Serializer\Base64' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'Phalcon\Storage\Serializer\Igbinary' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'Phalcon\Storage\Serializer\Json' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'Phalcon\Storage\Serializer\Msgpack' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'Phalcon\Storage\Serializer\None' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + + 'Phalcon\Storage\Serializer\Php' => [ + 'unserialize' => [ + '#if PHP_VERSION_ID >= 80000' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#else' => [ + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', + ' ZEND_ARG_INFO(0, serialized)', + 'ZEND_END_ARG_INFO()', + ], + ], + ], + 'AbstractSerializer' => [ 'unserialize' => [ '#if PHP_VERSION_ID >= 80000' => [ From d514b08589177dff04bcb93ce2401c196d7e3871 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 23 Jan 2022 18:38:19 +0000 Subject: [PATCH 102/128] #2341 - Refactor `renderPhalconCompatible()` method --- Library/ArgInfoDefinition.php | 20 +----- config/phalcon-compatibility-headers.php | 92 +----------------------- 2 files changed, 4 insertions(+), 108 deletions(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index 63df30b689..a53b8c803d 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -483,6 +483,7 @@ private function renderPhalconCompatible(): bool $implementedInterfaces = array_merge($implementedInterfaces, [$extendsClass]); } + $found = false; foreach ($implementedInterfaces as $implementedInterface) { if (isset($compatibilityClasses[$implementedInterface][$methodName])) { foreach ($compatibilityClasses[$implementedInterface][$methodName] as $condition => $args) { @@ -496,25 +497,10 @@ private function renderPhalconCompatible(): bool $this->codePrinter->output('#endif'); - return true; - } - - if (isset($compatibilityClasses[$extendsClass][$methodName])) { - foreach ($compatibilityClasses[$extendsClass][$methodName] as $condition => $args) { - $this->codePrinter->output($condition); - foreach ($args as $arg) { - $this->codePrinter->output( - str_replace(['__ce__'], [$this->name], $arg) - ); - } - } - - $this->codePrinter->output('#endif'); - - return true; + $found = true; } } - return false; + return $found; } } diff --git a/config/phalcon-compatibility-headers.php b/config/phalcon-compatibility-headers.php index e7550e18e4..fcc9d247ac 100644 --- a/config/phalcon-compatibility-headers.php +++ b/config/phalcon-compatibility-headers.php @@ -31,97 +31,7 @@ ], ], - 'Phalcon\Storage\Serializer\Base64' => [ - 'unserialize' => [ - '#if PHP_VERSION_ID >= 80000' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', - 'ZEND_END_ARG_INFO()', - ], - '#else' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_INFO(0, serialized)', - 'ZEND_END_ARG_INFO()', - ], - ], - ], - - 'Phalcon\Storage\Serializer\Igbinary' => [ - 'unserialize' => [ - '#if PHP_VERSION_ID >= 80000' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', - 'ZEND_END_ARG_INFO()', - ], - '#else' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_INFO(0, serialized)', - 'ZEND_END_ARG_INFO()', - ], - ], - ], - - 'Phalcon\Storage\Serializer\Json' => [ - 'unserialize' => [ - '#if PHP_VERSION_ID >= 80000' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', - 'ZEND_END_ARG_INFO()', - ], - '#else' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_INFO(0, serialized)', - 'ZEND_END_ARG_INFO()', - ], - ], - ], - - 'Phalcon\Storage\Serializer\Msgpack' => [ - 'unserialize' => [ - '#if PHP_VERSION_ID >= 80000' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', - 'ZEND_END_ARG_INFO()', - ], - '#else' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_INFO(0, serialized)', - 'ZEND_END_ARG_INFO()', - ], - ], - ], - - 'Phalcon\Storage\Serializer\None' => [ - 'unserialize' => [ - '#if PHP_VERSION_ID >= 80000' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', - 'ZEND_END_ARG_INFO()', - ], - '#else' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_INFO(0, serialized)', - 'ZEND_END_ARG_INFO()', - ], - ], - ], - - 'Phalcon\Storage\Serializer\Php' => [ - 'unserialize' => [ - '#if PHP_VERSION_ID >= 80000' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)', - 'ZEND_END_ARG_INFO()', - ], - '#else' => [ - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', - ' ZEND_ARG_INFO(0, serialized)', - 'ZEND_END_ARG_INFO()', - ], - ], - ], - - 'AbstractSerializer' => [ + 'Phalcon\Storage\Serializer\AbstractSerializer' => [ 'unserialize' => [ '#if PHP_VERSION_ID >= 80000' => [ 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(__ce__, 0, 1, IS_VOID, 0)', From 23825621701309e4c18c09ecbeb49da968fe9696 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 24 Jan 2022 21:20:29 +0000 Subject: [PATCH 103/128] #2341 - Update `SessionHandlerInterface:gc()` arg_info for PHP8.1 --- config/phalcon-compatibility-headers.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/config/phalcon-compatibility-headers.php b/config/phalcon-compatibility-headers.php index fcc9d247ac..a5dc8ed0dc 100644 --- a/config/phalcon-compatibility-headers.php +++ b/config/phalcon-compatibility-headers.php @@ -48,7 +48,12 @@ 'SessionHandlerInterface' => [ 'gc' => [ - '#if PHP_VERSION_ID >= 80000' => [ + '#if PHP_VERSION_ID >= 80100' => [ + 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#elif PHP_VERSION_ID >= 80000' => [ 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', 'ZEND_END_ARG_INFO()', @@ -63,7 +68,12 @@ 'Phalcon\Session\Adapter\Noop' => [ 'gc' => [ - '#if PHP_VERSION_ID >= 80000' => [ + '#if PHP_VERSION_ID >= 80100' => [ + 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', + ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', + 'ZEND_END_ARG_INFO()', + ], + '#elif PHP_VERSION_ID >= 80000' => [ 'ZEND_BEGIN_ARG_INFO_EX(__ce__, 0, 0, 1)', ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', 'ZEND_END_ARG_INFO()', From 1c62f6cd11ceec936b82bb536b249ebc19bff38b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 24 Jan 2022 21:30:37 +0000 Subject: [PATCH 104/128] #2341 - Fix number of args in `ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX` --- config/phalcon-compatibility-headers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/phalcon-compatibility-headers.php b/config/phalcon-compatibility-headers.php index a5dc8ed0dc..e11cb21e09 100644 --- a/config/phalcon-compatibility-headers.php +++ b/config/phalcon-compatibility-headers.php @@ -49,7 +49,7 @@ 'SessionHandlerInterface' => [ 'gc' => [ '#if PHP_VERSION_ID >= 80100' => [ - 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', + 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', 'ZEND_END_ARG_INFO()', ], @@ -69,7 +69,7 @@ 'Phalcon\Session\Adapter\Noop' => [ 'gc' => [ '#if PHP_VERSION_ID >= 80100' => [ - 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', + 'ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(__ce__, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)', ' ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)', 'ZEND_END_ARG_INFO()', ], From 8cf184cf5ceef5f89c80f4a9394c41d2b5538cd7 Mon Sep 17 00:00:00 2001 From: Weigang Date: Wed, 26 Jan 2022 16:45:04 +0800 Subject: [PATCH 105/128] There is no need to continue if no namespaces exists --- Library/Classes/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Classes/Entry.php b/Library/Classes/Entry.php index a1f8f548f1..8da02d9d3a 100644 --- a/Library/Classes/Entry.php +++ b/Library/Classes/Entry.php @@ -121,7 +121,7 @@ public function get(): string /** * External class, we don't know its ClassEntry in C world. */ - if (!$this->isInternalClass($classNamespace[0])) { + if ($classNamespace[0] == "" || !$this->isInternalClass($classNamespace[0])) { $className = str_replace(self::NAMESPACE_SEPARATOR, self::NAMESPACE_SEPARATOR.self::NAMESPACE_SEPARATOR, strtolower($className)); return sprintf( From 21030db26afa2223c1fc3ecac169f2bca5fe2cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=8B=E6=B2=99=E5=B1=85=E5=A3=AB?= Date: Thu, 27 Jan 2022 09:38:05 +0800 Subject: [PATCH 106/128] Update Library/Classes/Entry.php Co-authored-by: Anton Vasiliev --- Library/Classes/Entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Classes/Entry.php b/Library/Classes/Entry.php index 8da02d9d3a..400592fc95 100644 --- a/Library/Classes/Entry.php +++ b/Library/Classes/Entry.php @@ -121,7 +121,7 @@ public function get(): string /** * External class, we don't know its ClassEntry in C world. */ - if ($classNamespace[0] == "" || !$this->isInternalClass($classNamespace[0])) { + if ($classNamespace[0] === '' || !$this->isInternalClass($classNamespace[0])) { $className = str_replace(self::NAMESPACE_SEPARATOR, self::NAMESPACE_SEPARATOR.self::NAMESPACE_SEPARATOR, strtolower($className)); return sprintf( From 30dd75ca13d958e0522304a71a029dce03975da4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 6 Feb 2022 10:41:32 +0000 Subject: [PATCH 107/128] #2341 - Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96427988fc..bfedb946bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format based on [Keep a Changelog](http://keepachangelog.com) and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] +### Added +- Added custom list of arg info definition (Phalcon only) [#2341](https://github.com/zephir-lang/zephir/issues/2341) + ### Fixed - Fixed left `null` with `string` condition [#2299](https://github.com/zephir-lang/zephir/issues/2299) - Improved support of `mixed` type [#2330](https://github.com/zephir-lang/zephir/issues/2330) From 1528f43146bab258d7b2b2b7157e0675e5a3383d Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 6 Feb 2022 10:49:01 +0000 Subject: [PATCH 108/128] #2341 - Remove `isGeneratedConstructor` property --- Library/ClassDefinition.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/Library/ClassDefinition.php b/Library/ClassDefinition.php index eb375b4a58..52a24656f6 100644 --- a/Library/ClassDefinition.php +++ b/Library/ClassDefinition.php @@ -157,14 +157,6 @@ final class ClassDefinition extends AbstractClassDefinition */ protected ?AliasManager $aliasManager = null; - /** - * Whether the constructor was generated by Zephir - * (-> no constructor existed previously). - * - * @var bool - */ - protected bool $isGeneratedConstructor = false; - /** * @var Compiler */ @@ -206,26 +198,6 @@ public function isBundled(): bool return $this->isBundled; } - /** - * Sets if the class constructor was generated by zephir. - * - * @param bool $isGeneratedConstructor - */ - public function setIsGeneratedConstructor(bool $isGeneratedConstructor): void - { - $this->isGeneratedConstructor = $isGeneratedConstructor; - } - - /** - * Returns whether the constructor was generated by zephir. - * - * @return bool - */ - public function isGeneratedConstructor(): bool - { - return $this->isGeneratedConstructor; - } - /** * Sets whether the class is external or not. * From bd7517a34780fb3c1004095ee20951831ed8d30d Mon Sep 17 00:00:00 2001 From: Arhell Date: Fri, 11 Feb 2022 00:04:33 +0200 Subject: [PATCH 109/128] add discussions to readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cce56c3c5b..267f5cf880 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Functionality is exposed to the PHP language. ## Community * Follow us on [GitHub][zephir] and [Facebook][facebook] -* Get Zephir support on [Discord][discord] +* Get Zephir support on [Discord][discord] and [Github discussions][discussions] * Read our [Code of Conduct](./CODE_OF_CONDUCT.md) ## Contributing @@ -50,6 +50,7 @@ Zephir licensed under the MIT License. See the [LICENSE](./LICENSE) file for mor [zephir]: https://github.com/zephir-lang/zephir [facebook]: https://www.facebook.com/groups/zephir.language [discord]: https://phalcon.link/discord +[discussions]: https://github.com/zephir-lang/zephir/discussions [zephir logo]: https://assets.phalconphp.com/zephir/zephir_logo-105x36.svg [web site]: https://zephir-lang.com From 8c13b4a34322ff116d00be70974e7da295642ee9 Mon Sep 17 00:00:00 2001 From: Arhell Date: Sun, 13 Feb 2022 00:44:19 +0200 Subject: [PATCH 110/128] update config link --- Library/ConfigException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/ConfigException.php b/Library/ConfigException.php index 4287e6b69d..ab1ad6229a 100644 --- a/Library/ConfigException.php +++ b/Library/ConfigException.php @@ -17,7 +17,7 @@ class ConfigException extends Exception { public function __construct($message = '', $code = 0, Exception $previous = null) { - $message .= PHP_EOL.'Please see http://zephir-lang.com/config.html for more information'; + $message .= PHP_EOL.'Please see https://docs.zephir-lang.com/0.12/en/config for more information'; parent::__construct($message, $code, $previous); } From 17c4fc9e56a5e738bec512f4fb8aad18f6b1a514 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 13 Feb 2022 11:35:44 +0000 Subject: [PATCH 111/128] #2338 - Update Dockerfile for PHP8.1 --- docker/8.1/Dockerfile | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile index 7cc20a6c40..9761962773 100644 --- a/docker/8.1/Dockerfile +++ b/docker/8.1/Dockerfile @@ -16,23 +16,7 @@ RUN apt update -y && apt install -y \ pecl install psr zephir_parser RUN docker-php-ext-install zip gmp intl mysqli && \ - docker-php-ext-enable psr - -# Install Zephir parser -RUN PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" && \ - cd /opt && \ - git clone -b "development" \ - --depth 1 \ - -q https://github.com/phalcon/php-zephir-parser \ - php-zephir-parser && \ - cd php-zephir-parser || exit 1 && \ - phpize && \ - ./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser && \ - make -j"$(getconf _NPROCESSORS_ONLN)" && \ - sudo make install && \ - echo 'extension="zephir_parser.so"' |\ - sudo tee "$PHP_INI_DIR/zephir_parser.ini" && \ - php --ri "zephir_parser" + docker-php-ext-enable psr zephir_parser COPY --from=composer /usr/bin/composer /usr/local/bin/composer # Bash script with helper aliases From d65be0b60e7762e0e1ebe162976d74018b45d2e4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 13 Feb 2022 11:39:15 +0000 Subject: [PATCH 112/128] #2338 - Bump `MINIMUM_PARSER_VERSION` --- Library/Parser/Manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Parser/Manager.php b/Library/Parser/Manager.php index 7a096ce84a..8d746db18a 100644 --- a/Library/Parser/Manager.php +++ b/Library/Parser/Manager.php @@ -13,8 +13,8 @@ class Manager { - const MINIMUM_PARSER_VERSION = '1.3.0'; - const PARSER_HOME_PAGE = 'https://github.com/phalcon/php-zephir-parser'; + const MINIMUM_PARSER_VERSION = '1.5.0'; + const PARSER_HOME_PAGE = 'https://github.com/zephir-lang/php-zephir-parser'; /** * Zephir Parser. From 78047230560c42bbdc07fcecfdb3a28dfc309735 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 13 Feb 2022 11:39:44 +0000 Subject: [PATCH 113/128] #2338 - Bump `ZEPHIR_PARSER_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 ca5983c334..eb3ed37390 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.4.2 + ZEPHIR_PARSER_VERSION: 1.5.0 PSR_VERSION: 1.2.0 CACHE_DIR: .cache From e88cebd235ef35bd8440c5da949f02926fb65704 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 13 Feb 2022 11:40:24 +0000 Subject: [PATCH 114/128] #2338 - Bump `ZEPHIR_PARSER_VERSION` --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3f1e619b98..12255e73a3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,7 +7,7 @@ on: env: RE2C_VERSION: 2.2 - ZEPHIR_PARSER_VERSION: 1.4.2 + ZEPHIR_PARSER_VERSION: 1.5.0 PSR_VERSION: 1.2.0 CACHE_DIR: .cache From ece84c62c6dc579883363597bdf3c735d516c39f Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 13 Feb 2022 11:41:08 +0000 Subject: [PATCH 115/128] #2338 - Bump `BOX_VERSION` --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4007eecca..4bf729af17 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-20.04 env: - BOX_VERSION: 3.14.0 + BOX_VERSION: 3.15.0 steps: - name: Checkout Code From 59fad8fb16cddb4ac506c3699632c6413682e35f Mon Sep 17 00:00:00 2001 From: Arhell Date: Wed, 16 Feb 2022 00:57:32 +0200 Subject: [PATCH 116/128] update DocBlockTest license link --- tests/Zephir/Stubs/DocBlockTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Zephir/Stubs/DocBlockTest.php b/tests/Zephir/Stubs/DocBlockTest.php index e3be3daa0c..ac94554824 100644 --- a/tests/Zephir/Stubs/DocBlockTest.php +++ b/tests/Zephir/Stubs/DocBlockTest.php @@ -219,7 +219,7 @@ public function testPhpDocWithVariousDocBlockTags(): void * Method with various tags * @author Phalcon Team * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) - * @license MIT http://zephir-lang.com/license.html + * @license MIT https://docs.zephir-lang.com/0.12/en/license * @link https://github.com/zephir-lang/zephir * @since 1.0.0 * @todo Something @@ -236,7 +236,7 @@ public function testPhpDocWithVariousDocBlockTags(): void * * @author Phalcon Team * @copyright (c) 2013-present Phalcon Team (https://zephir-lang.com/) - * @license MIT http://zephir-lang.com/license.html + * @license MIT https://docs.zephir-lang.com/0.12/en/license * @link https://github.com/zephir-lang/zephir * @since 1.0.0 * @todo Something From cb407eda681855860ace79255e14f1e82c2bf322 Mon Sep 17 00:00:00 2001 From: Arhell Date: Sat, 19 Feb 2022 14:13:30 +0200 Subject: [PATCH 117/128] update apc.php links --- prototypes/apc.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/prototypes/apc.php b/prototypes/apc.php index 9acecb9172..d488269dcc 100644 --- a/prototypes/apc.php +++ b/prototypes/apc.php @@ -38,7 +38,7 @@ /** * Class APCIterator. * - * @see http://www.php.net/manual/en/class.apciterator.php + * @see https://www.php.net/manual/en/class.apciterator.php */ class APCIterator implements Iterator { @@ -90,7 +90,7 @@ public function getTotalCount() } /** - * @see http://www.php.net/manual/en/function.apc-cache-info.php + * @see https://www.php.net/manual/en/function.apc-cache-info.php * * @param string $type * @param bool $limited @@ -100,7 +100,7 @@ function apc_cache_info($type = '', $limited = false) } /** - * @see http://www.php.net/manual/en/function.apc-clear-cache.php + * @see https://www.php.net/manual/en/function.apc-clear-cache.php * * @param string $cache_type */ @@ -109,7 +109,7 @@ function apc_clear_cache($cache_type = '') } /** - * @see http://www.php.net/manual/en/function.apc-sma-info.php + * @see https://www.php.net/manual/en/function.apc-sma-info.php * * @param bool $limited */ @@ -118,7 +118,7 @@ function apc_sma_info($limited = false) } /** - * @see http://www.php.net/manual/en/function.apc-store.php + * @see https://www.php.net/manual/en/function.apc-store.php * * @param $key * @param $var @@ -129,7 +129,7 @@ function apc_store($key, $var, $ttl = 0) } /** - * @see http://www.php.net/manual/en/function.apc-fetch.php + * @see https://www.php.net/manual/en/function.apc-fetch.php * * @param $key * @param null $success @@ -141,7 +141,7 @@ function apc_fetch($key, &$success = null) } /** - * @see http://www.php.net/manual/en/function.apc-delete.php + * @see https://www.php.net/manual/en/function.apc-delete.php * * @param $key */ @@ -150,7 +150,7 @@ function apc_delete($key) } /** - * @see http://www.php.net/manual/en/function.apc-define-constants.php + * @see https://www.php.net/manual/en/function.apc-define-constants.php * * @param $key * @param array $constants @@ -161,7 +161,7 @@ function apc_define_constants($key, array $constants, $case_sensitive = true) } /** - * @see http://www.php.net/manual/en/function.apc-add.php + * @see https://www.php.net/manual/en/function.apc-add.php * * @param $key * @param $var @@ -172,7 +172,7 @@ function apc_add($key, $var, $ttl = 0) } /** - * @see http://www.php.net/manual/en/function.apc-compile-file.php + * @see https://www.php.net/manual/en/function.apc-compile-file.php * * @param $filename * @param bool $atomic @@ -182,7 +182,7 @@ function apc_compile_file($filename, $atomic = true) } /** - * @see http://www.php.net/manual/en/function.apc-load-constants.php + * @see https://www.php.net/manual/en/function.apc-load-constants.php * * @param $key * @param bool $case_sensitive @@ -192,7 +192,7 @@ function apc_load_constants($key, $case_sensitive = true) } /** - * @see http://www.php.net/manual/en/function.apc-exists.php + * @see https://www.php.net/manual/en/function.apc-exists.php * * @param $keys */ @@ -201,7 +201,7 @@ function apc_exists($keys) } /** - * @see http://www.php.net/manual/en/function.apc-delete-file.php + * @see https://www.php.net/manual/en/function.apc-delete-file.php * * @param $keys */ @@ -210,7 +210,7 @@ function apc_delete_file($keys) } /** - * @see http://www.php.net/manual/en/function.apc-inc.php + * @see https://www.php.net/manual/en/function.apc-inc.php * * @param $key * @param int $step @@ -221,7 +221,7 @@ function apc_inc($key, $step = 1, &$success = null) } /** - * @see http://www.php.net/manual/en/function.apc-dec.php + * @see https://www.php.net/manual/en/function.apc-dec.php * * @param $key * @param int $step @@ -232,7 +232,7 @@ function apc_dec($key, $step = 1, &$success = null) } /** - * @see http://php.net/manual/en/function.apc-cas.php + * @see https://php.net/manual/en/function.apc-cas.php * * @param $key * @param $old @@ -243,7 +243,7 @@ function apc_cas($key, $old, $new) } /** - * @see http://php.net/manual/en/function.apc-bin-dump.php + * @see https://php.net/manual/en/function.apc-bin-dump.php * * @param null $files * @param null $user_vars @@ -253,7 +253,7 @@ function apc_bin_dump($files = null, $user_vars = null) } /** - * @see http://php.net/manual/en/function.apc-bin-dumpfile.php + * @see https://php.net/manual/en/function.apc-bin-dumpfile.php * * @param $files * @param $user_vars @@ -266,7 +266,7 @@ function apc_bin_dumpfile($files, $user_vars, $filename, $flags = 0, $context = } /** - * @see http://php.net/manual/en/function.apc-bin-load.php + * @see https://php.net/manual/en/function.apc-bin-load.php * * @param $data * @param int $flags @@ -276,7 +276,7 @@ function apc_bin_load($data, $flags = 0) } /** - * @see http://php.net/manual/en/function.apc-bin-loadfile.php + * @see https://php.net/manual/en/function.apc-bin-loadfile.php * * @param $filename * @param null $context From e314f720b1620f2d05d7e8f02b8a67284eb87861 Mon Sep 17 00:00:00 2001 From: Arhell Date: Tue, 22 Feb 2022 00:37:01 +0200 Subject: [PATCH 118/128] update memcached.php links --- prototypes/memcached.php | 100 +++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/prototypes/memcached.php b/prototypes/memcached.php index 527e35cb1c..a46c5dbe9f 100644 --- a/prototypes/memcached.php +++ b/prototypes/memcached.php @@ -108,7 +108,7 @@ class Memcached const GET_ERROR_RETURN_VALUE = false; /** - * @see http://php.net/manual/en/memcached.construct.php + * @see https://php.net/manual/en/memcached.construct.php * * @param string $persistent_id */ @@ -117,7 +117,7 @@ public function __construct($persistent_id) } /** - * @see http://php.net/manual/en/memcached.getresultcode.php + * @see https://php.net/manual/en/memcached.getresultcode.php * * @return int */ @@ -126,7 +126,7 @@ public function getResultCode() } /** - * @see http://php.net/manual/en/memcached.getresultmessage.php + * @see https://php.net/manual/en/memcached.getresultmessage.php * * @return string */ @@ -135,7 +135,7 @@ public function getResultMessage() } /** - * @see http://php.net/manual/en/memcached.get.php + * @see https://php.net/manual/en/memcached.get.php * * @param string $key * @param callable $cache_cb @@ -148,7 +148,7 @@ public function get($key, callable $cache_cb = null, &$cas_token = null) } /** - * @see http://php.net/manual/en/memcached.getbykey.php + * @see https://php.net/manual/en/memcached.getbykey.php * * @param string $server_key * @param string $key @@ -162,7 +162,7 @@ public function getByKey($server_key, $key, callable $cache_cb = null, &$cas_tok } /** - * @see http://php.net/manual/en/memcached.getmulti.php + * @see https://php.net/manual/en/memcached.getmulti.php * * @param array $keys * @param array $cas_tokens @@ -175,7 +175,7 @@ public function getMulti(array $keys, array &$cas_tokens = null, $flags = null) } /** - * @see http://php.net/manual/en/memcached.getmultibykey.php + * @see https://php.net/manual/en/memcached.getmultibykey.php * * @param string $server_key * @param array $keys @@ -189,7 +189,7 @@ public function getMultiByKey($server_key, array $keys, &$cas_tokens = null, $fl } /** - * @see http://php.net/manual/en/memcached.getdelayed.php + * @see https://php.net/manual/en/memcached.getdelayed.php * * @param array $keys * @param bool $with_cas @@ -202,7 +202,7 @@ public function getDelayed(array $keys, $with_cas = null, callable $value_cb = n } /** - * @see http://php.net/manual/en/memcached.getdelayedbykey.php + * @see https://php.net/manual/en/memcached.getdelayedbykey.php * * @param string $server_key * @param array $keys @@ -216,7 +216,7 @@ public function getDelayedByKey($server_key, array $keys, $with_cas = null, call } /** - * @see http://php.net/manual/en/memcached.fetch.php + * @see https://php.net/manual/en/memcached.fetch.php * * @return array */ @@ -225,7 +225,7 @@ public function fetch() } /** - * @see http://php.net/manual/en/memcached.fetchall.php + * @see https://php.net/manual/en/memcached.fetchall.php * * @return array */ @@ -234,7 +234,7 @@ public function fetchAll() } /** - * @see http://php.net/manual/en/memcached.set.php + * @see https://php.net/manual/en/memcached.set.php * * @param string $key * @param mixed $value @@ -247,7 +247,7 @@ public function set($key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.setbykey.php + * @see https://php.net/manual/en/memcached.setbykey.php * * @param string $server_key * @param string $key @@ -261,7 +261,7 @@ public function setByKey($server_key, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.touch.php + * @see https://php.net/manual/en/memcached.touch.php * * @param string $key * @param int $expiration @@ -273,7 +273,7 @@ public function touch($key, $expiration) } /** - * @see http://php.net/manual/en/memcached.touchbykey.php + * @see https://php.net/manual/en/memcached.touchbykey.php * * @param string $server_key * @param string $key @@ -286,7 +286,7 @@ public function touchByKey($server_key, $key, $expiration) } /** - * @see http://php.net/manual/en/memcached.setmulti.php + * @see https://php.net/manual/en/memcached.setmulti.php * * @param array $items * @param int $expiration @@ -298,7 +298,7 @@ public function setMulti(array $items, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.setmultibykey.php + * @see https://php.net/manual/en/memcached.setmultibykey.php * * @param string $server_key * @param array $items @@ -311,7 +311,7 @@ public function setMultiByKey($server_key, array $items, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.cas.php + * @see https://php.net/manual/en/memcached.cas.php * * @param float $cas_token * @param string $key @@ -325,7 +325,7 @@ public function cas($cas_token, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.casbykey.php + * @see https://php.net/manual/en/memcached.casbykey.php * * @param float $cas_token * @param string $server_key @@ -340,7 +340,7 @@ public function casByKey($cas_token, $server_key, $key, $value, $expiration = nu } /** - * @see http://php.net/manual/en/memcached.add.php + * @see https://php.net/manual/en/memcached.add.php * * @param string $key * @param mixed $value @@ -353,7 +353,7 @@ public function add($key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.addbykey.php + * @see https://php.net/manual/en/memcached.addbykey.php * * @param string $server_key * @param string $key @@ -367,7 +367,7 @@ public function addByKey($server_key, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.append.php + * @see https://php.net/manual/en/memcached.append.php * * @param string $key * @param string $value @@ -379,7 +379,7 @@ public function append($key, $value) } /** - * @see http://php.net/manual/en/memcached.appendbykey.php + * @see https://php.net/manual/en/memcached.appendbykey.php * * @param string $server_key * @param string $key @@ -392,7 +392,7 @@ public function appendByKey($server_key, $key, $value) } /** - * @see http://php.net/manual/en/memcached.prepend.php + * @see https://php.net/manual/en/memcached.prepend.php * * @param string $key * @param string $value @@ -404,7 +404,7 @@ public function prepend($key, $value) } /** - * @see http://php.net/manual/en/memcached.prependbykey.php + * @see https://php.net/manual/en/memcached.prependbykey.php * * @param string $server_key * @param string $key @@ -417,7 +417,7 @@ public function prependByKey($server_key, $key, $value) } /** - * @see http://php.net/manual/en/memcached.replace.php + * @see https://php.net/manual/en/memcached.replace.php * * @param string $key * @param mixed $value @@ -430,7 +430,7 @@ public function replace($key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.replacebykey.php + * @see https://php.net/manual/en/memcached.replacebykey.php * * @param string $server_key * @param string $key @@ -444,7 +444,7 @@ public function replaceByKey($server_key, $key, $value, $expiration = null) } /** - * @see http://php.net/manual/en/memcached.delete.php + * @see https://php.net/manual/en/memcached.delete.php * * @param string $key * @param int $time @@ -456,7 +456,7 @@ public function delete($key, $time = 0) } /** - * @see http://php.net/manual/en/memcached.deletemulti.php + * @see https://php.net/manual/en/memcached.deletemulti.php * * @param array $keys * @param int $time @@ -468,7 +468,7 @@ public function deleteMulti(array $keys, $time = 0) } /** - * @see http://php.net/manual/en/memcached.deletebykey.php + * @see https://php.net/manual/en/memcached.deletebykey.php * * @param string $server_key * @param string $key @@ -481,7 +481,7 @@ public function deleteByKey($server_key, $key, $time = 0) } /** - * @see http://php.net/manual/en/memcached.deletemultibykey.php + * @see https://php.net/manual/en/memcached.deletemultibykey.php * * @param string $server_key * @param array $keys @@ -494,7 +494,7 @@ public function deleteMultiByKey($server_key, array $keys, $time = 0) } /** - * @see http://php.net/manual/en/memcached.increment.php + * @see https://php.net/manual/en/memcached.increment.php * * @param string $key * @param int $offset @@ -508,7 +508,7 @@ public function increment($key, $offset = 1, $initial_value = 0, $expiry = 0) } /** - * @see http://php.net/manual/en/memcached.decrement.php + * @see https://php.net/manual/en/memcached.decrement.php * * @param string $key * @param int $offset @@ -522,7 +522,7 @@ public function decrement($key, $offset = 1, $initial_value = 0, $expiry = 0) } /** - * @see http://php.net/manual/en/memcached.incrementbykey.php + * @see https://php.net/manual/en/memcached.incrementbykey.php * * @param string $server_key * @param string $key @@ -537,7 +537,7 @@ public function incrementByKey($server_key, $key, $offset = 1, $initial_value = } /** - * @see http://php.net/manual/en/memcached.decrementbykey.php + * @see https://php.net/manual/en/memcached.decrementbykey.php * * @param string $server_key * @param string $key @@ -552,7 +552,7 @@ public function decrementByKey($server_key, $key, $offset = 1, $initial_value = } /** - * @see http://php.net/manual/en/memcached.addserver.php + * @see https://php.net/manual/en/memcached.addserver.php * * @param string $host * @param int $port @@ -565,7 +565,7 @@ public function addServer($host, $port, $weight = 0) } /** - * @see http://php.net/manual/en/memcached.addservers.php + * @see https://php.net/manual/en/memcached.addservers.php * * @param array $servers * @@ -576,7 +576,7 @@ public function addServers(array $servers) } /** - * @see http://php.net/manual/en/memcached.getserverlist.php + * @see https://php.net/manual/en/memcached.getserverlist.php * * @return array */ @@ -585,7 +585,7 @@ public function getServerList() } /** - * @see http://php.net/manual/en/memcached.getserverbykey.php + * @see https://php.net/manual/en/memcached.getserverbykey.php * * @param string $server_key * @@ -596,7 +596,7 @@ public function getServerByKey($server_key) } /** - * @see http://php.net/manual/en/memcached.resetserverlist.php + * @see https://php.net/manual/en/memcached.resetserverlist.php * * @return bool */ @@ -605,7 +605,7 @@ public function resetServerList() } /** - * @see http://php.net/manual/en/memcached.quit.php + * @see https://php.net/manual/en/memcached.quit.php * * @return bool */ @@ -614,7 +614,7 @@ public function quit() } /** - * @see http://php.net/manual/en/memcached.getstats.php + * @see https://php.net/manual/en/memcached.getstats.php * * @return array */ @@ -623,7 +623,7 @@ public function getStats() } /** - * @see http://php.net/manual/en/memcached.getversion.php + * @see https://php.net/manual/en/memcached.getversion.php * * @return array */ @@ -632,7 +632,7 @@ public function getVersion() } /** - * @see http://php.net/manual/en/memcached.getallkeys.php + * @see https://php.net/manual/en/memcached.getallkeys.php * * @return array */ @@ -641,7 +641,7 @@ public function getAllKeys() } /** - * @see http://php.net/manual/en/memcached.flush.php + * @see https://php.net/manual/en/memcached.flush.php * * @param int $delay * @@ -652,7 +652,7 @@ public function flush($delay = 0) } /** - * @see http://php.net/manual/en/memcached.getoption.php + * @see https://php.net/manual/en/memcached.getoption.php * * @param int $option * @@ -663,7 +663,7 @@ public function getOption($option) } /** - * @see http://php.net/manual/en/memcached.setoption.php + * @see https://php.net/manual/en/memcached.setoption.php * * @param int $option * @param mixed $value @@ -675,7 +675,7 @@ public function setOption($option, $value) } /** - * @see http://php.net/manual/en/memcached.setoptions.php + * @see https://php.net/manual/en/memcached.setoptions.php * * @param array $options * @@ -686,7 +686,7 @@ public function setOptions(array $options) } /** - * @see http://php.net/manual/en/memcached.ispersistent.php + * @see https://php.net/manual/en/memcached.ispersistent.php * * @return bool */ @@ -695,7 +695,7 @@ public function isPersistent() } /** - * @see http://php.net/manual/en/memcached.ispristine.php + * @see https://php.net/manual/en/memcached.ispristine.php * * @return bool */ From bc1176ff30f8321ba09cd22e6c8165e5f721cfbc Mon Sep 17 00:00:00 2001 From: Arhell Date: Fri, 25 Feb 2022 00:27:07 +0200 Subject: [PATCH 119/128] update links --- .editorconfig | 2 +- CHANGELOG.md | 4 ++-- CONTRIBUTING.md | 2 +- Library/Documentation/Theme.php | 2 +- Library/Expression/Constants.php | 4 ++-- .../Arithmetical/ArithmeticalBaseOperator.php | 2 +- Library/Operators/Bitwise/BitwiseBaseOperator.php | 2 +- Library/Optimizers/FunctionCall/IsScalarOptimizer.php | 2 +- Library/Optimizers/FunctionCall/JoinOptimizer.php | 2 +- Library/Passes/LocalContextPass.php | 2 +- WINDOWS.md | 8 ++++---- ext/stub/emptytest.zep.c | 2 +- ext/stub/fannkuch.zep.c | 2 +- ext/stub/regexdna.zep.c | 2 +- ext/stub/spectralnorm.zep.c | 2 +- prototypes/gd.php | 10 +++++----- prototypes/memcache.php | 2 +- stub/emptytest.zep | 2 +- stub/regexdna.zep | 2 +- stub/spectralnorm.zep | 2 +- templates/Api/themes/zephir/static/zephir-theme.css | 2 +- tests/fixtures/lifecycle/.editorconfig | 2 +- tests/fixtures/typehints/.editorconfig | 2 +- tests/sharness/README.md | 8 ++++---- 24 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3f7a94244a..197c662f97 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true diff --git a/CHANGELOG.md b/CHANGELOG.md index bfedb946bb..3960cc4c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Change Log All notable changes to this project will be documented in this file. -The format based on [Keep a Changelog](http://keepachangelog.com) -and this project adheres to [Semantic Versioning](http://semver.org). +The format based on [Keep a Changelog](https://keepachangelog.com) +and this project adheres to [Semantic Versioning](https://semver.org). ## [Unreleased] ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4360a464bb..11d5411f2c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,5 +82,5 @@ Phalcon Team [team]: https://phalcon.io/en-us/team [issues]: https://github.com/zephir-lang/zephir/issues [docs]: https://docs.zephir-lang.com -[git rebase]: http://git-scm.com/book/en/Git-Branching-Rebasing +[git rebase]: https://git-scm.com/book/en/Git-Branching-Rebasing [psr-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md diff --git a/Library/Documentation/Theme.php b/Library/Documentation/Theme.php index 797ecc1b21..4e6ee9c633 100644 --- a/Library/Documentation/Theme.php +++ b/Library/Documentation/Theme.php @@ -83,7 +83,7 @@ private function __namespaceTreeHelper(NamespaceHelper $ns) } /** - * from : http://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php. + * from : https://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php. * * @param $src * @param $dst diff --git a/Library/Expression/Constants.php b/Library/Expression/Constants.php index 1bed77c32d..3ce948fddc 100644 --- a/Library/Expression/Constants.php +++ b/Library/Expression/Constants.php @@ -38,7 +38,7 @@ class Constants /** * Reserved ENV Constants. * - * @see http://www.php.net/manual/ru/reserved.constants.php + * @see https://www.php.net/manual/ru/reserved.constants.php * * @var array */ @@ -66,7 +66,7 @@ class Constants /** * Magic constants. * - * @see http://php.net/manual/en/language.constants.predefined.php + * @see https://php.net/manual/en/language.constants.predefined.php * * @var array */ diff --git a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php index f19b2b9ac9..c490503d83 100644 --- a/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php +++ b/Library/Operators/Arithmetical/ArithmeticalBaseOperator.php @@ -32,7 +32,7 @@ class ArithmeticalBaseOperator extends AbstractOperator * * Probably gcc/clang will optimize them without this optimization * - * @see http://en.wikipedia.org/wiki/Constant_folding + * @see https://en.wikipedia.org/wiki/Constant_folding * * @param array $expression * @param CompilationContext $compilationContext diff --git a/Library/Operators/Bitwise/BitwiseBaseOperator.php b/Library/Operators/Bitwise/BitwiseBaseOperator.php index 957c3cf3d0..3d27040aee 100644 --- a/Library/Operators/Bitwise/BitwiseBaseOperator.php +++ b/Library/Operators/Bitwise/BitwiseBaseOperator.php @@ -29,7 +29,7 @@ class BitwiseBaseOperator extends AbstractOperator * This tries to perform arithmetical operations * Probably gcc/clang will optimize them without this optimization. * - * @see http://en.wikipedia.org/wiki/Constant_folding + * @see https://en.wikipedia.org/wiki/Constant_folding * * @param array $expression * @param CompilationContext $compilationContext diff --git a/Library/Optimizers/FunctionCall/IsScalarOptimizer.php b/Library/Optimizers/FunctionCall/IsScalarOptimizer.php index 17f570a77d..3795da2ff9 100644 --- a/Library/Optimizers/FunctionCall/IsScalarOptimizer.php +++ b/Library/Optimizers/FunctionCall/IsScalarOptimizer.php @@ -21,7 +21,7 @@ * * Optimizes calls to 'is_scalar' using internal function * - * @see http://php.net/manual/en/function.is-scalar.php + * @see https://php.net/manual/en/function.is-scalar.php */ class IsScalarOptimizer extends OptimizerAbstract { diff --git a/Library/Optimizers/FunctionCall/JoinOptimizer.php b/Library/Optimizers/FunctionCall/JoinOptimizer.php index 61c754a377..1d6354b0bd 100644 --- a/Library/Optimizers/FunctionCall/JoinOptimizer.php +++ b/Library/Optimizers/FunctionCall/JoinOptimizer.php @@ -12,7 +12,7 @@ namespace Zephir\Optimizers\FunctionCall; /** - * @see http://php.net/manual/en/function.join.php + * @see https://php.net/manual/en/function.join.php * * Optimizes calls to 'join' using ImplodeOptimizer via it is an alias */ diff --git a/Library/Passes/LocalContextPass.php b/Library/Passes/LocalContextPass.php index 46fde8523c..206c4e3d18 100644 --- a/Library/Passes/LocalContextPass.php +++ b/Library/Passes/LocalContextPass.php @@ -24,7 +24,7 @@ * mutations is relative, since assignments inside cycles/loops may perform a n-number of * mutations * - * @see http://en.wikipedia.org/wiki/Escape_analysis + * @see https://en.wikipedia.org/wiki/Escape_analysis */ class LocalContextPass { diff --git a/WINDOWS.md b/WINDOWS.md index 885b964680..1f83831283 100644 --- a/WINDOWS.md +++ b/WINDOWS.md @@ -7,24 +7,24 @@ PHP-Version requirements are marked using `[ ]` ## Software Requirements [PHP 5.5 or later] -- [Install Visual Studio 2012 Express](http://www.microsoft.com/en-US/download/details.aspx?id=34673) +- [Install Visual Studio 2012 Express](https://www.microsoft.com/en-US/download/details.aspx?id=34673) (You should start it and activate it) ## Software Requirements General -- [Install PHP (NTS)](http://windows.php.net/download/) +- [Install PHP (NTS)](https://windows.php.net/download/) - Download and extract it - Make sure it is in the PATH, as for example below: ```cmd setx path "%path%;c:\path-to-php\" ``` -- [Install PHP SDK for PHP 5.6](http://windows.php.net/downloads/php-sdk/)(Currently `php-sdk-binary-tools-20110915.zip` is the newest) +- [Install PHP SDK for PHP 5.6](https://windows.php.net/downloads/php-sdk/)(Currently `php-sdk-binary-tools-20110915.zip` is the newest) - [Install PHP SDK for PHP 7.0+](https://github.com/Microsoft/php-sdk-binary-tools/releases) ```cmd setx php_sdk "c:\path-to-php-sdk" ``` -- [Download PHP Developer Pack(NTS!):***php-devel-pack-?.?.?-Win??-VC??-x??.zip***](http://windows.php.net/downloads/releases/) +- [Download PHP Developer Pack(NTS!):***php-devel-pack-?.?.?-Win??-VC??-x??.zip***](https://windows.php.net/downloads/releases/) (or build it yourself with `--enable-debug --disable-zts` and `nmake build-devel` or just `nmake snap` by using the PHP-SDK) ```cmd setx php_devpack "c:\path-to-extracted-devpack" diff --git a/ext/stub/emptytest.zep.c b/ext/stub/emptytest.zep.c index aa846e4d90..86489b35f7 100644 --- a/ext/stub/emptytest.zep.c +++ b/ext/stub/emptytest.zep.c @@ -22,7 +22,7 @@ * Control Flow */ /** - * @link http://ru2.php.net/empty + * @link https://ru2.php.net/empty */ ZEPHIR_INIT_CLASS(Stub_EmptyTest) { diff --git a/ext/stub/fannkuch.zep.c b/ext/stub/fannkuch.zep.c index 91d53018bf..cff9afa057 100644 --- a/ext/stub/fannkuch.zep.c +++ b/ext/stub/fannkuch.zep.c @@ -23,7 +23,7 @@ * * Fannkuch Redux in Zephir * - * @see http://disciple-devel.blogspot.mx/2010/11/shootout-fannkuch-redux.html + * @see https://disciple-devel.blogspot.mx/2010/11/shootout-fannkuch-redux.html */ ZEPHIR_INIT_CLASS(Stub_Fannkuch) { diff --git a/ext/stub/regexdna.zep.c b/ext/stub/regexdna.zep.c index 8c4dba80ac..050f60ff0b 100644 --- a/ext/stub/regexdna.zep.c +++ b/ext/stub/regexdna.zep.c @@ -24,7 +24,7 @@ /** * RegexDNA * - * @see http://www.haskell.org/haskellwiki/Shootout/Regex_DNA + * @see https://www.haskell.org/haskellwiki/Shootout/Regex_DNA */ ZEPHIR_INIT_CLASS(Stub_RegexDNA) { diff --git a/ext/stub/spectralnorm.zep.c b/ext/stub/spectralnorm.zep.c index 7f7de5c42c..69fde255be 100644 --- a/ext/stub/spectralnorm.zep.c +++ b/ext/stub/spectralnorm.zep.c @@ -23,7 +23,7 @@ /** * SpectralNorm * - * @see http://mathworld.wolfram.com/SpectralNorm.html + * @see https://mathworld.wolfram.com/SpectralNorm.html */ ZEPHIR_INIT_CLASS(Stub_SpectralNorm) { diff --git a/prototypes/gd.php b/prototypes/gd.php index ec7bc0236b..058bfbdf39 100644 --- a/prototypes/gd.php +++ b/prototypes/gd.php @@ -13,7 +13,7 @@ /** * Retrieve information about the currently installed GD library. * - * @see http://www.php.net/manual/en/function.gd-info.php + * @see https://www.php.net/manual/en/function.gd-info.php * * @return array */ @@ -170,7 +170,7 @@ function imageantialias($image, $enabled) /** * Draws an arc. * - * @see http://www.php.net/manual/ru/function.imagearc.php + * @see https://www.php.net/manual/ru/function.imagearc.php * * @param resource $image * @param int $cx @@ -357,7 +357,7 @@ function imagecolordeallocate($image, $color) /** * Get the index of the specified color. * - * @see http://www.php.net/manual/ru/function.imagecolorexact.php + * @see https://www.php.net/manual/ru/function.imagecolorexact.php * * @param resource $image * @param int $red @@ -394,7 +394,7 @@ function imagecolorexactalpha($image, $red, $green, $blue, $alpha) /** * Makes the colors of the palette version of an image more closely match the true color version. * - * @see http://www.php.net/manual/ru/function.imagecolormatch.php + * @see https://www.php.net/manual/ru/function.imagecolormatch.php * * @param resource $image1 * @param resource $image2 @@ -410,7 +410,7 @@ function imagecolormatch($image1, $image2) /** * Get the index of the specified color or its closest possible alternative. * - * @see http://www.php.net/manual/ru/function.imagecolorresolve.php + * @see https://www.php.net/manual/ru/function.imagecolorresolve.php * * @param resource $image * @param int $red diff --git a/prototypes/memcache.php b/prototypes/memcache.php index 62c5c0793e..ad0dae9ea9 100644 --- a/prototypes/memcache.php +++ b/prototypes/memcache.php @@ -15,7 +15,7 @@ /** * Class Memcache. * - * @see http://se2.php.net/manual/en/class.memcache.php + * @see https://se2.php.net/manual/en/class.memcache.php */ class memcache { diff --git a/stub/emptytest.zep b/stub/emptytest.zep index 66e3daeeff..d9f7fc72a3 100644 --- a/stub/emptytest.zep +++ b/stub/emptytest.zep @@ -6,7 +6,7 @@ namespace Stub; /** - * @link http://ru2.php.net/empty + * @link https://ru2.php.net/empty */ class EmptyTest { diff --git a/stub/regexdna.zep b/stub/regexdna.zep index 342af0e1e3..893355a3a8 100644 --- a/stub/regexdna.zep +++ b/stub/regexdna.zep @@ -4,7 +4,7 @@ namespace Stub; /** * RegexDNA * - * @see http://www.haskell.org/haskellwiki/Shootout/Regex_DNA + * @see https://www.haskell.org/haskellwiki/Shootout/Regex_DNA */ class RegexDNA { diff --git a/stub/spectralnorm.zep b/stub/spectralnorm.zep index 90b482df6f..fdbc332742 100644 --- a/stub/spectralnorm.zep +++ b/stub/spectralnorm.zep @@ -4,7 +4,7 @@ namespace Stub; /** * SpectralNorm * - * @see http://mathworld.wolfram.com/SpectralNorm.html + * @see https://mathworld.wolfram.com/SpectralNorm.html */ class SpectralNorm { diff --git a/templates/Api/themes/zephir/static/zephir-theme.css b/templates/Api/themes/zephir/static/zephir-theme.css index b0dd04af66..e40281edc0 100644 --- a/templates/Api/themes/zephir/static/zephir-theme.css +++ b/templates/Api/themes/zephir/static/zephir-theme.css @@ -1,4 +1,4 @@ -/* http://meyerweb.com/eric/tools/css/reset/ +/* https://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ diff --git a/tests/fixtures/lifecycle/.editorconfig b/tests/fixtures/lifecycle/.editorconfig index 059d88d4f2..5e311e5ede 100644 --- a/tests/fixtures/lifecycle/.editorconfig +++ b/tests/fixtures/lifecycle/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org [*.{c,h}] trim_trailing_whitespace = false diff --git a/tests/fixtures/typehints/.editorconfig b/tests/fixtures/typehints/.editorconfig index 059d88d4f2..5e311e5ede 100644 --- a/tests/fixtures/typehints/.editorconfig +++ b/tests/fixtures/typehints/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org [*.{c,h}] trim_trailing_whitespace = false diff --git a/tests/sharness/README.md b/tests/sharness/README.md index 13a7d7a356..0c9b7ad9fb 100644 --- a/tests/sharness/README.md +++ b/tests/sharness/README.md @@ -21,9 +21,9 @@ Here's an example of parallel testing powered by a recent version of [prove][:3: ```shell $ prove --jobs 15 ./t[0-9]*.sh -./t0003-init-errors.sh .. ok -./t0002-generate.sh ..... ok -./t0001-compile.sh ...... ok +./t0003-init-errors.sh .. ok +./t0002-generate.sh ..... ok +./t0001-compile.sh ...... ok All tests successful. Files=3, Tests=6, 30 wallclock secs ( 0.04 usr 0.01 sys + 33.47 cusr 9.56 csys = 43.08 CPU) Result: PASS @@ -55,5 +55,5 @@ $ ./t0001-compile.sh -v -i ``` [:1:]: https://github.com/mlafeldt/sharness/ -[:2:]: http://testanything.org +[:2:]: https://testanything.org [:3:]: https://linux.die.net/man/1/prove From 238d0f4e8cc0c9aa49168ac04bb5db4dd4acc95c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 27 Feb 2022 23:18:19 +0000 Subject: [PATCH 120/128] #2338 - Implement `MAY_BE_*` arg info types --- Library/ArgInfoDefinition.php | 50 ++++++++++++++++++----- Library/ClassMethod.php | 51 +++++++++++++++++++++--- stub/types/maybe.zep | 10 +++++ tests/Extension/Types/UnionTypesTest.php | 28 +++++++++++++ 4 files changed, 122 insertions(+), 17 deletions(-) create mode 100644 stub/types/maybe.zep create mode 100644 tests/Extension/Types/UnionTypesTest.php diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index a53b8c803d..fb366cd8ad 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -233,18 +233,46 @@ private function richRenderStart(): void ) ); $this->codePrinter->output('#endif'); - } else { - $this->codePrinter->output( - sprintf( - 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', - $this->name, - (int) $this->returnByRef, - $this->functionLike->getNumberOfRequiredParameters(), - $this->getReturnType(), - (int) $this->functionLike->areReturnTypesNullCompatible() - ) - ); + + return; } + + if (count($this->functionLike->getReturnTypes()) > 1) { + $types = []; + $mayBeTypes = $this->functionLike->getMayBeArgTypes(); + foreach ($this->functionLike->getReturnTypes() as $type => $typeInfo) { + if (!isset($mayBeTypes[$type])) { + continue; + } + + $types[] = $mayBeTypes[$type]; + } + + if (count($types) > 1) { + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(%s, %d, %d, %s)', + $this->name, + (int) $this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + join('|', $types) + ) + ); + + return; + } + } + + $this->codePrinter->output( + sprintf( + 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(%s, %d, %d, %s, %d)', + $this->name, + (int) $this->returnByRef, + $this->functionLike->getNumberOfRequiredParameters(), + $this->getReturnType(), + (int) $this->functionLike->areReturnTypesNullCompatible() + ) + ); } private function renderEnd(): void diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 4724ba8a42..8c1ec47486 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -77,6 +77,16 @@ class ClassMethod */ protected array $returnTypes = []; + /** + * Zend MAY_BE_* types. + * + * @var array|string[] + */ + protected array $mayBeArgTypes = [ + 'int' => 'MAY_BE_LONG', + 'false' => 'MAY_BE_FALSE', + ]; + /** * Raw-types returned by the method. * @@ -673,7 +683,7 @@ public function areReturnTypesDoubleCompatible(): bool } /** - * Checks whether at least one return type hint is integer compatible. + * Checks whether at least one return type hint is bool compatible. * * @return bool */ @@ -683,7 +693,17 @@ public function areReturnTypesBoolCompatible(): bool } /** - * Checks whether at least one return type hint is integer compatible. + * Checks whether at least one return type hint is false compatible. + * + * @return bool + */ + public function areReturnTypesFalseCompatible(): bool + { + return isset($this->returnTypes['false']); + } + + /** + * Checks whether at least one return type hint is string compatible. * * @return bool */ @@ -997,6 +1017,14 @@ public function isShortcut(): bool return $this->expression && 'shortcut' === $this->expression['type']; } + /** + * @return array|string[] + */ + public function getMayBeArgTypes(): array + { + return $this->mayBeArgTypes; + } + /** * Return shortcut method name. * @@ -2294,6 +2322,7 @@ public function isReturnTypesHintDetermined(): bool $this->areReturnTypesIntCompatible() || $this->areReturnTypesNullCompatible() || $this->areReturnTypesStringCompatible() || + $this->areReturnTypesFalseCompatible() || \array_key_exists('array', $this->getReturnTypes()) ) { continue; @@ -2323,13 +2352,23 @@ public function areReturnTypesCompatible(): bool return true; } - // null | T1 | T2 - if (count($this->returnTypes) > 2) { - return false; + $totalTypes = count($this->returnTypes); + + // union types + if ($totalTypes > 1) { + $diff = array_diff(array_keys($this->returnTypes), array_keys($this->mayBeArgTypes)); + if (count($diff) === 0) { + return true; + } } // T1 | T2 - if (2 === count($this->returnTypes) && !isset($this->returnTypes['null'])) { + if (2 === $totalTypes && !isset($this->returnTypes['null'])) { + return false; + } + + // null | T1 | T2 + if ($totalTypes > 2) { return false; } diff --git a/stub/types/maybe.zep b/stub/types/maybe.zep new file mode 100644 index 0000000000..8aa66b1f63 --- /dev/null +++ b/stub/types/maybe.zep @@ -0,0 +1,10 @@ + +namespace Stub\Types; + +class MayBe +{ + public function gc(int maxlifetime) -> int | false + { + return 1; + } +} diff --git a/tests/Extension/Types/UnionTypesTest.php b/tests/Extension/Types/UnionTypesTest.php new file mode 100644 index 0000000000..e740f7d397 --- /dev/null +++ b/tests/Extension/Types/UnionTypesTest.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Extension\Types; + +use PHPUnit\Framework\TestCase; +use Stub\Types\MayBe; + +final class UnionTypesTest extends TestCase +{ + public function testIntFalse(): void + { + $class = new MayBe(); + + $this->assertSame(1, $class->gc(123)); + $this->assertFalse($class->gcFalse()); + } +} From 61bc3b9e1d50acc90d0d93165839937145c6ea96 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 19 Mar 2022 20:06:25 +0000 Subject: [PATCH 121/128] #2338 - Add new type `T_FALSE` and its support in return --- Library/Statements/ReturnStatement.php | 8 +++++++- Library/Types.php | 1 + stub/types/maybe.zep | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Library/Statements/ReturnStatement.php b/Library/Statements/ReturnStatement.php index 5ffc637dec..a411c5816d 100644 --- a/Library/Statements/ReturnStatement.php +++ b/Library/Statements/ReturnStatement.php @@ -119,7 +119,13 @@ public function compile(CompilationContext $compilationContext): void break; case Types::T_BOOL: - if (!$currentMethod->areReturnTypesBoolCompatible() && !$currentMethod->isMixed()) { + if (!$currentMethod->areReturnTypesBoolCompatible() && !$currentMethod->isMixed() && !$currentMethod->areReturnTypesFalseCompatible()) { + throw new InvalidTypeException($resolvedExpr->getType(), $statement['expr']); + } + break; + + case Types::T_FALSE: + if (!$currentMethod->areReturnTypesFalseCompatible() && !$currentMethod->isMixed()) { throw new InvalidTypeException($resolvedExpr->getType(), $statement['expr']); } break; diff --git a/Library/Types.php b/Library/Types.php index 7ac86b67c8..ffb1eff3f7 100644 --- a/Library/Types.php +++ b/Library/Types.php @@ -24,6 +24,7 @@ final class Types const T_NUMBER = 'number'; const T_NULL = 'null'; const T_BOOL = 'bool'; + const T_FALSE = 'false'; const T_STRING = 'string'; const T_ISTRING = 'istring'; const T_VARIABLE = 'variable'; diff --git a/stub/types/maybe.zep b/stub/types/maybe.zep index 8aa66b1f63..e3364d6c64 100644 --- a/stub/types/maybe.zep +++ b/stub/types/maybe.zep @@ -7,4 +7,9 @@ class MayBe { return 1; } + + public function gcFalse() -> int | false + { + return false; + } } From a5346b24d4b7212003879ccf4fa1661f4e86ac3b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 19 Mar 2022 20:18:08 +0000 Subject: [PATCH 122/128] #2338 - Add PHP version condition --- Library/ArgInfoDefinition.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Library/ArgInfoDefinition.php b/Library/ArgInfoDefinition.php index fb366cd8ad..43889ca010 100644 --- a/Library/ArgInfoDefinition.php +++ b/Library/ArgInfoDefinition.php @@ -249,15 +249,28 @@ 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)', $this->name, (int) $this->returnByRef, $this->functionLike->getNumberOfRequiredParameters(), - join('|', $types) + 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; } From 2904b26267b9f23a0754d4258f6e5b7558ae0ab9 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 19 Mar 2022 20:28:23 +0000 Subject: [PATCH 123/128] #2338 - Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfedb946bb..054af98484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org). ## [Unreleased] ### Added - Added custom list of arg info definition (Phalcon only) [#2341](https://github.com/zephir-lang/zephir/issues/2341) +- Added support for `int|false` return type (PHP >= 8.0 only) [#2338](https://github.com/zephir-lang/zephir/issues/2338) ### Fixed - Fixed left `null` with `string` condition [#2299](https://github.com/zephir-lang/zephir/issues/2299) From 60789fb9db2c1ea406e8fca6822aae2f2b321c64 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sat, 19 Mar 2022 20:29:26 +0000 Subject: [PATCH 124/128] #2338 - Update composer packages --- composer.lock | 312 ++++++++++++++++++++++++++------------------------ 1 file changed, 160 insertions(+), 152 deletions(-) diff --git a/composer.lock b/composer.lock index b358aafa2d..45579a7075 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "monolog/monolog", - "version": "2.3.5", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd4380d6fc37626e2f799f29d91195040137eba9" + "reference": "d7fd7450628561ba697b7097d86db72662f54aef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9", - "reference": "fd4380d6fc37626e2f799f29d91195040137eba9", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef", + "reference": "d7fd7450628561ba697b7097d86db72662f54aef", "shasum": "" }, "require": { @@ -39,7 +39,7 @@ "phpstan/phpstan": "^0.12.91", "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", - "rollbar/rollbar": "^1.3", + "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": ">=0.90@dev", "swiftmailer/swiftmailer": "^5.3|^6.0" }, @@ -91,7 +91,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.3.5" + "source": "https://github.com/Seldaek/monolog/tree/2.4.0" }, "funding": [ { @@ -103,7 +103,7 @@ "type": "tidelift" } ], - "time": "2021-10-01T21:08:31+00:00" + "time": "2022-03-14T12:44:37+00:00" }, { "name": "psr/container", @@ -255,16 +255,16 @@ }, { "name": "symfony/console", - "version": "v5.4.1", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4" + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", - "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", + "url": "https://api.github.com/repos/symfony/console/zipball/d8111acc99876953f52fe16d4c50eb60940d49ad", + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad", "shasum": "" }, "require": { @@ -334,7 +334,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.1" + "source": "https://github.com/symfony/console/tree/v5.4.5" }, "funding": [ { @@ -350,7 +350,7 @@ "type": "tidelift" } ], - "time": "2021-12-09T11:22:43+00:00" + "time": "2022-02-24T12:45:35+00:00" }, { "name": "symfony/deprecation-contracts", @@ -421,16 +421,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb" + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/27d39ae126352b9fa3be5e196ccf4617897be3eb", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", "shasum": "" }, "require": { @@ -486,7 +486,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.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" }, "funding": [ { @@ -502,7 +502,7 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -585,21 +585,24 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -614,12 +617,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -644,7 +647,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -660,20 +663,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -693,12 +696,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -725,7 +728,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" }, "funding": [ { @@ -741,11 +744,11 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -774,12 +777,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -809,7 +812,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" }, "funding": [ { @@ -829,21 +832,24 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -858,12 +864,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -889,7 +895,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -905,20 +911,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -935,12 +941,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -968,7 +974,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -984,20 +990,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "" }, "require": { @@ -1014,12 +1020,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1051,7 +1057,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -1067,7 +1073,7 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { "name": "symfony/service-contracts", @@ -1154,16 +1160,16 @@ }, { "name": "symfony/string", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d" + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", - "reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d", + "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10", + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10", "shasum": "" }, "require": { @@ -1185,12 +1191,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -1220,7 +1226,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.0" + "source": "https://github.com/symfony/string/tree/v5.4.3" }, "funding": [ { @@ -1236,35 +1242,36 @@ "type": "tidelift" } ], - "time": "2021-11-24T10:02:00+00:00" + "time": "2022-01-02T09:53:40+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -1291,7 +1298,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -1307,41 +1314,42 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1357,7 +1365,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -1365,7 +1373,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", @@ -1485,16 +1493,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -1530,9 +1538,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1646,16 +1654,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -1690,9 +1698,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", @@ -1763,16 +1771,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.10", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { @@ -1828,7 +1836,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -1836,7 +1844,7 @@ "type": "github" } ], - "time": "2021-12-05T09:12:13+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2081,16 +2089,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.10", + "version": "9.5.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807", + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807", "shasum": "" }, "require": { @@ -2106,7 +2114,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -2120,7 +2128,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -2141,11 +2149,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2168,11 +2176,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -2180,7 +2188,7 @@ "type": "github" } ], - "time": "2021-09-25T07:38:51+00:00" + "time": "2022-03-15T09:57:31+00:00" }, { "name": "sebastian/cli-parser", @@ -2688,16 +2696,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -2740,7 +2748,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -2748,7 +2756,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -3039,28 +3047,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3083,7 +3091,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -3091,7 +3099,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", @@ -3276,5 +3284,5 @@ "ext-pdo_sqlite": "*", "ext-zip": "*" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } From b57e0e7746925eb84f21904845d75200af1a070b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 20 Mar 2022 11:42:00 +0000 Subject: [PATCH 125/128] Fix root path detection inside .phar --- zephir | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zephir b/zephir index 64905b3c4a..4c08cf25e9 100755 --- a/zephir +++ b/zephir @@ -82,7 +82,10 @@ if (filter_var(getenv('ZEPHIR_DEBUG'), FILTER_VALIDATE_BOOLEAN)) { }); } -$rootPath = realpath(dirname(__FILE__)); +/** + * When it is executed inside .phar, realpath() will return `false`. + */ +$rootPath = Phar::running() ?: realpath(dirname(__FILE__)); $config = Config::fromServer(); /** From e2e37e2110889cae0d7080f2b4896ea2ccb1732b Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 20 Mar 2022 15:06:34 +0000 Subject: [PATCH 126/128] Update CHANGELOG.md --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4436ba517d..d43b4c719f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,12 @@ The format based on [Keep a Changelog](https://keepachangelog.com) and this project adheres to [Semantic Versioning](https://semver.org). ## [Unreleased] + +## [0.16.0] - 2022-03-20 ### Added - Added custom list of arg info definition (Phalcon only) [#2341](https://github.com/zephir-lang/zephir/issues/2341) - Added support for `int|false` return type (PHP >= 8.0 only) [#2338](https://github.com/zephir-lang/zephir/issues/2338) +- Added support of PHP `8.1` [#2255](https://github.com/zephir-lang/zephir/issues/2255) ### Fixed - Fixed left `null` with `string` condition [#2299](https://github.com/zephir-lang/zephir/issues/2299) @@ -569,7 +572,8 @@ and this project adheres to [Semantic Versioning](https://semver.org). [#1524](https://github.com/zephir-lang/zephir/issues/1524) -[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.15.2...HEAD +[Unreleased]: https://github.com/zephir-lang/zephir/compare/0.16.0...HEAD +[0.16.0]: https://github.com/zephir-lang/zephir/compare/0.15.2...0.16.0 [0.15.2]: https://github.com/zephir-lang/zephir/compare/0.15.1...0.15.2 [0.15.1]: https://github.com/zephir-lang/zephir/compare/0.15.0...0.15.1 [0.15.0]: https://github.com/zephir-lang/zephir/compare/0.14.0...0.15.0 From 76d9a245ccaea933e029e502d7fc51b9cf6b7da4 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 20 Mar 2022 15:13:00 +0000 Subject: [PATCH 127/128] Bump version to `0.16.0` --- Library/Zephir.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Zephir.php b/Library/Zephir.php index 45c76411b2..52ae64c3d8 100644 --- a/Library/Zephir.php +++ b/Library/Zephir.php @@ -16,7 +16,7 @@ */ final class Zephir { - public const VERSION = '0.15.2-$Id$'; + public const VERSION = '0.16.0-$Id$'; public const LOGO = <<<'ASCII' _____ __ _ From fd6e5f1e8139d7f1e88fa370da6aeaa3b650a855 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 20 Mar 2022 15:13:42 +0000 Subject: [PATCH 128/128] Regenerate `ext/` directory --- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/php_stub.h | 2 +- ext/stub.c | 4 +- ext/stub.h | 1 + ext/stub/arrayaccessarr.zep.c | 156 ++++++++++++++++++++++++++++++++++ ext/stub/arrayaccessarr.zep.h | 49 +++++++++++ ext/stub/fannkuch.zep.c | 2 +- ext/stub/mcall.zep.c | 7 +- ext/stub/types/maybe.zep.c | 56 ++++++++++++ ext/stub/types/maybe.zep.h | 28 ++++++ 11 files changed, 299 insertions(+), 9 deletions(-) create mode 100644 ext/stub/arrayaccessarr.zep.c create mode 100644 ext/stub/arrayaccessarr.zep.h create mode 100644 ext/stub/types/maybe.zep.c create mode 100644 ext/stub/types/maybe.zep.h diff --git a/ext/config.m4 b/ext/config.m4 index 0239a40805..f654c649f3 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -213,6 +213,7 @@ if test "$PHP_STUB" = "yes"; then stub/typehinting/testabstract.zep.c stub/typeinstances.zep.c stub/typeoff.zep.c + stub/types/maybe.zep.c stub/types/mixedtype.zep.c stub/unknownclass.zep.c stub/unsettest.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index 9eabe07921..cea2bd118b 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -38,7 +38,7 @@ if (PHP_STUB != "no") { ADD_SOURCES(configure_module_dirname + "/stub/requires", "external3.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/router", "exception.zep.c route.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/typehinting", "testabstract.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/types", "mixedtype.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/types", "maybe.zep.c mixedtype.zep.c", "stub"); ADD_FLAG("CFLAGS_STUB", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); ADD_FLAG("CFLAGS", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); ADD_FLAG("LDFLAGS", "/LTCG"); diff --git a/ext/php_stub.h b/ext/php_stub.h index f77c451e76..1b5391c9f1 100644 --- a/ext/php_stub.h +++ b/ext/php_stub.h @@ -14,7 +14,7 @@ #define PHP_STUB_VERSION "1.0.0" #define PHP_STUB_EXTNAME "stub" #define PHP_STUB_AUTHOR "Phalcon Team and contributors" -#define PHP_STUB_ZEPVERSION "0.15.2-$Id$" +#define PHP_STUB_ZEPVERSION "0.16.0-$Id$" #define PHP_STUB_DESCRIPTION "Description test for
Test Extension." typedef struct _zephir_struct_db { diff --git a/ext/stub.c b/ext/stub.c index ba694c7e7e..aa6294f0a7 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -241,6 +241,7 @@ zend_class_entry *stub_trytest_ce; zend_class_entry *stub_typehinting_testabstract_ce; zend_class_entry *stub_typeinstances_ce; zend_class_entry *stub_typeoff_ce; +zend_class_entry *stub_types_maybe_ce; zend_class_entry *stub_types_mixedtype_ce; zend_class_entry *stub_unknownclass_ce; zend_class_entry *stub_unsettest_ce; @@ -470,6 +471,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_TypeHinting_TestAbstract); ZEPHIR_INIT(Stub_TypeInstances); ZEPHIR_INIT(Stub_Typeoff); + ZEPHIR_INIT(Stub_Types_MayBe); ZEPHIR_INIT(Stub_Types_MixedType); ZEPHIR_INIT(Stub_UnknownClass); ZEPHIR_INIT(Stub_Unsettest); @@ -582,7 +584,7 @@ static PHP_MINFO_FUNCTION(stub) php_info_print_table_start(); php_info_print_table_header(2, "Test Extension support", "Value"); php_info_print_table_row(2, "Lifecycle hooks", "PHP provides several lifecycle events, which extensions can use to perform common initialization or shutdown tasks."); - php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); + php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); php_info_print_table_end(); php_info_print_table_start(); php_info_print_table_header(2, "Test variable", "Value"); diff --git a/ext/stub.h b/ext/stub.h index 2e49dd8007..942bbaba88 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -208,6 +208,7 @@ #include "stub/typehinting/testabstract.zep.h" #include "stub/typeinstances.zep.h" #include "stub/typeoff.zep.h" +#include "stub/types/maybe.zep.h" #include "stub/types/mixedtype.zep.h" #include "stub/unknownclass.zep.h" #include "stub/unsettest.zep.h" diff --git a/ext/stub/arrayaccessarr.zep.c b/ext/stub/arrayaccessarr.zep.c new file mode 100644 index 0000000000..e498d4e969 --- /dev/null +++ b/ext/stub/arrayaccessarr.zep.c @@ -0,0 +1,156 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/memory.h" +#include "kernel/array.h" +#include "kernel/object.h" + + +ZEPHIR_INIT_CLASS(Stub_ArrayAccessArr) +{ + ZEPHIR_REGISTER_CLASS(Stub, ArrayAccessArr, stub, arrayaccessarr, stub_arrayaccessarr_method_entry, 0); + + zend_declare_property_null(stub_arrayaccessarr_ce, SL("test"), ZEND_ACC_PROTECTED); + zend_class_implements(stub_arrayaccessarr_ce, 1, zend_ce_arrayaccess); + return SUCCESS; +} + +PHP_METHOD(Stub_ArrayAccessArr, __construct) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + add_assoc_long_ex(&_0, SL("one"), 1); + add_assoc_long_ex(&_0, SL("two"), 2); + add_assoc_long_ex(&_0, SL("three"), 3); + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &_0); + ZEPHIR_MM_RESTORE(); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetSet) +{ + zval offset_sub, value_sub; + zval *offset, *value; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&value_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(offset) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); + + + if (Z_TYPE_P(offset) == IS_NULL) { + zephir_update_property_array_append(this_ptr, SL("test"), value); + } else { + zephir_update_property_array(this_ptr, SL("test"), offset, value); + } +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetExists) +{ + zval offset_sub, _0; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &offset); + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, offset)); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetUnset) +{ + zval offset_sub, _0; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &offset); + + + zephir_unset_property_array(this_ptr, ZEND_STRL("test"), offset); + zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_0, offset, PH_SEPARATE); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetGet) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, _0, _1, _2; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &offset); + + + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset(&_1, offset)) { + zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_0, &_2, offset, PH_NOISY, "stub/arrayaccessarr.zep", 37); + } else { + ZVAL_NULL(&_0); + } + RETURN_CCTOR(&_0); +} + diff --git a/ext/stub/arrayaccessarr.zep.h b/ext/stub/arrayaccessarr.zep.h new file mode 100644 index 0000000000..0a5755c1a1 --- /dev/null +++ b/ext/stub/arrayaccessarr.zep.h @@ -0,0 +1,49 @@ + +extern zend_class_entry *stub_arrayaccessarr_ce; + +ZEPHIR_INIT_CLASS(Stub_ArrayAccessArr); + +PHP_METHOD(Stub_ArrayAccessArr, __construct); +PHP_METHOD(Stub_ArrayAccessArr, offsetSet); +PHP_METHOD(Stub_ArrayAccessArr, offsetExists); +PHP_METHOD(Stub_ArrayAccessArr, offsetUnset); +PHP_METHOD(Stub_ArrayAccessArr, offsetGet); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessarr___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetset, 0, 2, IS_VOID, 0) + + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetexists, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetunset, 0, 1, IS_VOID, 0) + + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_arrayaccessarr_method_entry) { +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_ArrayAccessArr, __construct, arginfo_stub_arrayaccessarr___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#else + PHP_ME(Stub_ArrayAccessArr, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#endif + PHP_ME(Stub_ArrayAccessArr, offsetSet, arginfo_stub_arrayaccessarr_offsetset, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessArr, offsetExists, arginfo_stub_arrayaccessarr_offsetexists, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessArr, offsetUnset, arginfo_stub_arrayaccessarr_offsetunset, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessArr, offsetGet, arginfo_stub_arrayaccessarr_offsetget, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/ext/stub/fannkuch.zep.c b/ext/stub/fannkuch.zep.c index cff9afa057..91d53018bf 100644 --- a/ext/stub/fannkuch.zep.c +++ b/ext/stub/fannkuch.zep.c @@ -23,7 +23,7 @@ * * Fannkuch Redux in Zephir * - * @see https://disciple-devel.blogspot.mx/2010/11/shootout-fannkuch-redux.html + * @see http://disciple-devel.blogspot.mx/2010/11/shootout-fannkuch-redux.html */ ZEPHIR_INIT_CLASS(Stub_Fannkuch) { diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index bc706450cc..4c277c33e6 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -1208,11 +1208,8 @@ PHP_METHOD(Stub_Mcall, issue1136) if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); object_init_ex(&_finfo, zephir_get_internal_ce(SL("finfo"))); - if (zephir_has_constructor(&_finfo)) { - ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); - zephir_check_call_status(); - } - + ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); + zephir_check_call_status(); } else { ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 59); zephir_check_call_status(); diff --git a/ext/stub/types/maybe.zep.c b/ext/stub/types/maybe.zep.c new file mode 100644 index 0000000000..559628295d --- /dev/null +++ b/ext/stub/types/maybe.zep.c @@ -0,0 +1,56 @@ + +#ifdef HAVE_CONFIG_H +#include "../../ext_config.h" +#endif + +#include +#include "../../php_ext.h" +#include "../../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/operators.h" +#include "kernel/memory.h" +#include "kernel/object.h" + + +ZEPHIR_INIT_CLASS(Stub_Types_MayBe) +{ + ZEPHIR_REGISTER_CLASS(Stub\\Types, MayBe, stub, types_maybe, stub_types_maybe_method_entry, 0); + + return SUCCESS; +} + +PHP_METHOD(Stub_Types_MayBe, gc) +{ + zval *maxlifetime_param = NULL; + zend_long maxlifetime; + zval *this_ptr = getThis(); + +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(maxlifetime) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &maxlifetime_param); + maxlifetime = zephir_get_intval(maxlifetime_param); + + + RETURN_LONG(1); +} + +PHP_METHOD(Stub_Types_MayBe, gcFalse) +{ + zval *this_ptr = getThis(); + + + + RETURN_BOOL(0); +} + diff --git a/ext/stub/types/maybe.zep.h b/ext/stub/types/maybe.zep.h new file mode 100644 index 0000000000..3730deddc8 --- /dev/null +++ b/ext/stub/types/maybe.zep.h @@ -0,0 +1,28 @@ + +extern zend_class_entry *stub_types_maybe_ce; + +ZEPHIR_INIT_CLASS(Stub_Types_MayBe); + +PHP_METHOD(Stub_Types_MayBe, gc); +PHP_METHOD(Stub_Types_MayBe, gcFalse); + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gc, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gc, 0, 1, IS_LONG, 0) +#endif + ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, MAY_BE_LONG|MAY_BE_FALSE) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, IS_LONG, 0) +#endif +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_types_maybe_method_entry) { + PHP_ME(Stub_Types_MayBe, gc, arginfo_stub_types_maybe_gc, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MayBe, gcFalse, arginfo_stub_types_maybe_gcfalse, ZEND_ACC_PUBLIC) + PHP_FE_END +};