From 64b25c4daa347f4fd9da37f07fb3d46b88ca622b Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 11:58:11 +0200 Subject: [PATCH 01/15] =?UTF-8?q?:pushpin:=20N=C2=B04284=20Composer=20libs?= =?UTF-8?q?=20:=20fix=20twig/twig=20to=20~1.42.5=20Without=20specifying=20?= =?UTF-8?q?explicitly=20the=20Twig=20version,=20since=20the=20update=20of?= =?UTF-8?q?=20require=20php=20from=205.6=20to=207.0=20we=20are=20getting?= =?UTF-8?q?=20Twig=202.12.5=20!=20We=20don't=20want=20Twig=202=20as=20this?= =?UTF-8?q?=20version=20changes=20the=20macro=20scope=20and=20causes=20mas?= =?UTF-8?q?sive=20changes=20in=20our=20code...=20This=20update=20will=20be?= =?UTF-8?q?=20done=20later=20in=20other=20branches.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 3 +- composer.lock | 26 ++-- lib/autoload.php | 5 + lib/bin/php-parse | 118 +++++++++++++++++- lib/bin/php-parse.bat | 5 + lib/composer/ClassLoader.php | 2 +- lib/composer/InstalledVersions.php | 15 +++ lib/composer/autoload_classmap.php | 13 +- lib/composer/autoload_files.php | 6 +- lib/composer/autoload_namespaces.php | 2 +- lib/composer/autoload_psr4.php | 2 +- lib/composer/autoload_real.php | 30 ++--- lib/composer/autoload_static.php | 15 ++- lib/composer/include_paths.php | 2 +- lib/composer/installed.json | 20 +-- lib/composer/installed.php | 10 +- lib/composer/platform_check.php | 4 +- lib/twig/twig/CHANGELOG | 4 + lib/twig/twig/LICENSE | 4 +- lib/twig/twig/composer.json | 4 +- lib/twig/twig/ext/twig/php_twig.h | 2 +- lib/twig/twig/src/Environment.php | 6 +- lib/twig/twig/src/ExpressionParser.php | 2 +- lib/twig/twig/src/Extension/CoreExtension.php | 2 +- lib/twig/twig/src/Parser.php | 4 +- lib/twig/twig/src/Sandbox/SecurityPolicy.php | 4 +- lib/twig/twig/src/Template.php | 6 +- 27 files changed, 230 insertions(+), 86 deletions(-) mode change 120000 => 100644 lib/bin/php-parse create mode 100644 lib/bin/php-parse.bat diff --git a/composer.json b/composer.json index c94bff4a4..86f6d1e6a 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "symfony/framework-bundle": "~3.4.47", "symfony/polyfill-php70": "1.*", "symfony/twig-bundle": "~3.4.47", - "symfony/yaml": "~3.4.47" + "symfony/yaml": "~3.4.47", + "twig/twig": "~1.42.5" }, "require-dev": { "symfony/stopwatch": "~3.4.47", diff --git a/composer.lock b/composer.lock index 67b4fcea6..dc6fb38da 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": "9993a936d8716519fc42cc50600cd84f", + "content-hash": "3e305dd9061cf7b6d05ab014a27156d0", "packages": [ { "name": "combodo/tcpdf", @@ -2677,16 +2677,16 @@ }, { "name": "twig/twig", - "version": "v1.42.4", + "version": "v1.42.5", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152" + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/e587180584c3d2d6cb864a0454e777bb6dcb6152", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", "shasum": "" }, "require": { @@ -2695,8 +2695,7 @@ }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^3.4|^4.2", - "symfony/phpunit-bridge": "^4.4@dev|^5.0" + "symfony/phpunit-bridge": "^4.4|^5.0" }, "type": "library", "extra": { @@ -2725,7 +2724,6 @@ }, { "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" }, { @@ -2739,7 +2737,11 @@ "keywords": [ "templating" ], - "time": "2019-11-11T16:49:32+00:00" + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/1.x" + }, + "time": "2020-02-11T05:59:23+00:00" } ], "packages-dev": [ @@ -2973,7 +2975,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6.0", + "php": ">=7.0.8", "ext-ctype": "*", "ext-dom": "*", "ext-gd": "*", @@ -2984,7 +2986,7 @@ }, "platform-dev": [], "platform-overrides": { - "php": "5.6.0" + "php": "7.0.8" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/lib/autoload.php b/lib/autoload.php index 79c1600b5..64168f99a 100644 --- a/lib/autoload.php +++ b/lib/autoload.php @@ -2,6 +2,11 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + exit(1); +} + require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b::getLoader(); diff --git a/lib/bin/php-parse b/lib/bin/php-parse deleted file mode 120000 index 062d66a3e..000000000 --- a/lib/bin/php-parse +++ /dev/null @@ -1 +0,0 @@ -../nikic/php-parser/bin/php-parse \ No newline at end of file diff --git a/lib/bin/php-parse b/lib/bin/php-parse new file mode 100644 index 000000000..80f0e486d --- /dev/null +++ b/lib/bin/php-parse @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse'); + exit(0); + } +} + +include __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse'; diff --git a/lib/bin/php-parse.bat b/lib/bin/php-parse.bat new file mode 100644 index 000000000..2c5096dc3 --- /dev/null +++ b/lib/bin/php-parse.bat @@ -0,0 +1,5 @@ +@ECHO OFF +setlocal DISABLEDELAYEDEXPANSION +SET BIN_TARGET=%~dp0/php-parse +SET COMPOSER_RUNTIME_BIN_DIR=%~dp0 +php "%BIN_TARGET%" %* diff --git a/lib/composer/ClassLoader.php b/lib/composer/ClassLoader.php index 0cd6055d1..afef3fa2a 100644 --- a/lib/composer/ClassLoader.php +++ b/lib/composer/ClassLoader.php @@ -149,7 +149,7 @@ class ClassLoader /** * @return string[] Array of classname => path - * @psalm-var array + * @psalm-return array */ public function getClassMap() { diff --git a/lib/composer/InstalledVersions.php b/lib/composer/InstalledVersions.php index 7c5502ca4..41bc143c1 100644 --- a/lib/composer/InstalledVersions.php +++ b/lib/composer/InstalledVersions.php @@ -21,11 +21,26 @@ use Composer\Semver\VersionParser; * See also https://getcomposer.org/doc/07-runtime.md#installed-versions * * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final */ class InstalledVersions { + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + */ private static $installed; + + /** + * @var bool|null + */ private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ private static $installedByVendor = array(); /** diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index 753caac85..0bfee344b 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -2,7 +2,7 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( @@ -854,9 +854,6 @@ return array( 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser' => $vendorDir . '/symfony/framework-bundle/Templating/TemplateNameParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference' => $vendorDir . '/symfony/framework-bundle/Templating/TemplateReference.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TimedPhpEngine' => $vendorDir . '/symfony/framework-bundle/Templating/TimedPhpEngine.php', - 'Symfony\\Bundle\\FrameworkBundle\\Test\\ForwardCompatTestTrait' => $vendorDir . '/symfony/framework-bundle/Test/ForwardCompatTestTrait.php', - 'Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase' => $vendorDir . '/symfony/framework-bundle/Test/KernelTestCase.php', - 'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => $vendorDir . '/symfony/framework-bundle/Test/WebTestCase.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpExtractor' => $vendorDir . '/symfony/framework-bundle/Translation/PhpExtractor.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpStringTokenParser' => $vendorDir . '/symfony/framework-bundle/Translation/PhpStringTokenParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\TranslationLoader' => $vendorDir . '/symfony/framework-bundle/Translation/TranslationLoader.php', @@ -1661,7 +1658,6 @@ return array( 'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => $vendorDir . '/symfony/var-dumper/Dumper/DataDumperInterface.php', 'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => $vendorDir . '/symfony/var-dumper/Dumper/HtmlDumper.php', 'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => $vendorDir . '/symfony/var-dumper/Exception/ThrowingCasterException.php', - 'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => $vendorDir . '/symfony/var-dumper/Test/VarDumperTestTrait.php', 'Symfony\\Component\\VarDumper\\VarDumper' => $vendorDir . '/symfony/var-dumper/VarDumper.php', 'Symfony\\Component\\Yaml\\Command\\LintCommand' => $vendorDir . '/symfony/yaml/Command/LintCommand.php', 'Symfony\\Component\\Yaml\\Dumper' => $vendorDir . '/symfony/yaml/Dumper.php', @@ -1865,6 +1861,8 @@ return array( 'Twig\\Source' => $vendorDir . '/twig/twig/src/Source.php', 'Twig\\Template' => $vendorDir . '/twig/twig/src/Template.php', 'Twig\\TemplateWrapper' => $vendorDir . '/twig/twig/src/TemplateWrapper.php', + 'Twig\\Test\\IntegrationTestCase' => $vendorDir . '/twig/twig/src/Test/IntegrationTestCase.php', + 'Twig\\Test\\NodeTestCase' => $vendorDir . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => $vendorDir . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AbstractTokenParser.php', 'Twig\\TokenParser\\ApplyTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ApplyTokenParser.php', @@ -2062,6 +2060,11 @@ return array( 'Twig_Test' => $vendorDir . '/twig/twig/lib/Twig/Test.php', 'Twig_TestCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/TestCallableInterface.php', 'Twig_TestInterface' => $vendorDir . '/twig/twig/lib/Twig/TestInterface.php', + 'Twig_Test_Function' => $vendorDir . '/twig/twig/lib/Twig/Test/Function.php', + 'Twig_Test_IntegrationTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php', + 'Twig_Test_Method' => $vendorDir . '/twig/twig/lib/Twig/Test/Method.php', + 'Twig_Test_Node' => $vendorDir . '/twig/twig/lib/Twig/Test/Node.php', + 'Twig_Test_NodeTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/NodeTestCase.php', 'Twig_Token' => $vendorDir . '/twig/twig/lib/Twig/Token.php', 'Twig_TokenParser' => $vendorDir . '/twig/twig/lib/Twig/TokenParser.php', 'Twig_TokenParserBroker' => $vendorDir . '/twig/twig/lib/Twig/TokenParserBroker.php', diff --git a/lib/composer/autoload_files.php b/lib/composer/autoload_files.php index 65bc196d3..6706671aa 100644 --- a/lib/composer/autoload_files.php +++ b/lib/composer/autoload_files.php @@ -2,16 +2,16 @@ // autoload_files.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', '023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php', - '32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php', 'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', + '32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', ); diff --git a/lib/composer/autoload_namespaces.php b/lib/composer/autoload_namespaces.php index d12922d08..e6117c750 100644 --- a/lib/composer/autoload_namespaces.php +++ b/lib/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/lib/composer/autoload_psr4.php b/lib/composer/autoload_psr4.php index 20234ce5e..596febb62 100644 --- a/lib/composer/autoload_psr4.php +++ b/lib/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/lib/composer/autoload_real.php b/lib/composer/autoload_real.php index 661cd2543..752e35fbd 100644 --- a/lib/composer/autoload_real.php +++ b/lib/composer/autoload_real.php @@ -25,33 +25,20 @@ class ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b require __DIR__ . '/platform_check.php'; spl_autoload_register(array('ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; $includePaths[] = get_include_path(); set_include_path(implode(PATH_SEPARATOR, $includePaths)); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit0018331147de7601e7552f7da8e3bb8b::getInitializer($loader)); - } else { - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInit0018331147de7601e7552f7da8e3bb8b::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit0018331147de7601e7552f7da8e3bb8b::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } + $includeFiles = \Composer\Autoload\ComposerStaticInit0018331147de7601e7552f7da8e3bb8b::$files; foreach ($includeFiles as $fileIdentifier => $file) { composerRequire0018331147de7601e7552f7da8e3bb8b($fileIdentifier, $file); } @@ -60,11 +47,16 @@ class ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b } } +/** + * @param string $fileIdentifier + * @param string $file + * @return void + */ function composerRequire0018331147de7601e7552f7da8e3bb8b($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - require $file; - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; } } diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php index ee0ac2f41..b8bcc954b 100644 --- a/lib/composer/autoload_static.php +++ b/lib/composer/autoload_static.php @@ -7,12 +7,12 @@ namespace Composer\Autoload; class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b { public static $files = array ( - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', '023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php', - '32dcc8afd4335739640db7d200c1971d' => __DIR__ . '/..' . '/symfony/polyfill-apcu/bootstrap.php', 'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php', + '32dcc8afd4335739640db7d200c1971d' => __DIR__ . '/..' . '/symfony/polyfill-apcu/bootstrap.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', ); @@ -1084,9 +1084,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateNameParser' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TemplateNameParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TemplateReference' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TemplateReference.php', 'Symfony\\Bundle\\FrameworkBundle\\Templating\\TimedPhpEngine' => __DIR__ . '/..' . '/symfony/framework-bundle/Templating/TimedPhpEngine.php', - 'Symfony\\Bundle\\FrameworkBundle\\Test\\ForwardCompatTestTrait' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/ForwardCompatTestTrait.php', - 'Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/KernelTestCase.php', - 'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/WebTestCase.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpExtractor' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/PhpExtractor.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpStringTokenParser' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/PhpStringTokenParser.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\TranslationLoader' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/TranslationLoader.php', @@ -1891,7 +1888,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/DataDumperInterface.php', 'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/HtmlDumper.php', 'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => __DIR__ . '/..' . '/symfony/var-dumper/Exception/ThrowingCasterException.php', - 'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => __DIR__ . '/..' . '/symfony/var-dumper/Test/VarDumperTestTrait.php', 'Symfony\\Component\\VarDumper\\VarDumper' => __DIR__ . '/..' . '/symfony/var-dumper/VarDumper.php', 'Symfony\\Component\\Yaml\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/yaml/Command/LintCommand.php', 'Symfony\\Component\\Yaml\\Dumper' => __DIR__ . '/..' . '/symfony/yaml/Dumper.php', @@ -2095,6 +2091,8 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Twig\\Source' => __DIR__ . '/..' . '/twig/twig/src/Source.php', 'Twig\\Template' => __DIR__ . '/..' . '/twig/twig/src/Template.php', 'Twig\\TemplateWrapper' => __DIR__ . '/..' . '/twig/twig/src/TemplateWrapper.php', + 'Twig\\Test\\IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/IntegrationTestCase.php', + 'Twig\\Test\\NodeTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => __DIR__ . '/..' . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AbstractTokenParser.php', 'Twig\\TokenParser\\ApplyTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ApplyTokenParser.php', @@ -2292,6 +2290,11 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Twig_Test' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test.php', 'Twig_TestCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestCallableInterface.php', 'Twig_TestInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestInterface.php', + 'Twig_Test_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Function.php', + 'Twig_Test_IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php', + 'Twig_Test_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Method.php', + 'Twig_Test_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Node.php', + 'Twig_Test_NodeTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/NodeTestCase.php', 'Twig_Token' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Token.php', 'Twig_TokenParser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser.php', 'Twig_TokenParserBroker' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserBroker.php', diff --git a/lib/composer/include_paths.php b/lib/composer/include_paths.php index d4fb96718..af33c1491 100644 --- a/lib/composer/include_paths.php +++ b/lib/composer/include_paths.php @@ -2,7 +2,7 @@ // include_paths.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/lib/composer/installed.json b/lib/composer/installed.json index 7dfe785e3..87a25eb41 100644 --- a/lib/composer/installed.json +++ b/lib/composer/installed.json @@ -3017,17 +3017,17 @@ }, { "name": "twig/twig", - "version": "v1.42.4", - "version_normalized": "1.42.4.0", + "version": "v1.42.5", + "version_normalized": "1.42.5.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152" + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/e587180584c3d2d6cb864a0454e777bb6dcb6152", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", "shasum": "" }, "require": { @@ -3036,10 +3036,9 @@ }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^3.4|^4.2", - "symfony/phpunit-bridge": "^4.4@dev|^5.0" + "symfony/phpunit-bridge": "^4.4|^5.0" }, - "time": "2019-11-11T16:49:32+00:00", + "time": "2020-02-11T05:59:23+00:00", "type": "library", "extra": { "branch-alias": { @@ -3068,7 +3067,6 @@ }, { "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" }, { @@ -3082,6 +3080,10 @@ "keywords": [ "templating" ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/1.x" + }, "install-path": "../twig/twig" } ], diff --git a/lib/composer/installed.php b/lib/composer/installed.php index 0e7baac98..f13e6c3fe 100644 --- a/lib/composer/installed.php +++ b/lib/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '9ad341f73a2aa0bd50515d88e1daac99b124238f', + 'reference' => '51fdd8ab85c2859972d4ecbb40c711f8857cf05c', 'name' => '__root__', 'dev' => true, ), @@ -16,7 +16,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '9ad341f73a2aa0bd50515d88e1daac99b124238f', + 'reference' => '51fdd8ab85c2859972d4ecbb40c711f8857cf05c', 'dev_requirement' => false, ), 'combodo/tcpdf' => array( @@ -425,12 +425,12 @@ ), ), 'twig/twig' => array( - 'pretty_version' => 'v1.42.4', - 'version' => '1.42.4.0', + 'pretty_version' => 'v1.42.5', + 'version' => '1.42.5.0', 'type' => 'library', 'install_path' => __DIR__ . '/../twig/twig', 'aliases' => array(), - 'reference' => 'e587180584c3d2d6cb864a0454e777bb6dcb6152', + 'reference' => '87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e', 'dev_requirement' => false, ), ), diff --git a/lib/composer/platform_check.php b/lib/composer/platform_check.php index 8b379f446..85ef2d984 100644 --- a/lib/composer/platform_check.php +++ b/lib/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 50600)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 70008)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.8". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/lib/twig/twig/CHANGELOG b/lib/twig/twig/CHANGELOG index b9833e51e..e549c9307 100644 --- a/lib/twig/twig/CHANGELOG +++ b/lib/twig/twig/CHANGELOG @@ -1,3 +1,7 @@ +* 1.42.5 (2020-02-11) + + * Fix implementation of case-insensitivity for method names + * 1.42.4 (2019-11-11) * optimized "block('foo') ?? 'bar" diff --git a/lib/twig/twig/LICENSE b/lib/twig/twig/LICENSE index d06ced2a3..5e8a0b8b9 100644 --- a/lib/twig/twig/LICENSE +++ b/lib/twig/twig/LICENSE @@ -1,6 +1,4 @@ -Copyright (c) 2009-2019 by the Twig Team. - -Some rights reserved. +Copyright (c) 2009-2020 by the Twig Team. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/lib/twig/twig/composer.json b/lib/twig/twig/composer.json index 9807aa771..c306353a9 100644 --- a/lib/twig/twig/composer.json +++ b/lib/twig/twig/composer.json @@ -14,7 +14,6 @@ }, { "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" }, { @@ -28,8 +27,7 @@ "symfony/polyfill-ctype": "^1.8" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4@dev|^5.0", - "symfony/debug": "^3.4|^4.2", + "symfony/phpunit-bridge": "^4.4|^5.0", "psr/container": "^1.0" }, "autoload": { diff --git a/lib/twig/twig/ext/twig/php_twig.h b/lib/twig/twig/ext/twig/php_twig.h index 6cc47b689..344539aba 100644 --- a/lib/twig/twig/ext/twig/php_twig.h +++ b/lib/twig/twig/ext/twig/php_twig.h @@ -15,7 +15,7 @@ #ifndef PHP_TWIG_H #define PHP_TWIG_H -#define PHP_TWIG_VERSION "1.42.4" +#define PHP_TWIG_VERSION "1.42.5-DEV" #include "php.h" diff --git a/lib/twig/twig/src/Environment.php b/lib/twig/twig/src/Environment.php index 1f80f3a87..97fa4c4db 100644 --- a/lib/twig/twig/src/Environment.php +++ b/lib/twig/twig/src/Environment.php @@ -41,11 +41,11 @@ use Twig\TokenParser\TokenParserInterface; */ class Environment { - const VERSION = '1.42.4'; - const VERSION_ID = 14204; + const VERSION = '1.42.5'; + const VERSION_ID = 14205; const MAJOR_VERSION = 1; const MINOR_VERSION = 42; - const RELEASE_VERSION = 4; + const RELEASE_VERSION = 5; const EXTRA_VERSION = ''; protected $charset; diff --git a/lib/twig/twig/src/ExpressionParser.php b/lib/twig/twig/src/ExpressionParser.php index 9066ade16..a3ff72530 100644 --- a/lib/twig/twig/src/ExpressionParser.php +++ b/lib/twig/twig/src/ExpressionParser.php @@ -657,7 +657,7 @@ class ExpressionParser $stream->expect(Token::NAME_TYPE, null, 'Only variables can be assigned to'); } $value = $token->getValue(); - if (\in_array(strtolower($value), ['true', 'false', 'none', 'null'])) { + if (\in_array(strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), ['true', 'false', 'none', 'null'])) { throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); } $targets[] = new AssignNameExpression($value, $token->getLine()); diff --git a/lib/twig/twig/src/Extension/CoreExtension.php b/lib/twig/twig/src/Extension/CoreExtension.php index 5f3cc24a1..5ff1e39ee 100644 --- a/lib/twig/twig/src/Extension/CoreExtension.php +++ b/lib/twig/twig/src/Extension/CoreExtension.php @@ -459,7 +459,7 @@ function twig_date_modify_filter(Environment $env, $date, $modifier) * @param \DateTime|\DateTimeInterface|string|null $date A date * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged * - * @return \DateTime + * @return \DateTimeInterface */ function twig_date_converter(Environment $env, $date = null, $timezone = null) { diff --git a/lib/twig/twig/src/Parser.php b/lib/twig/twig/src/Parser.php index 0ea102cc8..9fb6a83a4 100644 --- a/lib/twig/twig/src/Parser.php +++ b/lib/twig/twig/src/Parser.php @@ -299,7 +299,7 @@ class Parser implements \Twig_ParserInterface $this->reservedMacroNames = []; $r = new \ReflectionClass($this->env->getBaseTemplateClass()); foreach ($r->getMethods() as $method) { - $methodName = strtolower($method->getName()); + $methodName = strtr($method->getName(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); if ('get' === substr($methodName, 0, 3) && isset($methodName[3])) { $this->reservedMacroNames[] = substr($methodName, 3); @@ -307,7 +307,7 @@ class Parser implements \Twig_ParserInterface } } - return \in_array(strtolower($name), $this->reservedMacroNames); + return \in_array(strtr($name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), $this->reservedMacroNames); } public function addTrait($trait) diff --git a/lib/twig/twig/src/Sandbox/SecurityPolicy.php b/lib/twig/twig/src/Sandbox/SecurityPolicy.php index 31b6c3483..603843591 100644 --- a/lib/twig/twig/src/Sandbox/SecurityPolicy.php +++ b/lib/twig/twig/src/Sandbox/SecurityPolicy.php @@ -51,7 +51,7 @@ class SecurityPolicy implements SecurityPolicyInterface { $this->allowedMethods = []; foreach ($methods as $class => $m) { - $this->allowedMethods[$class] = array_map('strtolower', \is_array($m) ? $m : [$m]); + $this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); } } @@ -93,7 +93,7 @@ class SecurityPolicy implements SecurityPolicyInterface } $allowed = false; - $method = strtolower($method); + $method = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); foreach ($this->allowedMethods as $class => $methods) { if ($obj instanceof $class) { $allowed = \in_array($method, $methods); diff --git a/lib/twig/twig/src/Template.php b/lib/twig/twig/src/Template.php index 3f7447c12..704125e53 100644 --- a/lib/twig/twig/src/Template.php +++ b/lib/twig/twig/src/Template.php @@ -628,7 +628,7 @@ abstract class Template implements \Twig_TemplateInterface foreach ($ref->getMethods(\ReflectionMethod::IS_PUBLIC) as $refMethod) { // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment - if ('getenvironment' !== strtolower($refMethod->name)) { + if ('getenvironment' !== strtr($refMethod->name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) { $methods[] = $refMethod->name; } } @@ -642,7 +642,7 @@ abstract class Template implements \Twig_TemplateInterface foreach ($methods as $method) { $cache[$method] = $method; - $cache[$lcName = strtolower($method)] = $method; + $cache[$lcName = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')] = $method; if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { $name = substr($method, 3); @@ -670,7 +670,7 @@ abstract class Template implements \Twig_TemplateInterface $call = false; if (isset(self::$cache[$class][$item])) { $method = self::$cache[$class][$item]; - } elseif (isset(self::$cache[$class][$lcItem = strtolower($item)])) { + } elseif (isset(self::$cache[$class][$lcItem = strtr($item, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')])) { $method = self::$cache[$class][$lcItem]; } elseif (isset(self::$cache[$class]['__call'])) { $method = $item; From f15ef36fd1a9bbfd5f15de43da33cdd1daf2a20d Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 12:10:22 +0200 Subject: [PATCH 02/15] =?UTF-8?q?:heavy=5Fminus=5Fsign:=20N=C2=B04284=20Co?= =?UTF-8?q?mposer=20libs=20:=20remove=20symfony/polyfill-php70=20Though=20?= =?UTF-8?q?it=20is=20still=20downloaded=20because=20asked=20by=20symfony?= =?UTF-8?q?=20framework,=20but=20as=20we=20don't=20need=20it=20in=20our=20?= =?UTF-8?q?code=20no=20need=20to=20specify=20it=20here=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 86f6d1e6a..0b574dbc6 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,6 @@ "symfony/console": "~3.4.47", "symfony/dotenv": "~3.4.47", "symfony/framework-bundle": "~3.4.47", - "symfony/polyfill-php70": "1.*", "symfony/twig-bundle": "~3.4.47", "symfony/yaml": "~3.4.47", "twig/twig": "~1.42.5" From f8d435d5f382dc97974cb4b4a50dd57ecbc6b507 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 12:11:48 +0200 Subject: [PATCH 03/15] =?UTF-8?q?N=C2=B04284=20Composer=20libs=20:=20refre?= =?UTF-8?q?sh=20symfony?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 32 +++++++++++++++--------------- lib/composer/autoload_classmap.php | 7 ------- lib/composer/autoload_static.php | 7 ------- lib/composer/installed.php | 4 ++-- 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/composer.lock b/composer.lock index dc6fb38da..c4b3cf6ba 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": "3e305dd9061cf7b6d05ab014a27156d0", + "content-hash": "5141c3dfb5b8f6fdd5b262270fec9776", "packages": [ { "name": "combodo/tcpdf", @@ -1968,12 +1968,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2047,12 +2047,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2125,12 +2125,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php56\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2202,12 +2202,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, "classmap": [ "Resources/stubs" ] diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index 0bfee344b..0961e54e0 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -1861,8 +1861,6 @@ return array( 'Twig\\Source' => $vendorDir . '/twig/twig/src/Source.php', 'Twig\\Template' => $vendorDir . '/twig/twig/src/Template.php', 'Twig\\TemplateWrapper' => $vendorDir . '/twig/twig/src/TemplateWrapper.php', - 'Twig\\Test\\IntegrationTestCase' => $vendorDir . '/twig/twig/src/Test/IntegrationTestCase.php', - 'Twig\\Test\\NodeTestCase' => $vendorDir . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => $vendorDir . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AbstractTokenParser.php', 'Twig\\TokenParser\\ApplyTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ApplyTokenParser.php', @@ -2060,11 +2058,6 @@ return array( 'Twig_Test' => $vendorDir . '/twig/twig/lib/Twig/Test.php', 'Twig_TestCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/TestCallableInterface.php', 'Twig_TestInterface' => $vendorDir . '/twig/twig/lib/Twig/TestInterface.php', - 'Twig_Test_Function' => $vendorDir . '/twig/twig/lib/Twig/Test/Function.php', - 'Twig_Test_IntegrationTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php', - 'Twig_Test_Method' => $vendorDir . '/twig/twig/lib/Twig/Test/Method.php', - 'Twig_Test_Node' => $vendorDir . '/twig/twig/lib/Twig/Test/Node.php', - 'Twig_Test_NodeTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/NodeTestCase.php', 'Twig_Token' => $vendorDir . '/twig/twig/lib/Twig/Token.php', 'Twig_TokenParser' => $vendorDir . '/twig/twig/lib/Twig/TokenParser.php', 'Twig_TokenParserBroker' => $vendorDir . '/twig/twig/lib/Twig/TokenParserBroker.php', diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php index b8bcc954b..8afe4c51d 100644 --- a/lib/composer/autoload_static.php +++ b/lib/composer/autoload_static.php @@ -2091,8 +2091,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Twig\\Source' => __DIR__ . '/..' . '/twig/twig/src/Source.php', 'Twig\\Template' => __DIR__ . '/..' . '/twig/twig/src/Template.php', 'Twig\\TemplateWrapper' => __DIR__ . '/..' . '/twig/twig/src/TemplateWrapper.php', - 'Twig\\Test\\IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/IntegrationTestCase.php', - 'Twig\\Test\\NodeTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => __DIR__ . '/..' . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AbstractTokenParser.php', 'Twig\\TokenParser\\ApplyTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ApplyTokenParser.php', @@ -2290,11 +2288,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Twig_Test' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test.php', 'Twig_TestCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestCallableInterface.php', 'Twig_TestInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestInterface.php', - 'Twig_Test_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Function.php', - 'Twig_Test_IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php', - 'Twig_Test_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Method.php', - 'Twig_Test_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Node.php', - 'Twig_Test_NodeTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/NodeTestCase.php', 'Twig_Token' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Token.php', 'Twig_TokenParser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser.php', 'Twig_TokenParserBroker' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserBroker.php', diff --git a/lib/composer/installed.php b/lib/composer/installed.php index f13e6c3fe..4850fad9c 100644 --- a/lib/composer/installed.php +++ b/lib/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '51fdd8ab85c2859972d4ecbb40c711f8857cf05c', + 'reference' => '9f9560f322ed091f816fa7c0b03442a02bb82325', 'name' => '__root__', 'dev' => true, ), @@ -16,7 +16,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '51fdd8ab85c2859972d4ecbb40c711f8857cf05c', + 'reference' => '9f9560f322ed091f816fa7c0b03442a02bb82325', 'dev_requirement' => false, ), 'combodo/tcpdf' => array( From 5fe0d0b94f0dcbdf35a6794ad7ce1fa00e135ef8 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 12:15:44 +0200 Subject: [PATCH 04/15] =?UTF-8?q?:arrow=5Fup:=20N=C2=B04284=20Composer=20l?= =?UTF-8?q?ibs=20:=20update=20combodo/tcpdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- composer.lock | 36 +- lib/combodo/tcpdf/.github/FUNDING.yml | 1 - lib/combodo/tcpdf/.gitignore | 1 - lib/combodo/tcpdf/CHANGELOG.TXT | 121 +- lib/combodo/tcpdf/README.md | 2 +- lib/combodo/tcpdf/VERSION | 2 +- lib/combodo/tcpdf/composer.json | 14 +- .../tcpdf/include/barcodes/datamatrix.php | 118 +- lib/combodo/tcpdf/include/barcodes/pdf417.php | 28 +- lib/combodo/tcpdf/include/barcodes/qrcode.php | 399 +-- lib/combodo/tcpdf/include/tcpdf_colors.php | 22 +- lib/combodo/tcpdf/include/tcpdf_filters.php | 52 +- lib/combodo/tcpdf/include/tcpdf_fonts.php | 176 +- lib/combodo/tcpdf/include/tcpdf_images.php | 37 +- lib/combodo/tcpdf/include/tcpdf_static.php | 345 +- lib/combodo/tcpdf/tcpdf.php | 3121 +++++++++-------- lib/combodo/tcpdf/tcpdf_barcodes_1d.php | 141 +- lib/combodo/tcpdf/tcpdf_barcodes_2d.php | 46 +- lib/combodo/tcpdf/tcpdf_import.php | 2 +- lib/combodo/tcpdf/tcpdf_parser.php | 42 +- lib/composer/installed.json | 32 +- lib/composer/installed.php | 12 +- 23 files changed, 2535 insertions(+), 2217 deletions(-) delete mode 100644 lib/combodo/tcpdf/.github/FUNDING.yml delete mode 100644 lib/combodo/tcpdf/.gitignore diff --git a/composer.json b/composer.json index 0b574dbc6..707ad5051 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "ext-json": "*", "ext-mysqli": "*", "ext-soap": "*", - "combodo/tcpdf": "6.3.5", + "combodo/tcpdf": "~6.4.4", "nikic/php-parser": "^3.1", "pear/archive_tar": "1.4.14", "pelago/emogrifier": "2.1.0", diff --git a/composer.lock b/composer.lock index c4b3cf6ba..f6e6277e3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5141c3dfb5b8f6fdd5b262270fec9776", + "content-hash": "8efc1677968f1aeda2977543982242e6", "packages": [ { "name": "combodo/tcpdf", - "version": "6.3.5", + "version": "6.4.4", "source": { "type": "git", "url": "https://github.com/combodo-itop-libs/TCPDF.git", - "reference": "aedd4b7b8cf7fcc24e617c405c9d3304150f4b94" + "reference": "0e31c013ccd000aa6762e9186778aa6e259ac8e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/aedd4b7b8cf7fcc24e617c405c9d3304150f4b94", - "reference": "aedd4b7b8cf7fcc24e617c405c9d3304150f4b94", + "url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/0e31c013ccd000aa6762e9186778aa6e259ac8e8", + "reference": "0e31c013ccd000aa6762e9186778aa6e259ac8e8", "shasum": "" }, "require": { @@ -62,9 +62,27 @@ "email": "contact@combodo.com" } ], - "description": "TCPDF fork adding requirements for iTop: Specific fonts.", + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", "homepage": "https://github.com/combodo-itop-libs/TCPDF", - "time": "2020-09-28T12:19:09+00:00" + "keywords": [ + "PDFD32000-2008", + "TCPDF", + "barcodes", + "datamatrix", + "pdf", + "pdf417", + "qrcode" + ], + "support": { + "source": "https://github.com/combodo-itop-libs/TCPDF/tree/6.4.4" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project", + "type": "custom" + } + ], + "time": "2022-03-10T14:36:39+00:00" }, { "name": "nikic/php-parser", @@ -115,6 +133,10 @@ "parser", "php" ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v3.1.5" + }, "time": "2018-02-28T20:30:58+00:00" }, { diff --git a/lib/combodo/tcpdf/.github/FUNDING.yml b/lib/combodo/tcpdf/.github/FUNDING.yml deleted file mode 100644 index ca5b4292e..000000000 --- a/lib/combodo/tcpdf/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: ['https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project'] diff --git a/lib/combodo/tcpdf/.gitignore b/lib/combodo/tcpdf/.gitignore deleted file mode 100644 index 723ef36f4..000000000 --- a/lib/combodo/tcpdf/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea \ No newline at end of file diff --git a/lib/combodo/tcpdf/CHANGELOG.TXT b/lib/combodo/tcpdf/CHANGELOG.TXT index 3bdae3e24..e90bd161a 100644 --- a/lib/combodo/tcpdf/CHANGELOG.TXT +++ b/lib/combodo/tcpdf/CHANGELOG.TXT @@ -1,16 +1,129 @@ -6.2.25 +6.4.4 (2021-12-31) + - PHP 8.1 fixes + +6.4.3 (2021-12-28) + - Fix MultiCell PHPDoc typehint (#407) + - Fix type hint for \TCPDF_STATIC::_freadint (#414) + - Footer and Header font phpdoc fixes + constructor $pdfa phpdoc fix + setHeaderData lw param fix (#402) + - Fix text-annotation state options (#412) + - Fix - Named links have been broken. This fixes. (#415) + - Fixed type in comment for $lw header image logo width in mm + - Change Set to set. Fixes #419 (#421) + - Fix failing tests and failing tests not marking exit code as 1 (#426) + - Fix phpdoc and prefer null as default value (#444) + - Run on PHP 8.1 normally and add nightly PHP as allowed to fail (#452) + - Fix AES128 encryption if the OpenSSL extension is installed (#453) + - Explicitly cast values to int for imagesetpixel (#460) + - Fix cell_height_ratio type (#405) + - Leave &NBSP; lowercase when using text-transform (#403) + +6.4.2 (2021-07-20) + - Fix PHP 8.1 type error with TCPDF_STATIC::pregSplit on preg_split + - Fix a PHP array offset error + - Fixed phpdoc blocks + - Drop a PHP 4 polyfill and add a .gitattributes file + - Added a test-suite + - Removed pointless assignments + - Fix docblock spelling error + - Update version info + - Fix color being filled to type 0 with PHP 8 + - Fix warnings for undefined tags for $lineStyle + - Normalized composer.json + - Allowed transparency in PDF/A-2 and PDF/A-3 + - Add a TCPDF composer example + - Fixed implicit conversion from float to int for PHP 8.1 + - Removed status.txt from font directories, because of filesize + - Fixed type hints + - Removed "U" modifier from regexes + +6.4.1 (2021-03-27) + - Update tcpdf version (no code changes) + +6.4.0 (2021-03-27) + - allow styles on
tags + - check if file exists before calling unlink + - Fix image file type for urls with query params + - Fix SVGPath should accept 1.19.30 (equiv 1.19,.30) compacted values list + - Fix Second parameter of TCPDF::cell() must be a number + - PHP 8.0 function signature fixes + - Fix vulnerability to roman numeral bombs + - Optimized a regular expression + - Cache file get contents calls + - Remove mb_internal encoding handling + +6.3.5 (2020-02-14) + - Fixed curly braces in pdf417 + - Fixed a syntax error issue when accessing an index of a casted variable + +6.3.4 (2020-02-12) + - Check if imagekeys exist + - Unlink only images in cache + +6.3.3 (2020-02-12) + - Fixed PHP 7.4 - cannot use array offset on integers + - Fixed PDF/A-3B validation issue caused by missing pdfaSchema:property. + - Removed backup changelog files from repo + - Prevents the deletion of non-existent files in /tmp + - Prevent crash in case of no list access in cache path + - Check existence of file before delete it + - Fixed erase users pictures + - Fixed problem with $imagekeys undefined or unlinked + - Fix SVGPath elliptical arc with rx/ry=0 + z should return to initial point + - Fixed PHP 7.4 errors + - handle integers for pages + - Fixed background image doesn't work in RTL + - Fixed PDF/A validity + - Fixed datamatrix.php for PHP 7.4 + - Fixed deprecated PHP features + +6.3.2 (2019-09-20) + - Update ICC profile + +6.3.1 (2019-09-20) + - Fix reported version + - Fix Undefined property: GLPIPDF::$imagekeys + +6.3.0 (2019-09-19) + - fix SpotColor handling in HTML + - Add an additional empty test to prevent error in PHP 7.2 + - Fix the documentation how to calculate the cell height + - Drop duplicated array indices + - Fix TCPDF_STATIC::fileGetContents() + - Introduce other version of pdfA (2 and 3) + - Add UF and AFRelationship missing + - Fix performance issue of cloned instances + - Change glob to readdir which performs better + - URI in PDF can result in E_NOTICE + - Fix a warning for PHP 7.4 + - Fixed gradient offsets for percentage-based stops. + - Fixed file_get_contents return value should also be checked for a non-empty string + - Fix Array and string offset access syntax with curly braces is deprecated + - Fix PHP Warning: chr() expects parameter 1 to be int + - Add a VERSION file + +6.2.26 (2018-10-16) + - Update sRGB.icc with the one from the Debian package icc-profiles-free + - Fix unsupported operand types error when codepoints arrays are merged + +6.2.25 (2018-09-23) - Fix support for image URLs. 6.2.24 - Support remote urls when checking if file exists. -6.2.23 +6.2.23 (2018-09-22) - Simplify file_exists function. -6.2.22 +6.2.22 (2018-09-14) + - Fixes on `include/tcpdf_images.php`, `include/tcpdf_static.php` and `tcpdf.php` about file handling + +6.2.21 (2018-09-14) + - _no code changes_ + +6.2.20 (2018-09-14) - Fix for security vulnerability: Using the phar:// wrapper it was possible to trigger the unserialization of user provided data. -6.2.19 +6.2.19 (2018-09-14) - Merge various fixes for PHP 7.3 compatibility and security. 6.2.13 (2016-06-10) diff --git a/lib/combodo/tcpdf/README.md b/lib/combodo/tcpdf/README.md index db0149f69..0fb94009b 100644 --- a/lib/combodo/tcpdf/README.md +++ b/lib/combodo/tcpdf/README.md @@ -6,7 +6,7 @@ * **category** Library * **author** Nicola Asuni -* **copyright** 2002-2020 Nicola Asuni - Tecnick.com LTD +* **copyright** 2002-2021 Nicola Asuni - Tecnick.com LTD * **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT) * **link** http://www.tcpdf.org * **source** https://github.com/tecnickcom/TCPDF diff --git a/lib/combodo/tcpdf/VERSION b/lib/combodo/tcpdf/VERSION index b98d1d3fa..49df80bfe 100644 --- a/lib/combodo/tcpdf/VERSION +++ b/lib/combodo/tcpdf/VERSION @@ -1 +1 @@ -6.3.5 +6.4.4 diff --git a/lib/combodo/tcpdf/composer.json b/lib/combodo/tcpdf/composer.json index fe90ae9eb..b53dd6e7f 100644 --- a/lib/combodo/tcpdf/composer.json +++ b/lib/combodo/tcpdf/composer.json @@ -3,9 +3,19 @@ "replace": { "tecnickcom/tcpdf": "self.version" }, - "homepage": "https://github.com/combodo-itop-libs/TCPDF", "type": "library", - "description": "TCPDF fork adding requirements for iTop: Specific fonts.", + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", + "keywords": [ + "PDF", + "tcpdf", + "PDFD32000-2008", + "qrcode", + "datamatrix", + "pdf417", + "barcodes" + ], + "homepage": "https://github.com/combodo-itop-libs/TCPDF", + "version": "6.4.4", "license": "LGPL-3.0-only", "authors": [ { diff --git a/lib/combodo/tcpdf/include/barcodes/datamatrix.php b/lib/combodo/tcpdf/include/barcodes/datamatrix.php index 783f99da4..38bd625f7 100644 --- a/lib/combodo/tcpdf/include/barcodes/datamatrix.php +++ b/lib/combodo/tcpdf/include/barcodes/datamatrix.php @@ -229,7 +229,7 @@ class Datamatrix { /** * This is the class constructor. * Creates a datamatrix object - * @param $code (string) Code to represent using Datamatrix. + * @param string $code Code to represent using Datamatrix. * @public */ public function __construct($code) { @@ -355,11 +355,11 @@ class Datamatrix { /** * Product of two numbers in a Power-of-Two Galois Field - * @param $a (int) first number to multiply. - * @param $b (int) second number to multiply. - * @param $log (array) Log table. - * @param $alog (array) Anti-Log table. - * @param $gf (array) Number of Factors of the Reed-Solomon polynomial. + * @param int $a first number to multiply. + * @param int $b second number to multiply. + * @param array $log Log table. + * @param array $alog Anti-Log table. + * @param int $gf Number of Factors of the Reed-Solomon polynomial. * @return int product * @protected */ @@ -372,12 +372,12 @@ class Datamatrix { /** * Add error correction codewords to data codewords array (ANNEX E). - * @param $wd (array) Array of datacodewords. - * @param $nb (int) Number of blocks. - * @param $nd (int) Number of data codewords per block. - * @param $nc (int) Number of correction codewords per block. - * @param $gf (int) numner of fields on log/antilog table (power of 2). - * @param $pp (int) The value of its prime modulus polynomial (301 for ECC200). + * @param array $wd Array of datacodewords. + * @param int $nb Number of blocks. + * @param int $nd Number of data codewords per block. + * @param int $nc Number of correction codewords per block. + * @param int $gf numner of fields on log/antilog table (power of 2). + * @param int $pp The value of its prime modulus polynomial (301 for ECC200). * @return array data codewords + error codewords * @protected */ @@ -438,9 +438,9 @@ class Datamatrix { /** * Return the 253-state codeword - * @param $cwpad (int) Pad codeword. - * @param $cwpos (int) Number of data codewords from the beginning of encoded data. - * @return pad codeword + * @param int $cwpad Pad codeword. + * @param int $cwpos Number of data codewords from the beginning of encoded data. + * @return int pad codeword * @protected */ protected function get253StateCodeword($cwpad, $cwpos) { @@ -453,9 +453,9 @@ class Datamatrix { /** * Return the 255-state codeword - * @param $cwpad (int) Pad codeword. - * @param $cwpos (int) Number of data codewords from the beginning of encoded data. - * @return pad codeword + * @param int $cwpad Pad codeword. + * @param int $cwpos Number of data codewords from the beginning of encoded data. + * @return int pad codeword * @protected */ protected function get255StateCodeword($cwpad, $cwpos) { @@ -468,8 +468,8 @@ class Datamatrix { /** * Returns true if the char belongs to the selected mode - * @param $chr (int) Character (byte) to check. - * @param $mode (int) Current encoding mode. + * @param int $chr Character (byte) to check. + * @param int $mode Current encoding mode. * @return boolean true if the char is of the selected mode. * @protected */ @@ -514,9 +514,9 @@ class Datamatrix { /** * The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S). - * @param $data (string) data to encode - * @param $pos (int) current position - * @param $mode (int) current encoding mode + * @param string $data data to encode + * @param int $pos current position + * @param int $mode current encoding mode * @return int encoding mode * @protected */ @@ -646,8 +646,8 @@ class Datamatrix { /** * Get the switching codeword to a new encoding mode (latch codeword) - * @param $mode (int) New encoding mode. - * @return (int) Switch codeword. + * @param int $mode New encoding mode. + * @return int Switch codeword. * @protected */ protected function getSwitchEncodingCodeword($mode) { @@ -685,8 +685,8 @@ class Datamatrix { /** * Choose the minimum matrix size and return the max number of data codewords. - * @param $numcw (int) Number of current codewords. - * @return number of data codewords in matrix + * @param int $numcw Number of current codewords. + * @return int number of data codewords in matrix * @protected */ protected function getMaxDataCodewords($numcw) { @@ -700,7 +700,7 @@ class Datamatrix { /** * Get high level encoding using the minimum symbol data characters for ECC 200 - * @param $data (string) data to encode + * @param string $data data to encode * @return array of codewords * @protected */ @@ -970,13 +970,13 @@ class Datamatrix { /** * Places "chr+bit" with appropriate wrapping within array[]. * (Annex F - ECC 200 symbol character placement) - * @param $marr (array) Array of symbols. - * @param $nrow (int) Number of rows. - * @param $ncol (int) Number of columns. - * @param $row (int) Row number. - * @param $col (int) Column number. - * @param $chr (int) Char byte. - * @param $bit (int) Bit. + * @param array $marr Array of symbols. + * @param int $nrow Number of rows. + * @param int $ncol Number of columns. + * @param int $row Row number. + * @param int $col Column number. + * @param int $chr Char byte. + * @param int $bit Bit. * @return array * @protected */ @@ -996,12 +996,12 @@ class Datamatrix { /** * Places the 8 bits of a utah-shaped symbol character. * (Annex F - ECC 200 symbol character placement) - * @param $marr (array) Array of symbols. - * @param $nrow (int) Number of rows. - * @param $ncol (int) Number of columns. - * @param $row (int) Row number. - * @param $col (int) Column number. - * @param $chr (int) Char byte. + * @param array $marr Array of symbols. + * @param int $nrow Number of rows. + * @param int $ncol Number of columns. + * @param int $row Row number. + * @param int $col Column number. + * @param int $chr Char byte. * @return array * @protected */ @@ -1020,10 +1020,10 @@ class Datamatrix { /** * Places the 8 bits of the first special corner case. * (Annex F - ECC 200 symbol character placement) - * @param $marr (array) Array of symbols. - * @param $nrow (int) Number of rows. - * @param $ncol (int) Number of columns. - * @param $chr (int) Char byte. + * @param array $marr Array of symbols. + * @param int $nrow Number of rows. + * @param int $ncol Number of columns. + * @param int $chr Char byte. * @return array * @protected */ @@ -1042,10 +1042,10 @@ class Datamatrix { /** * Places the 8 bits of the second special corner case. * (Annex F - ECC 200 symbol character placement) - * @param $marr (array) Array of symbols. - * @param $nrow (int) Number of rows. - * @param $ncol (int) Number of columns. - * @param $chr (int) Char byte. + * @param array $marr Array of symbols. + * @param int $nrow Number of rows. + * @param int $ncol Number of columns. + * @param int $chr Char byte. * @return array * @protected */ @@ -1064,10 +1064,10 @@ class Datamatrix { /** * Places the 8 bits of the third special corner case. * (Annex F - ECC 200 symbol character placement) - * @param $marr (array) Array of symbols. - * @param $nrow (int) Number of rows. - * @param $ncol (int) Number of columns. - * @param $chr (int) Char byte. + * @param array $marr Array of symbols. + * @param int $nrow Number of rows. + * @param int $ncol Number of columns. + * @param int $chr Char byte. * @return array * @protected */ @@ -1086,10 +1086,10 @@ class Datamatrix { /** * Places the 8 bits of the fourth special corner case. * (Annex F - ECC 200 symbol character placement) - * @param $marr (array) Array of symbols. - * @param $nrow (int) Number of rows. - * @param $ncol (int) Number of columns. - * @param $chr (int) Char byte. + * @param array $marr Array of symbols. + * @param int $nrow Number of rows. + * @param int $ncol Number of columns. + * @param int $chr Char byte. * @return array * @protected */ @@ -1108,8 +1108,8 @@ class Datamatrix { /** * Build a placement map. * (Annex F - ECC 200 symbol character placement) - * @param $nrow (int) Number of rows. - * @param $ncol (int) Number of columns. + * @param int $nrow Number of rows. + * @param int $ncol Number of columns. * @return array * @protected */ diff --git a/lib/combodo/tcpdf/include/barcodes/pdf417.php b/lib/combodo/tcpdf/include/barcodes/pdf417.php index 9a58a21f6..742802e1f 100644 --- a/lib/combodo/tcpdf/include/barcodes/pdf417.php +++ b/lib/combodo/tcpdf/include/barcodes/pdf417.php @@ -523,10 +523,10 @@ class PDF417 { /** * This is the class constructor. * Creates a PDF417 object - * @param $code (string) code to represent using PDF417 - * @param $ecl (int) error correction level (0-8); default -1 = automatic correction level - * @param $aspectratio (float) the width to height of the symbol (excluding quiet zones) - * @param $macro (array) information for macro block + * @param string $code code to represent using PDF417 + * @param int $ecl error correction level (0-8); default -1 = automatic correction level + * @param float $aspectratio the width to height of the symbol (excluding quiet zones) + * @param array $macro information for macro block * @public */ public function __construct($code, $ecl=-1, $aspectratio=2, $macro=array()) { @@ -734,12 +734,13 @@ class PDF417 { /** * Returns the error correction level (0-8) to be used - * @param $ecl (int) error correction level - * @param $numcw (int) number of data codewords + * @param int $ecl error correction level + * @param int $numcw number of data codewords * @return int error correction level * @protected */ protected function getErrorCorrectionLevel($ecl, $numcw) { + $maxecl = 8; // starting error level // check for automatic levels if (($ecl < 0) OR ($ecl > 8)) { if ($numcw < 41) { @@ -755,7 +756,6 @@ class PDF417 { } } // get maximum correction level - $maxecl = 8; // starting error level $maxerrsize = (928 - $numcw); // available codewords for error while ($maxecl > 0) { $errsize = (2 << $ecl); @@ -772,8 +772,8 @@ class PDF417 { /** * Returns the error correction codewords - * @param $cw (array) array of codewords including Symbol Length Descriptor and pad - * @param $ecl (int) error correction level 0-8 + * @param array $cw array of codewords including Symbol Length Descriptor and pad + * @param int $ecl error correction level 0-8 * @return array of error correction codewords * @protected */ @@ -809,8 +809,8 @@ class PDF417 { /** * Create array of sequences from input - * @param $code (string) code - * @return bidimensional array containing characters and classification + * @param string $code code + * @return array bi-dimensional array containing characters and classification * @protected */ protected function getInputSequences($code) { @@ -864,9 +864,9 @@ class PDF417 { /** * Compact data by mode. - * @param $mode (int) compaction mode number - * @param $code (string) data to compact - * @param $addmode (boolean) if true add the mode codeword at first position + * @param int $mode compaction mode number + * @param string $code data to compact + * @param boolean $addmode if true add the mode codeword at first position * @return array of codewords * @protected */ diff --git a/lib/combodo/tcpdf/include/barcodes/qrcode.php b/lib/combodo/tcpdf/include/barcodes/qrcode.php index 7ef2759fd..2e7f2f576 100644 --- a/lib/combodo/tcpdf/include/barcodes/qrcode.php +++ b/lib/combodo/tcpdf/include/barcodes/qrcode.php @@ -247,32 +247,6 @@ if (!defined('QRCODEDEFS')) { } // end of definitions -// #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*# - -// for compatibility with PHP4 -if (!function_exists('str_split')) { - /** - * Convert a string to an array (needed for PHP4 compatibility) - * @param $string (string) The input string. - * @param $split_length (int) Maximum length of the chunk. - * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. - */ - function str_split($string, $split_length=1) { - if ((strlen($string) > $split_length) OR (!$split_length)) { - do { - $c = strlen($string); - $parts[] = substr($string, 0, $split_length); - $string = substr($string, $split_length); - } while ($string !== false); - } else { - $parts = array($string); - } - return $parts; - } -} - -// ##################################################### - /** * @class QRcode * Class to create QR-code arrays for TCPDF class. @@ -631,8 +605,8 @@ class QRcode { /** * This is the class constructor. * Creates a QRcode object - * @param $code (string) code to represent using QRcode - * @param $eclevel (string) error level:
  • L : About 7% or less errors can be corrected.
  • M : About 15% or less errors can be corrected.
  • Q : About 25% or less errors can be corrected.
  • H : About 30% or less errors can be corrected.
+ * @param string $code code to represent using QRcode + * @param string $eclevel error level:
  • L : About 7% or less errors can be corrected.
  • M : About 15% or less errors can be corrected.
  • Q : About 25% or less errors can be corrected.
  • H : About 30% or less errors can be corrected.
* @public * @since 1.0.000 */ @@ -683,7 +657,7 @@ class QRcode { /** * Convert the frame in binary form - * @param $frame (array) array to binarize + * @param array $frame array to binarize * @return array frame in binary form */ protected function binarize($frame) { @@ -699,7 +673,7 @@ class QRcode { /** * Encode the input string to QR code - * @param $string (string) input string to encode + * @param string $string input string to encode */ protected function encodeString($string) { $this->dataStr = $string; @@ -715,7 +689,7 @@ class QRcode { /** * Encode mask - * @param $mask (int) masking mode + * @param int $mask masking mode */ protected function encodeMask($mask) { $spec = array(0, 0, 0, 0, 0); @@ -780,8 +754,8 @@ class QRcode { /** * Set frame value at specified position - * @param $at (array) x,y position - * @param $val (int) value of the character to set + * @param array $at x,y position + * @param int $val value of the character to set */ protected function setFrameAt($at, $val) { $this->frame[$at['y']][$at['x']] = chr($val); @@ -789,7 +763,7 @@ class QRcode { /** * Get frame value at specified position - * @param $at (array) x,y position + * @param array $at x,y position * @return value at specified position */ protected function getFrameAt($at) { @@ -853,8 +827,8 @@ class QRcode { /** * Initialize code. - * @param $spec (array) array of ECC specification - * @return 0 in case of success, -1 in case of error + * @param array $spec array of ECC specification + * @return int 0 in case of success, -1 in case of error */ protected function init($spec) { $dl = $this->rsDataCodes1($spec); @@ -932,10 +906,10 @@ class QRcode { /** * Write Format Information on frame and returns the number of black bits - * @param $width (int) frame width - * @param $frame (array) frame - * @param $mask (array) masking mode - * @param $level (int) error correction level + * @param int $width frame width + * @param array $frame frame + * @param array $mask masking mode + * @param int $level error correction level * @return int blacks */ protected function writeFormatInformation($width, &$frame, $mask, $level) { @@ -976,8 +950,8 @@ class QRcode { /** * mask0 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask0($x, $y) { @@ -986,8 +960,8 @@ class QRcode { /** * mask1 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask1($x, $y) { @@ -996,8 +970,8 @@ class QRcode { /** * mask2 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask2($x, $y) { @@ -1006,8 +980,8 @@ class QRcode { /** * mask3 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask3($x, $y) { @@ -1016,8 +990,8 @@ class QRcode { /** * mask4 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask4($x, $y) { @@ -1026,8 +1000,8 @@ class QRcode { /** * mask5 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask5($x, $y) { @@ -1036,8 +1010,8 @@ class QRcode { /** * mask6 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask6($x, $y) { @@ -1046,8 +1020,8 @@ class QRcode { /** * mask7 - * @param $x (int) X position - * @param $y (int) Y position + * @param int $x X position + * @param int $y Y position * @return int mask */ protected function mask7($x, $y) { @@ -1056,9 +1030,9 @@ class QRcode { /** * Return bitmask - * @param $maskNo (int) mask number - * @param $width (int) width - * @param $frame (array) frame + * @param int $maskNo mask number + * @param int $width width + * @param array $frame frame * @return array bitmask */ protected function generateMaskNo($maskNo, $width, $frame) { @@ -1078,11 +1052,11 @@ class QRcode { /** * makeMaskNo - * @param $maskNo (int) - * @param $width (int) - * @param $s (int) - * @param $d (int) - * @param $maskGenOnly (boolean) + * @param int $maskNo + * @param int $width + * @param int $s + * @param int $d + * @param boolean $maskGenOnly * @return int b */ protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) { @@ -1106,10 +1080,10 @@ class QRcode { /** * makeMask - * @param $width (int) - * @param $frame (array) - * @param $maskNo (int) - * @param $level (int) + * @param int $width + * @param array $frame + * @param int $maskNo + * @param int $level * @return array mask */ protected function makeMask($width, $frame, $maskNo, $level) { @@ -1121,7 +1095,7 @@ class QRcode { /** * calcN1N3 - * @param $length (int) + * @param int $length * @return int demerit */ protected function calcN1N3($length) { @@ -1151,8 +1125,8 @@ class QRcode { /** * evaluateSymbol - * @param $width (int) - * @param $frame (array) + * @param int $width + * @param array $frame * @return int demerit */ protected function evaluateSymbol($width, $frame) { @@ -1212,9 +1186,9 @@ class QRcode { /** * mask - * @param $width (int) - * @param $frame (array) - * @param $level (int) + * @param int $width + * @param array $frame + * @param int $level * @return array best mask */ protected function mask($width, $frame, $level) { @@ -1255,8 +1229,8 @@ class QRcode { /** * Return true if the character at specified position is a number - * @param $str (string) string - * @param $pos (int) characted position + * @param string $str string + * @param int $pos characted position * @return boolean true of false */ protected function isdigitat($str, $pos) { @@ -1268,8 +1242,8 @@ class QRcode { /** * Return true if the character at specified position is an alphanumeric character - * @param $str (string) string - * @param $pos (int) characted position + * @param string $str string + * @param int $pos characted position * @return boolean true of false */ protected function isalnumat($str, $pos) { @@ -1281,7 +1255,7 @@ class QRcode { /** * identifyMode - * @param $pos (int) + * @param int $pos * @return int mode */ protected function identifyMode($pos) { @@ -1386,6 +1360,7 @@ class QRcode { $p += 2; } $this->items = $this->appendNewInputItem($this->items, QR_MODE_KJ, $p, str_split($this->dataStr)); + $run = $p; return $run; } @@ -1440,7 +1415,7 @@ class QRcode { /** * splitString - * @return (int) + * @return int */ protected function splitString() { while (strlen($this->dataStr) > 0) { @@ -1455,7 +1430,7 @@ class QRcode { break; } case QR_MODE_KJ: { - if ($hint == QR_MODE_KJ) { + if ($this->hint == QR_MODE_KJ) { $length = $this->eatKanji(); } else { $length = $this->eat8(); @@ -1504,10 +1479,10 @@ class QRcode { /** * newInputItem - * @param $mode (int) - * @param $size (int) - * @param $data (array) - * @param $bstream (array) + * @param int $mode + * @param int $size + * @param array $data + * @param array $bstream * @return array input item */ protected function newInputItem($mode, $size, $data, $bstream=null) { @@ -1528,8 +1503,8 @@ class QRcode { /** * encodeModeNum - * @param $inputitem (array) - * @param $version (int) + * @param array $inputitem + * @param int $version * @return array input item */ protected function encodeModeNum($inputitem, $version) { @@ -1557,8 +1532,8 @@ class QRcode { /** * encodeModeAn - * @param $inputitem (array) - * @param $version (int) + * @param array $inputitem + * @param int $version * @return array input item */ protected function encodeModeAn($inputitem, $version) { @@ -1580,8 +1555,8 @@ class QRcode { /** * encodeMode8 - * @param $inputitem (array) - * @param $version (int) + * @param array $inputitem + * @param int $version * @return array input item */ protected function encodeMode8($inputitem, $version) { @@ -1596,8 +1571,8 @@ class QRcode { /** * encodeModeKanji - * @param $inputitem (array) - * @param $version (int) + * @param array $inputitem + * @param int $version * @return array input item */ protected function encodeModeKanji($inputitem, $version) { @@ -1620,7 +1595,7 @@ class QRcode { /** * encodeModeStructure - * @param $inputitem (array) + * @param array $inputitem * @return array input item */ protected function encodeModeStructure($inputitem) { @@ -1634,8 +1609,8 @@ class QRcode { /** * encodeBitStream - * @param $inputitem (array) - * @param $version (int) + * @param array $inputitem + * @param int $version * @return array input item */ protected function encodeBitStream($inputitem, $version) { @@ -1686,11 +1661,11 @@ class QRcode { /** * Append data to an input object. * The data is copied and appended to the input object. - * @param $items (arrray) input items - * @param $mode (int) encoding mode. - * @param $size (int) size of data (byte). - * @param $data (array) array of input data. - * @return items + * @param array $items input items + * @param int $mode encoding mode. + * @param int $size size of data (byte). + * @param array $data array of input data. + * @return array items * */ protected function appendNewInputItem($items, $mode, $size, $data) { @@ -1703,10 +1678,10 @@ class QRcode { /** * insertStructuredAppendHeader - * @param $items (array) - * @param $size (int) - * @param $index (int) - * @param $parity (int) + * @param array $items + * @param int $size + * @param int $index + * @param int $parity * @return array items */ protected function insertStructuredAppendHeader($items, $size, $index, $parity) { @@ -1724,7 +1699,7 @@ class QRcode { /** * calcParity - * @param $items (array) + * @param array $items * @return int parity */ protected function calcParity($items) { @@ -1741,8 +1716,8 @@ class QRcode { /** * checkModeNum - * @param $size (int) - * @param $data (array) + * @param int $size + * @param array $data * @return boolean true or false */ protected function checkModeNum($size, $data) { @@ -1755,9 +1730,9 @@ class QRcode { } /** - * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19). - * @param $c (int) character value - * @return value + * Look up the alphabet-numeric conversion table (see JIS X0510:2004, pp.19). + * @param int $c character value + * @return int value */ protected function lookAnTable($c) { return (($c > 127)?-1:$this->anTable[$c]); @@ -1765,8 +1740,8 @@ class QRcode { /** * checkModeAn - * @param $size (int) - * @param $data (array) + * @param int $size + * @param array $data * @return boolean true or false */ protected function checkModeAn($size, $data) { @@ -1780,7 +1755,7 @@ class QRcode { /** * estimateBitsModeNum - * @param $size (int) + * @param int $size * @return int number of bits */ protected function estimateBitsModeNum($size) { @@ -1801,7 +1776,7 @@ class QRcode { /** * estimateBitsModeAn - * @param $size (int) + * @param int $size * @return int number of bits */ protected function estimateBitsModeAn($size) { @@ -1814,7 +1789,7 @@ class QRcode { /** * estimateBitsMode8 - * @param $size (int) + * @param int $size * @return int number of bits */ protected function estimateBitsMode8($size) { @@ -1823,7 +1798,7 @@ class QRcode { /** * estimateBitsModeKanji - * @param $size (int) + * @param int $size * @return int number of bits */ protected function estimateBitsModeKanji($size) { @@ -1832,8 +1807,8 @@ class QRcode { /** * checkModeKanji - * @param $size (int) - * @param $data (array) + * @param int $size + * @param array $data * @return boolean true or false */ protected function checkModeKanji($size, $data) { @@ -1851,9 +1826,9 @@ class QRcode { /** * Validate the input data. - * @param $mode (int) encoding mode. - * @param $size (int) size of data (byte). - * @param $data (array) data to validate + * @param int $mode encoding mode. + * @param int $size size of data (byte). + * @param array $data data to validate * @return boolean true in case of valid data, false otherwise */ protected function check($mode, $size, $data) { @@ -1885,8 +1860,8 @@ class QRcode { /** * estimateBitStreamSize - * @param $items (array) - * @param $version (int) + * @param array $items + * @param int $version * @return int bits */ protected function estimateBitStreamSize($items, $version) { @@ -1929,7 +1904,7 @@ class QRcode { /** * estimateVersion - * @param $items (array) + * @param array $items * @return int version */ protected function estimateVersion($items) { @@ -1948,9 +1923,9 @@ class QRcode { /** * lengthOfCode - * @param $mode (int) - * @param $version (int) - * @param $bits (int) + * @param int $mode + * @param int $version + * @param int $bits * @return int size */ protected function lengthOfCode($mode, $version, $bits) { @@ -2005,7 +1980,7 @@ class QRcode { /** * createBitStream - * @param $items (array) + * @param array $items * @return array of items and total bits */ protected function createBitStream($items) { @@ -2020,7 +1995,7 @@ class QRcode { /** * convertData - * @param $items (array) + * @param array $items * @return array items */ protected function convertData($items) { @@ -2049,7 +2024,7 @@ class QRcode { /** * Append Padding Bit to bitstream - * @param $bstream (array) + * @param array $bstream * @return array bitstream */ protected function appendPaddingBit($bstream) { @@ -2082,7 +2057,7 @@ class QRcode { /** * mergeBitStream - * @param $items (array) items + * @param array $items items * @return array bitstream */ protected function mergeBitStream($items) { @@ -2099,7 +2074,7 @@ class QRcode { /** * Returns a stream of bits. - * @param $items (int) + * @param int $items * @return array padded merged byte stream */ protected function getBitStream($items) { @@ -2109,7 +2084,7 @@ class QRcode { /** * Pack all bit streams padding bits into a byte array. - * @param $items (int) + * @param int $items * @return array padded merged byte stream */ protected function getByteStream($items) { @@ -2123,7 +2098,7 @@ class QRcode { /** * Return an array with zeros - * @param $setLength (int) array size + * @param int $setLength array size * @return array */ protected function allocate($setLength) { @@ -2132,8 +2107,8 @@ class QRcode { /** * Return new bitstream from number - * @param $bits (int) number of bits - * @param $num (int) number + * @param int $bits number of bits + * @param int $num number * @return array bitstream */ protected function newFromNum($bits, $num) { @@ -2152,8 +2127,8 @@ class QRcode { /** * Return new bitstream from bytes - * @param $size (int) size - * @param $data (array) bytes + * @param int $size size + * @param array $data bytes * @return array bitstream */ protected function newFromBytes($size, $data) { @@ -2176,8 +2151,8 @@ class QRcode { /** * Append one bitstream to another - * @param $bitstream (array) original bitstream - * @param $append (array) bitstream to append + * @param array $bitstream original bitstream + * @param array $append bitstream to append * @return array bitstream */ protected function appendBitstream($bitstream, $append) { @@ -2192,9 +2167,9 @@ class QRcode { /** * Append one bitstream created from number to another - * @param $bitstream (array) original bitstream - * @param $bits (int) number of bits - * @param $num (int) number + * @param array $bitstream original bitstream + * @param int $bits number of bits + * @param int $num number * @return array bitstream */ protected function appendNum($bitstream, $bits, $num) { @@ -2207,9 +2182,9 @@ class QRcode { /** * Append one bitstream created from bytes to another - * @param $bitstream (array) original bitstream - * @param $size (int) size - * @param $data (array) bytes + * @param array $bitstream original bitstream + * @param int $size size + * @param array $data bytes * @return array bitstream */ protected function appendBytes($bitstream, $size, $data) { @@ -2222,7 +2197,7 @@ class QRcode { /** * Convert bitstream to bytes - * @param $bstream (array) original bitstream + * @param array $bstream original bitstream * @return array of bytes */ protected function bitstreamToByte($bstream) { @@ -2263,11 +2238,11 @@ class QRcode { /** * Replace a value on the array at the specified position - * @param $srctab (array) - * @param $x (int) X position - * @param $y (int) Y position - * @param $repl (string) value to replace - * @param $replLen (int) length of the repl string + * @param array $srctab + * @param int $x X position + * @param int $y Y position + * @param string $repl value to replace + * @param int $replLen length of the repl string * @return array srctab */ protected function qrstrset($srctab, $x, $y, $repl, $replLen=false) { @@ -2277,8 +2252,8 @@ class QRcode { /** * Return maximum data code length (bytes) for the version. - * @param $version (int) version - * @param $level (int) error correction level + * @param int $version version + * @param int $level error correction level * @return int maximum size (bytes) */ protected function getDataLength($version, $level) { @@ -2287,8 +2262,8 @@ class QRcode { /** * Return maximum error correction code length (bytes) for the version. - * @param $version (int) version - * @param $level (int) error correction level + * @param int $version version + * @param int $level error correction level * @return int ECC size (bytes) */ protected function getECCLength($version, $level){ @@ -2297,7 +2272,7 @@ class QRcode { /** * Return the width of the symbol for the version. - * @param $version (int) version + * @param int $version version * @return int width */ protected function getWidth($version) { @@ -2306,7 +2281,7 @@ class QRcode { /** * Return the numer of remainder bits. - * @param $version (int) version + * @param int $version version * @return int number of remainder bits */ protected function getRemainder($version) { @@ -2315,8 +2290,8 @@ class QRcode { /** * Return a version number that satisfies the input code length. - * @param $size (int) input code length (bytes) - * @param $level (int) error correction level + * @param int $size input code length (bytes) + * @param int $level error correction level * @return int version number */ protected function getMinimumVersion($size, $level) { @@ -2332,8 +2307,8 @@ class QRcode { /** * Return the size of length indicator for the mode and version. - * @param $mode (int) encoding mode - * @param $version (int) version + * @param int $mode encoding mode + * @param int $version version * @return int the size of the appropriate length indicator (bits). */ protected function lengthIndicator($mode, $version) { @@ -2352,8 +2327,8 @@ class QRcode { /** * Return the maximum length for the mode and version. - * @param $mode (int) encoding mode - * @param $version (int) version + * @param int $mode encoding mode + * @param int $version version * @return int the maximum length (bytes) */ protected function maximumWords($mode, $version) { @@ -2377,9 +2352,9 @@ class QRcode { /** * Return an array of ECC specification. - * @param $version (int) version - * @param $level (int) error correction level - * @param $spec (array) an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code} + * @param int $version version + * @param int $level error correction level + * @param array $spec an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code} * @return array spec */ protected function getEccSpec($version, $level, $spec) { @@ -2408,9 +2383,9 @@ class QRcode { /** * Put an alignment marker. - * @param $frame (array) frame - * @param $ox (int) X center coordinate of the pattern - * @param $oy (int) Y center coordinate of the pattern + * @param array $frame frame + * @param int $ox X center coordinate of the pattern + * @param int $oy Y center coordinate of the pattern * @return array frame */ protected function putAlignmentMarker($frame, $ox, $oy) { @@ -2431,9 +2406,9 @@ class QRcode { /** * Put an alignment pattern. - * @param $version (int) version - * @param $frame (array) frame - * @param $width (int) width + * @param int $version version + * @param array $frame frame + * @param int $width width * @return array frame */ protected function putAlignmentPattern($version, $frame, $width) { @@ -2473,8 +2448,8 @@ class QRcode { /** * Return BCH encoded version information pattern that is used for the symbol of version 7 or greater. Use lower 18 bits. - * @param $version (int) version - * @return BCH encoded version information pattern + * @param int $version version + * @return string BCH encoded version information pattern */ protected function getVersionPattern($version) { if (($version < 7) OR ($version > QRSPEC_VERSION_MAX)) { @@ -2485,9 +2460,9 @@ class QRcode { /** * Return BCH encoded format information pattern. - * @param $mask (array) - * @param $level (int) error correction level - * @return BCH encoded format information pattern + * @param array $mask + * @param int $level error correction level + * @return string BCH encoded format information pattern */ protected function getFormatInfo($mask, $level) { if (($mask < 0) OR ($mask > 7)) { @@ -2501,9 +2476,9 @@ class QRcode { /** * Put a finder pattern. - * @param $frame (array) frame - * @param $ox (int) X center coordinate of the pattern - * @param $oy (int) Y center coordinate of the pattern + * @param array $frame frame + * @param int $ox X center coordinate of the pattern + * @param int $oy Y center coordinate of the pattern * @return array frame */ protected function putFinderPattern($frame, $ox, $oy) { @@ -2524,8 +2499,8 @@ class QRcode { /** * Return a copy of initialized frame. - * @param $version (int) version - * @return Array of unsigned char. + * @param int $version version + * @return array array of unsigned char. */ protected function createFrame($version) { $width = $this->capacity[$version][QRCAP_WIDTH]; @@ -2589,8 +2564,8 @@ class QRcode { /** * Set new frame for the specified version. - * @param $version (int) version - * @return Array of unsigned char. + * @param int $version version + * @return array array of unsigned char. */ protected function newFrame($version) { if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) { @@ -2607,7 +2582,7 @@ class QRcode { /** * Return block number 0 - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsBlockNum($spec) { @@ -2616,7 +2591,7 @@ class QRcode { /** * Return block number 1 - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsBlockNum1($spec) { @@ -2625,7 +2600,7 @@ class QRcode { /** * Return data codes 1 - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsDataCodes1($spec) { @@ -2634,7 +2609,7 @@ class QRcode { /** * Return ecc codes 1 - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsEccCodes1($spec) { @@ -2643,7 +2618,7 @@ class QRcode { /** * Return block number 2 - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsBlockNum2($spec) { @@ -2652,7 +2627,7 @@ class QRcode { /** * Return data codes 2 - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsDataCodes2($spec) { @@ -2661,7 +2636,7 @@ class QRcode { /** * Return ecc codes 2 - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsEccCodes2($spec) { @@ -2670,7 +2645,7 @@ class QRcode { /** * Return data length - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsDataLength($spec) { @@ -2679,7 +2654,7 @@ class QRcode { /** * Return ecc length - * @param $spec (array) + * @param array $spec * @return int value */ protected function rsEccLength($spec) { @@ -2692,12 +2667,12 @@ class QRcode { /** * Initialize a Reed-Solomon codec and add it to existing rsitems - * @param $symsize (int) symbol size, bits - * @param $gfpoly (int) Field generator polynomial coefficients - * @param $fcr (int) first root of RS code generator polynomial, index form - * @param $prim (int) primitive element to generate polynomial roots - * @param $nroots (int) RS code generator polynomial degree (number of roots) - * @param $pad (int) padding bytes at front of shortened block + * @param int $symsize symbol size, bits + * @param int $gfpoly Field generator polynomial coefficients + * @param int $fcr first root of RS code generator polynomial, index form + * @param int $prim primitive element to generate polynomial roots + * @param int $nroots RS code generator polynomial degree (number of roots) + * @param int $pad padding bytes at front of shortened block * @return array Array of RS values:
  • mm = Bits per symbol;
  • nn = Symbols per block;
  • alpha_to = log lookup table array;
  • index_of = Antilog lookup table array;
  • genpoly = Generator polynomial array;
  • nroots = Number of generator;
  • roots = number of parity symbols;
  • fcr = First consecutive root, index form;
  • prim = Primitive element, index form;
  • iprim = prim-th root of 1, index form;
  • pad = Padding bytes in shortened block;
  • gfpoly
. */ protected function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) { @@ -2719,8 +2694,8 @@ class QRcode { /** * modnn - * @param $rs (array) RS values - * @param $x (int) X position + * @param array $rs RS values + * @param int $x X position * @return int X osition */ protected function modnn($rs, $x) { @@ -2733,12 +2708,12 @@ class QRcode { /** * Initialize a Reed-Solomon codec and returns an array of values. - * @param $symsize (int) symbol size, bits - * @param $gfpoly (int) Field generator polynomial coefficients - * @param $fcr (int) first root of RS code generator polynomial, index form - * @param $prim (int) primitive element to generate polynomial roots - * @param $nroots (int) RS code generator polynomial degree (number of roots) - * @param $pad (int) padding bytes at front of shortened block + * @param int $symsize symbol size, bits + * @param int $gfpoly Field generator polynomial coefficients + * @param int $fcr first root of RS code generator polynomial, index form + * @param int $prim primitive element to generate polynomial roots + * @param int $nroots RS code generator polynomial degree (number of roots) + * @param int $pad padding bytes at front of shortened block * @return array Array of RS values:
  • mm = Bits per symbol;
  • nn = Symbols per block;
  • alpha_to = log lookup table array;
  • index_of = Antilog lookup table array;
  • genpoly = Generator polynomial array;
  • nroots = Number of generator;
  • roots = number of parity symbols;
  • fcr = First consecutive root, index form;
  • prim = Primitive element, index form;
  • iprim = prim-th root of 1, index form;
  • pad = Padding bytes in shortened block;
  • gfpoly
. */ protected function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) { @@ -2820,9 +2795,9 @@ class QRcode { /** * Encode a Reed-Solomon codec and returns the parity array - * @param $rs (array) RS values - * @param $data (array) data - * @param $parity (array) parity + * @param array $rs RS values + * @param array $data data + * @param array $parity parity * @return parity array */ protected function encode_rs_char($rs, $data, $parity) { diff --git a/lib/combodo/tcpdf/include/tcpdf_colors.php b/lib/combodo/tcpdf/include/tcpdf_colors.php index 27fb7afd1..7f337f31a 100644 --- a/lib/combodo/tcpdf/include/tcpdf_colors.php +++ b/lib/combodo/tcpdf/include/tcpdf_colors.php @@ -240,9 +240,9 @@ class TCPDF_COLORS { /** * Return the Spot color array. - * @param $name (string) Name of the spot color. - * @param $spotc (array) Reference to an array of spot colors. - * @return (array) Spot color array or false if not defined. + * @param string $name Name of the spot color. + * @param array $spotc Reference to an array of spot colors. + * @return array|false Spot color array or false if not defined. * @since 5.9.125 (2011-10-03) * @public static */ @@ -264,10 +264,10 @@ class TCPDF_COLORS { /** * Returns an array (RGB or CMYK) from an html color name, or a six-digit (i.e. #3FE5AA), or three-digit (i.e. #7FF) hexadecimal color, or a javascript color array, or javascript color name. - * @param $hcolor (string) HTML color. - * @param $spotc (array) Reference to an array of spot colors. - * @param $defcol (array) Color to return in case of error. - * @return array RGB or CMYK color, or false in case of error. + * @param string $hcolor HTML color. + * @param array $spotc Reference to an array of spot colors. + * @param array $defcol Color to return in case of error. + * @return array|false RGB or CMYK color, or false in case of error. * @public static */ public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R'=>128,'G'=>128,'B'=>128)) { @@ -407,8 +407,8 @@ class TCPDF_COLORS { /** * Convert a color array into a string representation. - * @param $c (array) Array of colors. - * @return (string) The color array representation. + * @param array $c Array of colors. + * @return string The color array representation. * @since 5.9.137 (2011-12-01) * @public static */ @@ -438,7 +438,7 @@ class TCPDF_COLORS { /** * Convert color to javascript color. - * @param $color (string) color name or "#RRGGBB" + * @param string $color color name or "#RRGGBB" * @protected * @since 2.1.002 (2008-02-12) * @public static @@ -449,7 +449,7 @@ class TCPDF_COLORS { } if (!in_array($color, self::$jscolor)) { // default transparent color - $color = $jscolor[0]; + $color = self::$jscolor[0]; } return 'color.'.$color; } diff --git a/lib/combodo/tcpdf/include/tcpdf_filters.php b/lib/combodo/tcpdf/include/tcpdf_filters.php index 3bb89c092..3009cff7c 100644 --- a/lib/combodo/tcpdf/include/tcpdf_filters.php +++ b/lib/combodo/tcpdf/include/tcpdf_filters.php @@ -60,7 +60,7 @@ class TCPDF_FILTERS { /** * Get a list of available decoding filters. - * @return (array) Array of available filter decoders. + * @return array Array of available filter decoders. * @since 1.0.000 (2011-05-23) * @public static */ @@ -70,9 +70,9 @@ class TCPDF_FILTERS { /** * Decode data using the specified filter type. - * @param $filter (string) Filter name. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $filter Filter name. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -130,8 +130,8 @@ class TCPDF_FILTERS { /** * Standard * Default decoding filter (leaves data unchanged). - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -142,8 +142,8 @@ class TCPDF_FILTERS { /** * ASCIIHexDecode * Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -182,8 +182,8 @@ class TCPDF_FILTERS { /** * ASCII85Decode * Decodes data encoded in an ASCII base-85 representation, reproducing the original binary data. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -266,8 +266,8 @@ class TCPDF_FILTERS { /** * LZWDecode * Decompresses data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -347,8 +347,8 @@ class TCPDF_FILTERS { /** * FlateDecode * Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -364,7 +364,7 @@ class TCPDF_FILTERS { /** * RunLengthDecode * Decompresses data encoded using a byte-oriented run-length encoding algorithm. - * @param $data (string) Data to decode. + * @param string $data Data to decode. * @since 1.0.000 (2011-05-23) * @public static */ @@ -400,8 +400,8 @@ class TCPDF_FILTERS { /** * CCITTFaxDecode (NOT IMPLEMETED - RETURN AN EXCEPTION) * Decompresses data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel). - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -413,8 +413,8 @@ class TCPDF_FILTERS { /** * JBIG2Decode (NOT IMPLEMETED - RETURN AN EXCEPTION) * Decompresses data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data). - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -426,8 +426,8 @@ class TCPDF_FILTERS { /** * DCTDecode (NOT IMPLEMETED - RETURN AN EXCEPTION) * Decompresses data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -439,8 +439,8 @@ class TCPDF_FILTERS { /** * JPXDecode (NOT IMPLEMETED - RETURN AN EXCEPTION) * Decompresses data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -452,8 +452,8 @@ class TCPDF_FILTERS { /** * Crypt (NOT IMPLEMETED - RETURN AN EXCEPTION) * Decrypts data encrypted by a security handler, reproducing the data as it was before encryption. - * @param $data (string) Data to decode. - * @return Decoded data string. + * @param string $data Data to decode. + * @return string Decoded data string. * @since 1.0.000 (2011-05-23) * @public static */ @@ -466,7 +466,7 @@ class TCPDF_FILTERS { /** * Throw an exception. - * @param $msg (string) The error message + * @param string $msg The error message * @since 1.0.000 (2011-05-23) * @public static */ diff --git a/lib/combodo/tcpdf/include/tcpdf_fonts.php b/lib/combodo/tcpdf/include/tcpdf_fonts.php index 218fb6df1..c692ef87d 100644 --- a/lib/combodo/tcpdf/include/tcpdf_fonts.php +++ b/lib/combodo/tcpdf/include/tcpdf_fonts.php @@ -55,16 +55,16 @@ class TCPDF_FONTS { /** * Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable). - * @param $fontfile (string) Font file (full path). - * @param $fonttype (string) Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional. - * @param $enc (string) Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats. - * @param $flags (int) Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font. - * @param $outpath (string) Output path for generated font files (must be writeable by the web server). Leave empty for default font folder. - * @param $platid (int) Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1). - * @param $encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4. - * @param $addcbbox (boolean) If true includes the character bounding box information on the php font file. - * @param $link (boolean) If true link to system font instead of copying the font data (not transportable) - Note: do not work with Type1 fonts. - * @return (string) TCPDF font name or boolean false in case of error. + * @param string $fontfile Font file (full path). + * @param string $fonttype Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional. + * @param string $enc Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats. + * @param int $flags Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font. + * @param string $outpath Output path for generated font files (must be writeable by the web server). Leave empty for default font folder. + * @param int $platid Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1). + * @param int $encid Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4. + * @param boolean $addcbbox If true includes the character bounding box information on the php font file. + * @param boolean $link If true link to system font instead of copying the font data (not transportable) - Note: do not work with Type1 fonts. + * @return string|false TCPDF font name or boolean false in case of error. * @author Nicola Asuni * @since 5.9.123 (2010-09-30) * @public static @@ -557,6 +557,7 @@ class TCPDF_FONTS { $numGlyphs = TCPDF_STATIC::_getUSHORT($font, $offset); // ---------- get CIDToGIDMap ---------- $ctg = array(); + $c = 0; foreach ($encodingTables as $enctable) { // get only specified Platform ID and Encoding ID if (($enctable['platformID'] == $platid) AND ($enctable['encodingID'] == $encid)) { @@ -920,8 +921,8 @@ class TCPDF_FONTS { /** * Returs the checksum of a TTF table. - * @param $table (string) table to check - * @param $length (int) length of table in bytes + * @param string $table table to check + * @param int $length length of table in bytes * @return int checksum * @author Nicola Asuni * @since 5.2.000 (2010-06-02) @@ -942,9 +943,9 @@ class TCPDF_FONTS { /** * Returns a subset of the TrueType font data without the unused glyphs. - * @param $font (string) TrueType font data. - * @param $subsetchars (array) Array of used characters (the glyphs to keep). - * @return (string) A subset of TrueType font data without the unused glyphs. + * @param string $font TrueType font data. + * @param array $subsetchars Array of used characters (the glyphs to keep). + * @return string A subset of TrueType font data without the unused glyphs. * @author Nicola Asuni * @since 5.2.000 (2010-06-02) * @public static @@ -956,6 +957,7 @@ class TCPDF_FONTS { // sfnt version must be 0x00010000 for TrueType version 1.0. return $font; } + $c = 0; $offset += 4; // get number of tables $numTables = TCPDF_STATIC::_getUSHORT($font, $offset); @@ -1387,9 +1389,9 @@ class TCPDF_FONTS { /** * Outputs font widths - * @param $font (array) font data - * @param $cidoffset (int) offset for CID values - * @return PDF command string for font widths + * @param array $font font data + * @param int $cidoffset offset for CID values + * @return string PDF command string for font widths * @author Nicola Asuni * @since 4.4.000 (2008-12-07) * @public static @@ -1495,10 +1497,10 @@ class TCPDF_FONTS { /** * Update the CIDToGIDMap string with a new value. - * @param $map (string) CIDToGIDMap. - * @param $cid (int) CID value. - * @param $gid (int) GID value. - * @return (string) CIDToGIDMap. + * @param string $map CIDToGIDMap. + * @param int $cid CID value. + * @param int $gid GID value. + * @return string CIDToGIDMap. * @author Nicola Asuni * @since 5.9.123 (2011-09-29) * @public static @@ -1533,8 +1535,8 @@ class TCPDF_FONTS { /** * Return font full path - * @param $file (string) Font file name. - * @param $fontdir (string) Font directory (set to false fto search on default directories) + * @param string $file Font file name. + * @param string $fontdir Font directory (set to false fto search on default directories) * @return string Font full path or empty string * @author Nicola Asuni * @since 6.0.025 @@ -1558,8 +1560,8 @@ class TCPDF_FONTS { /** * Get a reference font size. - * @param $size (string) String containing font size value. - * @param $refsize (float) Reference font size in points. + * @param string $size String containing font size value. + * @param float $refsize Reference font size in points. * @return float value in points * @public static */ @@ -1657,9 +1659,9 @@ class TCPDF_FONTS { /** * Returns the unicode caracter specified by the value - * @param $c (int) UTF-8 value - * @param $unicode (boolean) True if we are in unicode mode, false otherwise. - * @return Returns the specified character. + * @param int $c UTF-8 value + * @param boolean $unicode True if we are in unicode mode, false otherwise. + * @return string Returns the specified character. * @since 2.3.000 (2008-03-05) * @public static */ @@ -1686,8 +1688,8 @@ class TCPDF_FONTS { /** * Returns the unicode caracter specified by UTF-8 value - * @param $c (int) UTF-8 value - * @return Returns the specified character. + * @param int $c UTF-8 value + * @return string Returns the specified character. * @public static */ public static function unichrUnicode($c) { @@ -1696,8 +1698,8 @@ class TCPDF_FONTS { /** * Returns the unicode caracter specified by ASCII value - * @param $c (int) UTF-8 value - * @return Returns the specified character. + * @param int $c UTF-8 value + * @return string Returns the specified character. * @public static */ public static function unichrASCII($c) { @@ -1734,8 +1736,8 @@ class TCPDF_FONTS { * W1 = 110110yyyyyyyyyy * W2 = 110111xxxxxxxxxx * - * @param $unicode (array) array containing UTF-8 unicode values - * @param $setbom (boolean) if true set the Byte Order Mark (BOM = 0xFEFF) + * @param array $unicode array containing UTF-8 unicode values + * @param boolean $setbom if true set the Byte Order Mark (BOM = 0xFEFF) * @return string * @protected * @author Nicola Asuni @@ -1770,9 +1772,9 @@ class TCPDF_FONTS { /** * Convert an array of UTF8 values to array of unicode characters - * @param $ta (array) The input array of UTF8 values. - * @param $isunicode (boolean) True for Unicode mode, false otherwise. - * @return Return array of unicode characters + * @param array $ta The input array of UTF8 values. + * @param boolean $isunicode True for Unicode mode, false otherwise. + * @return array Return array of unicode characters * @since 4.5.037 (2009-04-07) * @public static */ @@ -1785,11 +1787,11 @@ class TCPDF_FONTS { /** * Extract a slice of the $strarr array and return it as string. - * @param $strarr (string) The input array of characters. - * @param $start (int) the starting element of $strarr. - * @param $end (int) first element that will not be returned. - * @param $unicode (boolean) True if we are in unicode mode, false otherwise. - * @return Return part of a string + * @param string[] $strarr The input array of characters. + * @param int $start the starting element of $strarr. + * @param int $end first element that will not be returned. + * @param boolean $unicode True if we are in unicode mode, false otherwise. + * @return string Return part of a string * @public static */ public static function UTF8ArrSubString($strarr, $start='', $end='', $unicode=true) { @@ -1808,10 +1810,10 @@ class TCPDF_FONTS { /** * Extract a slice of the $uniarr array and return it as string. - * @param $uniarr (string) The input array of characters. - * @param $start (int) the starting element of $strarr. - * @param $end (int) first element that will not be returned. - * @return Return part of a string + * @param string[] $uniarr The input array of characters. + * @param int $start the starting element of $strarr. + * @param int $end first element that will not be returned. + * @return string Return part of a string * @since 4.5.037 (2009-04-07) * @public static */ @@ -1831,7 +1833,7 @@ class TCPDF_FONTS { /** * Converts UTF-8 characters array to array of Latin1 characters array
- * @param $unicode (array) array containing UTF-8 unicode values + * @param array $unicode array containing UTF-8 unicode values * @return array * @author Nicola Asuni * @since 4.8.023 (2010-01-15) @@ -1855,9 +1857,9 @@ class TCPDF_FONTS { } /** - * Converts UTF-8 characters array to array of Latin1 string
- * @param $unicode (array) array containing UTF-8 unicode values - * @return array + * Converts UTF-8 characters array to Latin1 string
+ * @param array $unicode array containing UTF-8 unicode values + * @return string * @author Nicola Asuni * @since 4.8.023 (2010-01-15) * @public static @@ -1882,8 +1884,8 @@ class TCPDF_FONTS { /** * Converts UTF-8 character to integer value.
* Uses the getUniord() method if the value is not cached. - * @param $uch (string) character string to process. - * @return integer Unicode value + * @param string $uch character string to process. + * @return int Unicode value * @public static */ public static function uniord($uch) { @@ -1921,8 +1923,8 @@ class TCPDF_FONTS { * UTF8-tail = %x80-BF * --------------------------------------------------------------------- * - * @param $uch (string) character string to process. - * @return integer Unicode value + * @param string $uch character string to process. + * @return int Unicode value * @author Nicola Asuni * @public static */ @@ -1988,14 +1990,14 @@ class TCPDF_FONTS { /** * Converts UTF-8 strings to codepoints array.
* Invalid byte sequences will be replaced with 0xFFFD (replacement character)
- * @param $str (string) string to process. - * @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise. - * @param $currentfont (array) Reference to current font array. + * @param string $str string to process. + * @param boolean $isunicode True when the documetn is in Unicode mode, false otherwise. + * @param array $currentfont Reference to current font array. * @return array containing codepoints (UTF-8 characters values) * @author Nicola Asuni * @public static */ - public static function UTF8StringToArray($str, $isunicode=true, &$currentfont) { + public static function UTF8StringToArray($str, $isunicode, &$currentfont) { if ($isunicode) { // requires PCRE unicode support turned on $chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY); @@ -2014,30 +2016,30 @@ class TCPDF_FONTS { /** * Converts UTF-8 strings to Latin1 when using the standard 14 core fonts.
- * @param $str (string) string to process. - * @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise. - * @param $currentfont (array) Reference to current font array. + * @param string $str string to process. + * @param boolean $isunicode True when the documetn is in Unicode mode, false otherwise. + * @param array $currentfont Reference to current font array. * @return string * @since 3.2.000 (2008-06-23) * @public static */ - public static function UTF8ToLatin1($str, $isunicode=true, &$currentfont) { + public static function UTF8ToLatin1($str, $isunicode, &$currentfont) { $unicode = self::UTF8StringToArray($str, $isunicode, $currentfont); // array containing UTF-8 unicode values return self::UTF8ArrToLatin1($unicode); } /** * Converts UTF-8 strings to UTF16-BE.
- * @param $str (string) string to process. - * @param $setbom (boolean) if true set the Byte Order Mark (BOM = 0xFEFF) - * @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise. - * @param $currentfont (array) Reference to current font array. + * @param string $str string to process. + * @param boolean $setbom if true set the Byte Order Mark (BOM = 0xFEFF) + * @param boolean $isunicode True when the documetn is in Unicode mode, false otherwise. + * @param array $currentfont Reference to current font array. * @return string * @author Nicola Asuni * @since 1.53.0.TC005 (2005-01-05) * @public static */ - public static function UTF8ToUTF16BE($str, $setbom=false, $isunicode=true, &$currentfont) { + public static function UTF8ToUTF16BE($str, $setbom, $isunicode, &$currentfont) { if (!$isunicode) { return $str; // string is not in unicode } @@ -2047,50 +2049,50 @@ class TCPDF_FONTS { /** * Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). - * @param $str (string) string to manipulate. - * @param $setbom (bool) if true set the Byte Order Mark (BOM = 0xFEFF) - * @param $forcertl (bool) if true forces RTL text direction - * @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise. - * @param $currentfont (array) Reference to current font array. + * @param string $str string to manipulate. + * @param bool $setbom if true set the Byte Order Mark (BOM = 0xFEFF) + * @param bool $forcertl if true forces RTL text direction + * @param boolean $isunicode True if the document is in Unicode mode, false otherwise. + * @param array $currentfont Reference to current font array. * @return string * @author Nicola Asuni * @since 2.1.000 (2008-01-08) * @public static */ - public static function utf8StrRev($str, $setbom=false, $forcertl=false, $isunicode=true, &$currentfont) { + public static function utf8StrRev($str, $setbom, $forcertl, $isunicode, &$currentfont) { return self::utf8StrArrRev(self::UTF8StringToArray($str, $isunicode, $currentfont), $str, $setbom, $forcertl, $isunicode, $currentfont); } /** * Reverse the RLT substrings array using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). - * @param $arr (array) array of unicode values. - * @param $str (string) string to manipulate (or empty value). - * @param $setbom (bool) if true set the Byte Order Mark (BOM = 0xFEFF) - * @param $forcertl (bool) if true forces RTL text direction - * @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise. - * @param $currentfont (array) Reference to current font array. + * @param array $arr array of unicode values. + * @param string $str string to manipulate (or empty value). + * @param bool $setbom if true set the Byte Order Mark (BOM = 0xFEFF) + * @param bool $forcertl if true forces RTL text direction + * @param boolean $isunicode True if the document is in Unicode mode, false otherwise. + * @param array $currentfont Reference to current font array. * @return string * @author Nicola Asuni * @since 4.9.000 (2010-03-27) * @public static */ - public static function utf8StrArrRev($arr, $str='', $setbom=false, $forcertl=false, $isunicode=true, &$currentfont) { + public static function utf8StrArrRev($arr, $str, $setbom, $forcertl, $isunicode, &$currentfont) { return self::arrUTF8ToUTF16BE(self::utf8Bidi($arr, $str, $forcertl, $isunicode, $currentfont), $setbom); } /** * Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). - * @param $ta (array) array of characters composing the string. - * @param $str (string) string to process - * @param $forcertl (bool) if 'R' forces RTL, if 'L' forces LTR - * @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise. - * @param $currentfont (array) Reference to current font array. + * @param array $ta array of characters composing the string. + * @param string $str string to process + * @param bool $forcertl if 'R' forces RTL, if 'L' forces LTR + * @param boolean $isunicode True if the document is in Unicode mode, false otherwise. + * @param array $currentfont Reference to current font array. * @return array of unicode chars * @author Nicola Asuni * @since 2.4.000 (2008-03-06) * @public static */ - public static function utf8Bidi($ta, $str='', $forcertl=false, $isunicode=true, &$currentfont) { + public static function utf8Bidi($ta, $str, $forcertl, $isunicode, &$currentfont) { // paragraph embedding level $pel = 0; // max level diff --git a/lib/combodo/tcpdf/include/tcpdf_images.php b/lib/combodo/tcpdf/include/tcpdf_images.php index 5e504f210..6f2860c60 100644 --- a/lib/combodo/tcpdf/include/tcpdf_images.php +++ b/lib/combodo/tcpdf/include/tcpdf_images.php @@ -55,6 +55,8 @@ class TCPDF_IMAGES { * Array of hinheritable SVG properties. * @since 5.0.000 (2010-05-02) * @public static + * + * @var string[] */ public static $svginheritprop = array('clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'display', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'visibility', 'word-spacing', 'writing-mode'); @@ -62,8 +64,8 @@ class TCPDF_IMAGES { /** * Return the image type given the file name or array returned by getimagesize() function. - * @param $imgfile (string) image file name - * @param $iminfo (array) array of image information returned by getimagesize() function. + * @param string $imgfile image file name + * @param array $iminfo array of image information returned by getimagesize() function. * @return string image type * @since 4.8.017 (2009-11-27) * @public static @@ -77,10 +79,7 @@ class TCPDF_IMAGES { } } if (empty($type)) { - $fileinfo = pathinfo($imgfile); - if (isset($fileinfo['extension']) AND (!TCPDF_STATIC::empty_string($fileinfo['extension']))) { - $type = strtolower(trim($fileinfo['extension'])); - } + $type = strtolower(trim(pathinfo(parse_url($imgfile, PHP_URL_PATH), PATHINFO_EXTENSION))); } if ($type == 'jpg') { $type = 'jpeg'; @@ -90,9 +89,9 @@ class TCPDF_IMAGES { /** * Set the transparency for the given GD image. - * @param $new_image (image) GD image object - * @param $image (image) GD image object. - * return GD image object. + * @param resource $new_image GD image object + * @param resource $image GD image object. + * @return resource GD image object $new_image * @since 4.9.016 (2010-04-20) * @public static */ @@ -115,8 +114,8 @@ class TCPDF_IMAGES { /** * Convert the loaded image to a PNG and then return a structure for the PDF creator. * This function requires GD library and write access to the directory defined on K_PATH_CACHE constant. - * @param $image (image) Image object. - * @param $tempfile (string) Temporary file name. + * @param resource $image Image object. + * @param string $tempfile Temporary file name. * return image PNG image object. * @since 4.9.016 (2010-04-20) * @public static @@ -138,10 +137,10 @@ class TCPDF_IMAGES { /** * Convert the loaded image to a JPEG and then return a structure for the PDF creator. * This function requires GD library and write access to the directory defined on K_PATH_CACHE constant. - * @param $image (image) Image object. - * @param $quality (int) JPEG quality. - * @param $tempfile (string) Temporary file name. - * return image JPEG image object. + * @param resource $image Image object. + * @param int $quality JPEG quality. + * @param string $tempfile Temporary file name. + * return array|false image JPEG image object. * @public static */ public static function _toJPEG($image, $quality, $tempfile) { @@ -155,8 +154,8 @@ class TCPDF_IMAGES { /** * Extract info from a JPEG file without using the GD library. - * @param $file (string) image file to parse - * @return array structure containing the image data + * @param string $file image file to parse + * @return array|false structure containing the image data * @public static */ public static function _parsejpeg($file) { @@ -234,8 +233,8 @@ class TCPDF_IMAGES { /** * Extract info from a PNG file without using the GD library. - * @param $file (string) image file to parse - * @return array structure containing the image data + * @param string $file image file to parse + * @return array|false structure containing the image data * @public static */ public static function _parsepng($file) { diff --git a/lib/combodo/tcpdf/include/tcpdf_static.php b/lib/combodo/tcpdf/include/tcpdf_static.php index 06a1dddcc..a118d0588 100644 --- a/lib/combodo/tcpdf/include/tcpdf_static.php +++ b/lib/combodo/tcpdf/include/tcpdf_static.php @@ -7,7 +7,7 @@ // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- -// Copyright (C) 2002-2015 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2002-2021 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.3.5'; + private static $tcpdf_version = '6.4.4'; /** * String alias for total number of pages. @@ -110,7 +110,7 @@ class TCPDF_STATIC { /** * Return the current TCPDF version. - * @return TCPDF version string + * @return string TCPDF version string * @since 5.9.012 (2010-11-10) * @public static */ @@ -120,7 +120,7 @@ class TCPDF_STATIC { /** * Return the current TCPDF producer. - * @return TCPDF producer string + * @return string TCPDF producer string * @since 6.0.000 (2013-03-16) * @public static */ @@ -130,7 +130,7 @@ class TCPDF_STATIC { /** * Sets the current active configuration setting of magic_quotes_runtime (if the set_magic_quotes_runtime function exist) - * @param $mqr (boolean) FALSE for off, TRUE for on. + * @param boolean $mqr FALSE for off, TRUE for on. * @since 4.6.025 (2009-08-17) * @public static */ @@ -146,7 +146,7 @@ class TCPDF_STATIC { /** * Gets the current active configuration setting of magic_quotes_runtime (if the get_magic_quotes_runtime function exist) - * @return Returns 0 if magic quotes runtime is off or get_magic_quotes_runtime doesn't exist, 1 otherwise. + * @return int Returns 0 if magic quotes runtime is off or get_magic_quotes_runtime doesn't exist, 1 otherwise. * @since 4.6.025 (2009-08-17) * @public static */ @@ -163,13 +163,16 @@ class TCPDF_STATIC { /** * Check if the URL exist. - * @param $url (string) URL to check. - * @return Boolean true if the URl exist, false otherwise. + * @param string $url URL to check. + * @return boolean true if the URl exist, false otherwise. * @since 5.9.204 (2013-01-28) * @public static */ public static function isValidURL($url) { $headers = @get_headers($url); + if ($headers === false) { + return false; + } return (strpos($headers[0], '200') !== false); } @@ -184,8 +187,8 @@ class TCPDF_STATIC { *
  • UTF-8 (hex): 0xC2 0xAD (c2ad)
  • *
  • UTF-8 character: chr(194).chr(173)
  • * - * @param $txt (string) input string - * @param $unicode (boolean) True if we are in unicode mode, false otherwise. + * @param string $txt input string + * @param boolean $unicode True if we are in unicode mode, false otherwise. * @return string without SHY characters. * @since (4.5.019) 2009-02-28 * @public static @@ -201,10 +204,10 @@ class TCPDF_STATIC { /** * Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages) - * @param $brd (mixed) Indicates if borders must be drawn around the cell block. The value can be a number:
    • 0: no border (default)
    • 1: frame
    or a string containing some or all of the following characters (in any order):
    • L: left
    • T: top
    • R: right
    • B: bottom
    or an array of line styles for each border group: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $position (string) multicell position: 'start', 'middle', 'end' - * @param $opencell (boolean) True when the cell is left open at the page bottom, false otherwise. - * @return border mode array + * @param string|array|int $brd Indicates if borders must be drawn around the cell block. The value can be a number:
    • 0: no border (default)
    • 1: frame
    or a string containing some or all of the following characters (in any order):
    • L: left
    • T: top
    • R: right
    • B: bottom
    or an array of line styles for each border group: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param string $position multicell position: 'start', 'middle', 'end' + * @param boolean $opencell True when the cell is left open at the page bottom, false otherwise. + * @return array border mode array * @since 4.4.002 (2008-12-09) * @public static */ @@ -275,8 +278,8 @@ class TCPDF_STATIC { /** * Determine whether a string is empty. - * @param $str (string) string to be checked - * @return boolean true if string is empty + * @param string $str string to be checked + * @return bool true if string is empty * @since 4.5.044 (2009-04-16) * @public static */ @@ -286,8 +289,8 @@ class TCPDF_STATIC { /** * Returns a temporary filename for caching object on filesystem. - * @param $type (string) Type of file (name of the subdir on the tcpdf cache folder). - * @param $file_id (string) TCPDF file_id. + * @param string $type Type of file (name of the subdir on the tcpdf cache folder). + * @param string $file_id TCPDF file_id. * @return string filename. * @since 4.5.000 (2008-12-31) * @public static @@ -298,7 +301,7 @@ class TCPDF_STATIC { /** * Add "\" before "\", "(" and ")" - * @param $s (string) string to escape. + * @param string $s string to escape. * @return string escaped string. * @public static */ @@ -309,8 +312,8 @@ class TCPDF_STATIC { /** * Escape some special characters (< > &) for XML output. - * @param $str (string) Input string to convert. - * @return converted string + * @param string $str Input string to convert. + * @return string converted string * @since 5.9.121 (2011-09-28) * @public static */ @@ -322,8 +325,8 @@ class TCPDF_STATIC { /** * Creates a copy of a class object - * @param $object (object) class object to be cloned - * @return cloned object + * @param object $object class object to be cloned + * @return object cloned object * @since 4.5.029 (2009-03-19) * @public static */ @@ -337,8 +340,8 @@ class TCPDF_STATIC { /** * Output input data and compress it if possible. - * @param $data (string) Data to output. - * @param $length (int) Data length in bytes. + * @param string $data Data to output. + * @param int $length Data length in bytes. * @since 5.9.086 * @public static */ @@ -352,10 +355,10 @@ class TCPDF_STATIC { /** * Replace page number aliases with number. - * @param $page (string) Page content. - * @param $replace (array) Array of replacements (array keys are replacement strings, values are alias arrays). - * @param $diff (int) If passed, this will be set to the total char number difference between alias and replacements. - * @return replaced page content and updated $diff parameter as array. + * @param string $page Page content. + * @param array $replace Array of replacements (array keys are replacement strings, values are alias arrays). + * @param int $diff If passed, this will be set to the total char number difference between alias and replacements. + * @return array replaced page content and updated $diff parameter as array. * @public static */ public static function replacePageNumAliases($page, $replace, $diff=0) { @@ -372,7 +375,7 @@ class TCPDF_STATIC { /** * Returns timestamp in seconds from formatted date-time. - * @param $date (string) Formatted date-time. + * @param string $date Formatted date-time. * @return int seconds. * @since 5.9.152 (2012-03-23) * @public static @@ -387,7 +390,7 @@ class TCPDF_STATIC { /** * Returns a formatted date-time. - * @param $time (int) Time in seconds. + * @param int $time Time in seconds. * @return string escaped date string. * @since 5.9.152 (2012-03-23) * @public static @@ -398,7 +401,7 @@ class TCPDF_STATIC { /** * Returns a string containing random data to be used as a seed for encryption methods. - * @param $seed (string) starting seed value + * @param string $seed starting seed value * @return string containing random data * @author Nicola Asuni * @since 5.9.006 (2010-10-19) @@ -422,8 +425,8 @@ class TCPDF_STATIC { /** * Encrypts a string using MD5 and returns it's value as a binary string. - * @param $str (string) input string - * @return String MD5 encrypted binary string + * @param string $str input string + * @return string MD5 encrypted binary string * @since 2.0.000 (2008-01-02) * @public static */ @@ -432,11 +435,11 @@ class TCPDF_STATIC { } /** - * Returns the input text exrypted using AES algorithm and the specified key. + * Returns the input text encrypted using AES algorithm and the specified key. * This method requires openssl or mcrypt. Text is padded to 16bytes blocks - * @param $key (string) encryption key - * @param $text (String) input text to be encrypted - * @return String encrypted text + * @param string $key encryption key + * @param string $text input text to be encrypted + * @return string encrypted text * @author Nicola Asuni * @since 5.0.005 (2010-05-11) * @public static @@ -446,8 +449,12 @@ class TCPDF_STATIC { $padding = 16 - (strlen($text) % 16); $text .= str_repeat(chr($padding), $padding); if (extension_loaded('openssl')) { - $iv = openssl_random_pseudo_bytes (openssl_cipher_iv_length('aes-256-cbc')); - $text = openssl_encrypt($text, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv); + $algo = 'aes-256-cbc'; + if (strlen($key) == 16) { + $algo = 'aes-128-cbc'; + } + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($algo)); + $text = openssl_encrypt($text, $algo, $key, OPENSSL_RAW_DATA, $iv); return $iv.substr($text, 0, -16); } $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND); @@ -457,19 +464,23 @@ class TCPDF_STATIC { } /** - * Returns the input text exrypted using AES algorithm and the specified key. + * Returns the input text encrypted using AES algorithm and the specified key. * This method requires openssl or mcrypt. Text is not padded - * @param $key (string) encryption key - * @param $text (String) input text to be encrypted - * @return String encrypted text + * @param string $key encryption key + * @param string $text input text to be encrypted + * @return string encrypted text * @author Nicola Asuni * @since TODO * @public static */ public static function _AESnopad($key, $text) { if (extension_loaded('openssl')) { - $iv = str_repeat("\x00", openssl_cipher_iv_length('aes-256-cbc')); - $text = openssl_encrypt($text, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv); + $algo = 'aes-256-cbc'; + if (strlen($key) == 16) { + $algo = 'aes-128-cbc'; + } + $iv = str_repeat("\x00", openssl_cipher_iv_length($algo)); + $text = openssl_encrypt($text, $algo, $key, OPENSSL_RAW_DATA, $iv); return substr($text, 0, -16); } $iv = str_repeat("\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); @@ -480,11 +491,11 @@ class TCPDF_STATIC { /** * Returns the input text encrypted using RC4 algorithm and the specified key. * RC4 is the standard encryption algorithm used in PDF format - * @param $key (string) Encryption key. - * @param $text (String) Input text to be encrypted. - * @param $last_enc_key (String) Reference to last RC4 key encrypted. - * @param $last_enc_key_c (String) Reference to last RC4 computed key. - * @return String encrypted text + * @param string $key Encryption key. + * @param string $text Input text to be encrypted. + * @param string $last_enc_key Reference to last RC4 key encrypted. + * @param string $last_enc_key_c Reference to last RC4 computed key. + * @return string encrypted text * @since 2.0.000 (2008-01-02) * @author Klemen Vodopivec, Nicola Asuni * @public static @@ -495,7 +506,7 @@ class TCPDF_STATIC { return $out; } if ($last_enc_key != $key) { - $k = str_repeat($key, ((256 / strlen($key)) + 1)); + $k = str_repeat($key, (int) ((256 / strlen($key)) + 1)); $rc4 = range(0, 255); $j = 0; for ($i = 0; $i < 256; ++$i) { @@ -527,8 +538,8 @@ class TCPDF_STATIC { /** * Return the permission code used on encryption (P value). - * @param $permissions (Array) the set of permissions (specify the ones you want to block). - * @param $mode (int) encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. + * @param array $permissions the set of permissions (specify the ones you want to block). + * @param int $mode encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. * @since 5.0.005 (2010-05-12) * @author Nicola Asuni * @public static @@ -564,8 +575,8 @@ class TCPDF_STATIC { /** * Convert hexadecimal string to string - * @param $bs (string) byte-string to convert - * @return String + * @param string $bs byte-string to convert + * @return string * @since 5.0.005 (2010-05-12) * @author Nicola Asuni * @public static @@ -586,8 +597,8 @@ class TCPDF_STATIC { /** * Convert string to hexadecimal string (byte string) - * @param $s (string) string to convert - * @return byte string + * @param string $s string to convert + * @return string byte string * @since 5.0.010 (2010-05-17) * @author Nicola Asuni * @public static @@ -603,8 +614,8 @@ class TCPDF_STATIC { /** * Convert encryption P value to a string of bytes, low-order byte first. - * @param $protection (string) 32bit encryption permission value (P value) - * @return String + * @param string $protection 32bit encryption permission value (P value) + * @return string * @since 5.0.005 (2010-05-12) * @author Nicola Asuni * @public static @@ -620,8 +631,8 @@ class TCPDF_STATIC { /** * Encode a name object. - * @param $name (string) Name object to encode. - * @return (string) Encoded name object. + * @param string $name Name object to encode. + * @return string Encoded name object. * @author Nicola Asuni * @since 5.9.097 (2011-06-23) * @public static @@ -642,9 +653,9 @@ class TCPDF_STATIC { /** * Convert JavaScript form fields properties array to Annotation Properties array. - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. - * @param $spot_colors (array) Reference to spot colors array. - * @param $rtl (boolean) True if in Right-To-Left text direction mode, false otherwise. + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $spot_colors Reference to spot colors array. + * @param boolean $rtl True if in Right-To-Left text direction mode, false otherwise. * @return array of annotation properties * @author Nicola Asuni * @since 4.8.000 (2009-09-06) @@ -652,7 +663,7 @@ class TCPDF_STATIC { */ public static function getAnnotOptFromJSProp($prop, &$spot_colors, $rtl=false) { if (isset($prop['aopt']) AND is_array($prop['aopt'])) { - // the annotation options area lready defined + // the annotation options are already defined return $prop['aopt']; } $opt = array(); // value to be returned @@ -1011,8 +1022,9 @@ class TCPDF_STATIC { /** * Format the page numbers. - * This method can be overriden for custom formats. - * @param $num (int) page number + * This method can be overridden for custom formats. + * @param int $num page number + * @return string * @since 4.2.005 (2008-11-06) * @public static */ @@ -1022,8 +1034,9 @@ class TCPDF_STATIC { /** * Format the page numbers on the Table Of Content. - * This method can be overriden for custom formats. - * @param $num (int) page number + * This method can be overridden for custom formats. + * @param int $num page number + * @return string * @since 4.5.001 (2009-01-04) * @see addTOC(), addHTMLTOC() * @public static @@ -1034,8 +1047,8 @@ class TCPDF_STATIC { /** * Extracts the CSS properties from a CSS string. - * @param $cssdata (string) string containing CSS definitions. - * @return An array where the keys are the CSS selectors and the values are the CSS properties. + * @param string $cssdata string containing CSS definitions. + * @return array An array where the keys are the CSS selectors and the values are the CSS properties. * @author Nicola Asuni * @since 5.1.000 (2010-05-25) * @public static @@ -1125,20 +1138,20 @@ class TCPDF_STATIC { /** * Cleanup HTML code (requires HTML Tidy library). - * @param $html (string) htmlcode to fix - * @param $default_css (string) CSS commands to add - * @param $tagvs (array) parameters for setHtmlVSpace method - * @param $tidy_options (array) options for tidy_parse_string function - * @param $tagvspaces (array) Array of vertical spaces for tags. + * @param string $html htmlcode to fix + * @param string $default_css CSS commands to add + * @param array|null $tagvs parameters for setHtmlVSpace method + * @param array|null $tidy_options options for tidy_parse_string function + * @param array $tagvspaces Array of vertical spaces for tags. * @return string XHTML code cleaned up * @author Nicola Asuni * @since 5.9.017 (2010-11-16) * @see setHtmlVSpace() * @public static */ - public static function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='', &$tagvspaces) { + public static function fixHTMLCode($html, $default_css, $tagvs, $tidy_options, &$tagvspaces) { // configure parameters for HTML Tidy - if ($tidy_options === '') { + if (TCPDF_STATIC::empty_string($tidy_options)) { $tidy_options = array ( 'clean' => 1, 'drop-empty-paras' => 0, @@ -1185,7 +1198,7 @@ class TCPDF_STATIC { // remove some empty tag blocks $html = preg_replace('/]*)><\/div>/', '', $html); $html = preg_replace('/]*)><\/p>/', '', $html); - if ($tagvs !== '') { + if (!TCPDF_STATIC::empty_string($tagvs)) { // set vertical space for some XHTML tags $tagvspaces = $tagvs; } @@ -1195,9 +1208,9 @@ class TCPDF_STATIC { /** * Returns true if the CSS selector is valid for the selected HTML tag - * @param $dom (array) array of HTML tags and properties - * @param $key (int) key of the current HTML tag - * @param $selector (string) CSS selector string + * @param array $dom array of HTML tags and properties + * @param int $key key of the current HTML tag + * @param string $selector CSS selector string * @return true if the selector is valid, false otherwise * @since 5.1.000 (2010-05-25) * @public static @@ -1355,9 +1368,9 @@ class TCPDF_STATIC { /** * Returns the styles array that apply for the selected HTML tag. - * @param $dom (array) array of HTML tags and properties - * @param $key (int) key of the current HTML tag - * @param $css (array) array of CSS properties + * @param array $dom array of HTML tags and properties + * @param int $key key of the current HTML tag + * @param array $css array of CSS properties * @return array containing CSS properties * @since 5.1.000 (2010-05-25) * @public static @@ -1402,7 +1415,7 @@ class TCPDF_STATIC { /** * Compact CSS data array into single string. - * @param $css (array) array of CSS properties + * @param array $css array of CSS properties * @return string containing merged CSS properties * @since 5.9.070 (2011-04-19) * @public static @@ -1433,13 +1446,17 @@ class TCPDF_STATIC { /** * Returns the Roman representation of an integer number - * @param $number (int) number to convert + * @param int $number number to convert * @return string roman representation of the specified number * @since 4.4.004 (2008-12-10) * @public static */ public static function intToRoman($number) { $roman = ''; + if ($number >= 4000) { + // do not represent numbers above 4000 in Roman numerals + return strval($number); + } while ($number >= 1000) { $roman .= 'M'; $number -= 1000; @@ -1497,10 +1514,10 @@ class TCPDF_STATIC { /** * Find position of last occurrence of a substring in a string - * @param $haystack (string) The string to search in. - * @param $needle (string) substring to search. - * @param $offset (int) May be specified to begin searching an arbitrary number of characters into the string. - * @return Returns the position where the needle exists. Returns FALSE if the needle was not found. + * @param string $haystack The string to search in. + * @param string $needle substring to search. + * @param int $offset May be specified to begin searching an arbitrary number of characters into the string. + * @return int|false Returns the position where the needle exists. Returns FALSE if the needle was not found. * @since 4.8.038 (2010-03-13) * @public static */ @@ -1513,7 +1530,7 @@ class TCPDF_STATIC { /** * Returns an array of hyphenation patterns. - * @param $file (string) TEX file containing hypenation patterns. TEX pattrns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/ + * @param string $file TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/ * @return array of hyphenation patterns * @author Nicola Asuni * @since 4.9.012 (2010-04-12) @@ -1546,7 +1563,7 @@ class TCPDF_STATIC { /** * Get the Path-Painting Operators. - * @param $style (string) Style of rendering. Possible values are: + * @param string $style Style of rendering. Possible values are: *
      *
    • S or D: Stroke the path.
    • *
    • s or d: Close and stroke the path.
    • @@ -1560,7 +1577,8 @@ class TCPDF_STATIC { *
    • CEO: Clipping mode using the nonzero winding number rule to determine which regions lie inside the clipping path
    • *
    • n: End the path object without filling or stroking it.
    • *
    - * @param $default (string) default style + * @param string $default default style + * @return string * @author Nicola Asuni * @since 5.0.000 (2010-04-30) * @public static @@ -1637,9 +1655,9 @@ class TCPDF_STATIC { /** * Get the product of two SVG tranformation matrices - * @param $ta (array) first SVG tranformation matrix - * @param $tb (array) second SVG tranformation matrix - * @return transformation array + * @param array $ta first SVG tranformation matrix + * @param array $tb second SVG tranformation matrix + * @return array transformation array * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @public static @@ -1657,7 +1675,7 @@ class TCPDF_STATIC { /** * Get the tranformation matrix from SVG transform attribute - * @param $attribute (string) transformation + * @param string $attribute transformation * @return array of transformations * @author Nicola Asuni * @since 5.0.000 (2010-05-02) @@ -1752,10 +1770,10 @@ class TCPDF_STATIC { /** * Returns the angle in radiants between two vectors - * @param $x1 (int) X coordinate of first vector point - * @param $y1 (int) Y coordinate of first vector point - * @param $x2 (int) X coordinate of second vector point - * @param $y2 (int) Y coordinate of second vector point + * @param int $x1 X coordinate of first vector point + * @param int $y1 Y coordinate of first vector point + * @param int $x2 X coordinate of second vector point + * @param int $y2 Y coordinate of second vector point * @author Nicola Asuni * @since 5.0.000 (2010-05-04) * @public static @@ -1777,17 +1795,20 @@ class TCPDF_STATIC { /** * Split string by a regular expression. * This is a wrapper for the preg_split function to avoid the bug: https://bugs.php.net/bug.php?id=45850 - * @param $pattern (string) The regular expression pattern to search for without the modifiers, as a string. - * @param $modifiers (string) The modifiers part of the pattern, - * @param $subject (string) The input string. - * @param $limit (int) If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1, 0 or NULL means "no limit" and, as is standard across PHP, you can use NULL to skip to the flags parameter. - * @param $flags (int) The flags as specified on the preg_split PHP function. - * @return Returns an array containing substrings of subject split along boundaries matched by pattern.modifier + * @param string $pattern The regular expression pattern to search for without the modifiers, as a string. + * @param string $modifiers The modifiers part of the pattern, + * @param string $subject The input string. + * @param int $limit If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1, 0 or NULL means "no limit" and, as is standard across PHP, you can use NULL to skip to the flags parameter. + * @param int $flags The flags as specified on the preg_split PHP function. + * @return array Returns an array containing substrings of subject split along boundaries matched by pattern.modifier * @author Nicola Asuni * @since 6.0.023 * @public static */ public static function pregSplit($pattern, $modifiers, $subject, $limit=NULL, $flags=NULL) { + // PHP 8.1 deprecates nulls for $limit and $flags + $limit = $limit === null ? -1 : $limit; + $flags = $flags === null ? 0 : $flags; // the bug only happens on PHP 5.2 when using the u modifier if ((strpos($modifiers, 'u') === FALSE) OR (count(preg_split('//u', "\n\t", -1, PREG_SPLIT_NO_EMPTY)) == 2)) { return preg_split($pattern.$modifiers, $subject, $limit, $flags); @@ -1807,9 +1828,9 @@ class TCPDF_STATIC { /** * Wrapper to use fopen only with local files - * @param filename (string) Name of the file to open - * @param $mode (string) - * @return Returns a file pointer resource on success, or FALSE on error. + * @param string $filename Name of the file to open + * @param string $mode + * @return resource|false Returns a file pointer resource on success, or FALSE on error. * @public static */ public static function fopenLocal($filename, $mode) { @@ -1823,9 +1844,10 @@ class TCPDF_STATIC { /** * Check if the URL exist. - * @param url (string) URL to check. - * @return Returns TRUE if the URL exists; FALSE otherwise. + * @param string $url URL to check. + * @return bool Returns TRUE if the URL exists; FALSE otherwise. * @public static + * @since 6.2.25 */ public static function url_exists($url) { $crs = curl_init(); @@ -1842,6 +1864,10 @@ class TCPDF_STATIC { curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file'); + curl_setopt($crs, CURLOPT_MAXREDIRS, 5); + if (defined('CURLOPT_PROTOCOLS')) { + curl_setopt($crs, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS); + } curl_exec($crs); $code = curl_getinfo($crs, CURLINFO_HTTP_CODE); curl_close($crs); @@ -1872,8 +1898,8 @@ class TCPDF_STATIC { * Wrapper for file_exists. * Checks whether a file or directory exists. * Only allows some protocols and local files. - * @param filename (string) Path to the file or directory. - * @return Returns TRUE if the file or directory specified by filename exists; FALSE otherwise. + * @param string $filename Path to the file or directory. + * @return bool Returns TRUE if the file or directory specified by filename exists; FALSE otherwise. * @public static */ public static function file_exists($filename) { @@ -1889,8 +1915,8 @@ class TCPDF_STATIC { /** * Reads entire file into a string. * The file can be also an URL. - * @param $file (string) Name of the file or URL to read. - * @return The function returns the read data or FALSE on failure. + * @param string $file Name of the file or URL to read. + * @return string|false The function returns the read data or FALSE on failure. * @author Nicola Asuni * @since 6.0.025 * @public static @@ -1973,6 +1999,10 @@ class TCPDF_STATIC { curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file'); + curl_setopt($crs, CURLOPT_MAXREDIRS, 5); + if (defined('CURLOPT_PROTOCOLS')) { + curl_setopt($crs, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS); + } $ret = curl_exec($crs); curl_close($crs); if ($ret !== false) { @@ -1985,8 +2015,8 @@ class TCPDF_STATIC { /** * Get ULONG from string (Big Endian 32-bit unsigned integer). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param string $str string from where to extract value + * @param int $offset point from where to read the data * @return int 32 bit value * @author Nicola Asuni * @since 5.2.000 (2010-06-02) @@ -1999,8 +2029,8 @@ class TCPDF_STATIC { /** * Get USHORT from string (Big Endian 16-bit unsigned integer). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param string $str string from where to extract value + * @param int $offset point from where to read the data * @return int 16 bit value * @author Nicola Asuni * @since 5.2.000 (2010-06-02) @@ -2013,8 +2043,8 @@ class TCPDF_STATIC { /** * Get SHORT from string (Big Endian 16-bit signed integer). - * @param $str (string) String from where to extract value. - * @param $offset (int) Point from where to read the data. + * @param string $str String from where to extract value. + * @param int $offset Point from where to read the data. * @return int 16 bit value * @author Nicola Asuni * @since 5.2.000 (2010-06-02) @@ -2027,8 +2057,8 @@ class TCPDF_STATIC { /** * Get FWORD from string (Big Endian 16-bit signed integer). - * @param $str (string) String from where to extract value. - * @param $offset (int) Point from where to read the data. + * @param string $str String from where to extract value. + * @param int $offset Point from where to read the data. * @return int 16 bit value * @author Nicola Asuni * @since 5.9.123 (2011-09-30) @@ -2044,8 +2074,8 @@ class TCPDF_STATIC { /** * Get UFWORD from string (Big Endian 16-bit unsigned integer). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param string $str string from where to extract value + * @param int $offset point from where to read the data * @return int 16 bit value * @author Nicola Asuni * @since 5.9.123 (2011-09-30) @@ -2058,8 +2088,8 @@ class TCPDF_STATIC { /** * Get FIXED from string (32-bit signed fixed-point number (16.16). - * @param $str (string) string from where to extract value - * @param $offset (int) point from where to read the data + * @param string $str string from where to extract value + * @param int $offset point from where to read the data * @return int 16 bit value * @author Nicola Asuni * @since 5.9.123 (2011-09-30) @@ -2076,8 +2106,8 @@ class TCPDF_STATIC { /** * Get BYTE from string (8-bit unsigned integer). - * @param $str (string) String from where to extract value. - * @param $offset (int) Point from where to read the data. + * @param string $str String from where to extract value. + * @param int $offset Point from where to read the data. * @return int 8 bit value * @author Nicola Asuni * @since 5.2.000 (2010-06-02) @@ -2090,9 +2120,9 @@ class TCPDF_STATIC { /** * Binary-safe and URL-safe file read. * Reads up to length bytes from the file pointer referenced by handle. Reading stops as soon as one of the following conditions is met: length bytes have been read; EOF (end of file) is reached. - * @param $handle (resource) - * @param $length (int) - * @return Returns the read string or FALSE in case of error. + * @param resource $handle + * @param int $length + * @return string|false Returns the read string or FALSE in case of error. * @author Nicola Asuni * @since 4.5.027 (2009-03-16) * @public static @@ -2111,8 +2141,8 @@ class TCPDF_STATIC { /** * Read a 4-byte (32 bit) integer from file. - * @param $f (string) file name. - * @return 4-byte integer + * @param resource $f file resource. + * @return int 4-byte integer * @public static */ public static function _freadint($f) { @@ -2120,11 +2150,12 @@ class TCPDF_STATIC { return $a['i']; } - /** * Array of page formats * measures are calculated in this way: (inches * 72) or (millimeters * 72 / 25.4) * @public static + * + * @var array */ public static $page_formats = array( // ISO 216 A Series + 2 SIS 014711 extensions @@ -2480,7 +2511,7 @@ class TCPDF_STATIC { /** * Get page dimensions from format name. - * @param $format (mixed) The format name @see self::$page_format
      + * @param mixed $format The format name @see self::$page_format
        * @return array containing page width and height in points * @since 5.0.010 (2010-05-17) * @public static @@ -2494,20 +2525,20 @@ class TCPDF_STATIC { /** * Set page boundaries. - * @param $page (int) page number - * @param $type (string) valid values are:
        • 'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed;
        • 'CropBox' : the visible region of default user space;
        • 'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment;
        • 'TrimBox' : the intended dimensions of the finished page after trimming;
        • 'ArtBox' : the page's meaningful content (including potential white space).
        - * @param $llx (float) lower-left x coordinate in user units. - * @param $lly (float) lower-left y coordinate in user units. - * @param $urx (float) upper-right x coordinate in user units. - * @param $ury (float) upper-right y coordinate in user units. - * @param $points (boolean) If true uses user units as unit of measure, otherwise uses PDF points. - * @param $k (float) Scale factor (number of points in user unit). - * @param $pagedim (array) Array of page dimensions. - * @return pagedim array of page dimensions. + * @param int $page page number + * @param string $type valid values are:
        • 'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed;
        • 'CropBox' : the visible region of default user space;
        • 'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment;
        • 'TrimBox' : the intended dimensions of the finished page after trimming;
        • 'ArtBox' : the page's meaningful content (including potential white space).
        + * @param float $llx lower-left x coordinate in user units. + * @param float $lly lower-left y coordinate in user units. + * @param float $urx upper-right x coordinate in user units. + * @param float $ury upper-right y coordinate in user units. + * @param boolean $points If true uses user units as unit of measure, otherwise uses PDF points. + * @param float $k Scale factor (number of points in user unit). + * @param array $pagedim Array of page dimensions. + * @return array pagedim array of page dimensions. * @since 5.0.010 (2010-05-17) * @public static */ - public static function setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points=false, $k, $pagedim=array()) { + public static function setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points, $k, $pagedim=array()) { if (!isset($pagedim[$page])) { // initialize array $pagedim[$page] = array(); @@ -2527,9 +2558,9 @@ class TCPDF_STATIC { /** * Swap X and Y coordinates of page boxes (change page boxes orientation). - * @param $page (int) page number - * @param $pagedim (array) Array of page dimensions. - * @return pagedim array of page dimensions. + * @param int $page page number + * @param array $pagedim Array of page dimensions. + * @return array pagedim array of page dimensions. * @since 5.0.010 (2010-05-17) * @public static */ @@ -2550,8 +2581,8 @@ class TCPDF_STATIC { /** * Get the canonical page layout mode. - * @param $layout (string) The page layout. Possible values are:
        • SinglePage Display one page at a time
        • OneColumn Display the pages in one column
        • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
        • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
        • TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
        • TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right
        - * @return (string) Canonical page layout name. + * @param string $layout The page layout. Possible values are:
        • SinglePage Display one page at a time
        • OneColumn Display the pages in one column
        • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
        • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
        • TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
        • TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right
        + * @return string Canonical page layout name. * @public static */ public static function getPageLayoutMode($layout='SinglePage') { @@ -2593,8 +2624,8 @@ class TCPDF_STATIC { /** * Get the canonical page layout mode. - * @param $mode (string) A name object specifying how the document should be displayed when opened:
        • UseNone Neither document outline nor thumbnail images visible
        • UseOutlines Document outline visible
        • UseThumbs Thumbnail images visible
        • FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
        • UseOC (PDF 1.5) Optional content group panel visible
        • UseAttachments (PDF 1.6) Attachments panel visible
        - * @return (string) Canonical page mode name. + * @param string $mode A name object specifying how the document should be displayed when opened:
        • UseNone Neither document outline nor thumbnail images visible
        • UseOutlines Document outline visible
        • UseThumbs Thumbnail images visible
        • FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
        • UseOC (PDF 1.5) Optional content group panel visible
        • UseAttachments (PDF 1.6) Attachments panel visible
        + * @return string Canonical page mode name. * @public static */ public static function getPageMode($mode='UseNone') { diff --git a/lib/combodo/tcpdf/tcpdf.php b/lib/combodo/tcpdf/tcpdf.php index a71afc3a8..400434730 100644 --- a/lib/combodo/tcpdf/tcpdf.php +++ b/lib/combodo/tcpdf/tcpdf.php @@ -1,13 +1,13 @@ + * @phpstan-var array{0: string, 1: string, 2: float|null} */ protected $header_font; /** * Default font used on page footer. * @protected + * @var array + * @phpstan-var array{0: string, 1: string, 2: float|null} */ protected $footer_font; @@ -652,7 +656,7 @@ class TCPDF { protected $header_title = ''; /** - * String to pring on page header after title. + * String to print on page header after title. * @protected */ protected $header_string = ''; @@ -661,6 +665,8 @@ class TCPDF { * Color for header text (RGB array). * @since 5.9.174 (2012-07-25) * @protected + * @var int[] + * @phpstan-var array{0: int, 1: int, 2: int} */ protected $header_text_color = array(0,0,0); @@ -668,6 +674,8 @@ class TCPDF { * Color for header line (RGB array). * @since 5.9.174 (2012-07-25) * @protected + * @var int[] + * @phpstan-var array{0: int, 1: int, 2: int} */ protected $header_line_color = array(0,0,0); @@ -675,6 +683,8 @@ class TCPDF { * Color for footer text (RGB array). * @since 5.9.174 (2012-07-25) * @protected + * @var int[] + * @phpstan-var array{0: int, 1: int, 2: int} */ protected $footer_text_color = array(0,0,0); @@ -682,6 +692,8 @@ class TCPDF { * Color for footer line (RGB array). * @since 5.9.174 (2012-07-25) * @protected + * @var int[] + * @phpstan-var array{0: int, 1: int, 2: int} */ protected $footer_line_color = array(0,0,0); @@ -773,13 +785,6 @@ class TCPDF { */ protected $encoding = 'UTF-8'; - /** - * PHP internal encoding. - * @protected - * @since 1.53.0.TC016 - */ - protected $internal_encoding; - /** * Boolean flag to indicate if the document language is Right-To-Left. * @protected @@ -923,6 +928,7 @@ class TCPDF { * Default cell height ratio. * @protected * @since 3.0.014 (2008-05-23) + * @var float */ protected $cell_height_ratio = K_CELL_HEIGHT_RATIO; @@ -1800,6 +1806,7 @@ class TCPDF { * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). * @protected * @since 5.9.152 (2012-03-23) + * @var array */ protected $overprint = array('OP' => false, 'op' => false, 'OPM' => 0); @@ -1832,6 +1839,23 @@ class TCPDF { */ protected $gdgammacache = array(); + /** + * Cache array for file content + * @protected + * @var array + * @since 6.3.5 (2020-09-28) + */ + protected $fileContentCache = array(); + + /** + * Whether to allow local file path in image html tags, when prefixed with file:// + * + * @var bool + * @protected + * @since 6.4 (2020-07-23) + */ + protected $allowLocalFiles = false; + //------------------------------------------------------------ // METHODS //------------------------------------------------------------ @@ -1840,24 +1864,17 @@ class TCPDF { * This is the class constructor. * It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes). * - * IMPORTANT: Please note that this method sets the mb_internal_encoding to ASCII, so if you are using the mbstring module functions with TCPDF you need to correctly set/unset the mb_internal_encoding when needed. - * - * @param $orientation (string) page orientation. Possible values are (case insensitive):
        • P or Portrait (default)
        • L or Landscape
        • '' (empty string) for automatic orientation
        - * @param $unit (string) User measure unit. Possible values are:
        • pt: point
        • mm: millimeter (default)
        • cm: centimeter
        • in: inch

        A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit. - * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). - * @param $unicode (boolean) TRUE means that the input text is unicode (default = true) - * @param $encoding (string) Charset encoding (used only when converting back html entities); default is UTF-8. - * @param $diskcache (boolean) DEPRECATED FEATURE - * @param $pdfa (integer) If not false, set the document to PDF/A mode and the good version (1 or 3). + * @param string $orientation page orientation. Possible values are (case insensitive):
        • P or Portrait (default)
        • L or Landscape
        • '' (empty string) for automatic orientation
        + * @param string $unit User measure unit. Possible values are:
        • pt: point
        • mm: millimeter (default)
        • cm: centimeter
        • in: inch

        A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit. + * @param mixed $format The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). + * @param boolean $unicode TRUE means that the input text is unicode (default = true) + * @param string $encoding Charset encoding (used only when converting back html entities); default is UTF-8. + * @param boolean $diskcache DEPRECATED FEATURE + * @param false|integer $pdfa If not false, set the document to PDF/A mode and the good version (1 or 3). * @public * @see getPageSizeFromFormat(), setPageFormat() */ public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false, $pdfa=false) { - /* Set internal character encoding to ASCII */ - if (function_exists('mb_internal_encoding') AND mb_internal_encoding()) { - $this->internal_encoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } // set file ID for trailer $serformat = (is_array($format) ? json_encode($format) : $format); $this->file_id = md5(TCPDF_STATIC::getRandomSeed('TCPDF'.$orientation.$unit.$serformat.$encoding)); @@ -1932,7 +1949,7 @@ class TCPDF { $this->setPageFormat($format, $orientation); // page margins (1 cm) $margin = 28.35 / $this->k; - $this->SetMargins($margin, $margin); + $this->setMargins($margin, $margin); $this->clMargin = $this->lMargin; $this->crMargin = $this->rMargin; // internal cell padding @@ -1947,11 +1964,11 @@ class TCPDF { $this->linestyleJoin = '0 j'; $this->linestyleDash = '[] 0 d'; // automatic page break - $this->SetAutoPageBreak(true, (2 * $margin)); + $this->setAutoPageBreak(true, (2 * $margin)); // full width display mode - $this->SetDisplayMode('fullwidth'); + $this->setDisplayMode('fullwidth'); // compression - $this->SetCompression(); + $this->setCompression(); // set default PDF version number $this->setPDFVersion(); $this->tcpdflink = true; @@ -1982,7 +1999,7 @@ class TCPDF { // initialize some settings TCPDF_FONTS::utf8Bidi(array(), '', false, $this->isunicode, $this->CurrentFont); // set default font - $this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt); + $this->setFont($this->FontFamily, $this->FontStyle, $this->FontSizePt); $this->setHeaderFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt)); $this->setFooterFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt)); // check if PCRE Unicode support is enabled @@ -2024,7 +2041,7 @@ class TCPDF { /** * Set the units of measure for the document. - * @param $unit (string) User measure unit. Possible values are:
        • pt: point
        • mm: millimeter (default)
        • cm: centimeter
        • in: inch

        A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit. + * @param string $unit User measure unit. Possible values are:
        • pt: point
        • mm: millimeter (default)
        • cm: centimeter
        • in: inch

        A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit. * @public * @since 3.0.015 (2008-06-06) */ @@ -2067,7 +2084,7 @@ class TCPDF { /** * Change the format of the current page - * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() documentation or an array of two numbers (width, height) or an array containing the following measures and options:
          + * @param mixed $format The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() documentation or an array of two numbers (width, height) or an array containing the following measures and options:
            *
          • ['format'] = page format name (one of the above);
          • *
          • ['Rotate'] : The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
          • *
          • ['PZ'] : The page's preferred zoom (magnification) factor.
          • @@ -2111,7 +2128,7 @@ class TCPDF { *
          • ['trans']['SS'] : (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
          • *
          • ['trans']['B'] : (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
          • *
          - * @param $orientation (string) page orientation. Possible values are (case insensitive):
            + * @param string $orientation page orientation. Possible values are (case insensitive):
              *
            • P or Portrait (default)
            • *
            • L or Landscape
            • *
            • '' (empty string) for automatic orientation
            • @@ -2228,13 +2245,13 @@ class TCPDF { /** * Set page orientation. - * @param $orientation (string) page orientation. Possible values are (case insensitive):
              • P or Portrait (default)
              • L or Landscape
              • '' (empty string) for automatic orientation
              - * @param $autopagebreak (boolean) Boolean indicating if auto-page-break mode should be on or off. - * @param $bottommargin (float) bottom margin of the page. + * @param string $orientation page orientation. Possible values are (case insensitive):
              • P or Portrait (default)
              • L or Landscape
              • '' (empty string) for automatic orientation
              + * @param boolean|null $autopagebreak Boolean indicating if auto-page-break mode should be on or off. + * @param float|null $bottommargin bottom margin of the page. * @public * @since 3.0.015 (2008-06-06) */ - public function setPageOrientation($orientation, $autopagebreak='', $bottommargin='') { + public function setPageOrientation($orientation, $autopagebreak=null, $bottommargin=null) { if (!isset($this->pagedim[$this->page]['MediaBox'])) { // the boundaries of the physical medium on which the page shall be displayed or printed $this->pagedim = TCPDF_STATIC::setPageBoxes($this->page, 'MediaBox', 0, 0, $this->fwPt, $this->fhPt, true, $this->k, $this->pagedim); @@ -2306,7 +2323,7 @@ class TCPDF { $bottommargin = 2 * 28.35 / $this->k; } } - $this->SetAutoPageBreak($autopagebreak, $bottommargin); + $this->setAutoPageBreak($autopagebreak, $bottommargin); // store page dimensions $this->pagedim[$this->page]['w'] = $this->wPt; $this->pagedim[$this->page]['h'] = $this->hPt; @@ -2336,7 +2353,7 @@ class TCPDF { * \p{Lo} : Unicode letter or ideograph that does not have lowercase and uppercase variants. Is used to chunk chinese words. * \xa0 : Unicode Character 'NO-BREAK SPACE' (U+00A0) * - * @param $re (string) regular expression (leave empty for default). + * @param string $re regular expression (leave empty for default). * @public * @since 4.6.016 (2009-06-15) */ @@ -2360,8 +2377,8 @@ class TCPDF { /** * Enable or disable Right-To-Left language mode - * @param $enable (Boolean) if true enable Right-To-Left language mode. - * @param $resetx (Boolean) if true reset the X position on direction change. + * @param boolean $enable if true enable Right-To-Left language mode. + * @param boolean $resetx if true reset the X position on direction change. * @public * @since 2.0.000 (2008-01-03) */ @@ -2377,7 +2394,7 @@ class TCPDF { /** * Return the RTL status - * @return boolean + * @return bool * @public * @since 4.0.012 (2008-07-24) */ @@ -2387,7 +2404,7 @@ class TCPDF { /** * Force temporary RTL language direction - * @param $mode (mixed) can be false, 'L' for LTR or 'R' for RTL + * @param false|string $mode can be false, 'L' for LTR or 'R' for RTL * @public * @since 2.1.000 (2008-01-09) */ @@ -2419,7 +2436,7 @@ class TCPDF { /** * Return the current temporary RTL status - * @return boolean + * @return bool * @public * @since 4.8.014 (2009-11-04) */ @@ -2429,7 +2446,7 @@ class TCPDF { /** * Set the last cell height. - * @param $h (float) cell height. + * @param float $h cell height. * @author Nicola Asuni * @public * @since 1.53.0.TC034 @@ -2440,9 +2457,10 @@ class TCPDF { /** * Return the cell height - * @param $fontsize (int) Font size in internal units - * @param $padding (boolean) If true add cell padding + * @param int $fontsize Font size in internal units + * @param boolean $padding If true add cell padding * @public + * @return float */ public function getCellHeight($fontsize, $padding=TRUE) { $height = ($fontsize * $this->cell_height_ratio); @@ -2463,7 +2481,7 @@ class TCPDF { /** * Get the last cell height. - * @return last cell height + * @return float last cell height * @public * @since 4.0.017 (2008-08-05) */ @@ -2473,7 +2491,7 @@ class TCPDF { /** * Set the adjusting factor to convert pixels to user units. - * @param $scale (float) adjusting factor to convert pixels to user units. + * @param float $scale adjusting factor to convert pixels to user units. * @author Nicola Asuni * @public * @since 1.5.2 @@ -2496,13 +2514,13 @@ class TCPDF { /** * Returns an array of page dimensions: *
              • $this->pagedim[$this->page]['w'] = page width in points
              • $this->pagedim[$this->page]['h'] = height in points
              • $this->pagedim[$this->page]['wk'] = page width in user units
              • $this->pagedim[$this->page]['hk'] = page height in user units
              • $this->pagedim[$this->page]['tm'] = top margin
              • $this->pagedim[$this->page]['bm'] = bottom margin
              • $this->pagedim[$this->page]['lm'] = left margin
              • $this->pagedim[$this->page]['rm'] = right margin
              • $this->pagedim[$this->page]['pb'] = auto page break
              • $this->pagedim[$this->page]['or'] = page orientation
              • $this->pagedim[$this->page]['olm'] = original left margin
              • $this->pagedim[$this->page]['orm'] = original right margin
              • $this->pagedim[$this->page]['Rotate'] = The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
              • $this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.
              • $this->pagedim[$this->page]['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
                • $this->pagedim[$this->page]['trans']['Dur'] = The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
                • $this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
                • $this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.
                • $this->pagedim[$this->page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
                • $this->pagedim[$this->page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
                • $this->pagedim[$this->page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
                • $this->pagedim[$this->page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
                • $this->pagedim[$this->page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
              • $this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
                • $this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points
                • $this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points
                • $this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points
                • $this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points
              • $this->pagedim[$this->page]['CropBox'] : the visible region of default user space
                • $this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points
                • $this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points
                • $this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points
                • $this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points
              • $this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment
                • $this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points
                • $this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points
                • $this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points
                • $this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points
              • $this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming
                • $this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points
                • $this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points
                • $this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points
                • $this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points
              • $this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content
                • $this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points
                • $this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points
                • $this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points
                • $this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points
              - * @param $pagenum (int) page number (empty = current page) + * @param int|null $pagenum page number (empty = current page) * @return array of page dimensions. * @author Nicola Asuni * @public * @since 4.5.027 (2009-03-16) */ - public function getPageDimensions($pagenum='') { + public function getPageDimensions($pagenum=null) { if (empty($pagenum)) { $pagenum = $this->page; } @@ -2511,14 +2529,14 @@ class TCPDF { /** * Returns the page width in units. - * @param $pagenum (int) page number (empty = current page) + * @param int|null $pagenum page number (empty = current page) * @return int page width. * @author Nicola Asuni * @public * @since 1.5.2 * @see getPageDimensions() */ - public function getPageWidth($pagenum='') { + public function getPageWidth($pagenum=null) { if (empty($pagenum)) { return $this->w; } @@ -2527,14 +2545,14 @@ class TCPDF { /** * Returns the page height in units. - * @param $pagenum (int) page number (empty = current page) + * @param int|null $pagenum page number (empty = current page) * @return int page height. * @author Nicola Asuni * @public * @since 1.5.2 * @see getPageDimensions() */ - public function getPageHeight($pagenum='') { + public function getPageHeight($pagenum=null) { if (empty($pagenum)) { return $this->h; } @@ -2543,14 +2561,14 @@ class TCPDF { /** * Returns the page break margin. - * @param $pagenum (int) page number (empty = current page) + * @param int|null $pagenum page number (empty = current page) * @return int page break margin. * @author Nicola Asuni * @public * @since 1.5.2 * @see getPageDimensions() */ - public function getBreakMargin($pagenum='') { + public function getBreakMargin($pagenum=null) { if (empty($pagenum)) { return $this->bMargin; } @@ -2570,19 +2588,19 @@ class TCPDF { /** * Defines the left, top and right margins. - * @param $left (float) Left margin. - * @param $top (float) Top margin. - * @param $right (float) Right margin. Default value is the left one. - * @param $keepmargins (boolean) if true overwrites the default page margins + * @param float $left Left margin. + * @param float $top Top margin. + * @param float $right Right margin. Default value is the left one. + * @param boolean $keepmargins if true overwrites the default page margins * @public * @since 1.0 * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() */ - public function SetMargins($left, $top, $right=-1, $keepmargins=false) { + public function setMargins($left, $top, $right=null, $keepmargins=false) { //Set left, top and right margins $this->lMargin = $left; $this->tMargin = $top; - if ($right == -1) { + if ($right == -1 OR $right === null) { $right = $left; } $this->rMargin = $right; @@ -2595,12 +2613,12 @@ class TCPDF { /** * Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin. - * @param $margin (float) The margin. + * @param float $margin The margin. * @public * @since 1.4 * @see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetLeftMargin($margin) { + public function setLeftMargin($margin) { //Set left margin $this->lMargin = $margin; if (($this->page > 0) AND ($this->x < $margin)) { @@ -2610,12 +2628,12 @@ class TCPDF { /** * Defines the top margin. The method can be called before creating the first page. - * @param $margin (float) The margin. + * @param float $margin The margin. * @public * @since 1.5 * @see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetTopMargin($margin) { + public function setTopMargin($margin) { //Set top margin $this->tMargin = $margin; if (($this->page > 0) AND ($this->y < $margin)) { @@ -2625,12 +2643,12 @@ class TCPDF { /** * Defines the right margin. The method can be called before creating the first page. - * @param $margin (float) The margin. + * @param float $margin The margin. * @public * @since 1.5 * @see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetRightMargin($margin) { + public function setRightMargin($margin) { $this->rMargin = $margin; if (($this->page > 0) AND ($this->x > ($this->w - $margin))) { $this->x = $this->w - $margin; @@ -2639,12 +2657,12 @@ class TCPDF { /** * Set the same internal Cell padding for top, right, bottom, left- - * @param $pad (float) internal padding. + * @param float $pad internal padding. * @public * @since 2.1.000 (2008-01-09) * @see getCellPaddings(), setCellPaddings() */ - public function SetCellPadding($pad) { + public function setCellPadding($pad) { if ($pad >= 0) { $this->cell_padding['L'] = $pad; $this->cell_padding['T'] = $pad; @@ -2655,25 +2673,25 @@ class TCPDF { /** * Set the internal Cell paddings. - * @param $left (float) left padding - * @param $top (float) top padding - * @param $right (float) right padding - * @param $bottom (float) bottom padding + * @param float|null $left left padding + * @param float|null $top top padding + * @param float|null $right right padding + * @param float|null $bottom bottom padding * @public * @since 5.9.000 (2010-10-03) * @see getCellPaddings(), SetCellPadding() */ - public function setCellPaddings($left='', $top='', $right='', $bottom='') { - if (($left !== '') AND ($left >= 0)) { + public function setCellPaddings($left=null, $top=null, $right=null, $bottom=null) { + if (!TCPDF_STATIC::empty_string($left) AND ($left >= 0)) { $this->cell_padding['L'] = $left; } - if (($top !== '') AND ($top >= 0)) { + if (!TCPDF_STATIC::empty_string($top) AND ($top >= 0)) { $this->cell_padding['T'] = $top; } - if (($right !== '') AND ($right >= 0)) { + if (!TCPDF_STATIC::empty_string($right) AND ($right >= 0)) { $this->cell_padding['R'] = $right; } - if (($bottom !== '') AND ($bottom >= 0)) { + if (!TCPDF_STATIC::empty_string($bottom) AND ($bottom >= 0)) { $this->cell_padding['B'] = $bottom; } } @@ -2691,25 +2709,25 @@ class TCPDF { /** * Set the internal Cell margins. - * @param $left (float) left margin - * @param $top (float) top margin - * @param $right (float) right margin - * @param $bottom (float) bottom margin + * @param float|null $left left margin + * @param float|null $top top margin + * @param float|null $right right margin + * @param float|null $bottom bottom margin * @public * @since 5.9.000 (2010-10-03) * @see getCellMargins() */ - public function setCellMargins($left='', $top='', $right='', $bottom='') { - if (($left !== '') AND ($left >= 0)) { + public function setCellMargins($left=null, $top=null, $right=null, $bottom=null) { + if (!TCPDF_STATIC::empty_string($left) AND ($left >= 0)) { $this->cell_margin['L'] = $left; } - if (($top !== '') AND ($top >= 0)) { + if (!TCPDF_STATIC::empty_string($top) AND ($top >= 0)) { $this->cell_margin['T'] = $top; } - if (($right !== '') AND ($right >= 0)) { + if (!TCPDF_STATIC::empty_string($right) AND ($right >= 0)) { $this->cell_margin['R'] = $right; } - if (($bottom !== '') AND ($bottom >= 0)) { + if (!TCPDF_STATIC::empty_string($bottom) AND ($bottom >= 0)) { $this->cell_margin['B'] = $bottom; } } @@ -2727,8 +2745,8 @@ class TCPDF { /** * Adjust the internal Cell padding array to take account of the line width. - * @param $brd (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @return array of adjustments + * @param string|array|int $brd Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @return void|array array of adjustments * @public * @since 5.9.000 (2010-10-03) */ @@ -2744,7 +2762,11 @@ class TCPDF { $newbrd[$brd[$i]] = true; } $brd = $newbrd; - } elseif (($brd === 1) OR ($brd === true) OR (is_numeric($brd) AND (intval($brd) > 0))) { + } elseif ( + ($brd === 1) + || ($brd === true) + || (is_numeric($brd) && ((int)$brd > 0)) + ) { $brd = array('LRTB' => true); } if (!is_array($brd)) { @@ -2762,7 +2784,7 @@ class TCPDF { // process borders foreach ($brd as $border => $style) { $line_width = $this->LineWidth; - if (is_array($style) AND isset($style['width'])) { + if (is_array($style) && isset($style['width'])) { // get border width $line_width = $style['width']; } @@ -2783,31 +2805,54 @@ class TCPDF { } } // correct internal cell padding if required to avoid overlap between text and lines - if ((strpos($border,'T') !== false) AND ($this->cell_padding['T'] < $adj)) { + if ( + is_numeric($this->cell_padding['T']) + && ($this->cell_padding['T'] < $adj) + && (strpos($border, 'T') !== false) + ) { $this->cell_padding['T'] = $adj; } - if ((strpos($border,'R') !== false) AND ($this->cell_padding['R'] < $adj)) { + if ( + is_numeric($this->cell_padding['R']) + && ($this->cell_padding['R'] < $adj) + && (strpos($border, 'R') !== false) + ) { $this->cell_padding['R'] = $adj; } - if ((strpos($border,'B') !== false) AND ($this->cell_padding['B'] < $adj)) { + if ( + is_numeric($this->cell_padding['B']) + && ($this->cell_padding['B'] < $adj) + && (strpos($border, 'B') !== false) + ) { $this->cell_padding['B'] = $adj; } - if ((strpos($border,'L') !== false) AND ($this->cell_padding['L'] < $adj)) { + if ( + is_numeric($this->cell_padding['L']) + && ($this->cell_padding['L'] < $adj) + && (strpos($border, 'L') !== false) + ) { $this->cell_padding['L'] = $adj; } + } - return array('T' => ($this->cell_padding['T'] - $cp['T']), 'R' => ($this->cell_padding['R'] - $cp['R']), 'B' => ($this->cell_padding['B'] - $cp['B']), 'L' => ($this->cell_padding['L'] - $cp['L'])); + + return array( + 'T' => ($this->cell_padding['T'] - $cp['T']), + 'R' => ($this->cell_padding['R'] - $cp['R']), + 'B' => ($this->cell_padding['B'] - $cp['B']), + 'L' => ($this->cell_padding['L'] - $cp['L']), + ); } /** * Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm. - * @param $auto (boolean) Boolean indicating if mode should be on or off. - * @param $margin (float) Distance from the bottom of the page. + * @param boolean $auto Boolean indicating if mode should be on or off. + * @param float $margin Distance from the bottom of the page. * @public * @since 1.0 * @see Cell(), MultiCell(), AcceptPageBreak() */ - public function SetAutoPageBreak($auto, $margin=0) { + public function setAutoPageBreak($auto, $margin=0) { $this->AutoPageBreak = $auto ? true : false; $this->bMargin = $margin; $this->PageBreakTrigger = $this->h - $margin; @@ -2815,7 +2860,7 @@ class TCPDF { /** * Return the auto-page-break mode (true or false). - * @return boolean auto-page-break mode + * @return bool auto-page-break mode * @public * @since 5.9.088 */ @@ -2825,13 +2870,13 @@ class TCPDF { /** * Defines the way the document is to be displayed by the viewer. - * @param $zoom (mixed) The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
              • fullpage: displays the entire page on screen
              • fullwidth: uses maximum width of window
              • real: uses real size (equivalent to 100% zoom)
              • default: uses viewer default mode
              - * @param $layout (string) The page layout. Possible values are:
              • SinglePage Display one page at a time
              • OneColumn Display the pages in one column
              • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
              • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
              • TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
              • TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right
              - * @param $mode (string) A name object specifying how the document should be displayed when opened:
              • UseNone Neither document outline nor thumbnail images visible
              • UseOutlines Document outline visible
              • UseThumbs Thumbnail images visible
              • FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
              • UseOC (PDF 1.5) Optional content group panel visible
              • UseAttachments (PDF 1.6) Attachments panel visible
              + * @param mixed $zoom The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
              • fullpage: displays the entire page on screen
              • fullwidth: uses maximum width of window
              • real: uses real size (equivalent to 100% zoom)
              • default: uses viewer default mode
              + * @param string $layout The page layout. Possible values are:
              • SinglePage Display one page at a time
              • OneColumn Display the pages in one column
              • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
              • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
              • TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
              • TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right
              + * @param string $mode A name object specifying how the document should be displayed when opened:
              • UseNone Neither document outline nor thumbnail images visible
              • UseOutlines Document outline visible
              • UseThumbs Thumbnail images visible
              • FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
              • UseOC (PDF 1.5) Optional content group panel visible
              • UseAttachments (PDF 1.6) Attachments panel visible
              * @public * @since 1.2 */ - public function SetDisplayMode($zoom, $layout='SinglePage', $mode='UseNone') { + public function setDisplayMode($zoom, $layout='SinglePage', $mode='UseNone') { if (($zoom == 'fullpage') OR ($zoom == 'fullwidth') OR ($zoom == 'real') OR ($zoom == 'default') OR (!is_string($zoom))) { $this->ZoomMode = $zoom; } else { @@ -2844,11 +2889,11 @@ class TCPDF { /** * Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default. * Note: the Zlib extension is required for this feature. If not present, compression will be turned off. - * @param $compress (boolean) Boolean indicating if compression must be enabled. + * @param boolean $compress Boolean indicating if compression must be enabled. * @public * @since 1.4 */ - public function SetCompression($compress=true) { + public function setCompression($compress=true) { $this->compress = false; if (function_exists('gzcompress')) { if ($compress) { @@ -2861,7 +2906,7 @@ class TCPDF { /** * Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document. - * @param $mode (boolean) If true force sRGB output intent. + * @param boolean $mode If true force sRGB output intent. * @public * @since 5.9.121 (2011-09-28) */ @@ -2872,72 +2917,84 @@ class TCPDF { /** * Turn on/off Unicode mode for document information dictionary (meta tags). * This has effect only when unicode mode is set to false. - * @param $unicode (boolean) if true set the meta information in Unicode + * @param boolean $unicode if true set the meta information in Unicode * @since 5.9.027 (2010-12-01) * @public */ - public function SetDocInfoUnicode($unicode=true) { + public function setDocInfoUnicode($unicode=true) { $this->docinfounicode = $unicode ? true : false; } /** * Defines the title of the document. - * @param $title (string) The title. + * @param string $title The title. * @public * @since 1.2 * @see SetAuthor(), SetCreator(), SetKeywords(), SetSubject() */ - public function SetTitle($title) { + public function setTitle($title) { $this->title = $title; } /** * Defines the subject of the document. - * @param $subject (string) The subject. + * @param string $subject The subject. * @public * @since 1.2 * @see SetAuthor(), SetCreator(), SetKeywords(), SetTitle() */ - public function SetSubject($subject) { + public function setSubject($subject) { $this->subject = $subject; } /** * Defines the author of the document. - * @param $author (string) The name of the author. + * @param string $author The name of the author. * @public * @since 1.2 * @see SetCreator(), SetKeywords(), SetSubject(), SetTitle() */ - public function SetAuthor($author) { + public function setAuthor($author) { $this->author = $author; } /** * Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'. - * @param $keywords (string) The list of keywords. + * @param string $keywords The list of keywords. * @public * @since 1.2 * @see SetAuthor(), SetCreator(), SetSubject(), SetTitle() */ - public function SetKeywords($keywords) { + public function setKeywords($keywords) { $this->keywords = $keywords; } /** * Defines the creator of the document. This is typically the name of the application that generates the PDF. - * @param $creator (string) The name of the creator. + * @param string $creator The name of the creator. * @public * @since 1.2 * @see SetAuthor(), SetKeywords(), SetSubject(), SetTitle() */ - public function SetCreator($creator) { + public function setCreator($creator) { $this->creator = $creator; } + /** + * Whether to allow local file path in image html tags, when prefixed with file:// + * + * @param bool $allowLocalFiles true, when local files should be allowed. Otherwise false. + * @public + * @since 6.4 + */ + public function setAllowLocalFiles($allowLocalFiles) { + $this->allowLocalFiles = (bool) $allowLocalFiles; + } + + /** * Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true. - * @param $msg (string) The error message + * @param string $msg The error message * @public * @since 1.0 */ @@ -2984,13 +3041,13 @@ class TCPDF { $gvars = $this->getGraphicVars(); $this->setEqualColumns(); $this->lastpage(true); - $this->SetAutoPageBreak(false); + $this->setAutoPageBreak(false); $this->x = 0; $this->y = $this->h - (1 / $this->k); $this->lMargin = 0; $this->_outSaveGraphicsState(); $font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica'; - $this->SetFont($font, '', 1); + $this->setFont($font, '', 1); $this->setTextRenderingMode(0, false, false); $msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; $lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67"; @@ -3009,8 +3066,8 @@ class TCPDF { /** * Move pointer at the specified document page and update page dimensions. - * @param $pnum (int) page number (1 ... numpages) - * @param $resetmargins (boolean) if true reset left, right, top margins and Y position. + * @param int $pnum page number (1 ... numpages) + * @param boolean $resetmargins if true reset left, right, top margins and Y position. * @public * @since 2.1.000 (2008-01-07) * @see getPage(), lastpage(), getNumPages() @@ -3035,13 +3092,13 @@ class TCPDF { $this->original_rMargin = $this->pagedim[$this->page]['orm']; $this->AutoPageBreak = $this->pagedim[$this->page]['pb']; $this->CurOrientation = $this->pagedim[$this->page]['or']; - $this->SetAutoPageBreak($this->AutoPageBreak, $this->bMargin); + $this->setAutoPageBreak($this->AutoPageBreak, $this->bMargin); // restore graphic settings //$this->setGraphicVars($gvars); if ($resetmargins) { $this->lMargin = $this->pagedim[$this->page]['olm']; $this->rMargin = $this->pagedim[$this->page]['orm']; - $this->SetY($this->tMargin); + $this->setY($this->tMargin); } else { // account for booklet mode if ($this->pagedim[$this->page]['olm'] != $this->pagedim[$oldpage]['olm']) { @@ -3057,7 +3114,7 @@ class TCPDF { /** * Reset pointer to the last document page. - * @param $resetmargins (boolean) if true reset left, right, top margins and Y position. + * @param boolean $resetmargins if true reset left, right, top margins and Y position. * @public * @since 2.0.000 (2008-01-04) * @see setPage(), getPage(), getNumPages() @@ -3090,9 +3147,9 @@ class TCPDF { /** * Adds a new TOC (Table Of Content) page to the document. - * @param $orientation (string) page orientation. - * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). - * @param $keepmargins (boolean) if true overwrites the default page margins with the current margins + * @param string $orientation page orientation. + * @param mixed $format The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). + * @param boolean $keepmargins if true overwrites the default page margins with the current margins * @public * @since 5.0.001 (2010-05-06) * @see AddPage(), startPage(), endPage(), endTOCPage() @@ -3114,10 +3171,10 @@ class TCPDF { /** * Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer (if enabled). Then the page is added, the current position set to the top-left corner according to the left and top margins (or top-right if in RTL mode), and Header() is called to display the header (if enabled). * The origin of the coordinate system is at the top-left corner (or top-right for RTL) and increasing ordinates go downwards. - * @param $orientation (string) page orientation. Possible values are (case insensitive):
              • P or PORTRAIT (default)
              • L or LANDSCAPE
              - * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). - * @param $keepmargins (boolean) if true overwrites the default page margins with the current margins - * @param $tocpage (boolean) if true set the tocpage state to true (the added page will be used to display Table Of Content). + * @param string $orientation page orientation. Possible values are (case insensitive):
              • P or PORTRAIT (default)
              • L or LANDSCAPE
              + * @param mixed $format The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). + * @param boolean $keepmargins if true overwrites the default page margins with the current margins + * @param boolean $tocpage if true set the tocpage state to true (the added page will be used to display Table Of Content). * @public * @since 1.0 * @see startPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat() @@ -3141,7 +3198,7 @@ class TCPDF { /** * Terminate the current page - * @param $tocpage (boolean) if true set the tocpage state to false (end the page used to display Table Of Content). + * @param boolean $tocpage if true set the tocpage state to false (end the page used to display Table Of Content). * @public * @since 4.2.010 (2008-11-14) * @see AddPage(), startPage(), addTOCPage(), endTOCPage() @@ -3165,9 +3222,9 @@ class TCPDF { /** * Starts a new page to the document. The page must be closed using the endPage() function. * The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards. - * @param $orientation (string) page orientation. Possible values are (case insensitive):
              • P or PORTRAIT (default)
              • L or LANDSCAPE
              - * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). - * @param $tocpage (boolean) if true the page is designated to contain the Table-Of-Content. + * @param string $orientation page orientation. Possible values are (case insensitive):
              • P or PORTRAIT (default)
              • L or LANDSCAPE
              + * @param mixed $format The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). + * @param boolean $tocpage if true the page is designated to contain the Table-Of-Content. * @since 4.2.010 (2008-11-14) * @see AddPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat() * @public @@ -3204,7 +3261,7 @@ class TCPDF { if ($this->numpages > $this->page) { // this page has been already added $this->setPage($this->page + 1); - $this->SetY($this->tMargin); + $this->setY($this->tMargin); return; } // start a new page @@ -3252,7 +3309,7 @@ class TCPDF { /** * Set start-writing mark on selected page. * Borders and fills are always created after content and inserted on the position marked by this method. - * @param $page (int) page number (default is the current page) + * @param int $page page number (default is the current page) * @protected * @since 4.6.021 (2009-07-20) */ @@ -3269,12 +3326,12 @@ class TCPDF { /** * Set header data. - * @param $ln (string) header image logo - * @param $lw (string) header image logo width in mm - * @param $ht (string) string to print as title on document header - * @param $hs (string) string to print on document header - * @param $tc (array) RGB array color for text. - * @param $lc (array) RGB array color for line. + * @param string $ln header image logo + * @param int $lw header image logo width in mm + * @param string $ht string to print as title on document header + * @param string $hs string to print on document header + * @param int[] $tc RGB array color for text. + * @param int[] $lc RGB array color for line. * @public */ public function setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0,0,0), $lc=array(0,0,0)) { @@ -3288,8 +3345,8 @@ class TCPDF { /** * Set footer data. - * @param $tc (array) RGB array color for text. - * @param $lc (array) RGB array color for line. + * @param int[] $tc RGB array color for text. + * @param int[] $lc RGB array color for line. * @public */ public function setFooterData($tc=array(0,0,0), $lc=array(0,0,0)) { @@ -3300,7 +3357,7 @@ class TCPDF { /** * Returns header data: *
              • $ret['logo'] = logo image
              • $ret['logo_width'] = width of the image logo in user units
              • $ret['title'] = header title
              • $ret['string'] = header description string
              - * @return array() + * @return array * @public * @since 4.0.012 (2008-07-24) */ @@ -3318,7 +3375,7 @@ class TCPDF { /** * Set header margin. * (minimum distance between header and top page margin) - * @param $hm (int) distance in user units + * @param int $hm distance in user units * @public */ public function setHeaderMargin($hm=10) { @@ -3338,7 +3395,7 @@ class TCPDF { /** * Set footer margin. * (minimum distance between footer and bottom page margin) - * @param $fm (int) distance in user units + * @param int $fm distance in user units * @public */ public function setFooterMargin($fm=10) { @@ -3356,7 +3413,7 @@ class TCPDF { } /** * Set a flag to print page header. - * @param $val (boolean) set to true to print the page header (default), false otherwise. + * @param boolean $val set to true to print the page header (default), false otherwise. * @public */ public function setPrintHeader($val=true) { @@ -3365,7 +3422,7 @@ class TCPDF { /** * Set a flag to print page footer. - * @param $val (boolean) set to true to print the page footer (default), false otherwise. + * @param boolean $val set to true to print the page footer (default), false otherwise. * @public */ public function setPrintFooter($val=true) { @@ -3400,7 +3457,7 @@ class TCPDF { /** * Set a flag to automatically reset the xobject template used by Header() method at each page. - * @param $val (boolean) set to true to reset Header xobject template at each page, false otherwise. + * @param boolean $val set to true to reset Header xobject template at each page, false otherwise. * @public */ public function setHeaderTemplateAutoreset($val=true) { @@ -3445,22 +3502,22 @@ class TCPDF { $header_x = $this->original_lMargin + ($headerdata['logo_width'] * 1.1); } $cw = $this->w - $this->original_lMargin - $this->original_rMargin - ($headerdata['logo_width'] * 1.1); - $this->SetTextColorArray($this->header_text_color); + $this->setTextColorArray($this->header_text_color); // header title - $this->SetFont($headerfont[0], 'B', $headerfont[2] + 1); - $this->SetX($header_x); + $this->setFont($headerfont[0], 'B', $headerfont[2] + 1); + $this->setX($header_x); $this->Cell($cw, $cell_height, $headerdata['title'], 0, 1, '', 0, '', 0); // header string - $this->SetFont($headerfont[0], $headerfont[1], $headerfont[2]); - $this->SetX($header_x); + $this->setFont($headerfont[0], $headerfont[1], $headerfont[2]); + $this->setX($header_x); $this->MultiCell($cw, $cell_height, $headerdata['string'], 0, '', 0, 1, '', '', true, 0, false, true, 0, 'T', false); // print an ending header line - $this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $headerdata['line_color'])); - $this->SetY((2.835 / $this->k) + max($imgy, $this->y)); + $this->setLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $headerdata['line_color'])); + $this->setY((2.835 / $this->k) + max($imgy, $this->y)); if ($this->rtl) { - $this->SetX($this->original_rMargin); + $this->setX($this->original_rMargin); } else { - $this->SetX($this->original_lMargin); + $this->setX($this->original_lMargin); } $this->Cell(($this->w - $this->original_lMargin - $this->original_rMargin), 0, '', 'T', 0, 'C'); $this->endTemplate(); @@ -3491,10 +3548,10 @@ class TCPDF { */ public function Footer() { $cur_y = $this->y; - $this->SetTextColorArray($this->footer_text_color); + $this->setTextColorArray($this->footer_text_color); //set style for cell border $line_width = (0.85 / $this->k); - $this->SetLineStyle(array('width' => $line_width, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $this->footer_line_color)); + $this->setLineStyle(array('width' => $line_width, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $this->footer_line_color)); //print document barcode $barcode = $this->getBarcode(); if (!empty($barcode)) { @@ -3520,13 +3577,13 @@ class TCPDF { } else { $pagenumtxt = $w_page.$this->getPageNumGroupAlias().' / '.$this->getPageGroupAlias(); } - $this->SetY($cur_y); + $this->setY($cur_y); //Print page number if ($this->getRTL()) { - $this->SetX($this->original_rMargin); + $this->setX($this->original_rMargin); $this->Cell(0, 0, $pagenumtxt, 'T', 0, 'L'); } else { - $this->SetX($this->original_lMargin); + $this->setX($this->original_lMargin); $this->Cell(0, 0, $this->getAliasRightShift().$pagenumtxt, 'T', 0, 'R'); } } @@ -3549,20 +3606,20 @@ class TCPDF { $this->_outSaveGraphicsState(); $this->rMargin = $this->original_rMargin; $this->lMargin = $this->original_lMargin; - $this->SetCellPadding(0); + $this->setCellPadding(0); //set current position if ($this->rtl) { - $this->SetXY($this->original_rMargin, $this->header_margin); + $this->setXY($this->original_rMargin, $this->header_margin); } else { - $this->SetXY($this->original_lMargin, $this->header_margin); + $this->setXY($this->original_lMargin, $this->header_margin); } - $this->SetFont($this->header_font[0], $this->header_font[1], $this->header_font[2]); + $this->setFont($this->header_font[0], $this->header_font[1], $this->header_font[2]); $this->Header(); //restore position if ($this->rtl) { - $this->SetXY($this->original_rMargin, $this->tMargin); + $this->setXY($this->original_rMargin, $this->tMargin); } else { - $this->SetXY($this->original_lMargin, $this->tMargin); + $this->setXY($this->original_lMargin, $this->tMargin); } $this->_outRestoreGraphicsState(); $this->lasth = $lasth; @@ -3597,21 +3654,21 @@ class TCPDF { $this->_outSaveGraphicsState(); $this->rMargin = $this->original_rMargin; $this->lMargin = $this->original_lMargin; - $this->SetCellPadding(0); + $this->setCellPadding(0); //set current position $footer_y = $this->h - $this->footer_margin; if ($this->rtl) { - $this->SetXY($this->original_rMargin, $footer_y); + $this->setXY($this->original_rMargin, $footer_y); } else { - $this->SetXY($this->original_lMargin, $footer_y); + $this->setXY($this->original_lMargin, $footer_y); } - $this->SetFont($this->footer_font[0], $this->footer_font[1], $this->footer_font[2]); + $this->setFont($this->footer_font[0], $this->footer_font[1], $this->footer_font[2]); $this->Footer(); //restore position if ($this->rtl) { - $this->SetXY($this->original_rMargin, $this->tMargin); + $this->setXY($this->original_rMargin, $this->tMargin); } else { - $this->SetXY($this->original_lMargin, $this->tMargin); + $this->setXY($this->original_lMargin, $this->tMargin); } $this->_outRestoreGraphicsState(); $this->lasth = $lasth; @@ -3629,7 +3686,7 @@ class TCPDF { /** * Check if we are on the page body (excluding page header and footer). - * @return true if we are not in page header nor in page footer, false otherwise. + * @return bool true if we are not in page header nor in page footer, false otherwise. * @protected * @since 5.9.091 (2011-06-15) */ @@ -3715,7 +3772,7 @@ class TCPDF { /** * Returns the array of spot colors. - * @return (array) Spot colors array. + * @return array Spot colors array. * @public * @since 6.0.038 (2013-09-30) */ @@ -3727,11 +3784,11 @@ class TCPDF { * Defines a new spot color. * It can be expressed in RGB components or gray scale. * The method can be called before the first page is created and the value is retained from page to page. - * @param $name (string) Full name of the spot color. - * @param $c (float) Cyan color for CMYK. Value between 0 and 100. - * @param $m (float) Magenta color for CMYK. Value between 0 and 100. - * @param $y (float) Yellow color for CMYK. Value between 0 and 100. - * @param $k (float) Key (Black) color for CMYK. Value between 0 and 100. + * @param string $name Full name of the spot color. + * @param float $c Cyan color for CMYK. Value between 0 and 100. + * @param float $m Magenta color for CMYK. Value between 0 and 100. + * @param float $y Yellow color for CMYK. Value between 0 and 100. + * @param float $k Key (Black) color for CMYK. Value between 0 and 100. * @public * @since 4.0.024 (2008-09-12) * @see SetDrawSpotColor(), SetFillSpotColor(), SetTextSpotColor() @@ -3745,10 +3802,10 @@ class TCPDF { /** * Set the spot color for the specified type ('draw', 'fill', 'text'). - * @param $type (string) Type of object affected by this color: ('draw', 'fill', 'text'). - * @param $name (string) Name of the spot color. - * @param $tint (float) Intensity of the color (from 0 to 100 ; 100 = full intensity by default). - * @return (string) PDF color command. + * @param string $type Type of object affected by this color: ('draw', 'fill', 'text'). + * @param string $name Name of the spot color. + * @param float $tint Intensity of the color (from 0 to 100 ; 100 = full intensity by default). + * @return string PDF color command. * @public * @since 5.9.125 (2011-10-03) */ @@ -3792,37 +3849,37 @@ class TCPDF { /** * Defines the spot color used for all drawing operations (lines, rectangles and cell borders). - * @param $name (string) Name of the spot color. - * @param $tint (float) Intensity of the color (from 0 to 100 ; 100 = full intensity by default). + * @param string $name Name of the spot color. + * @param float $tint Intensity of the color (from 0 to 100 ; 100 = full intensity by default). * @public * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetFillSpotColor(), SetTextSpotColor() */ - public function SetDrawSpotColor($name, $tint=100) { + public function setDrawSpotColor($name, $tint=100) { $this->setSpotColor('draw', $name, $tint); } /** * Defines the spot color used for all filling operations (filled rectangles and cell backgrounds). - * @param $name (string) Name of the spot color. - * @param $tint (float) Intensity of the color (from 0 to 100 ; 100 = full intensity by default). + * @param string $name Name of the spot color. + * @param float $tint Intensity of the color (from 0 to 100 ; 100 = full intensity by default). * @public * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetDrawSpotColor(), SetTextSpotColor() */ - public function SetFillSpotColor($name, $tint=100) { + public function setFillSpotColor($name, $tint=100) { $this->setSpotColor('fill', $name, $tint); } /** * Defines the spot color used for text. - * @param $name (string) Name of the spot color. - * @param $tint (int) Intensity of the color (from 0 to 100 ; 100 = full intensity by default). + * @param string $name Name of the spot color. + * @param int $tint Intensity of the color (from 0 to 100 ; 100 = full intensity by default). * @public * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetDrawSpotColor(), SetFillSpotColor() */ - public function SetTextSpotColor($name, $tint=100) { + public function setTextSpotColor($name, $tint=100) { $this->setSpotColor('text', $name, $tint); } @@ -3830,10 +3887,10 @@ class TCPDF { * Set the color array for the specified type ('draw', 'fill', 'text'). * It can be expressed in RGB, CMYK or GRAY SCALE components. * The method can be called before the first page is created and the value is retained from page to page. - * @param $type (string) Type of object affected by this color: ('draw', 'fill', 'text'). - * @param $color (array) Array of colors (1=gray, 3=RGB, 4=CMYK or 5=spotcolor=CMYK+name values). - * @param $ret (boolean) If true do not send the PDF command. - * @return (string) The PDF command or empty string. + * @param string $type Type of object affected by this color: ('draw', 'fill', 'text'). + * @param array $color Array of colors (1=gray, 3=RGB, 4=CMYK or 5=spotcolor=CMYK+name values). + * @param boolean $ret If true do not send the PDF command. + * @return string The PDF command or empty string. * @public * @since 3.1.000 (2008-06-11) */ @@ -3861,14 +3918,14 @@ class TCPDF { * Defines the color used for all drawing operations (lines, rectangles and cell borders). * It can be expressed in RGB, CMYK or GRAY SCALE components. * The method can be called before the first page is created and the value is retained from page to page. - * @param $color (array) Array of colors (1, 3 or 4 values). - * @param $ret (boolean) If true do not send the PDF command. + * @param array $color Array of colors (1, 3 or 4 values). + * @param boolean $ret If true do not send the PDF command. * @return string the PDF command * @public * @since 3.1.000 (2008-06-11) * @see SetDrawColor() */ - public function SetDrawColorArray($color, $ret=false) { + public function setDrawColorArray($color, $ret=false) { return $this->setColorArray('draw', $color, $ret); } @@ -3876,39 +3933,39 @@ class TCPDF { * Defines the color used for all filling operations (filled rectangles and cell backgrounds). * It can be expressed in RGB, CMYK or GRAY SCALE components. * The method can be called before the first page is created and the value is retained from page to page. - * @param $color (array) Array of colors (1, 3 or 4 values). - * @param $ret (boolean) If true do not send the PDF command. + * @param array $color Array of colors (1, 3 or 4 values). + * @param boolean $ret If true do not send the PDF command. * @public * @since 3.1.000 (2008-6-11) * @see SetFillColor() */ - public function SetFillColorArray($color, $ret=false) { + public function setFillColorArray($color, $ret=false) { return $this->setColorArray('fill', $color, $ret); } /** * Defines the color used for text. It can be expressed in RGB components or gray scale. * The method can be called before the first page is created and the value is retained from page to page. - * @param $color (array) Array of colors (1, 3 or 4 values). - * @param $ret (boolean) If true do not send the PDF command. + * @param array $color Array of colors (1, 3 or 4 values). + * @param boolean $ret If true do not send the PDF command. * @public * @since 3.1.000 (2008-6-11) * @see SetFillColor() */ - public function SetTextColorArray($color, $ret=false) { + public function setTextColorArray($color, $ret=false) { return $this->setColorArray('text', $color, $ret); } /** * Defines the color used by the specified type ('draw', 'fill', 'text'). - * @param $type (string) Type of object affected by this color: ('draw', 'fill', 'text'). - * @param $col1 (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). - * @param $col2 (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). - * @param $col3 (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). - * @param $col4 (float) KEY (BLACK) color for CMYK (0-100). - * @param $ret (boolean) If true do not send the command. - * @param $name (string) spot color name (if any) - * @return (string) The PDF command or empty string. + * @param string $type Type of object affected by this color: ('draw', 'fill', 'text'). + * @param float $col1 GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). + * @param float $col2 GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). + * @param float $col3 BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). + * @param float $col4 KEY (BLACK) color for CMYK (0-100). + * @param boolean $ret If true do not send the command. + * @param string $name spot color name (if any) + * @return string The PDF command or empty string. * @public * @since 5.9.125 (2011-10-03) */ @@ -3980,7 +4037,7 @@ class TCPDF { } } $this->ColorFlag = ($this->FillColor != $this->TextColor); - if (($type != 'text') AND ($this->state == 2)) { + if (($type != 'text') AND ($this->state == 2) AND $type !== 0) { if (!$ret) { $this->_out($pdfcolor); } @@ -3991,63 +4048,63 @@ class TCPDF { /** * Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. - * @param $col1 (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). - * @param $col2 (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). - * @param $col3 (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). - * @param $col4 (float) KEY (BLACK) color for CMYK (0-100). - * @param $ret (boolean) If true do not send the command. - * @param $name (string) spot color name (if any) + * @param float $col1 GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). + * @param float $col2 GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). + * @param float $col3 BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). + * @param float $col4 KEY (BLACK) color for CMYK (0-100). + * @param boolean $ret If true do not send the command. + * @param string $name spot color name (if any) * @return string the PDF command * @public * @since 1.3 * @see SetDrawColorArray(), SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell() */ - public function SetDrawColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function setDrawColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { return $this->setColor('draw', $col1, $col2, $col3, $col4, $ret, $name); } /** * Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. - * @param $col1 (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). - * @param $col2 (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). - * @param $col3 (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). - * @param $col4 (float) KEY (BLACK) color for CMYK (0-100). - * @param $ret (boolean) If true do not send the command. - * @param $name (string) Spot color name (if any). - * @return (string) The PDF command. + * @param float $col1 GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). + * @param float $col2 GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). + * @param float $col3 BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). + * @param float $col4 KEY (BLACK) color for CMYK (0-100). + * @param boolean $ret If true do not send the command. + * @param string $name Spot color name (if any). + * @return string The PDF command. * @public * @since 1.3 * @see SetFillColorArray(), SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell() */ - public function SetFillColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function setFillColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { return $this->setColor('fill', $col1, $col2, $col3, $col4, $ret, $name); } /** * Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. - * @param $col1 (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). - * @param $col2 (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). - * @param $col3 (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). - * @param $col4 (float) KEY (BLACK) color for CMYK (0-100). - * @param $ret (boolean) If true do not send the command. - * @param $name (string) Spot color name (if any). - * @return (string) Empty string. + * @param float $col1 GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). + * @param float $col2 GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). + * @param float $col3 BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). + * @param float $col4 KEY (BLACK) color for CMYK (0-100). + * @param boolean $ret If true do not send the command. + * @param string $name Spot color name (if any). + * @return string Empty string. * @public * @since 1.3 * @see SetTextColorArray(), SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell() */ - public function SetTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function setTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { return $this->setColor('text', $col1, $col2, $col3, $col4, $ret, $name); } /** * Returns the length of a string in user unit. A font must be selected.
              - * @param $s (string) The string whose length is to be computed - * @param $fontname (string) Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. - * @param $fontstyle (string) Font style. Possible values are (case insensitive):
              • empty string: regular
              • B: bold
              • I: italic
              • U: underline
              • D: line-through
              • O: overline
              or any combination. The default value is regular. - * @param $fontsize (float) Font size in points. The default value is the current size. - * @param $getarray (boolean) if true returns an array of characters widths, if false returns the total length. - * @return mixed int total string length or array of characted widths + * @param string $s The string whose length is to be computed + * @param string $fontname Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. + * @param string $fontstyle Font style. Possible values are (case insensitive):
              • empty string: regular
              • B: bold
              • I: italic
              • U: underline
              • D: line-through
              • O: overline
              or any combination. The default value is regular. + * @param float $fontsize Font size in points. The default value is the current size. + * @param boolean $getarray if true returns an array of characters widths, if false returns the total length. + * @return float[]|float total string length or array of characted widths * @author Nicola Asuni * @public * @since 1.2 @@ -4058,12 +4115,12 @@ class TCPDF { /** * Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.
              - * @param $sa (string) The array of chars whose total length is to be computed - * @param $fontname (string) Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. - * @param $fontstyle (string) Font style. Possible values are (case insensitive):
              • empty string: regular
              • B: bold
              • I: italic
              • U: underline
              • D: line through
              • O: overline
              or any combination. The default value is regular. - * @param $fontsize (float) Font size in points. The default value is the current size. - * @param $getarray (boolean) if true returns an array of characters widths, if false returns the total length. - * @return mixed int total string length or array of characted widths + * @param array $sa The array of chars whose total length is to be computed + * @param string $fontname Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. + * @param string $fontstyle Font style. Possible values are (case insensitive):
              • empty string: regular
              • B: bold
              • I: italic
              • U: underline
              • D: line through
              • O: overline
              or any combination. The default value is regular. + * @param float $fontsize Font size in points. The default value is the current size. + * @param boolean $getarray if true returns an array of characters widths, if false returns the total length. + * @return float[]|float total string length or array of characted widths * @author Nicola Asuni * @public * @since 2.4.000 (2008-03-06) @@ -4074,7 +4131,7 @@ class TCPDF { $prev_FontFamily = $this->FontFamily; $prev_FontStyle = $this->FontStyle; $prev_FontSizePt = $this->FontSizePt; - $this->SetFont($fontname, $fontstyle, $fontsize, '', 'default', false); + $this->setFont($fontname, $fontstyle, $fontsize, '', 'default', false); } // convert UTF-8 array to Latin1 if required if ($this->isunicode AND (!$this->isUnicodeFont())) { @@ -4090,7 +4147,7 @@ class TCPDF { } // restore previous values if (!TCPDF_STATIC::empty_string($fontname)) { - $this->SetFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt, '', 'default', false); + $this->setFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt, '', 'default', false); } if ($getarray) { return $wa; @@ -4100,8 +4157,8 @@ class TCPDF { /** * Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking). - * @param $char (int) The char code whose length is to be returned - * @param $notlast (boolean) If false ignore the font-spacing. + * @param int $char The char code whose length is to be returned + * @param boolean $notlast If false ignore the font-spacing. * @return float char width * @author Nicola Asuni * @public @@ -4123,7 +4180,7 @@ class TCPDF { /** * Returns the length of the char in user unit for the current font. - * @param $char (int) The char code whose length is to be returned + * @param int $char The char code whose length is to be returned * @return float char width * @author Nicola Asuni * @public @@ -4134,8 +4191,8 @@ class TCPDF { // SHY character will not be printed return (0); } - if (isset($this->CurrentFont['cw'][$char])) { - $w = $this->CurrentFont['cw'][$char]; + if (isset($this->CurrentFont['cw'][intval($char)])) { + $w = $this->CurrentFont['cw'][intval($char)]; } elseif (isset($this->CurrentFont['dw'])) { // default width $w = $this->CurrentFont['dw']; @@ -4150,7 +4207,7 @@ class TCPDF { /** * Returns the numbero of characters in a string. - * @param $s (string) The input string. + * @param string $s The input string. * @return int number of characters * @public * @since 2.0.0001 (2008-01-07) @@ -4182,11 +4239,11 @@ class TCPDF { * Imports a TrueType, Type1, core, or CID0 font and makes it available. * It is necessary to generate a font definition file first (read /fonts/utils/README.TXT). * The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by K_PATH_FONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated. - * @param $family (string) Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font. - * @param $style (string) Font style. Possible values are (case insensitive):
              • empty string: regular (default)
              • B: bold
              • I: italic
              • BI or IB: bold italic
              - * @param $fontfile (string) The font definition file. By default, the name is built from the family and style, in lower case with no spaces. - * @return array containing the font data, or false in case of error. - * @param $subset (mixed) if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font. + * @param string $family Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font. + * @param string $style Font style. Possible values are (case insensitive):
              • empty string: regular (default)
              • B: bold
              • I: italic
              • BI or IB: bold italic
              + * @param string $fontfile The font definition file. By default, the name is built from the family and style, in lower case with no spaces. + * @return array|false array containing the font data, or false in case of error. + * @param mixed $subset if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font. * @public * @since 1.5 * @see SetFont(), setFontSubsetting() @@ -4436,18 +4493,18 @@ class TCPDF { * The method can be called before the first page is created and the font is retained from page to page. * If you just wish to change the current font size, it is simpler to call SetFontSize(). * Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:
              • They are in the current directory (the one where the running script lies)
              • They are in one of the directories defined by the include_path parameter
              • They are in the directory defined by the K_PATH_FONTS constant

              - * @param $family (string) Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):
              • times (Times-Roman)
              • timesb (Times-Bold)
              • timesi (Times-Italic)
              • timesbi (Times-BoldItalic)
              • helvetica (Helvetica)
              • helveticab (Helvetica-Bold)
              • helveticai (Helvetica-Oblique)
              • helveticabi (Helvetica-BoldOblique)
              • courier (Courier)
              • courierb (Courier-Bold)
              • courieri (Courier-Oblique)
              • courierbi (Courier-BoldOblique)
              • symbol (Symbol)
              • zapfdingbats (ZapfDingbats)
              It is also possible to pass an empty string. In that case, the current family is retained. - * @param $style (string) Font style. Possible values are (case insensitive):
              • empty string: regular
              • B: bold
              • I: italic
              • U: underline
              • D: line through
              • O: overline
              or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined. - * @param $size (float) Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12 - * @param $fontfile (string) The font definition file. By default, the name is built from the family and style, in lower case with no spaces. - * @param $subset (mixed) if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font. - * @param $out (boolean) if true output the font size command, otherwise only set the font properties. + * @param string $family Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):
              • times (Times-Roman)
              • timesb (Times-Bold)
              • timesi (Times-Italic)
              • timesbi (Times-BoldItalic)
              • helvetica (Helvetica)
              • helveticab (Helvetica-Bold)
              • helveticai (Helvetica-Oblique)
              • helveticabi (Helvetica-BoldOblique)
              • courier (Courier)
              • courierb (Courier-Bold)
              • courieri (Courier-Oblique)
              • courierbi (Courier-BoldOblique)
              • symbol (Symbol)
              • zapfdingbats (ZapfDingbats)
              It is also possible to pass an empty string. In that case, the current family is retained. + * @param string $style Font style. Possible values are (case insensitive):
              • empty string: regular
              • B: bold
              • I: italic
              • U: underline
              • D: line through
              • O: overline
              or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined. + * @param float|null $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12 + * @param string $fontfile The font definition file. By default, the name is built from the family and style, in lower case with no spaces. + * @param mixed $subset if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font. + * @param boolean $out if true output the font size command, otherwise only set the font properties. * @author Nicola Asuni * @public * @since 1.0 * @see AddFont(), SetFontSize() */ - public function SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true) { + public function setFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true) { //Select a font; size given in points if ($size === null) { $size = $this->FontSizePt; @@ -4464,18 +4521,18 @@ class TCPDF { $this->setFontSubBuffer($this->CurrentFont['fontkey'], 'subsetchars', $this->CurrentFont['subsetchars']); } $this->CurrentFont = $this->getFontBuffer($fontdata['fontkey']); - $this->SetFontSize($size, $out); + $this->setFontSize($size, $out); } /** * Defines the size of the current font. - * @param $size (float) The font size in points. - * @param $out (boolean) if true output the font size command, otherwise only set the font properties. + * @param float $size The font size in points. + * @param boolean $out if true output the font size command, otherwise only set the font properties. * @public * @since 1.0 * @see SetFont() */ - public function SetFontSize($size, $out=true) { + public function setFontSize($size, $out=true) { $size = (float)$size; // font size in points $this->FontSizePt = $size; @@ -4551,7 +4608,7 @@ class TCPDF { /** * Convert a relative font measure into absolute value. - * @param $s (int) Font measure. + * @param int $s Font measure. * @return float Absolute measure. * @since 5.9.186 (2012-09-13) */ @@ -4561,8 +4618,8 @@ class TCPDF { /** * Returns the glyph bounding box of the specified character in the current font in user units. - * @param $char (int) Input character code. - * @return mixed array(xMin, yMin, xMax, yMax) or FALSE if not defined. + * @param int $char Input character code. + * @return false|array array(xMin, yMin, xMax, yMax) or FALSE if not defined. * @since 5.9.186 (2012-09-13) */ public function getCharBBox($char) { @@ -4580,9 +4637,9 @@ class TCPDF { /** * Return the font descent value - * @param $font (string) font name - * @param $style (string) font style - * @param $size (float) The size (in points) + * @param string $font font name + * @param string $style font style + * @param float $size The size (in points) * @return int font descent * @public * @author Nicola Asuni @@ -4601,9 +4658,9 @@ class TCPDF { /** * Return the font ascent value. - * @param $font (string) font name - * @param $style (string) font style - * @param $size (float) The size (in points) + * @param string $font font name + * @param string $style font style + * @param float $size The size (in points) * @return int font ascent * @public * @author Nicola Asuni @@ -4622,10 +4679,10 @@ class TCPDF { /** * Return true in the character is present in the specified font. - * @param $char (mixed) Character to check (integer value or string) - * @param $font (string) Font name (family name). - * @param $style (string) Font style. - * @return (boolean) true if the char is defined, false otherwise. + * @param mixed $char Character to check (integer value or string) + * @param string $font Font name (family name). + * @param string $style Font style. + * @return bool true if the char is defined, false otherwise. * @public * @since 5.9.153 (2012-03-28) */ @@ -4648,11 +4705,11 @@ class TCPDF { /** * Replace missing font characters on selected font with specified substitutions. - * @param $text (string) Text to process. - * @param $font (string) Font name (family name). - * @param $style (string) Font style. - * @param $subs (array) Array of possible character substitutions. The key is the character to check (integer value) and the value is a single intege value or an array of possible substitutes. - * @return (string) Processed text. + * @param string $text Text to process. + * @param string $font Font name (family name). + * @param string $style Font style. + * @param array $subs Array of possible character substitutions. The key is the character to check (integer value) and the value is a single intege value or an array of possible substitutes. + * @return string Processed text. * @public * @since 5.9.153 (2012-03-28) */ @@ -4689,11 +4746,11 @@ class TCPDF { /** * Defines the default monospaced font. - * @param $font (string) Font name. + * @param string $font Font name. * @public * @since 4.5.025 */ - public function SetDefaultMonospacedFont($font) { + public function setDefaultMonospacedFont($font) { $this->default_monospaced_font = $font; } @@ -4713,14 +4770,14 @@ class TCPDF { /** * Defines the page and position a link points to. - * @param $link (int) The link identifier returned by AddLink() - * @param $y (float) Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) - * @param $page (int|string) Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. + * @param int $link The link identifier returned by AddLink() + * @param float $y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) + * @param int|string $page Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. * @public * @since 1.5 * @see AddLink() */ - public function SetLink($link, $y=0, $page=-1) { + public function setLink($link, $y=0, $page=-1) { $fixed = false; if (!empty($page) AND (substr($page, 0, 1) == '*')) { $page = intval(substr($page, 1)); @@ -4739,12 +4796,12 @@ class TCPDF { /** * Puts a link on a rectangular area of the page. * Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image. - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $w (float) Width of the rectangle - * @param $h (float) Height of the rectangle - * @param $link (mixed) URL or identifier returned by AddLink() - * @param $spaces (int) number of spaces on the text to link + * @param float $x Abscissa of the upper-left corner of the rectangle + * @param float $y Ordinate of the upper-left corner of the rectangle + * @param float $w Width of the rectangle + * @param float $h Height of the rectangle + * @param mixed $link URL or identifier returned by AddLink() + * @param int $spaces number of spaces on the text to link * @public * @since 1.5 * @see AddLink(), Annotation(), Cell(), Write(), Image() @@ -4756,13 +4813,13 @@ class TCPDF { /** * Puts a markup annotation on a rectangular area of the page. * !!!!THE ANNOTATION SUPPORT IS NOT YET FULLY IMPLEMENTED !!!! - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $w (float) Width of the rectangle - * @param $h (float) Height of the rectangle - * @param $text (string) annotation text or alternate content - * @param $opt (array) array of options (see section 8.4 of PDF reference 1.7). - * @param $spaces (int) number of spaces on the text to link + * @param float $x Abscissa of the upper-left corner of the rectangle + * @param float $y Ordinate of the upper-left corner of the rectangle + * @param float $w Width of the rectangle + * @param float $h Height of the rectangle + * @param string $text annotation text or alternate content + * @param array $opt array of options (see section 8.4 of PDF reference 1.7). + * @param int $spaces number of spaces on the text to link * @public * @since 4.0.018 (2008-08-06) */ @@ -4863,7 +4920,7 @@ class TCPDF { } reset($this->embeddedfiles); foreach ($this->embeddedfiles as $filename => $filedata) { - $data = TCPDF_STATIC::fileGetContents($filedata['file']); + $data = $this->getCachedFileContents($filedata['file']); if ($data !== FALSE) { $rawsize = strlen($data); if ($rawsize > 0) { @@ -4902,31 +4959,31 @@ class TCPDF { /** * Prints a text cell at the specified position. * This method allows to place a string precisely on the page. - * @param $x (float) Abscissa of the cell origin - * @param $y (float) Ordinate of the cell origin - * @param $txt (string) String to print - * @param $fstroke (int) outline size in user units (false = disable) - * @param $fclip (boolean) if true activate clipping mode (you must call StartTransform() before this function and StopTransform() to stop the clipping tranformation). - * @param $ffill (boolean) if true fills the text - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
              • 0: to the right (or left for RTL languages)
              • 1: to the beginning of the next line
              • 2: below
              Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. - * @param $align (string) Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              - * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). - * @param $link (mixed) URL or identifier returned by AddLink(). - * @param $stretch (int) font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. - * @param $ignore_min_height (boolean) if true ignore automatic minimum height value. - * @param $calign (string) cell vertical alignment relative to the specified Y value. Possible values are:
              • T : cell top
              • A : font top
              • L : font baseline
              • D : font bottom
              • B : cell bottom
              - * @param $valign (string) text vertical alignment inside the cell. Possible values are:
              • T : top
              • C : center
              • B : bottom
              - * @param $rtloff (boolean) if true uses the page top-left corner as origin of axis for $x and $y initial position. + * @param float $x Abscissa of the cell origin + * @param float $y Ordinate of the cell origin + * @param string $txt String to print + * @param int $fstroke outline size in user units (0 = disable) + * @param boolean $fclip if true activate clipping mode (you must call StartTransform() before this function and StopTransform() to stop the clipping tranformation). + * @param boolean $ffill if true fills the text + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param int $ln Indicates where the current position should go after the call. Possible values are:
              • 0: to the right (or left for RTL languages)
              • 1: to the beginning of the next line
              • 2: below
              Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. + * @param string $align Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              + * @param boolean $fill Indicates if the cell background must be painted (true) or transparent (false). + * @param mixed $link URL or identifier returned by AddLink(). + * @param int $stretch font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. + * @param boolean $ignore_min_height if true ignore automatic minimum height value. + * @param string $calign cell vertical alignment relative to the specified Y value. Possible values are:
              • T : cell top
              • A : font top
              • L : font baseline
              • D : font bottom
              • B : cell bottom
              + * @param string $valign text vertical alignment inside the cell. Possible values are:
              • T : top
              • C : center
              • B : bottom
              + * @param boolean $rtloff if true uses the page top-left corner as origin of axis for $x and $y initial position. * @public * @since 1.0 * @see Cell(), Write(), MultiCell(), WriteHTML(), WriteHTMLCell() */ - public function Text($x, $y, $txt, $fstroke=false, $fclip=false, $ffill=true, $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M', $rtloff=false) { + public function Text($x, $y, $txt, $fstroke=0, $fclip=false, $ffill=true, $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M', $rtloff=false) { $textrendermode = $this->textrendermode; $textstrokewidth = $this->textstrokewidth; $this->setTextRenderingMode($fstroke, $ffill, $fclip); - $this->SetXY($x, $y, $rtloff); + $this->setXY($x, $y, $rtloff); $this->Cell(0, 0, $txt, $border, $ln, $align, $fill, $link, $stretch, $ignore_min_height, $calign, $valign); // restore previous rendering mode $this->textrendermode = $textrendermode; @@ -4937,7 +4994,7 @@ class TCPDF { * Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. * The default implementation returns a value according to the mode selected by SetAutoPageBreak().
              * This method is called automatically and should not be called directly by the application. - * @return boolean + * @return bool * @public * @since 1.4 * @see SetAutoPageBreak() @@ -4962,14 +5019,14 @@ class TCPDF { /** * Add page if needed. - * @param $h (float) Cell height. Default value: 0. - * @param $y (mixed) starting y position, leave empty for current position. - * @param $addpage (boolean) if true add a page, otherwise only return the true/false state - * @return boolean true in case of page break, false otherwise. + * @param float $h Cell height. Default value: 0. + * @param float|null $y starting y position, leave empty for current position. + * @param bool $addpage if true add a page, otherwise only return the true/false state + * @return bool true in case of page break, false otherwise. * @since 3.2.000 (2008-07-01) * @protected */ - protected function checkPageBreak($h=0, $y='', $addpage=true) { + protected function checkPageBreak($h=0, $y=null, $addpage=true) { if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } @@ -5007,18 +5064,18 @@ class TCPDF { /** * Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
              * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting. - * @param $w (float) Cell width. If 0, the cell extends up to the right margin. - * @param $h (float) Cell height. Default value: 0. - * @param $txt (string) String to print. Default value: empty string. - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
              • 0: to the right (or left for RTL languages)
              • 1: to the beginning of the next line
              • 2: below
              Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. - * @param $align (string) Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              - * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). - * @param $link (mixed) URL or identifier returned by AddLink(). - * @param $stretch (int) font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. - * @param $ignore_min_height (boolean) if true ignore automatic minimum height value. - * @param $calign (string) cell vertical alignment relative to the specified Y value. Possible values are:
              • T : cell top
              • C : center
              • B : cell bottom
              • A : font top
              • L : font baseline
              • D : font bottom
              - * @param $valign (string) text vertical alignment inside the cell. Possible values are:
              • T : top
              • C : center
              • B : bottom
              + * @param float $w Cell width. If 0, the cell extends up to the right margin. + * @param float $h Cell height. Default value: 0. + * @param string $txt String to print. Default value: empty string. + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param int $ln Indicates where the current position should go after the call. Possible values are:
              • 0: to the right (or left for RTL languages)
              • 1: to the beginning of the next line
              • 2: below
              Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. + * @param string $align Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              + * @param boolean $fill Indicates if the cell background must be painted (true) or transparent (false). + * @param mixed $link URL or identifier returned by AddLink(). + * @param int $stretch font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. + * @param boolean $ignore_min_height if true ignore automatic minimum height value. + * @param string $calign cell vertical alignment relative to the specified Y value. Possible values are:
              • T : cell top
              • C : center
              • B : cell bottom
              • A : font top
              • L : font baseline
              • D : font bottom
              + * @param string $valign text vertical alignment inside the cell. Possible values are:
              • T : top
              • C : center
              • B : bottom
              * @public * @since 1.0 * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() @@ -5046,9 +5103,9 @@ class TCPDF { // print shadow $this->x += $this->txtshadow['depth_w']; $this->y += $this->txtshadow['depth_h']; - $this->SetFillColorArray($this->txtshadow['color']); - $this->SetTextColorArray($this->txtshadow['color']); - $this->SetDrawColorArray($this->txtshadow['color']); + $this->setFillColorArray($this->txtshadow['color']); + $this->setTextColorArray($this->txtshadow['color']); + $this->setDrawColorArray($this->txtshadow['color']); if ($this->txtshadow['opacity'] != $alpha['CA']) { $this->setAlpha($this->txtshadow['opacity'], $this->txtshadow['blend_mode']); } @@ -5058,9 +5115,9 @@ class TCPDF { //restore data $this->x = $x; $this->y = $y; - $this->SetFillColorArray($bc); - $this->SetTextColorArray($fc); - $this->SetDrawColorArray($sc); + $this->setFillColorArray($bc); + $this->setTextColorArray($fc); + $this->setDrawColorArray($sc); if ($this->txtshadow['opacity'] != $alpha['CA']) { $this->setAlpha($alpha['CA'], $alpha['BM'], $alpha['ca'], $alpha['AIS']); } @@ -5075,18 +5132,18 @@ class TCPDF { /** * Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
              * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting. - * @param $w (float) Cell width. If 0, the cell extends up to the right margin. - * @param $h (float) Cell height. Default value: 0. - * @param $txt (string) String to print. Default value: empty string. - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
              • 0: to the right (or left for RTL languages)
              • 1: to the beginning of the next line
              • 2: below
              Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. - * @param $align (string) Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              - * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). - * @param $link (mixed) URL or identifier returned by AddLink(). - * @param $stretch (int) font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. - * @param $ignore_min_height (boolean) if true ignore automatic minimum height value. - * @param $calign (string) cell vertical alignment relative to the specified Y value. Possible values are:
              • T : cell top
              • C : center
              • B : cell bottom
              • A : font top
              • L : font baseline
              • D : font bottom
              - * @param $valign (string) text vertical alignment inside the cell. Possible values are:
              • T : top
              • M : middle
              • B : bottom
              + * @param float $w Cell width. If 0, the cell extends up to the right margin. + * @param float $h Cell height. Default value: 0. + * @param string $txt String to print. Default value: empty string. + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param int $ln Indicates where the current position should go after the call. Possible values are:
              • 0: to the right (or left for RTL languages)
              • 1: to the beginning of the next line
              • 2: below
              Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. + * @param string $align Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              + * @param boolean $fill Indicates if the cell background must be painted (true) or transparent (false). + * @param mixed $link URL or identifier returned by AddLink(). + * @param int $stretch font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. + * @param boolean $ignore_min_height if true ignore automatic minimum height value. + * @param string $calign cell vertical alignment relative to the specified Y value. Possible values are:
              • T : cell top
              • C : center
              • B : cell bottom
              • A : font top
              • L : font baseline
              • D : font bottom
              + * @param string $valign text vertical alignment inside the cell. Possible values are:
              • T : top
              • M : middle
              • B : bottom
              * @return string containing cell code * @protected * @since 1.0 @@ -5554,8 +5611,8 @@ class TCPDF { /** * Replace a char if is defined on the current font. - * @param $oldchar (int) Integer code (unicode) of the character to replace. - * @param $newchar (int) Integer code (unicode) of the new character. + * @param int $oldchar Integer code (unicode) of the character to replace. + * @param int $newchar Integer code (unicode) of the new character. * @return int the replaced char or the old char in case the new char i not defined * @protected * @since 5.9.167 (2012-06-22) @@ -5573,11 +5630,11 @@ class TCPDF { /** * Returns the code to draw the cell border - * @param $x (float) X coordinate. - * @param $y (float) Y coordinate. - * @param $w (float) Cell width. - * @param $h (float) Cell height. - * @param $brd (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param float $x X coordinate. + * @param float $y Y coordinate. + * @param float $w Cell width. + * @param float $h Cell height. + * @param string|array|int $brd Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) * @return string containing cell border code * @protected * @see SetLineStyle() @@ -5625,7 +5682,7 @@ class TCPDF { if (is_array($style) AND !empty($style)) { // apply border style $prev_style = $this->linestyleWidth.' '.$this->linestyleCap.' '.$this->linestyleJoin.' '.$this->linestyleDash.' '.$this->DrawColor.' '; - $s .= $this->SetLineStyle($style, true)."\n"; + $s .= $this->setLineStyle($style, true)."\n"; } switch ($mode) { case 'ext': { @@ -5765,28 +5822,28 @@ class TCPDF { * This method allows printing text with line breaks. * They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.
              * Text can be aligned, centered or justified. The cell block can be framed and the background painted. - * @param $w (float) Width of cells. If 0, they extend up to the right margin of the page. - * @param $h (float) Cell minimum height. The cell extends automatically if needed. - * @param $txt (string) String to print - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $align (string) Allows to center or align the text. Possible values are:
              • L or empty string: left align
              • C: center
              • R: right align
              • J: justification (default value when $ishtml=false)
              - * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). - * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
              • 0: to the right
              • 1: to the beginning of the next line [DEFAULT]
              • 2: below
              - * @param $x (float) x position in user units - * @param $y (float) y position in user units - * @param $reseth (boolean) if true reset the last cell height (default true). - * @param $stretch (int) font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. - * @param $ishtml (boolean) INTERNAL USE ONLY -- set to true if $txt is HTML content (default = false). Never set this parameter to true, use instead writeHTMLCell() or writeHTML() methods. - * @param $autopadding (boolean) if true, uses internal padding and automatically adjust it to account for line width. - * @param $maxh (float) maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. This feature works only when $ishtml=false. - * @param $valign (string) Vertical alignment of text (requires $maxh = $h > 0). Possible values are:
              • T: TOP
              • M: middle
              • B: bottom
              . This feature works only when $ishtml=false and the cell must fit in a single page. - * @param $fitcell (boolean) if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). $maxh must be greater than 0 and equal to $h. + * @param float $w Width of cells. If 0, they extend up to the right margin of the page. + * @param float $h Cell minimum height. The cell extends automatically if needed. + * @param string $txt String to print + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param string $align Allows to center or align the text. Possible values are:
              • L or empty string: left align
              • C: center
              • R: right align
              • J: justification (default value when $ishtml=false)
              + * @param boolean $fill Indicates if the cell background must be painted (true) or transparent (false). + * @param int $ln Indicates where the current position should go after the call. Possible values are:
              • 0: to the right
              • 1: to the beginning of the next line [DEFAULT]
              • 2: below
              + * @param float|null $x x position in user units + * @param float|null $y y position in user units + * @param boolean $reseth if true reset the last cell height (default true). + * @param int $stretch font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. + * @param boolean $ishtml INTERNAL USE ONLY -- set to true if $txt is HTML content (default = false). Never set this parameter to true, use instead writeHTMLCell() or writeHTML() methods. + * @param boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width. + * @param float $maxh maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. This feature works only when $ishtml=false. + * @param string $valign Vertical alignment of text (requires $maxh = $h > 0). Possible values are:
              • T: TOP
              • M: middle
              • B: bottom
              . This feature works only when $ishtml=false and the cell must fit in a single page. + * @param boolean $fitcell if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). $maxh must be greater than 0 and equal to $h. * @return int Return the number of cells or 1 for html mode. * @public * @since 1.3 * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak() */ - public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false) { + public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x=null, $y=null, $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false) { $prev_cell_margin = $this->cell_margin; $prev_cell_padding = $this->cell_padding; // adjust internal padding @@ -5801,7 +5858,7 @@ class TCPDF { $this->resetLastH(); } if (!TCPDF_STATIC::empty_string($y)) { - $this->SetY($y); // set y in order to convert negative y values to positive ones + $this->setY($y); // set y in order to convert negative y values to positive ones } $y = $this->GetY(); $resth = 0; @@ -5816,7 +5873,7 @@ class TCPDF { // get current column $startcolumn = $this->current_column; if (!TCPDF_STATIC::empty_string($x)) { - $this->SetX($x); + $this->setX($x); } else { $x = $this->GetX(); } @@ -5877,7 +5934,7 @@ class TCPDF { $maxit = (2 * min(100, max(10, intval($fmax)))); // max number of iterations while ($maxit >= 0) { $fmid = (($fmax + $fmin) / 2); - $this->SetFontSize($fmid, false); + $this->setFontSize($fmid, false); $this->resetLastH(); $text_height = $this->getStringHeight($w, $txt, $reseth, $autopadding, $mc_padding, $border); $diff = ($maxh - $text_height); @@ -5893,11 +5950,11 @@ class TCPDF { } if ($maxit < 0) { // premature exit, we get the minimum font value to fit the cell - $this->SetFontSize($fmin); + $this->setFontSize($fmin); $this->resetLastH(); $text_height = $this->getStringHeight($w, $txt, $reseth, $autopadding, $mc_padding, $border); } else { - $this->SetFontSize($fmid); + $this->setFontSize($fmid); $this->resetLastH(); } } @@ -5914,7 +5971,7 @@ class TCPDF { $nl = $this->Write($this->lasth, $txt, '', 0, $align, true, $stretch, false, true, $maxh, 0, $mc_margin); if ($fitcell) { // restore font size - $this->SetFontSize($prev_FontSizePt); + $this->setFontSize($prev_FontSizePt); } } if ($autopadding) { @@ -5961,7 +6018,7 @@ class TCPDF { $this->setPage($page); if ($this->num_columns < 2) { // single-column mode - $this->SetX($x); + $this->setX($x); $this->y = $this->tMargin; } // account for margin changes @@ -6123,15 +6180,15 @@ class TCPDF { } if ($ln > 0) { //Go to the beginning of the next line - $this->SetY($currentY + $mc_margin['B']); + $this->setY($currentY + $mc_margin['B']); if ($ln == 2) { - $this->SetX($x + $w + $mc_margin['L'] + $mc_margin['R']); + $this->setX($x + $w + $mc_margin['L'] + $mc_margin['R']); } } else { // go left or right by case $this->setPage($startpage); $this->y = $y; - $this->SetX($x + $w + $mc_margin['L'] + $mc_margin['R']); + $this->setX($x + $w + $mc_margin['L'] + $mc_margin['R']); } $this->setContentMark(); $this->cell_padding = $prev_cell_padding; @@ -6143,18 +6200,18 @@ class TCPDF { /** * This method return the estimated number of lines for print a simple text string using Multicell() method. - * @param $txt (string) String for calculating his height - * @param $w (float) Width of cells. If 0, they extend up to the right margin of the page. - * @param $reseth (boolean) if true reset the last cell height (default false). - * @param $autopadding (boolean) if true, uses internal padding and automatically adjust it to account for line width (default true). - * @param $cellpadding (float) Internal cell padding, if empty uses default cell padding. - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param string $txt String for calculating his height + * @param float $w Width of cells. If 0, they extend up to the right margin of the page. + * @param boolean $reseth if true reset the last cell height (default false). + * @param boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width (default true). + * @param array|null $cellpadding Internal cell padding, if empty uses default cell padding. + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) * @return float Return the minimal height needed for multicell method for printing the $txt param. * @author Alexander Escalona Fern\E1ndez, Nicola Asuni * @public * @since 4.5.011 */ - public function getNumLines($txt, $w=0, $reseth=false, $autopadding=true, $cellpadding='', $border=0) { + public function getNumLines($txt, $w=0, $reseth=false, $autopadding=true, $cellpadding=null, $border=0) { if ($txt === NULL) { return 0; } @@ -6237,7 +6294,7 @@ class TCPDF { * $start_page = $pdf->getPage(); * // call your printing functions with your parameters * // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * $pdf->MultiCell($w=0, $h=0, $txt, $border=1, $align='L', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0); + * $pdf->MultiCell($w=0, $h=0, $txt, $border=1, $align='L', $fill=false, $ln=1, $x=null, $y=null, $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0); * // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * // get the new Y * $end_y = $pdf->GetY(); @@ -6263,17 +6320,17 @@ class TCPDF { * // restore previous object * $pdf = $pdf->rollbackTransaction(); * - * @param $w (float) Width of cells. If 0, they extend up to the right margin of the page. - * @param $txt (string) String for calculating his height - * @param $reseth (boolean) if true reset the last cell height (default false). - * @param $autopadding (boolean) if true, uses internal padding and automatically adjust it to account for line width (default true). - * @param $cellpadding (float) Internal cell padding, if empty uses default cell padding. - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param float $w Width of cells. If 0, they extend up to the right margin of the page. + * @param string $txt String for calculating his height + * @param boolean $reseth if true reset the last cell height (default false). + * @param boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width (default true). + * @param array|null $cellpadding Internal cell padding, if empty uses default cell padding. + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) * @return float Return the minimal height needed for multicell method for printing the $txt param. * @author Nicola Asuni, Alexander Escalona Fern\E1ndez * @public */ - public function getStringHeight($w, $txt, $reseth=false, $autopadding=true, $cellpadding='', $border=0) { + public function getStringHeight($w, $txt, $reseth=false, $autopadding=true, $cellpadding=null, $border=0) { // adjust internal padding $prev_cell_padding = $this->cell_padding; $prev_lasth = $this->lasth; @@ -6290,30 +6347,30 @@ class TCPDF { /** * This method prints text from the current position.
              - * @param $h (float) Line height - * @param $txt (string) String to print - * @param $link (mixed) URL or identifier returned by AddLink() - * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). - * @param $align (string) Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              - * @param $ln (boolean) if true set cursor at the bottom of the line, otherwise set cursor at the top of the line. - * @param $stretch (int) font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. - * @param $firstline (boolean) if true prints only the first line and return the remaining string. - * @param $firstblock (boolean) if true the string is the starting of a line. - * @param $maxh (float) maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. - * @param $wadj (float) first line width will be reduced by this amount (used in HTML mode). - * @param $margin (array) margin array of the parent container + * @param float $h Line height + * @param string $txt String to print + * @param mixed $link URL or identifier returned by AddLink() + * @param boolean $fill Indicates if the cell background must be painted (true) or transparent (false). + * @param string $align Allows to center or align the text. Possible values are:
              • L or empty string: left align (default value)
              • C: center
              • R: right align
              • J: justify
              + * @param boolean $ln if true set cursor at the bottom of the line, otherwise set cursor at the top of the line. + * @param int $stretch font stretch mode:
              • 0 = disabled
              • 1 = horizontal scaling only if text is larger than cell width
              • 2 = forced horizontal scaling to fit cell width
              • 3 = character spacing only if text is larger than cell width
              • 4 = forced character spacing to fit cell width
              General font stretching and scaling values will be preserved when possible. + * @param boolean $firstline if true prints only the first line and return the remaining string. + * @param boolean $firstblock if true the string is the starting of a line. + * @param float $maxh maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. + * @param float $wadj first line width will be reduced by this amount (used in HTML mode). + * @param array|null $margin margin array of the parent container * @return mixed Return the number of cells or the remaining string if $firstline = true. * @public * @since 1.5 */ - public function Write($h, $txt, $link='', $fill=false, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0, $wadj=0, $margin='') { + public function Write($h, $txt, $link='', $fill=false, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0, $wadj=0, $margin=null) { // check page for no-write regions and adapt page margins if necessary list($this->x, $this->y) = $this->checkPageRegions($h, $this->x, $this->y); if (strlen($txt) == 0) { // fix empty text $txt = ' '; } - if ($margin === '') { + if (!is_array($margin)) { // set default margins $margin = $this->cell_margin; } @@ -6415,7 +6472,7 @@ class TCPDF { $w = $linew; $tmpcellpadding = $this->cell_padding; if ($maxh == 0) { - $this->SetCellPadding(0); + $this->setCellPadding(0); } } if ($firstblock AND $this->isRTLTextDir()) { @@ -6489,7 +6546,7 @@ class TCPDF { // *** very slow *** $l = $this->GetArrStringWidth(TCPDF_FONTS::utf8Bidi(array_slice($chars, $j, ($i - $j)), '', $this->tmprtl, $this->isunicode, $this->CurrentFont)); } else { - $l += $this->GetCharWidth($c); + $l += $this->GetCharWidth($c, ($i+1 < $nb)); } if (($l > $wmax) OR (($c == 173) AND (($l + $tmp_shy_replacement_width) >= $wmax))) { if (($c == 173) AND (($l + $tmp_shy_replacement_width) > $wmax)) { @@ -6526,7 +6583,7 @@ class TCPDF { $w = $linew; $tmpcellpadding = $this->cell_padding; if ($maxh == 0) { - $this->SetCellPadding(0); + $this->setCellPadding(0); } } if ($firstblock AND $this->isRTLTextDir()) { @@ -6570,7 +6627,7 @@ class TCPDF { $w = $linew; $tmpcellpadding = $this->cell_padding; if ($maxh == 0) { - $this->SetCellPadding(0); + $this->setCellPadding(0); } } if ($firstblock AND $this->isRTLTextDir()) { @@ -6618,7 +6675,7 @@ class TCPDF { $w = $linew; $tmpcellpadding = $this->cell_padding; if ($maxh == 0) { - $this->SetCellPadding(0); + $this->setCellPadding(0); } } // print the line @@ -6671,13 +6728,10 @@ class TCPDF { switch ($align) { case 'J': case 'C': { - $w = $w; break; } case 'L': { - if ($this->rtl) { - $w = $w; - } else { + if (!$this->rtl) { $w = $l; } break; @@ -6685,8 +6739,6 @@ class TCPDF { case 'R': { if ($this->rtl) { $w = $l; - } else { - $w = $w; } break; } @@ -6712,7 +6764,7 @@ class TCPDF { $w = $linew; $tmpcellpadding = $this->cell_padding; if ($maxh == 0) { - $this->SetCellPadding(0); + $this->setCellPadding(0); } } if ($firstblock AND $this->isRTLTextDir()) { @@ -6734,7 +6786,7 @@ class TCPDF { /** * Returns the remaining width between the current position and margins. - * @return int Return the remaining width + * @return float Return the remaining width * @protected */ protected function getRemainingWidth() { @@ -6748,12 +6800,12 @@ class TCPDF { /** * Set the block dimensions accounting for page breaks and page/column fitting - * @param $w (float) width - * @param $h (float) height - * @param $x (float) X coordinate - * @param $y (float) Y coodiante - * @param $fitonpage (boolean) if true the block is resized to not exceed page dimensions. - * @return array($w, $h, $x, $y) + * @param float $w width + * @param float $h height + * @param float $x X coordinate + * @param float $y Y coodiante + * @param boolean $fitonpage if true the block is resized to not exceed page dimensions. + * @return array array($w, $h, $x, $y) * @protected * @since 5.5.009 (2010-07-05) */ @@ -6829,43 +6881,49 @@ class TCPDF { * The format can be specified explicitly or inferred from the file extension.
              * It is possible to put a link on the image.
              * Remark: if an image is used several times, only one copy will be embedded in the file.
              - * @param $file (string) Name of the file containing the image or a '@' character followed by the image data string. To link an image without embedding it on the document, set an asterisk character before the URL (i.e.: '*http://www.example.com/image.jpg'). - * @param $x (float) Abscissa of the upper-left corner (LTR) or upper-right corner (RTL). - * @param $y (float) Ordinate of the upper-left corner (LTR) or upper-right corner (RTL). - * @param $w (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $h (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $type (string) Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension. - * @param $link (mixed) URL or identifier returned by AddLink(). - * @param $align (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
              • T: top-right for LTR or top-left for RTL
              • M: middle-right for LTR or middle-left for RTL
              • B: bottom-right for LTR or bottom-left for RTL
              • N: next line
              - * @param $resize (mixed) If true resize (reduce) the image to fit $w and $h (requires GD or ImageMagick library); if false do not resize; if 2 force resize in all cases (upscaling and downscaling). - * @param $dpi (int) dot-per-inch resolution used on resize - * @param $palign (string) Allows to center or align the image on the current line. Possible values are:
              • L : left align
              • C : center
              • R : right align
              • '' : empty string : left for LTR or right for RTL
              - * @param $ismask (boolean) true if this image is a mask, false otherwise - * @param $imgmask (mixed) image object returned by this function or false - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $fitbox (mixed) If not false scale image dimensions proportionally to fit within the ($w, $h) box. $fitbox can be true or a 2 characters string indicating the image alignment inside the box. The first character indicate the horizontal alignment (L = left, C = center, R = right) the second character indicate the vertical algnment (T = top, M = middle, B = bottom). - * @param $hidden (boolean) If true do not display the image. - * @param $fitonpage (boolean) If true the image is resized to not exceed page dimensions. - * @param $alt (boolean) If true the image will be added as alternative and not directly printed (the ID of the image will be returned). - * @param $altimgs (array) Array of alternate images IDs. Each alternative image must be an array with two values: an integer representing the image ID (the value returned by the Image method) and a boolean value to indicate if the image is the default for printing. - * @return image information + * @param string $file Name of the file containing the image or a '@' character followed by the image data string. To link an image without embedding it on the document, set an asterisk character before the URL (i.e.: '*http://www.example.com/image.jpg'). + * @param float|null $x Abscissa of the upper-left corner (LTR) or upper-right corner (RTL). + * @param float|null $y Ordinate of the upper-left corner (LTR) or upper-right corner (RTL). + * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param string $type Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension. + * @param mixed $link URL or identifier returned by AddLink(). + * @param string $align Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
              • T: top-right for LTR or top-left for RTL
              • M: middle-right for LTR or middle-left for RTL
              • B: bottom-right for LTR or bottom-left for RTL
              • N: next line
              + * @param mixed $resize If true resize (reduce) the image to fit $w and $h (requires GD or ImageMagick library); if false do not resize; if 2 force resize in all cases (upscaling and downscaling). + * @param int $dpi dot-per-inch resolution used on resize + * @param string $palign Allows to center or align the image on the current line. Possible values are:
              • L : left align
              • C : center
              • R : right align
              • '' : empty string : left for LTR or right for RTL
              + * @param boolean $ismask true if this image is a mask, false otherwise + * @param mixed $imgmask image object returned by this function or false + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param mixed $fitbox If not false scale image dimensions proportionally to fit within the ($w, $h) box. $fitbox can be true or a 2 characters string indicating the image alignment inside the box. The first character indicate the horizontal alignment (L = left, C = center, R = right) the second character indicate the vertical algnment (T = top, M = middle, B = bottom). + * @param boolean $hidden If true do not display the image. + * @param boolean $fitonpage If true the image is resized to not exceed page dimensions. + * @param boolean $alt If true the image will be added as alternative and not directly printed (the ID of the image will be returned). + * @param array $altimgs Array of alternate images IDs. Each alternative image must be an array with two values: an integer representing the image ID (the value returned by the Image method) and a boolean value to indicate if the image is the default for printing. + * @return mixed|false image information * @public * @since 1.1 */ - public function Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()) { + public function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()) { if ($this->state != 2) { - return; + return false; } - if (strcmp($x, '') === 0) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if (strcmp($y, '') === 0) { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary list($x, $y) = $this->checkPageRegions($h, $x, $y); $exurl = ''; // external streams $imsize = FALSE; + + // Make sure the file variable is not empty or null because accessing $file[0] later + // results in error when running PHP 7.4 + if (empty($file)) { + return false; + } // check if we are passing an image as file or string if ($file[0] === '@') { // image from string @@ -6877,18 +6935,14 @@ class TCPDF { $exurl = $file; } // check if file exist and it is valid - if (!@TCPDF_STATIC::file_exists($file)) { + if (!@$this->fileExists($file)) { return false; } - if (($imsize = @getimagesize($file)) === FALSE) { - if (in_array($file, $this->imagekeys)) { - // get existing image data - $info = $this->getImageBuffer($file); - $imsize = array($info['w'], $info['h']); - } elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE) { - $imgdata = TCPDF_STATIC::fileGetContents($file); - } - } + if (false !== $info = $this->getImageBuffer($file)) { + $imsize = array($info['w'], $info['h']); + } elseif (($imsize = @getimagesize($file)) === FALSE && strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE){ + $imgdata = $this->getCachedFileContents($file); + } } if (!empty($imgdata)) { // copy image to cache @@ -7093,7 +7147,7 @@ class TCPDF { $svgimg = substr($file, 1); } else { // get SVG file content - $svgimg = TCPDF_STATIC::fileGetContents($file); + $svgimg = $this->getCachedFileContents($file); } if ($svgimg !== FALSE) { // get width and height @@ -7146,7 +7200,7 @@ class TCPDF { } if ($info === false) { // unable to process image - return; + return false; } TCPDF_STATIC::set_mqr($mqr); if ($ismask) { @@ -7221,7 +7275,7 @@ class TCPDF { break; } case 'N': { - $this->SetY($this->img_rb_y); + $this->setY($this->img_rb_y); break; } default:{ @@ -7238,20 +7292,20 @@ class TCPDF { /** * Extract info from a PNG image with alpha channel using the Imagick or GD library. - * @param $file (string) Name of the file containing the image. - * @param $x (float) Abscissa of the upper-left corner. - * @param $y (float) Ordinate of the upper-left corner. - * @param $wpx (float) Original width of the image in pixels. - * @param $hpx (float) original height of the image in pixels. - * @param $w (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $h (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $type (string) Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension. - * @param $link (mixed) URL or identifier returned by AddLink(). - * @param $align (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
              • T: top-right for LTR or top-left for RTL
              • M: middle-right for LTR or middle-left for RTL
              • B: bottom-right for LTR or bottom-left for RTL
              • N: next line
              - * @param $resize (boolean) If true resize (reduce) the image to fit $w and $h (requires GD library). - * @param $dpi (int) dot-per-inch resolution used on resize - * @param $palign (string) Allows to center or align the image on the current line. Possible values are:
              • L : left align
              • C : center
              • R : right align
              • '' : empty string : left for LTR or right for RTL
              - * @param $filehash (string) File hash used to build unique file names. + * @param string $file Name of the file containing the image. + * @param float $x Abscissa of the upper-left corner. + * @param float $y Ordinate of the upper-left corner. + * @param float $wpx Original width of the image in pixels. + * @param float $hpx original height of the image in pixels. + * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param string $type Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension. + * @param mixed $link URL or identifier returned by AddLink(). + * @param string $align Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
              • T: top-right for LTR or top-left for RTL
              • M: middle-right for LTR or middle-left for RTL
              • B: bottom-right for LTR or bottom-left for RTL
              • N: next line
              + * @param boolean $resize If true resize (reduce) the image to fit $w and $h (requires GD library). + * @param int $dpi dot-per-inch resolution used on resize + * @param string $palign Allows to center or align the image on the current line. Possible values are:
              • L : left align
              • C : center
              • R : right align
              • '' : empty string : left for LTR or right for RTL
              + * @param string $filehash File hash used to build unique file names. * @author Nicola Asuni * @protected * @since 4.3.007 (2008-12-04) @@ -7315,7 +7369,7 @@ class TCPDF { $color = imagecolorat($img, $xpx, $ypx); // get and correct gamma color $alpha = $this->getGDgamma($img, $color); - imagesetpixel($imgalpha, $xpx, $ypx, $alpha); + imagesetpixel($imgalpha, (int) $xpx, (int) $ypx, (int) $alpha); } } imagepng($imgalpha, $tempfile_alpha); @@ -7346,8 +7400,8 @@ class TCPDF { /** * Get the GD-corrected PNG gamma value from alpha color - * @param $img (int) GD image Resource ID. - * @param $c (int) alpha color + * @param resource $img GD image Resource ID. + * @param int $c alpha color * @protected * @since 4.3.007 (2008-12-04) */ @@ -7355,9 +7409,9 @@ class TCPDF { if (!isset($this->gdgammacache['#'.$c])) { $colors = imagecolorsforindex($img, $c); // GD alpha is only 7 bit (0 -> 127) - $this->gdgammacache['#'.$c] = (((127 - $colors['alpha']) / 127) * 255); + $this->gdgammacache['#'.$c] = (int) (((127 - $colors['alpha']) / 127) * 255); // correct gamma - $this->gdgammacache['#'.$c] = (pow(($this->gdgammacache['#'.$c] / 255), 2.2) * 255); + $this->gdgammacache['#'.$c] = (int) (pow(($this->gdgammacache['#'.$c] / 255), 2.2) * 255); // store the latest values on cache to improve performances if (count($this->gdgammacache) > 8) { // remove one element from the cache array @@ -7370,13 +7424,13 @@ class TCPDF { /** * Performs a line break. * The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter. - * @param $h (float) The height of the break. By default, the value equals the height of the last printed cell. - * @param $cell (boolean) if true add the current left (or right o for RTL) padding to the X coordinate + * @param float|null $h The height of the break. By default, the value equals the height of the last printed cell. + * @param boolean $cell if true add the current left (or right o for RTL) padding to the X coordinate * @public * @since 1.0 * @see Cell() */ - public function Ln($h='', $cell=false) { + public function Ln($h=null, $cell=false) { if (($this->num_columns > 1) AND ($this->y == $this->columns[$this->current_column]['y']) AND isset($this->columns[$this->current_column]['x']) AND ($this->x == $this->columns[$this->current_column]['x'])) { // revove vertical space from the top of the column return; @@ -7395,7 +7449,7 @@ class TCPDF { } else { $this->x = $this->lMargin + $cellpadding; } - if (is_string($h)) { + if (TCPDF_STATIC::empty_string($h)) { $h = $this->lasth; } $this->y += $h; @@ -7444,13 +7498,13 @@ class TCPDF { /** * Defines the abscissa of the current position. * If the passed value is negative, it is relative to the right of the page (or left if language is RTL). - * @param $x (float) The value of the abscissa in user units. - * @param $rtloff (boolean) if true always uses the page top-left corner as origin of axis. + * @param float $x The value of the abscissa in user units. + * @param boolean $rtloff if true always uses the page top-left corner as origin of axis. * @public * @since 1.2 * @see GetX(), GetY(), SetY(), SetXY() */ - public function SetX($x, $rtloff=false) { + public function setX($x, $rtloff=false) { $x = floatval($x); if (!$rtloff AND $this->rtl) { if ($x >= 0) { @@ -7476,14 +7530,14 @@ class TCPDF { /** * Moves the current abscissa back to the left margin and sets the ordinate. * If the passed value is negative, it is relative to the bottom of the page. - * @param $y (float) The value of the ordinate in user units. - * @param $resetx (bool) if true (default) reset the X position. - * @param $rtloff (boolean) if true always uses the page top-left corner as origin of axis. + * @param float $y The value of the ordinate in user units. + * @param bool $resetx if true (default) reset the X position. + * @param boolean $rtloff if true always uses the page top-left corner as origin of axis. * @public * @since 1.0 * @see GetX(), GetY(), SetY(), SetXY() */ - public function SetY($y, $resetx=true, $rtloff=false) { + public function setY($y, $resetx=true, $rtloff=false) { $y = floatval($y); if ($resetx) { //reset x @@ -7509,59 +7563,59 @@ class TCPDF { /** * Defines the abscissa and ordinate of the current position. * If the passed values are negative, they are relative respectively to the right and bottom of the page. - * @param $x (float) The value of the abscissa. - * @param $y (float) The value of the ordinate. - * @param $rtloff (boolean) if true always uses the page top-left corner as origin of axis. + * @param float $x The value of the abscissa. + * @param float $y The value of the ordinate. + * @param boolean $rtloff if true always uses the page top-left corner as origin of axis. * @public * @since 1.2 * @see SetX(), SetY() */ - public function SetXY($x, $y, $rtloff=false) { - $this->SetY($y, false, $rtloff); - $this->SetX($x, $rtloff); + public function setXY($x, $y, $rtloff=false) { + $this->setY($y, false, $rtloff); + $this->setX($x, $rtloff); } /** * Set the absolute X coordinate of the current pointer. - * @param $x (float) The value of the abscissa in user units. + * @param float $x The value of the abscissa in user units. * @public * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsX($x) { + public function setAbsX($x) { $this->x = floatval($x); } /** * Set the absolute Y coordinate of the current pointer. - * @param $y (float) (float) The value of the ordinate in user units. + * @param float $y (float) The value of the ordinate in user units. * @public * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsY($y) { + public function setAbsY($y) { $this->y = floatval($y); } /** * Set the absolute X and Y coordinates of the current pointer. - * @param $x (float) The value of the abscissa in user units. - * @param $y (float) (float) The value of the ordinate in user units. + * @param float $x The value of the abscissa in user units. + * @param float $y (float) The value of the ordinate in user units. * @public * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsXY($x, $y) { - $this->SetAbsX($x); - $this->SetAbsY($y); + public function setAbsXY($x, $y) { + $this->setAbsX($x); + $this->setAbsY($y); } /** * Send the document to a given destination: string, local file or browser. * In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
              * The method first calls Close() if necessary to terminate the document. - * @param $name (string) The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character. - * @param $dest (string) Destination where to send the document. It can take one of the following values:
              • I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
              • D: send to the browser and force a file download with the name given by name.
              • F: save to a local server file with the name given by name.
              • S: return the document as a string (name is ignored).
              • FI: equivalent to F + I option
              • FD: equivalent to F + D option
              • E: return the document as base64 mime multi-part email attachment (RFC 2045)
              + * @param string $name The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character. + * @param string $dest Destination where to send the document. It can take one of the following values:
              • I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
              • D: send to the browser and force a file download with the name given by name.
              • F: save to a local server file with the name given by name.
              • S: return the document as a string (name is ignored).
              • FI: equivalent to F + I option
              • FD: equivalent to F + D option
              • E: return the document as base64 mime multi-part email attachment (RFC 2045)
              * @return string * @public * @since 1.0 @@ -7761,20 +7815,16 @@ class TCPDF { protected static $cleaned_ids = array(); /** * Unset all class variables except the following critical variables. - * @param $destroyall (boolean) if true destroys all class variables, otherwise preserves critical variables. - * @param $preserve_objcopy (boolean) if true preserves the objcopy variable + * @param boolean $destroyall if true destroys all class variables, otherwise preserves critical variables. + * @param boolean $preserve_objcopy if true preserves the objcopy variable * @public * @since 4.5.016 (2009-02-24) */ public function _destroy($destroyall=false, $preserve_objcopy=false) { - // restore internal encoding - if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { - mb_internal_encoding($this->internal_encoding); - } if (isset(self::$cleaned_ids[$this->file_id])) { $destroyall = false; } - if ($destroyall AND !$preserve_objcopy) { + if ($destroyall AND !$preserve_objcopy && isset($this->file_id)) { self::$cleaned_ids[$this->file_id] = true; // remove all temporary files if ($handle = @opendir(K_PATH_CACHE)) { @@ -7787,7 +7837,7 @@ class TCPDF { } if (isset($this->imagekeys)) { foreach($this->imagekeys as $file) { - if (strpos($file, K_PATH_CACHE) === 0) { + if (strpos($file, K_PATH_CACHE) === 0 && TCPDF_STATIC::file_exists($file)) { @unlink($file); } } @@ -7795,7 +7845,6 @@ class TCPDF { } $preserve = array( 'file_id', - 'internal_encoding', 'state', 'bufferlen', 'buffer', @@ -7834,7 +7883,7 @@ class TCPDF { /** * Return an array containing variations for the basic page number alias. - * @param $a (string) Base alias. + * @param string $a Base alias. * @return array of page number aliases * @protected */ @@ -7871,10 +7920,10 @@ class TCPDF { /** * Replace right shift page number aliases with spaces to correct right alignment. * This works perfectly only when using monospaced fonts. - * @param $page (string) Page content. - * @param $aliases (array) Array of page aliases. - * @param $diff (int) initial difference to add. - * @return replaced page content. + * @param string $page Page content. + * @param array $aliases Array of page aliases. + * @param int $diff initial difference to add. + * @return string replaced page content. * @protected */ protected function replaceRightShiftPageNumAliases($page, $aliases, $diff) { @@ -7909,7 +7958,7 @@ class TCPDF { /** * Set page boxes to be included on page descriptions. - * @param $boxes (array) Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'). + * @param array $boxes Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'). * @protected */ protected function setPageBoxTypes($boxes) { @@ -8024,7 +8073,7 @@ class TCPDF { } $out .= ' /Contents '.($this->n + 1).' 0 R'; $out .= ' /Rotate '.$this->pagedim[$n]['Rotate']; - if (!$this->pdfa_mode) { + if (!$this->pdfa_mode || $this->pdfa_version >= 2) { $out .= ' /Group << /Type /Group /S /Transparency /CS /DeviceRGB >>'; } if (isset($this->pagedim[$n]['trans']) AND !empty($this->pagedim[$n]['trans'])) { @@ -8081,7 +8130,7 @@ class TCPDF { /** * Get references to page annotations. - * @param $n (int) page number + * @param int $n page number * @return string * @protected * @author Nicola Asuni @@ -8379,8 +8428,13 @@ class TCPDF { } else { $annots .= ' /Name /Note'; } + $hasStateModel = isset($pl['opt']['statemodel']); + $hasState = isset($pl['opt']['state']); $statemodels = array('Marked', 'Review'); - if (isset($pl['opt']['statemodel']) AND in_array($pl['opt']['statemodel'], $statemodels)) { + if (!$hasStateModel && !$hasState) { + break; + } + if ($hasStateModel AND in_array($pl['opt']['statemodel'], $statemodels)) { $annots .= ' /StateModel /'.$pl['opt']['statemodel']; } else { $pl['opt']['statemodel'] = 'Marked'; @@ -8391,7 +8445,7 @@ class TCPDF { } else { $states = array('Accepted', 'Rejected', 'Cancelled', 'Completed', 'None'); } - if (isset($pl['opt']['state']) AND in_array($pl['opt']['state'], $states)) { + if ($hasState AND in_array($pl['opt']['state'], $states)) { $annots .= ' /State /'.$pl['opt']['state']; } else { if ($pl['opt']['statemodel'] == 'Marked') { @@ -8406,7 +8460,7 @@ class TCPDF { if (is_string($pl['txt']) && !empty($pl['txt'])) { if ($pl['txt'][0] == '#') { // internal destination - $annots .= ' /A <>'; + $annots .= ' /A <>'; } elseif ($pl['txt'][0] == '%') { // embedded PDF file $filename = basename(substr($pl['txt'], 1)); @@ -8769,9 +8823,9 @@ class TCPDF { /** * Put appearance streams XObject used to define annotation's appearance states. - * @param $w (int) annotation width - * @param $h (int) annotation height - * @param $stream (string) appearance stream + * @param int $w annotation width + * @param int $h annotation height + * @param string $stream appearance stream * @return int object ID * @protected * @since 4.8.001 (2009-09-09) @@ -8953,7 +9007,7 @@ class TCPDF { /** * Adds unicode fonts.
              * Based on PDF Reference 1.3 (section 5) - * @param $font (array) font data + * @param array $font font data * @protected * @author Nicola Asuni * @since 1.52.0.TC005 (2005-01-05) @@ -9057,7 +9111,7 @@ class TCPDF { /** * Output CID-0 fonts. * A Type 0 CIDFont contains glyph descriptions based on the Adobe Type 1 font format - * @param $font (array) font data + * @param array $font font data * @protected * @author Andrew Whitehead, Nicola Asuni, Yukihiro Nakadaira * @since 3.2.000 (2008-06-23) @@ -9278,7 +9332,7 @@ class TCPDF { $out .= ' /Matrix [1 0 0 1 0 0]'; $out .= ' /Resources <<'; $out .= ' /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'; - if (!$this->pdfa_mode) { + if (!$this->pdfa_mode || $this->pdfa_version >= 2) { // transparency if (isset($data['extgstates']) AND !empty($data['extgstates'])) { $out .= ' /ExtGState <<'; @@ -9416,7 +9470,7 @@ class TCPDF { } $out .= ' >>'; } - if (!$this->pdfa_mode) { + if (!$this->pdfa_mode || $this->pdfa_version >= 2) { // transparency if (isset($this->extgstates) AND !empty($this->extgstates)) { $out .= ' /ExtGState <<'; @@ -9530,7 +9584,7 @@ class TCPDF { /** * Set additional XMP data to be added on the default XMP data just before the end of "x:xmpmeta" tag. * IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method! - * @param $xmp (string) Custom XMP data. + * @param string $xmp Custom XMP data. * @since 5.9.128 (2011-10-06) * @public */ @@ -9541,7 +9595,7 @@ class TCPDF { /** * Set additional XMP data to be added on the default XMP data just before the end of "rdf:RDF" tag. * IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method! - * @param $xmp (string) Custom XMP RDF data. + * @param string $xmp Custom XMP RDF data. * @since 6.3.0 (2019-09-19) * @public */ @@ -9551,7 +9605,7 @@ class TCPDF { /** * Put XMP data object and return ID. - * @return (int) The object ID. + * @return int The object ID. * @since 5.9.121 (2011-09-28) * @protected */ @@ -10058,8 +10112,8 @@ class TCPDF { /** * Initialize a new page. - * @param $orientation (string) page orientation. Possible values are (case insensitive):
              • P or PORTRAIT (default)
              • L or LANDSCAPE
              - * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). + * @param string $orientation page orientation. Possible values are (case insensitive):
              • P or PORTRAIT (default)
              • L or LANDSCAPE
              + * @param mixed $format The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). * @protected * @see getPageSizeFromFormat(), setPageFormat() */ @@ -10123,13 +10177,13 @@ class TCPDF { /** * Return the starting object string for the selected object ID. - * @param $objid (int) Object ID (leave empty to get a new ID). + * @param int|null $objid Object ID (leave empty to get a new ID). * @return string the starting object string * @protected * @since 5.8.009 (2010-08-20) */ - protected function _getobj($objid='') { - if ($objid === '') { + protected function _getobj($objid=null) { + if (TCPDF_STATIC::empty_string($objid)) { ++$this->n; $objid = $this->n; } @@ -10140,9 +10194,9 @@ class TCPDF { /** * Underline text. - * @param $x (int) X coordinate - * @param $y (int) Y coordinate - * @param $txt (string) text to underline + * @param int $x X coordinate + * @param int $y Y coordinate + * @param string $txt text to underline * @protected */ protected function _dounderline($x, $y, $txt) { @@ -10152,9 +10206,9 @@ class TCPDF { /** * Underline for rectangular text area. - * @param $x (int) X coordinate - * @param $y (int) Y coordinate - * @param $w (int) width to underline + * @param int $x X coordinate + * @param int $y Y coordinate + * @param int $w width to underline * @protected * @since 4.8.008 (2009-09-29) */ @@ -10165,9 +10219,9 @@ class TCPDF { /** * Line through text. - * @param $x (int) X coordinate - * @param $y (int) Y coordinate - * @param $txt (string) text to linethrough + * @param int $x X coordinate + * @param int $y Y coordinate + * @param string $txt text to linethrough * @protected */ protected function _dolinethrough($x, $y, $txt) { @@ -10177,9 +10231,9 @@ class TCPDF { /** * Line through for rectangular text area. - * @param $x (int) X coordinate - * @param $y (int) Y coordinate - * @param $w (int) line length (width) + * @param int $x X coordinate + * @param int $y Y coordinate + * @param int $w line length (width) * @protected * @since 4.9.008 (2009-09-29) */ @@ -10190,9 +10244,9 @@ class TCPDF { /** * Overline text. - * @param $x (int) X coordinate - * @param $y (int) Y coordinate - * @param $txt (string) text to overline + * @param int $x X coordinate + * @param int $y Y coordinate + * @param string $txt text to overline * @protected * @since 4.9.015 (2010-04-19) */ @@ -10203,9 +10257,9 @@ class TCPDF { /** * Overline for rectangular text area. - * @param $x (int) X coordinate - * @param $y (int) Y coordinate - * @param $w (int) width to overline + * @param int $x X coordinate + * @param int $y Y coordinate + * @param int $w width to overline * @protected * @since 4.9.015 (2010-04-19) */ @@ -10217,8 +10271,8 @@ class TCPDF { /** * Format a data string for meta information - * @param $s (string) data string to escape. - * @param $n (int) object ID + * @param string $s data string to escape. + * @param int $n object ID * @return string escaped string. * @protected */ @@ -10232,7 +10286,7 @@ class TCPDF { /** * Set the document creation timestamp - * @param $time (mixed) Document creation timestamp in seconds or date-time string. + * @param mixed $time Document creation timestamp in seconds or date-time string. * @public * @since 5.9.152 (2012-03-23) */ @@ -10245,7 +10299,7 @@ class TCPDF { /** * Set the document modification timestamp - * @param $time (mixed) Document modification timestamp in seconds or date-time string. + * @param mixed $time Document modification timestamp in seconds or date-time string. * @public * @since 5.9.152 (2012-03-23) */ @@ -10258,7 +10312,7 @@ class TCPDF { /** * Returns document creation timestamp in seconds. - * @return (int) Creation timestamp in seconds. + * @return int Creation timestamp in seconds. * @public * @since 5.9.152 (2012-03-23) */ @@ -10268,7 +10322,7 @@ class TCPDF { /** * Returns document modification timestamp in seconds. - * @return (int) Modfication timestamp in seconds. + * @return int Modfication timestamp in seconds. * @public * @since 5.9.152 (2012-03-23) */ @@ -10278,8 +10332,8 @@ class TCPDF { /** * Returns a formatted date for meta information - * @param $n (int) Object ID. - * @param $timestamp (int) Timestamp to convert. + * @param int $n Object ID. + * @param int $timestamp Timestamp to convert. * @return string escaped date string. * @protected * @since 4.6.028 (2009-08-25) @@ -10293,8 +10347,8 @@ class TCPDF { /** * Format a text string for meta information - * @param $s (string) string to escape. - * @param $n (int) object ID + * @param string $s string to escape. + * @param int $n object ID * @return string escaped string. * @protected */ @@ -10308,8 +10362,8 @@ class TCPDF { /** * get raw output stream. - * @param $s (string) string to output. - * @param $n (int) object reference for encryption mode + * @param string $s string to output. + * @param int $n object reference for encryption mode * @protected * @author Nicola Asuni * @since 5.5.000 (2010-06-22) @@ -10324,7 +10378,7 @@ class TCPDF { /** * Output a string to the document. - * @param $s (string) string to output. + * @param string $s string to output. * @protected */ protected function _out($s) { @@ -10352,7 +10406,8 @@ class TCPDF { /** * Set header font. - * @param $font (array) Array describing the basic font parameters: (family, style, size). + * @param array $font Array describing the basic font parameters: (family, style, size). + * @phpstan-param array{0: string, 1: string, 2: float|null} $font * @public * @since 1.1 */ @@ -10362,7 +10417,8 @@ class TCPDF { /** * Get header font. - * @return array() Array describing the basic font parameters: (family, style, size). + * @return array Array describing the basic font parameters: (family, style, size). + * @phpstan-return array{0: string, 1: string, 2: float|null} * @public * @since 4.0.012 (2008-07-24) */ @@ -10372,7 +10428,8 @@ class TCPDF { /** * Set footer font. - * @param $font (array) Array describing the basic font parameters: (family, style, size). + * @param array $font Array describing the basic font parameters: (family, style, size). + * @phpstan-param array{0: string, 1: string, 2: float|null} $font * @public * @since 1.1 */ @@ -10382,7 +10439,8 @@ class TCPDF { /** * Get Footer font. - * @return array() Array describing the basic font parameters: (family, style, size). + * @return array Array describing the basic font parameters: (family, style, size). + * @phpstan-return array{0: string, 1: string, 2: float|null} $font * @public * @since 4.0.012 (2008-07-24) */ @@ -10392,7 +10450,7 @@ class TCPDF { /** * Set language array. - * @param $language (array) + * @param array $language * @public * @since 1.1 */ @@ -10418,17 +10476,17 @@ class TCPDF { /** * Output anchor link. - * @param $url (string) link URL or internal link (i.e.: <a href="#23,4.5">link to page 23 at 4.5 Y position</a>) - * @param $name (string) link name - * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). - * @param $firstline (boolean) if true prints only the first line and return the remaining string. - * @param $color (array) array of RGB text color - * @param $style (string) font style (U, D, B, I) - * @param $firstblock (boolean) if true the string is the starting of a line. - * @return the number of cells used or the remaining text if $firstline = true; + * @param string $url link URL or internal link (i.e.: <a href="#23,4.5">link to page 23 at 4.5 Y position</a>) + * @param string $name link name + * @param boolean $fill Indicates if the cell background must be painted (true) or transparent (false). + * @param boolean $firstline if true prints only the first line and return the remaining string. + * @param array|null $color array of RGB text color + * @param string $style font style (U, D, B, I) + * @param boolean $firstblock if true the string is the starting of a line. + * @return int the number of cells used or the remaining text if $firstline = true; * @public */ - public function addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false) { + public function addHtmlLink($url, $name, $fill=false, $firstline=false, $color=null, $style=-1, $firstblock=false) { if (isset($url[1]) AND ($url[0] == '#') AND is_numeric($url[1])) { // convert url to internal link $lnkdata = explode(',', $url); @@ -10440,32 +10498,32 @@ class TCPDF { $lnky = 0; } $url = $this->AddLink(); - $this->SetLink($url, $lnky, $page); + $this->setLink($url, $lnky, $page); } } // store current settings $prevcolor = $this->fgcolor; $prevstyle = $this->FontStyle; if (empty($color)) { - $this->SetTextColorArray($this->htmlLinkColorArray); + $this->setTextColorArray($this->htmlLinkColorArray); } else { - $this->SetTextColorArray($color); + $this->setTextColorArray($color); } if ($style == -1) { - $this->SetFont('', $this->FontStyle.$this->htmlLinkFontStyle); + $this->setFont('', $this->FontStyle.$this->htmlLinkFontStyle); } else { - $this->SetFont('', $this->FontStyle.$style); + $this->setFont('', $this->FontStyle.$style); } $ret = $this->Write($this->lasth, $name, $url, $fill, '', false, 0, $firstline, $firstblock, 0); // restore settings - $this->SetFont('', $prevstyle); - $this->SetTextColorArray($prevcolor); + $this->setFont('', $prevstyle); + $this->setTextColorArray($prevcolor); return $ret; } /** * Converts pixels to User's Units. - * @param $px (int) pixels + * @param int $px pixels * @return float value in user's unit * @public * @see setImageScale(), getImageScale() @@ -10477,7 +10535,7 @@ class TCPDF { /** * Reverse function for htmlentities. * Convert entities in UTF-8. - * @param $text_to_convert (string) Text to convert. + * @param string $text_to_convert Text to convert. * @return string converted text string * @public */ @@ -10490,7 +10548,7 @@ class TCPDF { /** * Compute encryption key depending on object number where the encrypted data is stored. * This is used for all strings and streams without crypt filter specifier. - * @param $n (int) object number + * @param int $n object number * @return int object key * @protected * @author Nicola Asuni @@ -10509,9 +10567,9 @@ class TCPDF { /** * Encrypt the input string. - * @param $n (int) object number - * @param $s (string) data string to encrypt - * @return encrypted string + * @param int $n object number + * @param string $s data string to encrypt + * @return string encrypted string * @protected * @author Nicola Asuni * @since 5.0.005 (2010-05-11) @@ -10754,7 +10812,7 @@ class TCPDF { /** * Convert password for AES-256 encryption mode - * @param $password (string) password + * @param string $password password * @return string password * @protected * @since 5.9.006 (2010-10-19) @@ -10884,16 +10942,16 @@ class TCPDF { * Remark: the protection against modification is for people who have the full Acrobat product. * If you don't set any password, the document will open as usual. If you set a user password, the PDF viewer will ask for it before displaying the document. The master password, if different from the user one, can be used to get full access. * Note: protecting a document requires to encrypt it, which increases the processing time a lot. This can cause a PHP time-out in some cases, especially if the document contains images or fonts. - * @param $permissions (Array) the set of permissions (specify the ones you want to block):
              • print : Print the document;
              • modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
              • copy : Copy or otherwise extract text and graphics from the document;
              • annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
              • fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
              • extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
              • assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
              • print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
              • owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
              - * @param $user_pass (String) user password. Empty by default. - * @param $owner_pass (String) owner password. If not specified, a random value is used. - * @param $mode (int) encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. - * @param $pubkeys (String) array of recipients containing public-key certificates ('c') and permissions ('p'). For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print'))) + * @param array $permissions the set of permissions (specify the ones you want to block):
              • print : Print the document;
              • modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
              • copy : Copy or otherwise extract text and graphics from the document;
              • annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
              • fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
              • extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
              • assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
              • print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
              • owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
              + * @param string $user_pass user password. Empty by default. + * @param string|null $owner_pass owner password. If not specified, a random value is used. + * @param int $mode encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. + * @param array|null $pubkeys array of recipients containing public-key certificates ('c') and permissions ('p'). For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print'))) * @public * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - public function SetProtection($permissions=array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass='', $owner_pass=null, $mode=0, $pubkeys=null) { + public function setProtection($permissions=array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass='', $owner_pass=null, $mode=0, $pubkeys=null) { if ($this->pdfa_mode) { // encryption is not allowed in PDF/A mode return; @@ -11040,9 +11098,9 @@ class TCPDF { } /** * Horizontal Scaling. - * @param $s_x (float) scaling factor for width as percent. 0 is not allowed. - * @param $x (int) abscissa of the scaling center. Default is current x position - * @param $y (int) ordinate of the scaling center. Default is current y position + * @param float $s_x scaling factor for width as percent. 0 is not allowed. + * @param int $x abscissa of the scaling center. Default is current x position + * @param int $y ordinate of the scaling center. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() @@ -11053,9 +11111,9 @@ class TCPDF { /** * Vertical Scaling. - * @param $s_y (float) scaling factor for height as percent. 0 is not allowed. - * @param $x (int) abscissa of the scaling center. Default is current x position - * @param $y (int) ordinate of the scaling center. Default is current y position + * @param float $s_y scaling factor for height as percent. 0 is not allowed. + * @param int $x abscissa of the scaling center. Default is current x position + * @param int $y ordinate of the scaling center. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() @@ -11066,9 +11124,9 @@ class TCPDF { /** * Vertical and horizontal proportional Scaling. - * @param $s (float) scaling factor for width and height as percent. 0 is not allowed. - * @param $x (int) abscissa of the scaling center. Default is current x position - * @param $y (int) ordinate of the scaling center. Default is current y position + * @param float $s scaling factor for width and height as percent. 0 is not allowed. + * @param int $x abscissa of the scaling center. Default is current x position + * @param int $y ordinate of the scaling center. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() @@ -11079,19 +11137,19 @@ class TCPDF { /** * Vertical and horizontal non-proportional Scaling. - * @param $s_x (float) scaling factor for width as percent. 0 is not allowed. - * @param $s_y (float) scaling factor for height as percent. 0 is not allowed. - * @param $x (int) abscissa of the scaling center. Default is current x position - * @param $y (int) ordinate of the scaling center. Default is current y position + * @param float $s_x scaling factor for width as percent. 0 is not allowed. + * @param float $s_y scaling factor for height as percent. 0 is not allowed. + * @param float|null $x abscissa of the scaling center. Default is current x position + * @param float|null $y ordinate of the scaling center. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Scale($s_x, $s_y, $x='', $y='') { - if ($x === '') { + public function Scale($s_x, $s_y, $x=null, $y=null) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } if (($s_x == 0) OR ($s_y == 0)) { @@ -11115,55 +11173,55 @@ class TCPDF { /** * Horizontal Mirroring. - * @param $x (int) abscissa of the point. Default is current x position + * @param float|null $x abscissa of the point. Default is current x position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorH($x='') { + public function MirrorH($x=null) { $this->Scale(-100, 100, $x); } /** * Verical Mirroring. - * @param $y (int) ordinate of the point. Default is current y position + * @param float|null $y ordinate of the point. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorV($y='') { - $this->Scale(100, -100, '', $y); + public function MirrorV($y=null) { + $this->Scale(100, -100, null, $y); } /** * Point reflection mirroring. - * @param $x (int) abscissa of the point. Default is current x position - * @param $y (int) ordinate of the point. Default is current y position + * @param float|null $x abscissa of the point. Default is current x position + * @param float|null $y ordinate of the point. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorP($x='',$y='') { + public function MirrorP($x=null,$y=null) { $this->Scale(-100, -100, $x, $y); } /** * Reflection against a straight line through point (x, y) with the gradient angle (angle). - * @param $angle (float) gradient angle of the straight line. Default is 0 (horizontal line). - * @param $x (int) abscissa of the point. Default is current x position - * @param $y (int) ordinate of the point. Default is current y position + * @param float $angle gradient angle of the straight line. Default is 0 (horizontal line). + * @param float|null $x abscissa of the point. Default is current x position + * @param float|null $y ordinate of the point. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorL($angle=0, $x='',$y='') { + public function MirrorL($angle=0, $x=null,$y=null) { $this->Scale(-100, 100, $x, $y); $this->Rotate(-2*($angle-90), $x, $y); } /** * Translate graphic object horizontally. - * @param $t_x (int) movement to the right (or left for RTL) + * @param int $t_x movement to the right (or left for RTL) * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() @@ -11174,7 +11232,7 @@ class TCPDF { /** * Translate graphic object vertically. - * @param $t_y (int) movement to the bottom + * @param int $t_y movement to the bottom * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() @@ -11185,8 +11243,8 @@ class TCPDF { /** * Translate graphic object horizontally and vertically. - * @param $t_x (int) movement to the right - * @param $t_y (int) movement to the bottom + * @param int $t_x movement to the right + * @param int $t_y movement to the bottom * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() @@ -11206,18 +11264,18 @@ class TCPDF { /** * Rotate object. - * @param $angle (float) angle in degrees for counter-clockwise rotation - * @param $x (int) abscissa of the rotation center. Default is current x position - * @param $y (int) ordinate of the rotation center. Default is current y position + * @param float $angle angle in degrees for counter-clockwise rotation + * @param float|null $x abscissa of the rotation center. Default is current x position + * @param float|null $y ordinate of the rotation center. Default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Rotate($angle, $x='', $y='') { - if ($x === '') { + public function Rotate($angle, $x=null, $y=null) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } $y = ($this->h - $y) * $this->k; @@ -11236,45 +11294,45 @@ class TCPDF { /** * Skew horizontally. - * @param $angle_x (float) angle in degrees between -90 (skew to the left) and 90 (skew to the right) - * @param $x (int) abscissa of the skewing center. default is current x position - * @param $y (int) ordinate of the skewing center. default is current y position + * @param float $angle_x angle in degrees between -90 (skew to the left) and 90 (skew to the right) + * @param float|null $x abscissa of the skewing center. default is current x position + * @param float|null $y ordinate of the skewing center. default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function SkewX($angle_x, $x='', $y='') { + public function SkewX($angle_x, $x=null, $y=null) { $this->Skew($angle_x, 0, $x, $y); } /** * Skew vertically. - * @param $angle_y (float) angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) - * @param $x (int) abscissa of the skewing center. default is current x position - * @param $y (int) ordinate of the skewing center. default is current y position + * @param float $angle_y angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) + * @param float|null $x abscissa of the skewing center. default is current x position + * @param float|null $y ordinate of the skewing center. default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function SkewY($angle_y, $x='', $y='') { + public function SkewY($angle_y, $x=null, $y=null) { $this->Skew(0, $angle_y, $x, $y); } /** * Skew. - * @param $angle_x (float) angle in degrees between -90 (skew to the left) and 90 (skew to the right) - * @param $angle_y (float) angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) - * @param $x (int) abscissa of the skewing center. default is current x position - * @param $y (int) ordinate of the skewing center. default is current y position + * @param float $angle_x angle in degrees between -90 (skew to the left) and 90 (skew to the right) + * @param float $angle_y angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) + * @param float|null $x abscissa of the skewing center. default is current x position + * @param float|null $y ordinate of the skewing center. default is current y position * @public * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Skew($angle_x, $angle_y, $x='', $y='') { - if ($x === '') { + public function Skew($angle_x, $angle_y, $x=null, $y=null) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } if (($angle_x <= -90) OR ($angle_x >= 90) OR ($angle_y <= -90) OR ($angle_y >= 90)) { @@ -11296,7 +11354,7 @@ class TCPDF { /** * Apply graphic transformations. - * @param $tm (array) transformation matrix + * @param array $tm transformation matrix * @protected * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() @@ -11328,12 +11386,12 @@ class TCPDF { /** * Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page. - * @param $width (float) The width. + * @param float $width The width. * @public * @since 1.0 * @see Line(), Rect(), Cell(), MultiCell() */ - public function SetLineWidth($width) { + public function setLineWidth($width) { //Set line width $this->LineWidth = $width; $this->linestyleWidth = sprintf('%F w', ($width * $this->k)); @@ -11355,7 +11413,7 @@ class TCPDF { /** * Set line style. - * @param $style (array) Line style. Array with keys among the following: + * @param array $style Line style. Array with keys among the following: *
                *
              • width (float): Width of the line in user units.
              • *
              • cap (string): Type of cap to put on the line. Possible values are: @@ -11371,15 +11429,15 @@ class TCPDF { * the point at which the pattern starts.
              • *
              • color (array): Draw color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName).
              • *
              - * @param $ret (boolean) if true do not send the command. + * @param boolean $ret if true do not send the command. * @return string the PDF command * @public * @since 2.1.000 (2008-01-08) */ - public function SetLineStyle($style, $ret=false) { + public function setLineStyle($style, $ret=false) { $s = ''; // string to be returned if (!is_array($style)) { - return; + return $s; } if (isset($style['width'])) { $this->LineWidth = $style['width']; @@ -11423,7 +11481,7 @@ class TCPDF { $s .= $this->linestyleDash.' '; } if (isset($style['color'])) { - $s .= $this->SetDrawColorArray($style['color'], true).' '; + $s .= $this->setDrawColorArray($style['color'], true).' '; } if (!$ret AND ($this->state == 2)) { $this->_out($s); @@ -11433,8 +11491,8 @@ class TCPDF { /** * Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment. - * @param $x (float) Abscissa of point. - * @param $y (float) Ordinate of point. + * @param float $x Abscissa of point. + * @param float $y Ordinate of point. * @protected * @since 2.1.000 (2008-01-08) */ @@ -11447,8 +11505,8 @@ class TCPDF { /** * Append a straight line segment from the current point to the point (x, y). * The new current point shall be (x, y). - * @param $x (float) Abscissa of end point. - * @param $y (float) Ordinate of end point. + * @param float $x Abscissa of end point. + * @param float $y Ordinate of end point. * @protected * @since 2.1.000 (2008-01-08) */ @@ -11460,11 +11518,11 @@ class TCPDF { /** * Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions widthand height in user space. - * @param $x (float) Abscissa of upper-left corner. - * @param $y (float) Ordinate of upper-left corner. - * @param $w (float) Width. - * @param $h (float) Height. - * @param $op (string) options + * @param float $x Abscissa of upper-left corner. + * @param float $y Ordinate of upper-left corner. + * @param float $w Width. + * @param float $h Height. + * @param string $op options * @protected * @since 2.1.000 (2008-01-08) */ @@ -11477,12 +11535,12 @@ class TCPDF { /** * Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bezier control points. * The new current point shall be (x3, y3). - * @param $x1 (float) Abscissa of control point 1. - * @param $y1 (float) Ordinate of control point 1. - * @param $x2 (float) Abscissa of control point 2. - * @param $y2 (float) Ordinate of control point 2. - * @param $x3 (float) Abscissa of end point. - * @param $y3 (float) Ordinate of end point. + * @param float $x1 Abscissa of control point 1. + * @param float $y1 Ordinate of control point 1. + * @param float $x2 Abscissa of control point 2. + * @param float $y2 Ordinate of control point 2. + * @param float $x3 Abscissa of end point. + * @param float $y3 Ordinate of end point. * @protected * @since 2.1.000 (2008-01-08) */ @@ -11495,10 +11553,10 @@ class TCPDF { /** * Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bezier control points. * The new current point shall be (x3, y3). - * @param $x2 (float) Abscissa of control point 2. - * @param $y2 (float) Ordinate of control point 2. - * @param $x3 (float) Abscissa of end point. - * @param $y3 (float) Ordinate of end point. + * @param float $x2 Abscissa of control point 2. + * @param float $y2 Ordinate of control point 2. + * @param float $x3 Abscissa of end point. + * @param float $y3 Ordinate of end point. * @protected * @since 4.9.019 (2010-04-26) */ @@ -11511,10 +11569,10 @@ class TCPDF { /** * Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bezier control points. * The new current point shall be (x3, y3). - * @param $x1 (float) Abscissa of control point 1. - * @param $y1 (float) Ordinate of control point 1. - * @param $x3 (float) Abscissa of end point. - * @param $y3 (float) Ordinate of end point. + * @param float $x1 Abscissa of control point 1. + * @param float $y1 Ordinate of control point 1. + * @param float $x3 Abscissa of end point. + * @param float $y3 Ordinate of end point. * @protected * @since 2.1.000 (2008-01-08) */ @@ -11526,11 +11584,11 @@ class TCPDF { /** * Draws a line between two points. - * @param $x1 (float) Abscissa of first point. - * @param $y1 (float) Ordinate of first point. - * @param $x2 (float) Abscissa of second point. - * @param $y2 (float) Ordinate of second point. - * @param $style (array) Line style. Array like for SetLineStyle(). Default value: default line style (empty array). + * @param float $x1 Abscissa of first point. + * @param float $y1 Ordinate of first point. + * @param float $x2 Abscissa of second point. + * @param float $y2 Ordinate of second point. + * @param array $style Line style. Array like for SetLineStyle(). Default value: default line style (empty array). * @public * @since 1.0 * @see SetLineWidth(), SetDrawColor(), SetLineStyle() @@ -11540,7 +11598,7 @@ class TCPDF { return; } if (is_array($style)) { - $this->SetLineStyle($style); + $this->setLineStyle($style); } $this->_outPoint($x1, $y1); $this->_outLine($x2, $y2); @@ -11549,18 +11607,18 @@ class TCPDF { /** * Draws a rectangle. - * @param $x (float) Abscissa of upper-left corner. - * @param $y (float) Ordinate of upper-left corner. - * @param $w (float) Width. - * @param $h (float) Height. - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $border_style (array) Border style of rectangle. Array with keys among the following: + * @param float $x Abscissa of upper-left corner. + * @param float $y Ordinate of upper-left corner. + * @param float $w Width. + * @param float $h Height. + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $border_style Border style of rectangle. Array with keys among the following: *
                *
              • all: Line style of all borders. Array like for SetLineStyle().
              • *
              • L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for SetLineStyle().
              • *
              * If a key is not present or is null, the correspondent border is not drawn. Default value: default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @public * @since 1.0 * @see SetLineStyle() @@ -11574,12 +11632,12 @@ class TCPDF { } if (!(strpos($style, 'F') === false) AND !empty($fill_color)) { // set background color - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); } if (!empty($border_style)) { if (isset($border_style['all']) AND !empty($border_style['all'])) { //set global style for border - $this->SetLineStyle($border_style['all']); + $this->setLineStyle($border_style['all']); $border_style = array(); } else { // remove stroke operator from style @@ -11621,17 +11679,17 @@ class TCPDF { * Draws a Bezier curve. * The Bezier curve is a tangent to the line between the control points at * either end of the curve. - * @param $x0 (float) Abscissa of start point. - * @param $y0 (float) Ordinate of start point. - * @param $x1 (float) Abscissa of control point 1. - * @param $y1 (float) Ordinate of control point 1. - * @param $x2 (float) Abscissa of control point 2. - * @param $y2 (float) Ordinate of control point 2. - * @param $x3 (float) Abscissa of end point. - * @param $y3 (float) Ordinate of end point. - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param float $x0 Abscissa of start point. + * @param float $y0 Ordinate of start point. + * @param float $x1 Abscissa of control point 1. + * @param float $y1 Ordinate of control point 1. + * @param float $x2 Abscissa of control point 2. + * @param float $y2 Ordinate of control point 2. + * @param float $x3 Abscissa of end point. + * @param float $y3 Ordinate of end point. + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @public * @see SetLineStyle() * @since 2.1.000 (2008-01-08) @@ -11641,11 +11699,11 @@ class TCPDF { return; } if (!(false === strpos($style, 'F')) AND isset($fill_color)) { - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); } $op = TCPDF_STATIC::getPathPaintOperator($style); if ($line_style) { - $this->SetLineStyle($line_style); + $this->setLineStyle($line_style); } $this->_outPoint($x0, $y0); $this->_outCurve($x1, $y1, $x2, $y2, $x3, $y3); @@ -11656,12 +11714,12 @@ class TCPDF { * Draws a poly-Bezier curve. * Each Bezier curve segment is a tangent to the line between the control points at * either end of the curve. - * @param $x0 (float) Abscissa of start point. - * @param $y0 (float) Ordinate of start point. - * @param $segments (float) An array of bezier descriptions. Format: array(x1, y1, x2, y2, x3, y3). - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param float $x0 Abscissa of start point. + * @param float $y0 Ordinate of start point. + * @param float[] $segments An array of bezier descriptions. Format: array(x1, y1, x2, y2, x3, y3). + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @public * @see SetLineStyle() * @since 3.0008 (2008-05-12) @@ -11671,14 +11729,14 @@ class TCPDF { return; } if (!(false === strpos($style, 'F')) AND isset($fill_color)) { - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); } $op = TCPDF_STATIC::getPathPaintOperator($style); if ($op == 'f') { $line_style = array(); } if ($line_style) { - $this->SetLineStyle($line_style); + $this->setLineStyle($line_style); } $this->_outPoint($x0, $y0); foreach ($segments as $segment) { @@ -11691,22 +11749,22 @@ class TCPDF { /** * Draws an ellipse. * An ellipse is formed from n Bezier curves. - * @param $x0 (float) Abscissa of center point. - * @param $y0 (float) Ordinate of center point. - * @param $rx (float) Horizontal radius. - * @param $ry (float) Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0. - * @param $angle: (float) Angle oriented (anti-clockwise). Default value: 0. - * @param $astart: (float) Angle start of draw line. Default value: 0. - * @param $afinish: (float) Angle finish of draw line. Default value: 360. - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of ellipse. Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). - * @param $nc (integer) Number of curves used to draw a 90 degrees portion of ellipse. + * @param float $x0 Abscissa of center point. + * @param float $y0 Ordinate of center point. + * @param float $rx Horizontal radius. + * @param float $ry Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0. + * @param float $angle Angle oriented (anti-clockwise). Default value: 0. + * @param float $astart Angle start of draw line. Default value: 0. + * @param float $afinish Angle finish of draw line. Default value: 360. + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of ellipse. Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param integer $nc Number of curves used to draw a 90 degrees portion of ellipse. * @author Nicola Asuni * @public * @since 2.1.000 (2008-01-08) */ - public function Ellipse($x0, $y0, $rx, $ry='', $angle=0, $astart=0, $afinish=360, $style='', $line_style=array(), $fill_color=array(), $nc=2) { + public function Ellipse($x0, $y0, $rx, $ry=0, $angle=0, $astart=0, $afinish=360, $style='', $line_style=array(), $fill_color=array(), $nc=2) { if ($this->state != 2) { return; } @@ -11714,14 +11772,14 @@ class TCPDF { $ry = $rx; } if (!(false === strpos($style, 'F')) AND isset($fill_color)) { - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); } $op = TCPDF_STATIC::getPathPaintOperator($style); if ($op == 'f') { $line_style = array(); } if ($line_style) { - $this->SetLineStyle($line_style); + $this->setLineStyle($line_style); } $this->_outellipticalarc($x0, $y0, $rx, $ry, $angle, $astart, $afinish, false, $nc, true, true, false); $this->_out($op); @@ -11730,18 +11788,18 @@ class TCPDF { /** * Append an elliptical arc to the current path. * An ellipse is formed from n Bezier curves. - * @param $xc (float) Abscissa of center point. - * @param $yc (float) Ordinate of center point. - * @param $rx (float) Horizontal radius. - * @param $ry (float) Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0. - * @param $xang: (float) Angle between the X-axis and the major axis of the ellipse. Default value: 0. - * @param $angs: (float) Angle start of draw line. Default value: 0. - * @param $angf: (float) Angle finish of draw line. Default value: 360. - * @param $pie (boolean) if true do not mark the border point (used to draw pie sectors). - * @param $nc (integer) Number of curves used to draw a 90 degrees portion of ellipse. - * @param $startpoint (boolean) if true output a starting point. - * @param $ccw (boolean) if true draws in counter-clockwise. - * @param $svg (boolean) if true the angles are in svg mode (already calculated). + * @param float $xc Abscissa of center point. + * @param float $yc Ordinate of center point. + * @param float $rx Horizontal radius. + * @param float $ry Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0. + * @param float $xang Angle between the X-axis and the major axis of the ellipse. Default value: 0. + * @param float $angs Angle start of draw line. Default value: 0. + * @param float $angf Angle finish of draw line. Default value: 360. + * @param boolean $pie if true do not mark the border point (used to draw pie sectors). + * @param integer $nc Number of curves used to draw a 90 degrees portion of ellipse. + * @param boolean $startpoint if true output a starting point. + * @param boolean $ccw if true draws in counter-clockwise. + * @param boolean $svg if true the angles are in svg mode (already calculated). * @return array bounding box coordinates (x min, y min, x max, y max) * @author Nicola Asuni * @protected @@ -11866,15 +11924,15 @@ class TCPDF { /** * Draws a circle. * A circle is formed from n Bezier curves. - * @param $x0 (float) Abscissa of center point. - * @param $y0 (float) Ordinate of center point. - * @param $r (float) Radius. - * @param $angstr: (float) Angle start of draw line. Default value: 0. - * @param $angend: (float) Angle finish of draw line. Default value: 360. - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of circle. Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). - * @param $nc (integer) Number of curves used to draw a 90 degrees portion of circle. + * @param float $x0 Abscissa of center point. + * @param float $y0 Ordinate of center point. + * @param float $r Radius. + * @param float $angstr Angle start of draw line. Default value: 0. + * @param float $angend Angle finish of draw line. Default value: 360. + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of circle. Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $fill_color Fill color. Format: array(red, green, blue). Default value: default color (empty array). + * @param integer $nc Number of curves used to draw a 90 degrees portion of circle. * @public * @since 2.1.000 (2008-01-08) */ @@ -11884,15 +11942,15 @@ class TCPDF { /** * Draws a polygonal line - * @param $p (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of polygon. Array with keys among the following: + * @param array $p Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of polygon. Array with keys among the following: *
                *
              • all: Line style of all lines. Array like for SetLineStyle().
              • *
              • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
              • *
              * If a key is not present or is null, not draws the line. Default value is default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @since 4.8.003 (2009-09-15) * @public */ @@ -11902,16 +11960,16 @@ class TCPDF { /** * Draws a polygon. - * @param $p (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of polygon. Array with keys among the following: + * @param array $p Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of polygon. Array with keys among the following: *
                *
              • all: Line style of all lines. Array like for SetLineStyle().
              • *
              • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
              • *
              * If a key is not present or is null, not draws the line. Default value is default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). - * @param $closed (boolean) if true the polygon is closes, otherwise will remain open + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param boolean $closed if true the polygon is closes, otherwise will remain open * @public * @since 2.1.000 (2008-01-08) */ @@ -11933,7 +11991,7 @@ class TCPDF { $nc += 4; } if (!(false === strpos($style, 'F')) AND isset($fill_color)) { - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); } $op = TCPDF_STATIC::getPathPaintOperator($style); if ($op == 'f') { @@ -11942,7 +12000,7 @@ class TCPDF { $draw = true; if ($line_style) { if (isset($line_style['all'])) { - $this->SetLineStyle($line_style['all']); + $this->setLineStyle($line_style['all']); } else { $draw = false; if ($op == 'B') { @@ -11962,7 +12020,7 @@ class TCPDF { if ($line_style[$line_num] != 0) { if (is_array($line_style[$line_num])) { $this->_out('S'); - $this->SetLineStyle($line_style[$line_num]); + $this->setLineStyle($line_style[$line_num]); $this->_outPoint($p[$i - 2], $p[$i - 1]); $this->_outLine($p[$i], $p[$i + 1]); $this->_out('S'); @@ -11989,21 +12047,21 @@ class TCPDF { /** * Draws a regular polygon. - * @param $x0 (float) Abscissa of center point. - * @param $y0 (float) Ordinate of center point. - * @param $r: (float) Radius of inscribed circle. - * @param $ns (integer) Number of sides. - * @param $angle (float) Angle oriented (anti-clockwise). Default value: 0. - * @param $draw_circle (boolean) Draw inscribed circle or not. Default value: false. - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of polygon sides. Array with keys among the following: + * @param float $x0 Abscissa of center point. + * @param float $y0 Ordinate of center point. + * @param float $r Radius of inscribed circle. + * @param integer $ns Number of sides. + * @param float $angle Angle oriented (anti-clockwise). Default value: 0. + * @param boolean $draw_circle Draw inscribed circle or not. Default value: false. + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of polygon sides. Array with keys among the following: *
                *
              • all: Line style of all sides. Array like for SetLineStyle().
              • *
              • 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().
              • *
              * If a key is not present or is null, not draws the side. Default value is default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). - * @param $circle_style (string) Style of rendering of inscribed circle (if draws). Possible values are: + * @param array $fill_color Fill color. Format: array(red, green, blue). Default value: default color (empty array). + * @param string $circle_style Style of rendering of inscribed circle (if draws). Possible values are: *
                *
              • D or empty string: Draw (default).
              • *
              • F: Fill.
              • @@ -12011,8 +12069,8 @@ class TCPDF { *
              • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
              • *
              • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
              • *
              - * @param $circle_outLine_style (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $circle_fill_color (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). + * @param array $circle_outLine_style Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $circle_fill_color Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). * @public * @since 2.1.000 (2008-01-08) */ @@ -12035,23 +12093,23 @@ class TCPDF { /** * Draws a star polygon - * @param $x0 (float) Abscissa of center point. - * @param $y0 (float) Ordinate of center point. - * @param $r (float) Radius of inscribed circle. - * @param $nv (integer) Number of vertices. - * @param $ng (integer) Number of gap (if ($ng % $nv = 1) then is a regular polygon). - * @param $angle: (float) Angle oriented (anti-clockwise). Default value: 0. - * @param $draw_circle: (boolean) Draw inscribed circle or not. Default value is false. - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $line_style (array) Line style of polygon sides. Array with keys among the following: + * @param float $x0 Abscissa of center point. + * @param float $y0 Ordinate of center point. + * @param float $r Radius of inscribed circle. + * @param integer $nv Number of vertices. + * @param integer $ng Number of gap (if ($ng % $nv = 1) then is a regular polygon). + * @param float $angle Angle oriented (anti-clockwise). Default value: 0. + * @param boolean $draw_circle Draw inscribed circle or not. Default value is false. + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $line_style Line style of polygon sides. Array with keys among the following: *
                *
              • all: Line style of all sides. Array like for * SetLineStyle().
              • *
              • 0 to (n - 1): Line style of each side. Array like for SetLineStyle().
              • *
              * If a key is not present or is null, not draws the side. Default value is default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). - * @param $circle_style (string) Style of rendering of inscribed circle (if draws). Possible values are: + * @param array $fill_color Fill color. Format: array(red, green, blue). Default value: default color (empty array). + * @param string $circle_style Style of rendering of inscribed circle (if draws). Possible values are: *
                *
              • D or empty string: Draw (default).
              • *
              • F: Fill.
              • @@ -12059,8 +12117,8 @@ class TCPDF { *
              • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
              • *
              • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
              • *
              - * @param $circle_outLine_style (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $circle_fill_color (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). + * @param array $circle_outLine_style Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $circle_fill_color Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). * @public * @since 2.1.000 (2008-01-08) */ @@ -12094,15 +12152,15 @@ class TCPDF { /** * Draws a rounded rectangle. - * @param $x (float) Abscissa of upper-left corner. - * @param $y (float) Ordinate of upper-left corner. - * @param $w (float) Width. - * @param $h (float) Height. - * @param $r (float) the radius of the circle used to round off the corners of the rectangle. - * @param $round_corner (string) Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111"). - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $border_style (array) Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param float $x Abscissa of upper-left corner. + * @param float $y Ordinate of upper-left corner. + * @param float $w Width. + * @param float $h Height. + * @param float $r the radius of the circle used to round off the corners of the rectangle. + * @param string $round_corner Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111"). + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $border_style Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @public * @since 2.1.000 (2008-01-08) */ @@ -12112,16 +12170,16 @@ class TCPDF { /** * Draws a rounded rectangle. - * @param $x (float) Abscissa of upper-left corner. - * @param $y (float) Ordinate of upper-left corner. - * @param $w (float) Width. - * @param $h (float) Height. - * @param $rx (float) the x-axis radius of the ellipse used to round off the corners of the rectangle. - * @param $ry (float) the y-axis radius of the ellipse used to round off the corners of the rectangle. - * @param $round_corner (string) Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111"). - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $border_style (array) Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). - * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). + * @param float $x Abscissa of upper-left corner. + * @param float $y Ordinate of upper-left corner. + * @param float $w Width. + * @param float $h Height. + * @param float $rx the x-axis radius of the ellipse used to round off the corners of the rectangle. + * @param float $ry the y-axis radius of the ellipse used to round off the corners of the rectangle. + * @param string $round_corner Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111"). + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param array $border_style Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). + * @param array $fill_color Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @public * @since 4.9.019 (2010-04-22) */ @@ -12136,14 +12194,14 @@ class TCPDF { } // Rounded if (!(false === strpos($style, 'F')) AND isset($fill_color)) { - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); } $op = TCPDF_STATIC::getPathPaintOperator($style); if ($op == 'f') { $border_style = array(); } if ($border_style) { - $this->SetLineStyle($border_style); + $this->setLineStyle($border_style); } $MyArc = 4 / 3 * (sqrt(2) - 1); $this->_outPoint($x + $rx, $y); @@ -12185,13 +12243,13 @@ class TCPDF { /** * Draws a grahic arrow. - * @param $x0 (float) Abscissa of first point. - * @param $y0 (float) Ordinate of first point. - * @param $x1 (float) Abscissa of second point. - * @param $y1 (float) Ordinate of second point. - * @param $head_style (int) (0 = draw only arrowhead arms, 1 = draw closed arrowhead, but no fill, 2 = closed and filled arrowhead, 3 = filled arrowhead) - * @param $arm_size (float) length of arrowhead arms - * @param $arm_angle (int) angle between an arm and the shaft + * @param float $x0 Abscissa of first point. + * @param float $y0 Ordinate of first point. + * @param float $x1 Abscissa of second point. + * @param float $y1 Ordinate of second point. + * @param int $head_style (0 = draw only arrowhead arms, 1 = draw closed arrowhead, but no fill, 2 = closed and filled arrowhead, 3 = filled arrowhead) + * @param float $arm_size length of arrowhead arms + * @param int $arm_angle angle between an arm and the shaft * @author Piotr Galecki, Nicola Asuni, Andy Meier * @since 4.6.018 (2009-07-10) */ @@ -12251,11 +12309,11 @@ class TCPDF { /** * Add a Named Destination. * NOTE: destination names are unique, so only last entry will be saved. - * @param $name (string) Destination name. - * @param $y (float) Y position in user units of the destiantion on the selected page (default = -1 = current position; 0 = page start;). - * @param $page (int|string) Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. - * @param $x (float) X position in user units of the destiantion on the selected page (default = -1 = current position;). - * @return (string) Stripped named destination identifier or false in case of error. + * @param string $name Destination name. + * @param float $y Y position in user units of the destiantion on the selected page (default = -1 = current position; 0 = page start;). + * @param int|string $page Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. + * @param float $x X position in user units of the destiantion on the selected page (default = -1 = current position;). + * @return string|false Stripped named destination identifier or false in case of error. * @public * @author Christian Deligant, Nicola Asuni * @since 5.9.097 (2011-06-23) @@ -12298,7 +12356,7 @@ class TCPDF { /** * Return the Named Destination array. - * @return (array) Named Destination array. + * @return array Named Destination array. * @public * @author Nicola Asuni * @since 5.9.097 (2011-06-23) @@ -12329,14 +12387,14 @@ class TCPDF { /** * Adds a bookmark - alias for Bookmark(). - * @param $txt (string) Bookmark description. - * @param $level (int) Bookmark level (minimum value is 0). - * @param $y (float) Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;). - * @param $page (int|string) Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. - * @param $style (string) Font style: B = Bold, I = Italic, BI = Bold + Italic. - * @param $color (array) RGB color array (values from 0 to 255). - * @param $x (float) X position in user units of the bookmark on the selected page (default = -1 = current position;). - * @param $link (mixed) URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). + * @param string $txt Bookmark description. + * @param int $level Bookmark level (minimum value is 0). + * @param float $y Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;). + * @param int|string $page Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. + * @param string $style Font style: B = Bold, I = Italic, BI = Bold + Italic. + * @param array $color RGB color array (values from 0 to 255). + * @param float $x X position in user units of the bookmark on the selected page (default = -1 = current position;). + * @param mixed $link URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). * @public */ public function setBookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0), $x=-1, $link='') { @@ -12345,14 +12403,14 @@ class TCPDF { /** * Adds a bookmark. - * @param $txt (string) Bookmark description. - * @param $level (int) Bookmark level (minimum value is 0). - * @param $y (float) Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;). - * @param $page (int|string) Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. - * @param $style (string) Font style: B = Bold, I = Italic, BI = Bold + Italic. - * @param $color (array) RGB color array (values from 0 to 255). - * @param $x (float) X position in user units of the bookmark on the selected page (default = -1 = current position;). - * @param $link (mixed) URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). + * @param string $txt Bookmark description. + * @param int $level Bookmark level (minimum value is 0). + * @param float $y Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;). + * @param int|string $page Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. + * @param string $style Font style: B = Bold, I = Italic, BI = Bold + Italic. + * @param array $color RGB color array (values from 0 to 255). + * @param float $x X position in user units of the bookmark on the selected page (default = -1 = current position;). + * @param mixed $link URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). * @public * @since 2.1.002 (2008-02-12) */ @@ -12543,7 +12601,7 @@ class TCPDF { /** * Adds a javascript - * @param $script (string) Javascript code + * @param string $script Javascript code * @public * @author Johannes G\FCntert, Nicola Asuni * @since 2.1.002 (2008-02-12) @@ -12554,8 +12612,8 @@ class TCPDF { /** * Adds a javascript object and return object ID - * @param $script (string) Javascript code - * @param $onload (boolean) if true executes this object when opening the document + * @param string $script Javascript code + * @param boolean $onload if true executes this object when opening the document * @return int internal object ID * @public * @author Nicola Asuni @@ -12624,13 +12682,13 @@ class TCPDF { /** * Adds a javascript form field. - * @param $type (string) field type - * @param $name (string) field name - * @param $x (int) horizontal position - * @param $y (int) vertical position - * @param $w (int) width - * @param $h (int) height - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param string $type field type + * @param string $name field name + * @param int $x horizontal position + * @param int $y vertical position + * @param int $w width + * @param int $h height + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. * @protected * @author Denis Van Nuffelen, Nicola Asuni * @since 2.1.002 (2008-02-12) @@ -12666,7 +12724,7 @@ class TCPDF { /** * Set default properties for form fields. - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. * @public * @author Nicola Asuni * @since 4.8.000 (2009-09-06) @@ -12688,23 +12746,23 @@ class TCPDF { /** * Creates a text field - * @param $name (string) field name - * @param $w (float) Width of the rectangle - * @param $h (float) Height of the rectangle - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. - * @param $opt (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $js (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). + * @param string $name field name + * @param float $w Width of the rectangle + * @param float $h Height of the rectangle + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $opt annotation parameters. Possible values are described on official PDF32000_2008 reference. + * @param float|null $x Abscissa of the upper-left corner of the rectangle + * @param float|null $y Ordinate of the upper-left corner of the rectangle + * @param boolean $js if true put the field using JavaScript (requires Acrobat Writer to be rendered). * @public * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function TextField($name, $w, $h, $prop=array(), $opt=array(), $x='', $y='', $js=false) { - if ($x === '') { + public function TextField($name, $w, $h, $prop=array(), $opt=array(), $x=null, $y=null, $js=false) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -12808,24 +12866,24 @@ class TCPDF { /** * Creates a RadioButton field. - * @param $name (string) Field name. - * @param $w (int) Width of the radio button. - * @param $prop (array) Javascript field properties. Possible values are described on official Javascript for Acrobat API reference. - * @param $opt (array) Annotation parameters. Possible values are described on official PDF32000_2008 reference. - * @param $onvalue (string) Value to be returned if selected. - * @param $checked (boolean) Define the initial state. - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $js (boolean) If true put the field using JavaScript (requires Acrobat Writer to be rendered). + * @param string $name Field name. + * @param int $w Width of the radio button. + * @param array $prop Javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $opt Annotation parameters. Possible values are described on official PDF32000_2008 reference. + * @param string $onvalue Value to be returned if selected. + * @param boolean $checked Define the initial state. + * @param float|null $x Abscissa of the upper-left corner of the rectangle + * @param float|null $y Ordinate of the upper-left corner of the rectangle + * @param boolean $js If true put the field using JavaScript (requires Acrobat Writer to be rendered). * @public * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function RadioButton($name, $w, $prop=array(), $opt=array(), $onvalue='On', $checked=false, $x='', $y='', $js=false) { - if ($x === '') { + public function RadioButton($name, $w, $prop=array(), $opt=array(), $onvalue='On', $checked=false, $x=null, $y=null, $js=false) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -12911,24 +12969,24 @@ class TCPDF { /** * Creates a List-box field - * @param $name (string) field name - * @param $w (int) width - * @param $h (int) height - * @param $values (array) array containing the list of values. - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. - * @param $opt (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $js (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). + * @param string $name field name + * @param int $w width + * @param int $h height + * @param array $values array containing the list of values. + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $opt annotation parameters. Possible values are described on official PDF32000_2008 reference. + * @param float|null $x Abscissa of the upper-left corner of the rectangle + * @param float|null $y Ordinate of the upper-left corner of the rectangle + * @param boolean $js if true put the field using JavaScript (requires Acrobat Writer to be rendered). * @public * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function ListBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { - if ($x === '') { + public function ListBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x=null, $y=null, $js=false) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -12997,24 +13055,24 @@ class TCPDF { /** * Creates a Combo-box field - * @param $name (string) field name - * @param $w (int) width - * @param $h (int) height - * @param $values (array) array containing the list of values. - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. - * @param $opt (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $js (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). + * @param string $name field name + * @param int $w width + * @param int $h height + * @param array $values array containing the list of values. + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $opt annotation parameters. Possible values are described on official PDF32000_2008 reference. + * @param float|null $x Abscissa of the upper-left corner of the rectangle + * @param float|null $y Ordinate of the upper-left corner of the rectangle + * @param boolean $js if true put the field using JavaScript (requires Acrobat Writer to be rendered). * @public * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function ComboBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { - if ($x === '') { + public function ComboBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x=null, $y=null, $js=false) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -13084,24 +13142,24 @@ class TCPDF { /** * Creates a CheckBox field - * @param $name (string) field name - * @param $w (int) width - * @param $checked (boolean) define the initial state. - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. - * @param $opt (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. - * @param $onvalue (string) value to be returned if selected. - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $js (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). + * @param string $name field name + * @param int $w width + * @param boolean $checked define the initial state. + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $opt annotation parameters. Possible values are described on official PDF32000_2008 reference. + * @param string $onvalue value to be returned if selected. + * @param float|null $x Abscissa of the upper-left corner of the rectangle + * @param float|null $y Ordinate of the upper-left corner of the rectangle + * @param boolean $js if true put the field using JavaScript (requires Acrobat Writer to be rendered). * @public * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes', $x='', $y='', $js=false) { - if ($x === '') { + public function CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes', $x=null, $y=null, $js=false) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -13163,25 +13221,25 @@ class TCPDF { /** * Creates a button field - * @param $name (string) field name - * @param $w (int) width - * @param $h (int) height - * @param $caption (string) caption. - * @param $action (mixed) action triggered by pressing the button. Use a string to specify a javascript action. Use an array to specify a form action options as on section 12.7.5 of PDF32000_2008. - * @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. - * @param $opt (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. - * @param $x (float) Abscissa of the upper-left corner of the rectangle - * @param $y (float) Ordinate of the upper-left corner of the rectangle - * @param $js (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). + * @param string $name field name + * @param int $w width + * @param int $h height + * @param string $caption caption. + * @param mixed $action action triggered by pressing the button. Use a string to specify a javascript action. Use an array to specify a form action options as on section 12.7.5 of PDF32000_2008. + * @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference. + * @param array $opt annotation parameters. Possible values are described on official PDF32000_2008 reference. + * @param float|null $x Abscissa of the upper-left corner of the rectangle + * @param float|null $y Ordinate of the upper-left corner of the rectangle + * @param boolean $js if true put the field using JavaScript (requires Acrobat Writer to be rendered). * @public * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function Button($name, $w, $h, $caption, $action, $prop=array(), $opt=array(), $x='', $y='', $js=false) { - if ($x === '') { + public function Button($name, $w, $h, $caption, $action, $prop=array(), $opt=array(), $x=null, $y=null, $js=false) { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -13214,7 +13272,7 @@ class TCPDF { 'R' => array('width' => $bw, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(51)), 'T' => array('width' => $bw, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(231)), 'B' => array('width' => $bw, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(51))); - $this->SetFillColor(204); + $this->setFillColor(204); $this->Cell($w, $h, $caption, $border, 0, 'C', true, '', 1, false, 'T', 'M'); $this->endTemplate(); --$this->n; @@ -13420,14 +13478,14 @@ class TCPDF { * WARNING: This is experimental and currently do not work. * Check the PDF Reference 8.7.1 Transform Methods, * Table 8.105 Entries in the UR transform parameters dictionary - * @param $enable (boolean) if true enable user's rights on PDF reader - * @param $document (string) Names specifying additional document-wide usage rights for the document. The only defined value is "/FullSave", which permits a user to save the document along with modified form and/or annotation data. - * @param $annots (string) Names specifying additional annotation-related usage rights for the document. Valid names in PDF 1.5 and later are /Create/Delete/Modify/Copy/Import/Export, which permit the user to perform the named operation on annotations. - * @param $form (string) Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate - * @param $signature (string) Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field. - * @param $ef (string) Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files + * @param boolean $enable if true enable user's rights on PDF reader + * @param string $document Names specifying additional document-wide usage rights for the document. The only defined value is "/FullSave", which permits a user to save the document along with modified form and/or annotation data. + * @param string $annots Names specifying additional annotation-related usage rights for the document. Valid names in PDF 1.5 and later are /Create/Delete/Modify/Copy/Import/Export, which permit the user to perform the named operation on annotations. + * @param string $form Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate + * @param string $signature Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field. + * @param string $ef Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files Names specifying additional embedded-files-related usage rights for the document. - * @param $formex (string) Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode. + * @param string $formex Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode. * @public * @author Nicola Asuni * @since 2.9.000 (2008-03-26) @@ -13458,13 +13516,13 @@ class TCPDF { * To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt * To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12 * To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes - * @param $signing_cert (mixed) signing certificate (string or filename prefixed with 'file://') - * @param $private_key (mixed) private key (string or filename prefixed with 'file://') - * @param $private_key_password (string) password - * @param $extracerts (string) specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used. - * @param $cert_type (int) The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature. - * @param $info (array) array of option information: Name, Location, Reason, ContactInfo. - * @param $approval (string) Enable approval signature eg. for PDF incremental update + * @param mixed $signing_cert signing certificate (string or filename prefixed with 'file://') + * @param mixed $private_key private key (string or filename prefixed with 'file://') + * @param string $private_key_password password + * @param string $extracerts specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used. + * @param int $cert_type The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature. + * @param array $info array of option information: Name, Location, Reason, ContactInfo. + * @param string $approval Enable approval signature eg. for PDF incremental update * @public * @author Nicola Asuni * @since 4.6.005 (2009-04-24) @@ -13496,12 +13554,12 @@ class TCPDF { /** * Set the digital signature appearance (a cliccable rectangle area to get signature properties) - * @param $x (float) Abscissa of the upper-left corner. - * @param $y (float) Ordinate of the upper-left corner. - * @param $w (float) Width of the signature area. - * @param $h (float) Height of the signature area. - * @param $page (int) option page number (if < 0 the current page is used). - * @param $name (string) Name of the signature. + * @param float $x Abscissa of the upper-left corner. + * @param float $y Ordinate of the upper-left corner. + * @param float $w Width of the signature area. + * @param float $h Height of the signature area. + * @param int $page option page number (if < 0 the current page is used). + * @param string $name Name of the signature. * @public * @author Nicola Asuni * @since 5.3.011 (2010-06-17) @@ -13512,12 +13570,12 @@ class TCPDF { /** * Add an empty digital signature appearance (a cliccable rectangle area to get signature properties) - * @param $x (float) Abscissa of the upper-left corner. - * @param $y (float) Ordinate of the upper-left corner. - * @param $w (float) Width of the signature area. - * @param $h (float) Height of the signature area. - * @param $page (int) option page number (if < 0 the current page is used). - * @param $name (string) Name of the signature. + * @param float $x Abscissa of the upper-left corner. + * @param float $y Ordinate of the upper-left corner. + * @param float $w Width of the signature area. + * @param float $h Height of the signature area. + * @param int $page option page number (if < 0 the current page is used). + * @param string $name Name of the signature. * @public * @author Nicola Asuni * @since 5.9.101 (2011-07-06) @@ -13529,13 +13587,13 @@ class TCPDF { /** * Get the array that defines the signature appearance (page and rectangle coordinates). - * @param $x (float) Abscissa of the upper-left corner. - * @param $y (float) Ordinate of the upper-left corner. - * @param $w (float) Width of the signature area. - * @param $h (float) Height of the signature area. - * @param $page (int) option page number (if < 0 the current page is used). - * @param $name (string) Name of the signature. - * @return (array) Array defining page and rectangle coordinates of signature appearance. + * @param float $x Abscissa of the upper-left corner. + * @param float $y Ordinate of the upper-left corner. + * @param float $w Width of the signature area. + * @param float $h Height of the signature area. + * @param int $page option page number (if < 0 the current page is used). + * @param string $name Name of the signature. + * @return array Array defining page and rectangle coordinates of signature appearance. * @protected * @author Nicola Asuni * @since 5.9.101 (2011-07-06) @@ -13564,10 +13622,10 @@ class TCPDF { * Enable document timestamping (requires the OpenSSL Library). * The trusted timestamping improve document security that means that no one should be able to change the document once it has been recorded. * Use with digital signature only! - * @param $tsa_host (string) Time Stamping Authority (TSA) server (prefixed with 'https://') - * @param $tsa_username (string) Specifies the username for TSA authorization (optional) OR specifies the TSA authorization PEM file (see: example_66.php, optional) - * @param $tsa_password (string) Specifies the password for TSA authorization (optional) - * @param $tsa_cert (string) Specifies the location of TSA certificate for authorization (optional for cURL) + * @param string $tsa_host Time Stamping Authority (TSA) server (prefixed with 'https://') + * @param string $tsa_username Specifies the username for TSA authorization (optional) OR specifies the TSA authorization PEM file (see: example_66.php, optional) + * @param string $tsa_password Specifies the password for TSA authorization (optional) + * @param string $tsa_cert Specifies the location of TSA certificate for authorization (optional for cURL) * @public * @author Richard Stockinger * @since 6.0.090 (2014-06-16) @@ -13594,8 +13652,8 @@ class TCPDF { /** * NOT YET IMPLEMENTED * Request TSA for a timestamp - * @param $signature (string) Digital signature as binary string - * @return (string) Timestamped digital signature + * @param string $signature Digital signature as binary string + * @return string Timestamped digital signature * @protected * @author Richard Stockinger * @since 6.0.090 (2014-06-16) @@ -13611,11 +13669,11 @@ class TCPDF { /** * Create a new page group. * NOTE: call this function before calling AddPage() - * @param $page (int) starting group page (leave empty for next page). + * @param int|null $page starting group page (leave empty for next page). * @public * @since 3.0.000 (2008-03-27) */ - public function startPageGroup($page='') { + public function startPageGroup($page=null) { if (empty($page)) { $page = $this->page + 1; } @@ -13624,7 +13682,7 @@ class TCPDF { /** * Set the starting page number. - * @param $num (int) Starting page number. + * @param int $num Starting page number. * @since 5.9.093 (2011-06-16) * @public */ @@ -13691,7 +13749,7 @@ class TCPDF { * Return the alias for the total number of pages in the current page group. * If the current font is unicode type, the returned string is surrounded by additional curly braces. * This alias will be replaced by the total number of pages in this group. - * @return alias of the current page group + * @return string alias of the current page group * @public * @since 3.0.000 (2008-03-27) */ @@ -13706,7 +13764,7 @@ class TCPDF { * Return the alias for the page number on the current page group. * If the current font is unicode type, the returned string is surrounded by additional curly braces. * This alias will be replaced by the page number (relative to the belonging group). - * @return alias of the current page group + * @return string alias of the current page group * @public * @since 4.5.000 (2009-01-02) */ @@ -13719,7 +13777,7 @@ class TCPDF { /** * Return the current page in the group. - * @return current page in the group + * @return int current page in the group * @public * @since 3.0.000 (2008-03-27) */ @@ -13773,10 +13831,10 @@ class TCPDF { /** * Start a new pdf layer. - * @param $name (string) Layer name (only a-z letters and numbers). Leave empty for automatic name. - * @param $print (boolean|null) Set to TRUE to print this layer, FALSE to not print and NULL to not set this option - * @param $view (boolean) Set to true to view this layer. - * @param $lock (boolean) If true lock the layer + * @param string $name Layer name (only a-z letters and numbers). Leave empty for automatic name. + * @param boolean|null $print Set to TRUE to print this layer, FALSE to not print and NULL to not set this option + * @param boolean $view Set to true to view this layer. + * @param boolean $lock If true lock the layer * @public * @since 5.9.102 (2011-07-13) */ @@ -13815,7 +13873,7 @@ class TCPDF { * Set the visibility of the successive elements. * This can be useful, for instance, to put a background * image or color that will show on screen but won't print. - * @param $v (string) visibility mode. Legal values are: all, print, screen or view. + * @param string $v visibility mode. Legal values are: all, print, screen or view. * @public * @since 3.0.000 (2008-03-27) */ @@ -13847,13 +13905,13 @@ class TCPDF { /** * Add transparency parameters to the current extgstate - * @param $parms (array) parameters - * @return the number of extgstates + * @param array $parms parameters + * @return int|void the number of extgstates * @protected * @since 3.0.000 (2008-03-27) */ protected function addExtGState($parms) { - if ($this->pdfa_mode) { + if ($this->pdfa_mode || $this->pdfa_version >= 2) { // transparencies are not allowed in PDF/A mode return; } @@ -13879,13 +13937,13 @@ class TCPDF { /** * Add an extgstate - * @param $gs (array) extgstate + * @param int $gs extgstate * @protected * @since 3.0.000 (2008-03-27) */ protected function setExtGState($gs) { - if ($this->pdfa_mode OR ($this->state != 2)) { - // transparency is not allowed in PDF/A mode + if (($this->pdfa_mode && $this->pdfa_version < 2) OR ($this->state != 2)) { + // transparency is not allowed in PDF/A-1 mode return; } $this->_out(sprintf('/GS%d gs', $gs)); @@ -13919,13 +13977,13 @@ class TCPDF { /** * Set overprint mode for stroking (OP) and non-stroking (op) painting operations. * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). - * @param $stroking (boolean) If true apply overprint for stroking operations. - * @param $nonstroking (boolean) If true apply overprint for painting operations other than stroking. - * @param $mode (integer) Overprint mode: (0 = each source colour component value replaces the value previously painted for the corresponding device colorant; 1 = a tint value of 0.0 for a source colour component shall leave the corresponding component of the previously painted colour unchanged). + * @param boolean $stroking If true apply overprint for stroking operations. + * @param boolean|null $nonstroking If true apply overprint for painting operations other than stroking. + * @param integer $mode Overprint mode: (0 = each source colour component value replaces the value previously painted for the corresponding device colorant; 1 = a tint value of 0.0 for a source colour component shall leave the corresponding component of the previously painted colour unchanged). * @public * @since 5.9.152 (2012-03-23) */ - public function setOverprint($stroking=true, $nonstroking='', $mode=0) { + public function setOverprint($stroking=true, $nonstroking=null, $mode=0) { if ($this->state != 2) { return; } @@ -13947,7 +14005,7 @@ class TCPDF { /** * Get the overprint mode array (OP, op, OPM). * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). - * @return array. + * @return array * @public * @since 5.9.152 (2012-03-23) */ @@ -13957,16 +14015,16 @@ class TCPDF { /** * Set alpha for stroking (CA) and non-stroking (ca) operations. - * @param $stroking (float) Alpha value for stroking operations: real value from 0 (transparent) to 1 (opaque). - * @param $bm (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity - * @param $nonstroking (float) Alpha value for non-stroking operations: real value from 0 (transparent) to 1 (opaque). - * @param $ais (boolean) + * @param float $stroking Alpha value for stroking operations: real value from 0 (transparent) to 1 (opaque). + * @param string $bm blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity + * @param float|null $nonstroking Alpha value for non-stroking operations: real value from 0 (transparent) to 1 (opaque). + * @param boolean $ais * @public * @since 3.0.000 (2008-03-27) */ - public function setAlpha($stroking=1, $bm='Normal', $nonstroking='', $ais=false) { - if ($this->pdfa_mode) { - // transparency is not allowed in PDF/A mode + public function setAlpha($stroking=1, $bm='Normal', $nonstroking=null, $ais=false) { + if ($this->pdfa_mode && $this->pdfa_version < 2) { + // transparency is not allowed in PDF/A-1 mode return; } $stroking = floatval($stroking); @@ -13992,7 +14050,7 @@ class TCPDF { /** * Get the alpha mode array (CA, ca, BM, AIS). * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). - * @return array. + * @return array * @public * @since 5.9.152 (2012-03-23) */ @@ -14002,7 +14060,7 @@ class TCPDF { /** * Set the default JPEG compression quality (1-100) - * @param $quality (int) JPEG quality, integer between 1 and 100 + * @param int $quality JPEG quality, integer between 1 and 100 * @public * @since 3.0.000 (2008-03-27) */ @@ -14015,7 +14073,7 @@ class TCPDF { /** * Set the default number of columns in a row for HTML tables. - * @param $cols (int) number of columns + * @param int $cols number of columns * @public * @since 3.0.014 (2008-06-04) */ @@ -14025,7 +14083,7 @@ class TCPDF { /** * Set the height of the cell (line height) respect the font height. - * @param $h (int) cell proportion respect font height (typical value = 1.25). + * @param float $h cell proportion respect font height (typical value = 1.25). * @public * @since 3.0.014 (2008-06-04) */ @@ -14036,6 +14094,7 @@ class TCPDF { /** * return the height of cell repect font height. * @public + * @return float * @since 4.0.012 (2008-07-24) */ public function getCellHeightRatio() { @@ -14044,15 +14103,18 @@ class TCPDF { /** * Set the PDF version (check PDF reference for valid values). - * @param $version (string) PDF document version. + * @param string $version PDF document version. * @public * @since 3.1.000 (2008-06-09) */ public function setPDFVersion($version='1.7') { if ($this->pdfa_mode && $this->pdfa_version == 1 ) { - // PDF/A mode + // PDF/A-1 mode $this->PDFVersion = '1.4'; - } else { + } elseif ($this->pdfa_mode && $this->pdfa_version >= 2 ) { + // PDF/A-2 mode + $this->PDFVersion = '1.7'; + } else { $this->PDFVersion = $version; } } @@ -14061,7 +14123,7 @@ class TCPDF { * Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print. * (see Section 8.1 of PDF reference, "Viewer Preferences"). *
              • HideToolbar boolean (Optional) A flag specifying whether to hide the viewer application's tool bars when the document is active. Default value: false.
              • HideMenubar boolean (Optional) A flag specifying whether to hide the viewer application's menu bar when the document is active. Default value: false.
              • HideWindowUI boolean (Optional) A flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed. Default value: false.
              • FitWindow boolean (Optional) A flag specifying whether to resize the document's window to fit the size of the first displayed page. Default value: false.
              • CenterWindow boolean (Optional) A flag specifying whether to position the document's window in the center of the screen. Default value: false.
              • DisplayDocTitle boolean (Optional; PDF 1.4) A flag specifying whether the window's title bar should display the document title taken from the Title entry of the document information dictionary (see Section 10.2.1, "Document Information Dictionary"). If false, the title bar should instead display the name of the PDF file containing the document. Default value: false.
              • NonFullScreenPageMode name (Optional) The document's page mode, specifying how to display the document on exiting full-screen mode:
                • UseNone Neither document outline nor thumbnail images visible
                • UseOutlines Document outline visible
                • UseThumbs Thumbnail images visible
                • UseOC Optional content group panel visible
                This entry is meaningful only if the value of the PageMode entry in the catalog dictionary (see Section 3.6.1, "Document Catalog") is FullScreen; it is ignored otherwise. Default value: UseNone.
              • ViewArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be displayed when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
                • MediaBox
                • CropBox (default)
                • BleedBox
                • TrimBox
                • ArtBox
              • ViewClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
                • MediaBox
                • CropBox (default)
                • BleedBox
                • TrimBox
                • ArtBox
              • PrintArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be rendered when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
                • MediaBox
                • CropBox (default)
                • BleedBox
                • TrimBox
                • ArtBox
              • PrintClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
                • MediaBox
                • CropBox (default)
                • BleedBox
                • TrimBox
                • ArtBox
              • PrintScaling name (Optional; PDF 1.6) The page scaling option to be selected when a print dialog is displayed for this document. Valid values are:
                • None, which indicates that the print dialog should reflect no page scaling
                • AppDefault (default), which indicates that applications should use the current print scaling
              • Duplex name (Optional; PDF 1.7) The paper handling option to use when printing the file from the print dialog. The following values are valid:
                • Simplex - Print single-sided
                • DuplexFlipShortEdge - Duplex and flip on the short edge of the sheet
                • DuplexFlipLongEdge - Duplex and flip on the long edge of the sheet
                Default value: none
              • PickTrayByPDFSize boolean (Optional; PDF 1.7) A flag specifying whether the PDF page size is used to select the input paper tray. This setting influences only the preset values used to populate the print dialog presented by a PDF viewer application. If PickTrayByPDFSize is true, the check box in the print dialog associated with input paper tray is checked. Note: This setting has no effect on Mac OS systems, which do not provide the ability to pick the input tray by size.
              • PrintPageRange array (Optional; PDF 1.7) The page numbers used to initialize the print dialog box when the file is printed. The first page of the PDF file is denoted by 1. Each pair consists of the first and last pages in the sub-range. An odd number of integers causes this entry to be ignored. Negative numbers cause the entire array to be ignored. Default value: as defined by PDF viewer application
              • NumCopies integer (Optional; PDF 1.7) The number of copies to be printed when the print dialog is opened for this file. Supported values are the integers 2 through 5. Values outside this range are ignored. Default value: as defined by PDF viewer application, but typically 1
              - * @param $preferences (array) array of options. + * @param array $preferences array of options. * @author Nicola Asuni * @public * @since 3.1.000 (2008-06-09) @@ -14072,13 +14134,13 @@ class TCPDF { /** * Paints color transition registration bars - * @param $x (float) abscissa of the top left corner of the rectangle. - * @param $y (float) ordinate of the top left corner of the rectangle. - * @param $w (float) width of the rectangle. - * @param $h (float) height of the rectangle. - * @param $transition (boolean) if true prints tcolor transitions to white. - * @param $vertical (boolean) if true prints bar vertically. - * @param $colors (string) colors to print separated by comma. Valid values are: A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT,. Where: A = grayscale black, W = grayscale white, R = RGB red, G RGB green, B RGB blue, C = CMYK cyan, M = CMYK magenta, Y = CMYK yellow, K = CMYK key/black, RGB = RGB registration color, CMYK = CMYK registration color, ALL = Spot registration color, ALLSPOT = print all defined spot colors, = name of the spot color to print. + * @param float $x abscissa of the top left corner of the rectangle. + * @param float $y ordinate of the top left corner of the rectangle. + * @param float $w width of the rectangle. + * @param float $h height of the rectangle. + * @param boolean $transition if true prints tcolor transitions to white. + * @param boolean $vertical if true prints bar vertically. + * @param string $colors colors to print separated by comma. Valid values are: A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT,. Where: A = grayscale black, W = grayscale white, R = RGB red, G RGB green, B RGB blue, C = CMYK cyan, M = CMYK magenta, Y = CMYK yellow, K = CMYK key/black, RGB = RGB registration color, CMYK = CMYK registration color, ALL = Spot registration color, ALLSPOT = print all defined spot colors, = name of the spot color to print. * @author Nicola Asuni * @since 4.9.000 (2010-03-26) * @public @@ -14201,7 +14263,7 @@ class TCPDF { // color gradient $this->LinearGradient($xb, $yb, $wb, $hb, $col_a, $col_b, $coords); } else { - $this->SetFillColorArray($col_b); + $this->setFillColorArray($col_b); // colored rectangle $this->Rect($xb, $yb, $wb, $hb, 'F', array()); } @@ -14213,18 +14275,18 @@ class TCPDF { /** * Paints crop marks. - * @param $x (float) abscissa of the crop mark center. - * @param $y (float) ordinate of the crop mark center. - * @param $w (float) width of the crop mark. - * @param $h (float) height of the crop mark. - * @param $type (string) type of crop mark, one symbol per type separated by comma: T = TOP, F = BOTTOM, L = LEFT, R = RIGHT, TL = A = TOP-LEFT, TR = B = TOP-RIGHT, BL = C = BOTTOM-LEFT, BR = D = BOTTOM-RIGHT. - * @param $color (array) crop mark color (default spot registration color). + * @param float $x abscissa of the crop mark center. + * @param float $y ordinate of the crop mark center. + * @param float $w width of the crop mark. + * @param float $h height of the crop mark. + * @param string $type type of crop mark, one symbol per type separated by comma: T = TOP, F = BOTTOM, L = LEFT, R = RIGHT, TL = A = TOP-LEFT, TR = B = TOP-RIGHT, BL = C = BOTTOM-LEFT, BR = D = BOTTOM-RIGHT. + * @param array $color crop mark color (default spot registration color). * @author Nicola Asuni * @since 4.9.000 (2010-03-26) * @public */ public function cropMark($x, $y, $w, $h, $type='T,R,B,L', $color=array(100,100,100,100,'All')) { - $this->SetLineStyle(array('width' => (0.5 / $this->k), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $color)); + $this->setLineStyle(array('width' => (0.5 / $this->k), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $color)); $type = strtoupper($type); $type = preg_replace('/[^A-Z\-\,]*/', '', $type); // split type in single components @@ -14284,28 +14346,28 @@ class TCPDF { /** * Paints a registration mark - * @param $x (float) abscissa of the registration mark center. - * @param $y (float) ordinate of the registration mark center. - * @param $r (float) radius of the crop mark. - * @param $double (boolean) if true print two concentric crop marks. - * @param $cola (array) crop mark color (default spot registration color 'All'). - * @param $colb (array) second crop mark color (default spot registration color 'None'). + * @param float $x abscissa of the registration mark center. + * @param float $y ordinate of the registration mark center. + * @param float $r radius of the crop mark. + * @param boolean $double if true print two concentric crop marks. + * @param array $cola crop mark color (default spot registration color 'All'). + * @param array $colb second crop mark color (default spot registration color 'None'). * @author Nicola Asuni * @since 4.9.000 (2010-03-26) * @public */ public function registrationMark($x, $y, $r, $double=false, $cola=array(100,100,100,100,'All'), $colb=array(0,0,0,0,'None')) { $line_style = array('width' => max((0.5 / $this->k),($r / 30)), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $cola); - $this->SetFillColorArray($cola); + $this->setFillColorArray($cola); $this->PieSector($x, $y, $r, 90, 180, 'F'); $this->PieSector($x, $y, $r, 270, 360, 'F'); $this->Circle($x, $y, $r, 0, 360, 'C', $line_style, array(), 8); if ($double) { $ri = $r * 0.5; - $this->SetFillColorArray($colb); + $this->setFillColorArray($colb); $this->PieSector($x, $y, $ri, 90, 180, 'F'); $this->PieSector($x, $y, $ri, 270, 360, 'F'); - $this->SetFillColorArray($cola); + $this->setFillColorArray($cola); $this->PieSector($x, $y, $ri, 0, 90, 'F'); $this->PieSector($x, $y, $ri, 180, 270, 'F'); $this->Circle($x, $y, $ri, 0, 360, 'C', $line_style, array(), 8); @@ -14314,9 +14376,9 @@ class TCPDF { /** * Paints a CMYK registration mark - * @param $x (float) abscissa of the registration mark center. - * @param $y (float) ordinate of the registration mark center. - * @param $r (float) radius of the crop mark. + * @param float $x abscissa of the registration mark center. + * @param float $y ordinate of the registration mark center. + * @param float $r radius of the crop mark. * @author Nicola Asuni * @since 6.0.038 (2013-09-30) * @public @@ -14329,20 +14391,20 @@ class TCPDF { // external radius $re = ($r * 1.3); // Cyan - $this->SetFillColorArray(array(100,0,0,0)); + $this->setFillColorArray(array(100,0,0,0)); $this->PieSector($x, $y, $ri, 270, 360, 'F'); // Magenta - $this->SetFillColorArray(array(0,100,0,0)); + $this->setFillColorArray(array(0,100,0,0)); $this->PieSector($x, $y, $ri, 0, 90, 'F'); // Yellow - $this->SetFillColorArray(array(0,0,100,0)); + $this->setFillColorArray(array(0,0,100,0)); $this->PieSector($x, $y, $ri, 90, 180, 'F'); // Key - black - $this->SetFillColorArray(array(0,0,0,100)); + $this->setFillColorArray(array(0,0,0,100)); $this->PieSector($x, $y, $ri, 180, 270, 'F'); // registration color $line_style = array('width' => $lw, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(100,100,100,100,'All')); - $this->SetFillColorArray(array(100,100,100,100,'All')); + $this->setFillColorArray(array(100,100,100,100,'All')); // external circle $this->Circle($x, $y, $r, 0, 360, 'C', $line_style, array(), 8); // cross lines @@ -14354,13 +14416,13 @@ class TCPDF { /** * Paints a linear colour gradient. - * @param $x (float) abscissa of the top left corner of the rectangle. - * @param $y (float) ordinate of the top left corner of the rectangle. - * @param $w (float) width of the rectangle. - * @param $h (float) height of the rectangle. - * @param $col1 (array) first color (Grayscale, RGB or CMYK components). - * @param $col2 (array) second color (Grayscale, RGB or CMYK components). - * @param $coords (array) array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0). + * @param float $x abscissa of the top left corner of the rectangle. + * @param float $y ordinate of the top left corner of the rectangle. + * @param float $w width of the rectangle. + * @param float $h height of the rectangle. + * @param array $col1 first color (Grayscale, RGB or CMYK components). + * @param array $col2 second color (Grayscale, RGB or CMYK components). + * @param array $coords array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0). * @author Andreas W\FCrmser, Nicola Asuni * @since 3.1.000 (2008-06-09) * @public @@ -14372,13 +14434,13 @@ class TCPDF { /** * Paints a radial colour gradient. - * @param $x (float) abscissa of the top left corner of the rectangle. - * @param $y (float) ordinate of the top left corner of the rectangle. - * @param $w (float) width of the rectangle. - * @param $h (float) height of the rectangle. - * @param $col1 (array) first color (Grayscale, RGB or CMYK components). - * @param $col2 (array) second color (Grayscale, RGB or CMYK components). - * @param $coords (array) array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined. + * @param float $x abscissa of the top left corner of the rectangle. + * @param float $y ordinate of the top left corner of the rectangle. + * @param float $w width of the rectangle. + * @param float $h height of the rectangle. + * @param array $col1 first color (Grayscale, RGB or CMYK components). + * @param array $col2 second color (Grayscale, RGB or CMYK components). + * @param array $coords array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined. * @author Andreas W\FCrmser, Nicola Asuni * @since 3.1.000 (2008-06-09) * @public @@ -14390,24 +14452,24 @@ class TCPDF { /** * Paints a coons patch mesh. - * @param $x (float) abscissa of the top left corner of the rectangle. - * @param $y (float) ordinate of the top left corner of the rectangle. - * @param $w (float) width of the rectangle. - * @param $h (float) height of the rectangle. - * @param $col1 (array) first color (lower left corner) (RGB components). - * @param $col2 (array) second color (lower right corner) (RGB components). - * @param $col3 (array) third color (upper right corner) (RGB components). - * @param $col4 (array) fourth color (upper left corner) (RGB components). - * @param $coords (array)
              • for one patch mesh: array(float x1, float y1, .... float x12, float y12): 12 pairs of coordinates (normally from 0 to 1) which specify the Bezier control points that define the patch. First pair is the lower left edge point, next is its right control point (control point 2). Then the other points are defined in the order: control point 1, edge point, control point 2 going counter-clockwise around the patch. Last (x12, y12) is the first edge point's left control point (control point 1).
              • for two or more patch meshes: array[number of patches]: arrays with the following keys for each patch: f: where to put that patch (0 = first patch, 1, 2, 3 = right, top and left of precedent patch - I didn't figure this out completely - just try and error ;-) points: 12 pairs of coordinates of the Bezier control points as above for the first patch, 8 pairs of coordinates for the following patches, ignoring the coordinates already defined by the precedent patch (I also didn't figure out the order of these - also: try and see what's happening) colors: must be 4 colors for the first patch, 2 colors for the following patches
              - * @param $coords_min (array) minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0 - * @param $coords_max (array) maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1 - * @param $antialias (boolean) A flag indicating whether to filter the shading function to prevent aliasing artifacts. + * @param float $x abscissa of the top left corner of the rectangle. + * @param float $y ordinate of the top left corner of the rectangle. + * @param float $w width of the rectangle. + * @param float $h height of the rectangle. + * @param array $col1 first color (lower left corner) (RGB components). + * @param array $col2 second color (lower right corner) (RGB components). + * @param array $col3 third color (upper right corner) (RGB components). + * @param array $col4 fourth color (upper left corner) (RGB components). + * @param array $coords
              • for one patch mesh: array(float x1, float y1, .... float x12, float y12): 12 pairs of coordinates (normally from 0 to 1) which specify the Bezier control points that define the patch. First pair is the lower left edge point, next is its right control point (control point 2). Then the other points are defined in the order: control point 1, edge point, control point 2 going counter-clockwise around the patch. Last (x12, y12) is the first edge point's left control point (control point 1).
              • for two or more patch meshes: array[number of patches]: arrays with the following keys for each patch: f: where to put that patch (0 = first patch, 1, 2, 3 = right, top and left of precedent patch - I didn't figure this out completely - just try and error ;-) points: 12 pairs of coordinates of the Bezier control points as above for the first patch, 8 pairs of coordinates for the following patches, ignoring the coordinates already defined by the precedent patch (I also didn't figure out the order of these - also: try and see what's happening) colors: must be 4 colors for the first patch, 2 colors for the following patches
              + * @param array $coords_min minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0 + * @param array $coords_max maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1 + * @param boolean $antialias A flag indicating whether to filter the shading function to prevent aliasing artifacts. * @author Andreas W\FCrmser, Nicola Asuni * @since 3.1.000 (2008-06-09) * @public */ public function CoonsPatchMesh($x, $y, $w, $h, $col1=array(), $col2=array(), $col3=array(), $col4=array(), $coords=array(0.00,0.0,0.33,0.00,0.67,0.00,1.00,0.00,1.00,0.33,1.00,0.67,1.00,1.00,0.67,1.00,0.33,1.00,0.00,1.00,0.00,0.67,0.00,0.33), $coords_min=0, $coords_max=1, $antialias=false) { - if ($this->pdfa_mode OR ($this->state != 2)) { + if (($this->pdfa_mode && $this->pdfa_version < 2) OR ($this->state != 2)) { return; } $this->Clip($x, $y, $w, $h); @@ -14467,8 +14529,8 @@ class TCPDF { if ($patch_array[$i]['points'][$j] > $bpcd) { $patch_array[$i]['points'][$j] = $bpcd; } - $this->gradients[$n]['stream'] .= chr(floor($patch_array[$i]['points'][$j] / 256)); - $this->gradients[$n]['stream'] .= chr(floor($patch_array[$i]['points'][$j] % 256)); + $this->gradients[$n]['stream'] .= chr((int) floor($patch_array[$i]['points'][$j] / 256)); + $this->gradients[$n]['stream'] .= chr((int) floor(intval($patch_array[$i]['points'][$j]) % 256)); } $count_cols = count($patch_array[$i]['colors']); for ($j=0; $j < $count_cols; ++$j) { @@ -14490,10 +14552,10 @@ class TCPDF { /** * Set a rectangular clipping area. - * @param $x (float) abscissa of the top left corner of the rectangle (or top right corner for RTL mode). - * @param $y (float) ordinate of the top left corner of the rectangle. - * @param $w (float) width of the rectangle. - * @param $h (float) height of the rectangle. + * @param float $x abscissa of the top left corner of the rectangle (or top right corner for RTL mode). + * @param float $y ordinate of the top left corner of the rectangle. + * @param float $w width of the rectangle. + * @param float $h height of the rectangle. * @author Andreas W\FCrmser, Nicola Asuni * @since 3.1.000 (2008-06-09) * @protected @@ -14516,17 +14578,17 @@ class TCPDF { /** * Output gradient. - * @param $type (int) type of gradient (1 Function-based shading; 2 Axial shading; 3 Radial shading; 4 Free-form Gouraud-shaded triangle mesh; 5 Lattice-form Gouraud-shaded triangle mesh; 6 Coons patch mesh; 7 Tensor-product patch mesh). (Not all types are currently supported) - * @param $coords (array) array of coordinates. - * @param $stops (array) array gradient color components: color = array of GRAY, RGB or CMYK color components; offset = (0 to 1) represents a location along the gradient vector; exponent = exponent of the exponential interpolation function (default = 1). - * @param $background (array) An array of colour components appropriate to the colour space, specifying a single background colour value. - * @param $antialias (boolean) A flag indicating whether to filter the shading function to prevent aliasing artifacts. + * @param int $type type of gradient (1 Function-based shading; 2 Axial shading; 3 Radial shading; 4 Free-form Gouraud-shaded triangle mesh; 5 Lattice-form Gouraud-shaded triangle mesh; 6 Coons patch mesh; 7 Tensor-product patch mesh). (Not all types are currently supported) + * @param array $coords array of coordinates. + * @param array $stops array gradient color components: color = array of GRAY, RGB or CMYK color components; offset = (0 to 1) represents a location along the gradient vector; exponent = exponent of the exponential interpolation function (default = 1). + * @param array $background An array of colour components appropriate to the colour space, specifying a single background colour value. + * @param boolean $antialias A flag indicating whether to filter the shading function to prevent aliasing artifacts. * @author Nicola Asuni * @since 3.1.000 (2008-06-09) * @public */ public function Gradient($type, $coords, $stops, $background=array(), $antialias=false) { - if ($this->pdfa_mode OR ($this->state != 2)) { + if (($this->pdfa_mode && $this->pdfa_version < 2) OR ($this->state != 2)) { return; } $n = count($this->gradients) + 1; @@ -14582,7 +14644,7 @@ class TCPDF { } if (isset($stop['opacity'])) { $this->gradients[$n]['colors'][$key]['opacity'] = $stop['opacity']; - if ((!$this->pdfa_mode) AND ($stop['opacity'] < 1)) { + if ((!($this->pdfa_mode && $this->pdfa_version < 2)) AND ($stop['opacity'] < 1)) { $this->gradients[$n]['transparency'] = true; } } else { @@ -14633,7 +14695,7 @@ class TCPDF { * @protected */ function _putshaders() { - if ($this->pdfa_mode) { + if ($this->pdfa_mode && $this->pdfa_version < 2) { return; } $idt = count($this->gradients); //index for transparency gradients @@ -14812,14 +14874,14 @@ class TCPDF { /** * Draw the sector of a circle. * It can be used for instance to render pie charts. - * @param $xc (float) abscissa of the center. - * @param $yc (float) ordinate of the center. - * @param $r (float) radius. - * @param $a (float) start angle (in degrees). - * @param $b (float) end angle (in degrees). - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $cw: (float) indicates whether to go clockwise (default: true). - * @param $o: (float) origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock). Default: 90. + * @param float $xc abscissa of the center. + * @param float $yc ordinate of the center. + * @param float $r radius. + * @param float $a start angle (in degrees). + * @param float $b end angle (in degrees). + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param float $cw indicates whether to go clockwise (default: true). + * @param float $o origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock). Default: 90. * @author Maxime Delorme, Nicola Asuni * @since 3.1.000 (2008-06-09) * @public @@ -14831,16 +14893,16 @@ class TCPDF { /** * Draw the sector of an ellipse. * It can be used for instance to render pie charts. - * @param $xc (float) abscissa of the center. - * @param $yc (float) ordinate of the center. - * @param $rx (float) the x-axis radius. - * @param $ry (float) the y-axis radius. - * @param $a (float) start angle (in degrees). - * @param $b (float) end angle (in degrees). - * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. - * @param $cw: (float) indicates whether to go clockwise. - * @param $o: (float) origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock). - * @param $nc (integer) Number of curves used to draw a 90 degrees portion of arc. + * @param float $xc abscissa of the center. + * @param float $yc ordinate of the center. + * @param float $rx the x-axis radius. + * @param float $ry the y-axis radius. + * @param float $a start angle (in degrees). + * @param float $b end angle (in degrees). + * @param string $style Style of rendering. See the getPathPaintOperator() function for more information. + * @param float $cw indicates whether to go clockwise. + * @param float $o origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock). + * @param integer $nc Number of curves used to draw a 90 degrees portion of arc. * @author Maxime Delorme, Nicola Asuni * @since 3.1.000 (2008-06-09) * @public @@ -14873,23 +14935,23 @@ class TCPDF { * NOTE: EPS is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library. * Only vector drawing is supported, not text or bitmap. * Although the script was successfully tested with various AI format versions, best results are probably achieved with files that were exported in the AI3 format (tested with Illustrator CS2, Freehand MX and Photoshop CS2). - * @param $file (string) Name of the file containing the image or a '@' character followed by the EPS/AI data string. - * @param $x (float) Abscissa of the upper-left corner. - * @param $y (float) Ordinate of the upper-left corner. - * @param $w (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $h (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $link (mixed) URL or identifier returned by AddLink(). - * @param $useBoundingBox (boolean) specifies whether to position the bounding box (true) or the complete canvas (false) at location (x,y). Default value is true. - * @param $align (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
              • T: top-right for LTR or top-left for RTL
              • M: middle-right for LTR or middle-left for RTL
              • B: bottom-right for LTR or bottom-left for RTL
              • N: next line
              - * @param $palign (string) Allows to center or align the image on the current line. Possible values are:
              • L : left align
              • C : center
              • R : right align
              • '' : empty string : left for LTR or right for RTL
              - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $fitonpage (boolean) if true the image is resized to not exceed page dimensions. - * @param $fixoutvals (boolean) if true remove values outside the bounding box. + * @param string $file Name of the file containing the image or a '@' character followed by the EPS/AI data string. + * @param float|null $x Abscissa of the upper-left corner. + * @param float|null $y Ordinate of the upper-left corner. + * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param mixed $link URL or identifier returned by AddLink(). + * @param boolean $useBoundingBox specifies whether to position the bounding box (true) or the complete canvas (false) at location (x,y). Default value is true. + * @param string $align Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
              • T: top-right for LTR or top-left for RTL
              • M: middle-right for LTR or middle-left for RTL
              • B: bottom-right for LTR or bottom-left for RTL
              • N: next line
              + * @param string $palign Allows to center or align the image on the current line. Possible values are:
              • L : left align
              • C : center
              • R : right align
              • '' : empty string : left for LTR or right for RTL
              + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
              • 0: no border (default)
              • 1: frame
              or a string containing some or all of the following characters (in any order):
              • L: left
              • T: top
              • R: right
              • B: bottom
              or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param boolean $fitonpage if true the image is resized to not exceed page dimensions. + * @param boolean $fixoutvals if true remove values outside the bounding box. * @author Valentin Schmidt, Nicola Asuni * @since 3.1.000 (2008-06-09) * @public */ - public function ImageEps($file, $x='', $y='', $w=0, $h=0, $link='', $useBoundingBox=true, $align='', $palign='', $border=0, $fitonpage=false, $fixoutvals=false) { + public function ImageEps($file, $x=null, $y=null, $w=0, $h=0, $link='', $useBoundingBox=true, $align='', $palign='', $border=0, $fitonpage=false, $fixoutvals=false) { if ($this->state != 2) { return; } @@ -14897,10 +14959,10 @@ class TCPDF { // convert EPS to raster image using GD or ImageMagick libraries return $this->Image($file, $x, $y, $w, $h, 'EPS', $link, $align, true, 300, $palign, false, false, $border, false, false, $fitonpage); } - if ($x === '') { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -14909,7 +14971,7 @@ class TCPDF { if ($file[0] === '@') { // image from string $data = substr($file, 1); } else { // EPS/AI file - $data = TCPDF_STATIC::fileGetContents($file); + $data = $this->getCachedFileContents($file); } if ($data === FALSE) { $this->Error('EPS file not found: '.$file); @@ -15193,7 +15255,7 @@ class TCPDF { break; } case 'N':{ - $this->SetY($this->img_rb_y); + $this->setY($this->img_rb_y); break; } default:{ @@ -15205,7 +15267,7 @@ class TCPDF { /** * Set document barcode. - * @param $bc (string) barcode + * @param string $bc barcode * @public */ public function setBarcode($bc='') { @@ -15224,14 +15286,14 @@ class TCPDF { /** * Print a Linear Barcode. - * @param $code (string) code to print - * @param $type (string) type of barcode (see tcpdf_barcodes_1d.php for supported formats). - * @param $x (int) x position in user units (empty string = current x position) - * @param $y (int) y position in user units (empty string = current y position) - * @param $w (int) width in user units (empty string = remaining page width) - * @param $h (int) height in user units (empty string = remaining page height) - * @param $xres (float) width of the smallest bar in user units (empty string = default value = 0.4mm) - * @param $style (array) array of options:
                + * @param string $code code to print + * @param string $type type of barcode (see tcpdf_barcodes_1d.php for supported formats). + * @param float|null $x x position in user units (null = current x position) + * @param float|null $y y position in user units (null = current y position) + * @param float|null $w width in user units (null = remaining page width) + * @param float|null $h height in user units (null = remaining page height) + * @param float|null $xres width of the smallest bar in user units (null = default value = 0.4mm) + * @param array $style array of options:
                  *
                • boolean $style['border'] if true prints a border
                • *
                • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
                • *
                • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
                • @@ -15247,12 +15309,12 @@ class TCPDF { *
                • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
                • *
                • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
                • *
                • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
                - * @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
                • T: top-right for LTR or top-left for RTL
                • M: middle-right for LTR or middle-left for RTL
                • B: bottom-right for LTR or bottom-left for RTL
                • N: next line
                + * @param string $align Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
                • T: top-right for LTR or top-left for RTL
                • M: middle-right for LTR or middle-left for RTL
                • B: bottom-right for LTR or bottom-left for RTL
                • N: next line
                * @author Nicola Asuni * @since 3.1.000 (2008-06-09) * @public */ - public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style=array(), $align='') { + public function write1DBarcode($code, $type, $x=null, $y=null, $w=null, $h=null, $xres=null, $style=array(), $align='') { if (TCPDF_STATIC::empty_string(trim($code))) { return; } @@ -15262,7 +15324,7 @@ class TCPDF { // create new barcode object $barcodeobj = new TCPDFBarcode($code, $type); $arrcode = $barcodeobj->getBarcodeArray(); - if (($arrcode === false) OR empty($arrcode) OR ($arrcode['maxw'] <= 0)) { + if (empty($arrcode) OR ($arrcode['maxw'] <= 0)) { $this->Error('Error in 1D barcode string'); } if ($arrcode['maxh'] <= 0) { @@ -15311,20 +15373,20 @@ class TCPDF { if (isset($style['fontsize'])) { $fontsize = $style['fontsize']; } - $this->SetFont($style['font'], '', $fontsize); + $this->setFont($style['font'], '', $fontsize); } if (!isset($style['stretchtext'])) { $style['stretchtext'] = 4; } - if ($x === '') { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary list($x, $y) = $this->checkPageRegions($h, $x, $y); - if (($w === '') OR ($w <= 0)) { + if (TCPDF_STATIC::empty_string($w) OR ($w <= 0)) { if ($this->rtl) { $w = $x - $this->lMargin; } else { @@ -15408,7 +15470,7 @@ class TCPDF { } $text_height = $this->getCellHeight($fontsize / $this->k); // height - if (($h === '') OR ($h <= 0)) { + if (TCPDF_STATIC::empty_string($h) OR ($h <= 0)) { // set default height $h = (($arrcode['maxw'] * $xres) / 3) + (2 * $vpadding) + $text_height; } @@ -15418,7 +15480,7 @@ class TCPDF { if ($text_height > $h) { $fontsize = (($h * $this->k) / (4 * $this->cell_height_ratio)); $text_height = $this->getCellHeight($fontsize / $this->k); - $this->SetFont($style['font'], '', $fontsize); + $this->setFont($style['font'], '', $fontsize); } if ($vpadding > 0) { $vpadding = (($h - $text_height) / 4); @@ -15483,8 +15545,8 @@ class TCPDF { $this->Rect($xpos_rect, $y, $w, $h, 'D'); } // set foreground color - $this->SetDrawColorArray($style['fgcolor']); - $this->SetTextColorArray($style['fgcolor']); + $this->setDrawColorArray($style['fgcolor']); + $this->setTextColorArray($style['fgcolor']); // print bars foreach ($arrcode['bcode'] as $k => $v) { $bw = ($v['w'] * $xres); @@ -15510,8 +15572,8 @@ class TCPDF { $this->x = $xpos_text; $this->y = $y + $vpadding + $barh; $cellpadding = $this->cell_padding; - $this->SetCellPadding(0); - $this->Cell($txtwidth, '', $label, 0, 0, 'C', false, '', $style['stretchtext'], false, 'T', 'T'); + $this->setCellPadding(0); + $this->Cell($txtwidth, 0, $label, 0, 0, 'C', false, '', $style['stretchtext'], false, 'T', 'T'); $this->cell_padding = $cellpadding; } // restore original direction @@ -15536,7 +15598,7 @@ class TCPDF { break; } case 'N':{ - $this->SetY($this->img_rb_y); + $this->setY($this->img_rb_y); break; } default:{ @@ -15548,13 +15610,13 @@ class TCPDF { /** * Print 2D Barcode. - * @param $code (string) code to print - * @param $type (string) type of barcode (see tcpdf_barcodes_2d.php for supported formats). - * @param $x (int) x position in user units - * @param $y (int) y position in user units - * @param $w (int) width in user units - * @param $h (int) height in user units - * @param $style (array) array of options:
                  + * @param string $code code to print + * @param string $type type of barcode (see tcpdf_barcodes_2d.php for supported formats). + * @param float|null $x x position in user units + * @param float|null $y y position in user units + * @param float|null $w width in user units + * @param float|null $h height in user units + * @param array $style array of options:
                    *
                  • boolean $style['border'] if true prints a border around the barcode
                  • *
                  • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
                  • *
                  • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
                  • @@ -15564,13 +15626,13 @@ class TCPDF { *
                  • array $style['fgcolor'] color array for bars and text
                  • *
                  • mixed $style['bgcolor'] color array for background or false for transparent
                  • *
                  • string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
                  • - * @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
                    • T: top-right for LTR or top-left for RTL
                    • M: middle-right for LTR or middle-left for RTL
                    • B: bottom-right for LTR or bottom-left for RTL
                    • N: next line
                    - * @param $distort (boolean) if true distort the barcode to fit width and height, otherwise preserve aspect ratio + * @param string $align Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
                    • T: top-right for LTR or top-left for RTL
                    • M: middle-right for LTR or middle-left for RTL
                    • B: bottom-right for LTR or bottom-left for RTL
                    • N: next line
                    + * @param boolean $distort if true distort the barcode to fit width and height, otherwise preserve aspect ratio * @author Nicola Asuni * @since 4.5.037 (2009-04-07) * @public */ - public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style=array(), $align='', $distort=false) { + public function write2DBarcode($code, $type, $x=null, $y=null, $w=null, $h=null, $style=array(), $align='', $distort=false) { if (TCPDF_STATIC::empty_string(trim($code))) { return; } @@ -15580,7 +15642,7 @@ class TCPDF { // create new barcode object $barcodeobj = new TCPDF2DBarcode($code, $type); $arrcode = $barcodeobj->getBarcodeArray(); - if (($arrcode === false) OR empty($arrcode) OR !isset($arrcode['num_rows']) OR ($arrcode['num_rows'] == 0) OR !isset($arrcode['num_cols']) OR ($arrcode['num_cols'] == 0)) { + if (empty($arrcode) OR !isset($arrcode['num_rows']) OR ($arrcode['num_rows'] == 0) OR !isset($arrcode['num_cols']) OR ($arrcode['num_cols'] == 0)) { $this->Error('Error in 2D barcode string'); } // set default values @@ -15621,10 +15683,10 @@ class TCPDF { if (!isset($style['module_height'])) { $style['module_height'] = 1; // height of a single module in points } - if ($x === '') { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -15666,7 +15728,7 @@ class TCPDF { $h = $maxh; } // set dimensions - if ((($w === '') OR ($w <= 0)) AND (($h === '') OR ($h <= 0))) { + if ((TCPDF_STATIC::empty_string($w) OR ($w <= 0)) AND (TCPDF_STATIC::empty_string($h) OR ($h <= 0))) { $w = ($cols + $hpad) * ($mw / $this->k); $h = ($rows + $vpad) * ($mh / $this->k); } elseif (($w === '') OR ($w <= 0)) { @@ -15733,7 +15795,7 @@ class TCPDF { $this->Rect($xpos, $y, $w, $h, 'D'); } // set foreground color - $this->SetDrawColorArray($style['fgcolor']); + $this->setDrawColorArray($style['fgcolor']); // print barcode cells // for each row for ($r = 0; $r < $rows; ++$r) { @@ -15770,7 +15832,7 @@ class TCPDF { break; } case 'N':{ - $this->SetY($this->img_rb_y); + $this->setY($this->img_rb_y); break; } default:{ @@ -15836,7 +15898,7 @@ class TCPDF { /** * Returns the current font size. - * @return current font size + * @return float current font size * @public * @since 3.2.000 (2008-06-23) */ @@ -15846,7 +15908,7 @@ class TCPDF { /** * Returns the current font size in points unit. - * @return current font size in points unit + * @return int current font size in points unit * @public * @since 3.2.000 (2008-06-23) */ @@ -15876,23 +15938,23 @@ class TCPDF { /** * Cleanup HTML code (requires HTML Tidy library). - * @param $html (string) htmlcode to fix - * @param $default_css (string) CSS commands to add - * @param $tagvs (array) parameters for setHtmlVSpace method - * @param $tidy_options (array) options for tidy_parse_string function + * @param string $html htmlcode to fix + * @param string $default_css CSS commands to add + * @param array|null $tagvs parameters for setHtmlVSpace method + * @param array|null $tidy_options options for tidy_parse_string function * @return string XHTML code cleaned up * @author Nicola Asuni * @public * @since 5.9.017 (2010-11-16) * @see setHtmlVSpace() */ - public function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='') { + public function fixHTMLCode($html, $default_css='', $tagvs=null, $tidy_options=null) { return TCPDF_STATIC::fixHTMLCode($html, $default_css, $tagvs, $tidy_options, $this->tagvspaces); } /** * Returns the border width from CSS property - * @param $width (string) border width + * @param string $width border width * @return int with in user units * @protected * @since 5.7.000 (2010-08-02) @@ -15912,7 +15974,7 @@ class TCPDF { /** * Returns the border dash style from CSS property - * @param $style (string) border style to convert + * @param string $style border style to convert * @return int sash style (return -1 in case of none or hidden border) * @protected * @since 5.7.000 (2010-08-02) @@ -15948,7 +16010,7 @@ class TCPDF { /** * Returns the border style array from CSS border properties - * @param $cssborder (string) border properties + * @param string $cssborder border properties * @return array containing border properties * @protected * @since 5.7.000 (2010-08-02) @@ -15998,8 +16060,8 @@ class TCPDF { /** * Get the internal Cell padding from CSS attribute. - * @param $csspadding (string) padding properties - * @param $width (float) width of the containing element + * @param string $csspadding padding properties + * @param float $width width of the containing element * @return array of cell paddings * @public * @since 5.9.000 (2010-10-04) @@ -16052,8 +16114,8 @@ class TCPDF { /** * Get the internal Cell margin from CSS attribute. - * @param $cssmargin (string) margin properties - * @param $width (float) width of the containing element + * @param string $cssmargin margin properties + * @param float $width width of the containing element * @return array of cell margins * @public * @since 5.9.000 (2010-10-04) @@ -16106,8 +16168,8 @@ class TCPDF { /** * Get the border-spacing from CSS attribute. - * @param $cssbspace (string) border-spacing CSS properties - * @param $width (float) width of the containing element + * @param string $cssbspace border-spacing CSS properties + * @param float $width width of the containing element * @return array of border spacings * @public * @since 5.9.010 (2010-10-27) @@ -16140,8 +16202,8 @@ class TCPDF { /** * Returns the letter-spacing value from CSS value - * @param $spacing (string) letter-spacing value - * @param $parent (float) font spacing (tracking) value of the parent element + * @param string $spacing letter-spacing value + * @param float $parent font spacing (tracking) value of the parent element * @return float quantity to increases or decreases the space between characters in a text. * @protected * @since 5.9.000 (2010-10-02) @@ -16171,8 +16233,8 @@ class TCPDF { /** * Returns the percentage of font stretching from CSS value - * @param $stretch (string) stretch mode - * @param $parent (float) stretch value of the parent element + * @param string $stretch stretch mode + * @param float $parent stretch value of the parent element * @return float font stretching percentage * @protected * @since 5.9.000 (2010-10-02) @@ -16242,10 +16304,10 @@ class TCPDF { /** * Convert HTML string containing font size value to points - * @param $val (string) String containing font size value and unit. - * @param $refsize (float) Reference font size in points. - * @param $parent_size (float) Parent font size in points. - * @param $defaultunit (string) Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt). + * @param string $val String containing font size value and unit. + * @param float $refsize Reference font size in points. + * @param float $parent_size Parent font size in points. + * @param string $defaultunit Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt). * @return float value in points * @public */ @@ -16298,7 +16360,7 @@ class TCPDF { /** * Returns the HTML DOM array. - * @param $html (string) html code + * @param string $html html code * @return array * @protected * @since 3.2.000 (2008-06-20) @@ -16308,15 +16370,15 @@ class TCPDF { $css = array(); // get CSS array defined at previous call $matches = array(); - if (preg_match_all('/([^\<]*)<\/cssarray>/isU', $html, $matches) > 0) { + if (preg_match_all('/([^\<]*?)<\/cssarray>/is', $html, $matches) > 0) { if (isset($matches[1][0])) { $css = array_merge($css, json_decode($this->unhtmlentities($matches[1][0]), true)); } - $html = preg_replace('/(.*?)<\/cssarray>/isU', '', $html); + $html = preg_replace('/(.*?)<\/cssarray>/is', '', $html); } // extract external CSS files $matches = array(); - if (preg_match_all('/]*)>/isU', $html, $matches) > 0) { + if (preg_match_all('/]*?)>/is', $html, $matches) > 0) { foreach ($matches[1] as $key => $link) { $type = array(); if (preg_match('/type[\s]*=[\s]*"text\/css"/', $link, $type)) { @@ -16328,7 +16390,7 @@ class TCPDF { $type = array(); if (preg_match('/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) { // read CSS data file - $cssdata = TCPDF_STATIC::fileGetContents(trim($type[1])); + $cssdata = $this->getCachedFileContents(trim($type[1])); if (($cssdata !== FALSE) AND (strlen($cssdata) > 0)) { $css = array_merge($css, TCPDF_STATIC::extractCSSproperties($cssdata)); } @@ -16339,7 +16401,7 @@ class TCPDF { } // extract style tags $matches = array(); - if (preg_match_all('/]*)>([^\<]*)<\/style>/isU', $html, $matches) > 0) { + if (preg_match_all('/]*?)>([^\<]*?)<\/style>/is', $html, $matches) > 0) { foreach ($matches[1] as $key => $media) { $type = array(); preg_match('/media[\s]*=[\s]*"([^"]*)"/', $media, $type); @@ -16354,8 +16416,8 @@ class TCPDF { // create a special tag to contain the CSS array (used for table content) $csstagarray = ''.htmlentities(json_encode($css)).''; // remove head and style blocks - $html = preg_replace('/]*)>(.*?)<\/head>/siU', '', $html); - $html = preg_replace('/]*)>([^\<]*)<\/style>/isU', '', $html); + $html = preg_replace('/]*?)>(.*?)<\/head>/is', '', $html); + $html = preg_replace('/]*?)>([^\<]*?)<\/style>/is', '', $html); // define block tags $blocktags = array('blockquote','br','dd','dl','div','dt','h1','h2','h3','h4','h5','h6','hr','li','ol','p','pre','ul','tcpdf','table','tr','td'); // define self-closing tags @@ -16549,7 +16611,11 @@ class TCPDF { $dom[($dom[$key]['parent'])]['content'] = str_replace('', '', $dom[($dom[$key]['parent'])]['content']); } // store header rows on a new table - if (($dom[$key]['value'] == 'tr') AND ($dom[($dom[$key]['parent'])]['thead'] === true)) { + if ( + ($dom[$key]['value'] === 'tr') + && !empty($dom[($dom[$key]['parent'])]['thead']) + && ($dom[($dom[$key]['parent'])]['thead'] === true) + ) { if (TCPDF_STATIC::empty_string($dom[($dom[($dom[$key]['parent'])]['parent'])]['thead'])) { $dom[($dom[($dom[$key]['parent'])]['parent'])]['thead'] = $csstagarray.$a[$dom[($dom[($dom[$key]['parent'])]['parent'])]['elkey']]; } @@ -16979,10 +17045,20 @@ class TCPDF { // rows on thead block are printed as a separate table } else { $dom[$key]['thead'] = false; + $parent = $dom[$key]['parent']; + + if (!isset($dom[$parent]['rows'])) { + $dom[$parent]['rows'] = 0; + } // store the number of rows on table element - ++$dom[($dom[$key]['parent'])]['rows']; + ++$dom[$parent]['rows']; + + if (!isset($dom[$parent]['trids'])) { + $dom[$parent]['trids'] = array(); + } + // store the TR elements IDs on table element - array_push($dom[($dom[$key]['parent'])]['trids'], $key); + array_push($dom[$parent]['trids'], $key); } } if (($dom[$key]['value'] == 'th') OR ($dom[$key]['value'] == 'td')) { @@ -17075,6 +17151,7 @@ class TCPDF { } } } + $element = preg_replace("/&NBSP;/i", " ", $element); } $dom[$key]['value'] = stripslashes($this->unhtmlentities($element)); } @@ -17101,7 +17178,7 @@ class TCPDF { /** * Return an hash code used to ensure that the serialized data has been generated by this TCPDF instance. - * @param $data (string) serialized data + * @param string $data serialized data * @return string * @public static */ @@ -17111,7 +17188,7 @@ class TCPDF { /** * Serialize an array of parameters to be used with TCPDF tag in HTML code. - * @param $data (array) parameters array + * @param array $data parameters array * @return string containing serialized data * @public static */ @@ -17122,7 +17199,7 @@ class TCPDF { /** * Unserialize parameters to be used with TCPDF tag in HTML code. - * @param $data (string) serialized data + * @param string $data serialized data * @return array containing unserialized data * @protected static */ @@ -17142,18 +17219,18 @@ class TCPDF { * IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting. * Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul * NOTE: all the HTML attributes must be enclosed in double-quote. - * @param $w (float) Cell width. If 0, the cell extends up to the right margin. - * @param $h (float) Cell minimum height. The cell extends automatically if needed. - * @param $x (float) upper-left corner X coordinate - * @param $y (float) upper-left corner Y coordinate - * @param $html (string) html text to print. Default value: empty string. - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
                    • 0: no border (default)
                    • 1: frame
                    or a string containing some or all of the following characters (in any order):
                    • L: left
                    • T: top
                    • R: right
                    • B: bottom
                    or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
                    • 0: to the right (or left for RTL language)
                    • 1: to the beginning of the next line
                    • 2: below
                    + * @param float $w Cell width. If 0, the cell extends up to the right margin. + * @param float $h Cell minimum height. The cell extends automatically if needed. + * @param float|null $x upper-left corner X coordinate + * @param float|null $y upper-left corner Y coordinate + * @param string $html html text to print. Default value: empty string. + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
                    • 0: no border (default)
                    • 1: frame
                    or a string containing some or all of the following characters (in any order):
                    • L: left
                    • T: top
                    • R: right
                    • B: bottom
                    or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param int $ln Indicates where the current position should go after the call. Possible values are:
                    • 0: to the right (or left for RTL language)
                    • 1: to the beginning of the next line
                    • 2: below
                    Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. - * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). - * @param $reseth (boolean) if true reset the last cell height (default true). - * @param $align (string) Allows to center or align the text. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    - * @param $autopadding (boolean) if true, uses internal padding and automatically adjust it to account for line width. + * @param boolean $fill Indicates if the cell background must be painted (true) or transparent (false). + * @param boolean $reseth if true reset the last cell height (default true). + * @param string $align Allows to center or align the text. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    + * @param boolean $autopadding if true, uses internal padding and automatically adjust it to account for line width. * @see Multicell(), writeHTML() * @public */ @@ -17166,12 +17243,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting. * Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul * NOTE: all the HTML attributes must be enclosed in double-quote. - * @param $html (string) text to display - * @param $ln (boolean) if true add a new line after text (default = true) - * @param $fill (boolean) Indicates if the background must be painted (true) or transparent (false). - * @param $reseth (boolean) if true reset the last cell height (default false). - * @param $cell (boolean) if true add the current left (or right for RTL) padding to each Write (default false). - * @param $align (string) Allows to center or align the text. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    + * @param string $html text to display + * @param boolean $ln if true add a new line after text (default = true) + * @param boolean $fill Indicates if the background must be painted (true) or transparent (false). + * @param boolean $reseth if true reset the last cell height (default false). + * @param boolean $cell if true add the current left (or right for RTL) padding to each Write (default false). + * @param string $align Allows to center or align the text. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    * @public */ public function writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='') { @@ -17561,7 +17638,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->cell_height_ratio = $dom[$key]['line-height']; $fontaligned = true; } - $this->SetFont($fontname, $fontstyle, $fontsize); + $this->setFont($fontname, $fontstyle, $fontsize); // reset row height $this->resetLastH(); $curfontname = $fontname; @@ -17588,16 +17665,16 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // get current position on page buffer $curpos = $this->pagelen[$startlinepage]; if (isset($dom[$key]['bgcolor']) AND ($dom[$key]['bgcolor'] !== false)) { - $this->SetFillColorArray($dom[$key]['bgcolor']); + $this->setFillColorArray($dom[$key]['bgcolor']); $wfill = true; } else { $wfill = $fill | false; } if (isset($dom[$key]['fgcolor']) AND ($dom[$key]['fgcolor'] !== false)) { - $this->SetTextColorArray($dom[$key]['fgcolor']); + $this->setTextColorArray($dom[$key]['fgcolor']); } if (isset($dom[$key]['strokecolor']) AND ($dom[$key]['strokecolor'] !== false)) { - $this->SetDrawColorArray($dom[$key]['strokecolor']); + $this->setDrawColorArray($dom[$key]['strokecolor']); } if (isset($dom[$key]['align'])) { $lalign = $dom[$key]['align']; @@ -18056,9 +18133,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (!($dom[$key]['tag'] AND !$dom[$key]['opening'] AND ($dom[$key]['value'] == 'table') AND (isset($this->emptypagemrk[$this->page])) AND ($this->emptypagemrk[$this->page] == $this->pagelen[$this->page]))) { - $this->SetFont($fontname, $fontstyle, $fontsize); + $this->setFont($fontname, $fontstyle, $fontsize); if ($wfill) { - $this->SetFillColorArray($this->bgcolor); + $this->setFillColorArray($this->bgcolor); } } } // end newline @@ -18358,14 +18435,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } elseif (strlen($dom[$key]['value']) > 0) { // print list-item if (!TCPDF_STATIC::empty_string($this->lispacer) AND ($this->lispacer != '^')) { - $this->SetFont($pfontname, $pfontstyle, $pfontsize); + $this->setFont($pfontname, $pfontstyle, $pfontsize); $this->resetLastH(); $minstartliney = $this->y; $maxbottomliney = ($startliney + $this->getCellHeight($this->FontSize)); if (is_numeric($pfontsize) AND ($pfontsize > 0)) { $this->putHtmlListBullet($this->listnum, $this->lispacer, $pfontsize); } - $this->SetFont($curfontname, $curfontstyle, $curfontsize); + $this->setFont($curfontname, $curfontstyle, $curfontsize); $this->resetLastH(); if (is_numeric($pfontsize) AND ($pfontsize > 0) AND is_numeric($curfontsize) AND ($curfontsize > 0) AND ($pfontsize != $curfontsize)) { $pfontascent = $this->getFontAscent($pfontname, $pfontstyle, $pfontsize); @@ -18726,10 +18803,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Process opening tags. - * @param $dom (array) html dom array - * @param $key (int) current element id - * @param $cell (boolean) if true add the default left (or right if RTL) padding to each new line (default false). - * @return $dom array + * @param array $dom html dom array + * @param int $key current element id + * @param boolean $cell if true add the default left (or right if RTL) padding to each new line (default false). + * @return array $dom * @protected */ protected function openHTMLTagHandler($dom, $key, $cell) { @@ -18823,7 +18900,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $dom[$key]['old_cell_padding'] = $this->cell_padding; if (isset($tag['attribute']['cellpadding'])) { $pad = $this->getHTMLUnitToUnits($tag['attribute']['cellpadding'], 1, 'px'); - $this->SetCellPadding($pad); + $this->setCellPadding($pad); } elseif (isset($tag['padding'])) { $this->cell_padding = $tag['padding']; } @@ -18864,9 +18941,37 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $hrWidth = $wtmp; } $prevlinewidth = $this->GetLineWidth(); - $this->SetLineWidth($hrHeight); - $this->Line($x, $y, $x + $hrWidth, $y); - $this->SetLineWidth($prevlinewidth); + $this->setLineWidth($hrHeight); + + $lineStyle = array(); + if (isset($tag['fgcolor'])) { + $lineStyle['color'] = $tag['fgcolor']; + } + + if (isset($tag['fgcolor'])) { + $lineStyle['color'] = $tag['fgcolor']; + } + + if (isset($tag['style']['cap'])) { + $lineStyle['cap'] = $tag['style']['cap']; + } + + if (isset($tag['style']['join'])) { + $lineStyle['join'] = $tag['style']['join']; + } + + if (isset($tag['style']['dash'])) { + $lineStyle['dash'] = $tag['style']['dash']; + } + + if (isset($tag['style']['phase'])) { + $lineStyle['phase'] = $tag['style']['phase']; + } + + $lineStyle = array_filter($lineStyle); + + $this->Line($x, $y, $x + $hrWidth, $y, $lineStyle); + $this->setLineWidth($prevlinewidth); $this->addHTMLVertSpace(max($hbc, ($hrHeight / 2)), 0, $cell, !isset($dom[($key + 1)])); break; } @@ -18885,7 +18990,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // data stream $imgsrc = '@'.base64_decode(substr($imgsrc, 1)); $type = ''; - } else { + } elseif ( $this->allowLocalFiles && substr($imgsrc, 0, 7) === 'file://') { + // get image type from a local file path + $imgsrc = substr($imgsrc, 7); + $type = TCPDF_IMAGES::getImageFileType($imgsrc); + } else { if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { // fix image path $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); @@ -18957,7 +19066,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $lnky = 0; } $imglink = $this->AddLink(); - $this->SetLink($imglink, $lnky, $page); + $this->setLink($imglink, $lnky, $page); } } } @@ -19111,11 +19220,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'sup': { - $this->SetXY($this->GetX(), $this->GetY() - ((0.7 * $this->FontSizePt) / $this->k)); + $this->setXY($this->GetX(), $this->GetY() - ((0.7 * $this->FontSizePt) / $this->k)); break; } case 'sub': { - $this->SetXY($this->GetX(), $this->GetY() + ((0.3 * $this->FontSizePt) / $this->k)); + $this->setXY($this->GetX(), $this->GetY() + ((0.3 * $this->FontSizePt) / $this->k)); break; } case 'h1': @@ -19417,11 +19526,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Process closing tags. - * @param $dom (array) html dom array - * @param $key (int) current element id - * @param $cell (boolean) if true add the default left (or right if RTL) padding to each new line (default false). - * @param $maxbottomliney (int) maximum y value of current line - * @return $dom array + * @param array $dom html dom array + * @param int $key current element id + * @param boolean $cell if true add the default left (or right if RTL) padding to each new line (default false). + * @param int $maxbottomliney maximum y value of current line + * @return array $dom * @protected */ protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0) { @@ -19626,7 +19735,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $border = $cellpos['border']; } if (isset($cellpos['bgcolor']) AND ($cellpos['bgcolor']) !== false) { - $this->SetFillColorArray($cellpos['bgcolor']); + $this->setFillColorArray($cellpos['bgcolor']); $fill = true; } else { $fill = false; @@ -19807,7 +19916,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } if (!$in_table_head) { // we are not inside a thead section - $this->cell_padding = $table_el['old_cell_padding']; + $this->cell_padding = isset($table_el['old_cell_padding']) ? $table_el['old_cell_padding'] : null; // reset row height $this->resetLastH(); if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) { @@ -19843,11 +19952,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'sup': { - $this->SetXY($this->GetX(), $this->GetY() + ((0.7 * $parent['fontsize']) / $this->k)); + $this->setXY($this->GetX(), $this->GetY() + ((0.7 * $parent['fontsize']) / $this->k)); break; } case 'sub': { - $this->SetXY($this->GetX(), $this->GetY() - ((0.3 * $parent['fontsize']) / $this->k)); + $this->setXY($this->GetX(), $this->GetY() - ((0.3 * $parent['fontsize']) / $this->k)); break; } case 'div': { @@ -19964,11 +20073,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Add vertical spaces if needed. - * @param $hbz (string) Distance between current y and line bottom. - * @param $hb (string) The height of the break. - * @param $cell (boolean) if true add the default left (or right if RTL) padding to each new line (default false). - * @param $firsttag (boolean) set to true when the tag is the first. - * @param $lasttag (boolean) set to true when the tag is the last. + * @param string $hbz Distance between current y and line bottom. + * @param string $hb The height of the break. + * @param boolean $cell if true add the default left (or right if RTL) padding to each new line (default false). + * @param boolean $firsttag set to true when the tag is the first. + * @param boolean $lasttag set to true when the tag is the last. * @protected */ protected function addHTMLVertSpace($hbz=0, $hb=0, $cell=false, $firsttag=false, $lasttag=false) { @@ -20008,8 +20117,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Draw an HTML block border and fill - * @param $tag (array) array of tag properties. - * @param $xmax (int) end X coordinate for border. + * @param array $tag array of tag properties. + * @param int $xmax end X coordinate for border. * @protected * @since 5.7.000 (2010-08-03) */ @@ -20035,7 +20144,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (isset($tag['bgcolor']) AND ($tag['bgcolor'] !== false)) { // get background color $old_bgcolor = $this->bgcolor; - $this->SetFillColorArray($tag['bgcolor']); + $this->setFillColorArray($tag['bgcolor']); $fill = true; } if (!$border AND !$fill) { @@ -20201,7 +20310,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->page_regions = $temp_page_regions; if (isset($old_bgcolor)) { // restore background color - $this->SetFillColorArray($old_bgcolor); + $this->setFillColorArray($old_bgcolor); } // restore pointer position $this->x = $prev_x; @@ -20211,7 +20320,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set the default bullet to be used as LI bullet symbol - * @param $symbol (string) character or string to be used (legal values are: '' = automatic, '!' = auto bullet, '#' = auto numbering, 'disc', 'disc', 'circle', 'square', '1', 'decimal', 'decimal-leading-zero', 'i', 'lower-roman', 'I', 'upper-roman', 'a', 'lower-alpha', 'lower-latin', 'A', 'upper-alpha', 'upper-latin', 'lower-greek', 'img|type|width|height|image.ext') + * @param string $symbol character or string to be used (legal values are: '' = automatic, '!' = auto bullet, '#' = auto numbering, 'disc', 'disc', 'circle', 'square', '1', 'decimal', 'decimal-leading-zero', 'i', 'lower-roman', 'I', 'upper-roman', 'a', 'lower-alpha', 'lower-latin', 'A', 'upper-alpha', 'upper-latin', 'lower-greek', 'img|type|width|height|image.ext') * @public * @since 4.0.028 (2008-09-26) */ @@ -20232,13 +20341,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set the booklet mode for double-sided pages. - * @param $booklet (boolean) true set the booklet mode on, false otherwise. - * @param $inner (float) Inner page margin. - * @param $outer (float) Outer page margin. + * @param boolean $booklet true set the booklet mode on, false otherwise. + * @param float $inner Inner page margin. + * @param float $outer Outer page margin. * @public * @since 4.2.000 (2008-10-29) */ - public function SetBooklet($booklet=true, $inner=-1, $outer=-1) { + public function setBooklet($booklet=true, $inner=-1, $outer=-1) { $this->booklet = $booklet; if ($inner >= 0) { $this->lMargin = $inner; @@ -20250,7 +20359,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Swap the left and right margins. - * @param $reverse (boolean) if true swap left and right margins. + * @param boolean $reverse if true swap left and right margins. * @protected * @since 4.2.000 (2008-10-29) */ @@ -20274,7 +20383,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * the second level contains 0 for opening tags or 1 for closing tags, * the third level contains the vertical space unit (h) and the number spaces to add (n). * If the h parameter is not specified, default values are used. - * @param $tagvs (array) array of tags and relative vertical spaces. + * @param array $tagvs array of tags and relative vertical spaces. * @public * @since 4.2.001 (2008-10-30) */ @@ -20284,7 +20393,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set custom width for list indentation. - * @param $width (float) width of the indentation. Use negative value to disable it. + * @param float $width width of the indentation. Use negative value to disable it. * @public * @since 4.2.007 (2008-11-12) */ @@ -20294,7 +20403,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set the top/bottom cell sides to be open or closed when the cell cross the page. - * @param $isopen (boolean) if true keeps the top/bottom border open for the cell sides that cross the page. + * @param boolean $isopen if true keeps the top/bottom border open for the cell sides that cross the page. * @public * @since 4.2.010 (2008-11-14) */ @@ -20304,8 +20413,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set the color and font style for HTML links. - * @param $color (array) RGB array of colors - * @param $fontstyle (string) additional font styles to add + * @param array $color RGB array of colors + * @param string $fontstyle additional font styles to add * @public * @since 4.4.003 (2008-12-09) */ @@ -20316,10 +20425,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Convert HTML string containing value and unit of measure to user's units or points. - * @param $htmlval (string) String containing values and unit. - * @param $refsize (string) Reference value in points. - * @param $defaultunit (string) Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt). - * @param $points (boolean) If true returns points, otherwise returns value in user's units. + * @param string $htmlval String containing values and unit. + * @param string $refsize Reference value in points. + * @param string $defaultunit Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt). + * @param boolean $points If true returns points, otherwise returns value in user's units. * @return float value in user's unit or point if $points=true * @public * @since 4.4.004 (2008-12-10) @@ -20402,9 +20511,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Output an HTML list bullet or ordered item symbol - * @param $listdepth (int) list nesting level - * @param $listtype (string) type of list - * @param $size (float) current font size + * @param int $listdepth list nesting level + * @param string $listtype type of list + * @param float $size current font size * @protected * @since 4.4.004 (2008-12-10) */ @@ -20599,9 +20708,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->x = $tmpx; $this->lispacer = '^'; // restore colors - $this->SetFillColorArray($bgcolor); - $this->SetDrawColorArray($strokecolor); - $this->SettextColorArray($color); + $this->setFillColorArray($bgcolor); + $this->setDrawColorArray($strokecolor); + $this->settextColorArray($color); } /** @@ -20666,8 +20775,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set graphic variables. - * @param $gvars (array) array of graphic variablesto restore - * @param $extended (boolean) if true restore extended graphic variables + * @param array $gvars array of graphic variablesto restore + * @param boolean $extended if true restore extended graphic variables * @protected * @since 4.2.010 (2008-11-14) */ @@ -20727,7 +20836,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } $this->_out(''.$this->linestyleWidth.' '.$this->linestyleCap.' '.$this->linestyleJoin.' '.$this->linestyleDash.' '.$this->DrawColor.' '.$this->FillColor.''); if (!TCPDF_STATIC::empty_string($this->FontFamily)) { - $this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt); + $this->setFont($this->FontFamily, $this->FontStyle, $this->FontSizePt); } } @@ -20749,7 +20858,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set buffer content (always append data). - * @param $data (string) data + * @param string $data data * @protected * @since 4.5.000 (2009-01-02) */ @@ -20760,7 +20869,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Replace the buffer content - * @param $data (string) data + * @param string $data data * @protected * @since 5.5.000 (2010-06-22) */ @@ -20781,9 +20890,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set page buffer content. - * @param $page (int) page number - * @param $data (string) page data - * @param $append (boolean) if true append data, false replace. + * @param int $page page number + * @param string $data page data + * @param boolean $append if true append data, false replace. * @protected * @since 4.5.000 (2008-12-31) */ @@ -20802,7 +20911,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Get page buffer content. - * @param $page (int) page number + * @param int $page page number * @return string page buffer content or false in case of error * @protected * @since 4.5.000 (2008-12-31) @@ -20816,8 +20925,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set image buffer content. - * @param $image (string) image key - * @param $data (array) image data + * @param string $image image key + * @param array $data image data * @return int image index number * @protected * @since 4.5.000 (2008-12-31) @@ -20834,9 +20943,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set image buffer content for a specified sub-key. - * @param $image (string) image key - * @param $key (string) image sub-key - * @param $data (array) image data + * @param string $image image key + * @param string $key image sub-key + * @param array $data image data * @protected * @since 4.5.000 (2008-12-31) */ @@ -20849,8 +20958,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Get image buffer content. - * @param $image (string) image key - * @return string image buffer content or false in case of error + * @param string $image image key + * @return string|false image buffer content or false in case of error * @protected * @since 4.5.000 (2008-12-31) */ @@ -20863,8 +20972,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set font buffer content. - * @param $font (string) font key - * @param $data (array) font data + * @param string $font font key + * @param array $data font data * @protected * @since 4.5.000 (2009-01-02) */ @@ -20881,9 +20990,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set font buffer content. - * @param $font (string) font key - * @param $key (string) font sub-key - * @param $data (array) font data + * @param string $font font key + * @param string $key font sub-key + * @param mixed $data font data * @protected * @since 4.5.000 (2009-01-02) */ @@ -20896,8 +21005,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Get font buffer content. - * @param $font (string) font key - * @return string font buffer content or false in case of error + * @param string $font font key + * @return string|false font buffer content or false in case of error * @protected * @since 4.5.000 (2009-01-02) */ @@ -20910,9 +21019,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Move a page to a previous position. - * @param $frompage (int) number of the source page - * @param $topage (int) number of the destination page (must be less than $frompage) - * @return true in case of success, false in case of error. + * @param int $frompage number of the source page + * @param int $topage number of the destination page (must be less than $frompage) + * @return bool true in case of success, false in case of error. * @public * @since 4.5.000 (2009-01-02) */ @@ -21082,8 +21191,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Remove the specified page. - * @param $page (int) page to remove - * @return true in case of success, false in case of error. + * @param int $page page to remove + * @return bool true in case of success, false in case of error. * @public * @since 4.6.004 (2009-04-23) */ @@ -21272,8 +21381,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Clone the specified page to a new page. - * @param $page (int) number of page to copy (0 = current page) - * @return true in case of success, false in case of error. + * @param int $page number of page to copy (0 = current page) + * @return bool true in case of success, false in case of error. * @public * @since 4.9.015 (2010-04-20) */ @@ -21343,18 +21452,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Before calling this method you have to open the page using the addTOCPage() method. * After calling this method you have to call endTOCPage() to close the TOC page. * You can override this method to achieve different styles. - * @param $page (int) page number where this TOC should be inserted (leave empty for current page). - * @param $numbersfont (string) set the font for page numbers (please use monospaced font for better alignment). - * @param $filler (string) string used to fill the space between text and page number. - * @param $toc_name (string) name to use for TOC bookmark. - * @param $style (string) Font style for title: B = Bold, I = Italic, BI = Bold + Italic. - * @param $color (array) RGB color array for bookmark title (values from 0 to 255). + * @param int|null $page page number where this TOC should be inserted (leave empty for current page). + * @param string $numbersfont set the font for page numbers (please use monospaced font for better alignment). + * @param string $filler string used to fill the space between text and page number. + * @param string $toc_name name to use for TOC bookmark. + * @param string $style Font style for title: B = Bold, I = Italic, BI = Bold + Italic. + * @param array $color RGB color array for bookmark title (values from 0 to 255). * @public * @author Nicola Asuni * @since 4.5.000 (2009-01-02) * @see addTOCPage(), endTOCPage(), addHTMLTOC() */ - public function addTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0,0,0)) { + public function addTOC($page=null, $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0,0,0)) { $fontsize = $this->FontSizePt; $fontfamily = $this->FontFamily; $fontstyle = $this->FontStyle; @@ -21382,7 +21491,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $page = 1; } } - $this->SetFont($numbersfont, $fontstyle, $fontsize); + $this->setFont($numbersfont, $fontstyle, $fontsize); $numwidth = $this->GetStringWidth('00000'); $maxpage = 0; //used for pages on attached documents foreach ($this->outlines as $key => $outline) { @@ -21398,11 +21507,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $alignnum = 'R'; } if ($outline['l'] == 0) { - $this->SetFont($fontfamily, $outline['s'].'B', $fontsize); + $this->setFont($fontfamily, $outline['s'].'B', $fontsize); } else { - $this->SetFont($fontfamily, $outline['s'], $fontsize - $outline['l']); + $this->setFont($fontfamily, $outline['s'], $fontsize - $outline['l']); } - $this->SetTextColorArray($outline['c']); + $this->setTextColorArray($outline['c']); // check for page break $this->checkPageBreak(2 * $this->getCellHeight($this->FontSize)); // set margins and X position @@ -21422,7 +21531,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $current_page = $this->page; $current_column = $this->current_column; } - $this->SetX($x_start); + $this->setX($x_start); $indent = ($spacer * $outline['l']); if ($this->rtl) { $this->x -= $indent; @@ -21432,7 +21541,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->lMargin = $this->x; } $link = $this->AddLink(); - $this->SetLink($link, $outline['y'], $outline['p']); + $this->setLink($link, $outline['y'], $outline['p']); // write the text if ($this->rtl) { $txt = ' '.$outline['t']; @@ -21445,7 +21554,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $tw = $this->w - $this->rMargin - $this->x; } - $this->SetFont($numbersfont, $fontstyle, $fontsize); + $this->setFont($numbersfont, $fontstyle, $fontsize); if (TCPDF_STATIC::empty_string($page)) { $pagenum = $outline['p']; } else { @@ -21553,18 +21662,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * This method must be called after all Bookmarks were set. * Before calling this method you have to open the page using the addTOCPage() method. * After calling this method you have to call endTOCPage() to close the TOC page. - * @param $page (int) page number where this TOC should be inserted (leave empty for current page). - * @param $toc_name (string) name to use for TOC bookmark. - * @param $templates (array) array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number. - * @param $correct_align (boolean) if true correct the number alignment (numbers must be in monospaced font like courier and right aligned on LTR, or left aligned on RTL) - * @param $style (string) Font style for title: B = Bold, I = Italic, BI = Bold + Italic. - * @param $color (array) RGB color array for title (values from 0 to 255). + * @param int|null $page page number where this TOC should be inserted (leave empty for current page). + * @param string $toc_name name to use for TOC bookmark. + * @param array $templates array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number. + * @param boolean $correct_align if true correct the number alignment (numbers must be in monospaced font like courier and right aligned on LTR, or left aligned on RTL) + * @param string $style Font style for title: B = Bold, I = Italic, BI = Bold + Italic. + * @param array $color RGB color array for title (values from 0 to 255). * @public * @author Nicola Asuni * @since 5.0.001 (2010-05-06) * @see addTOCPage(), endTOCPage(), addTOC() */ - public function addHTMLTOC($page='', $toc_name='TOC', $templates=array(), $correct_align=true, $style='', $color=array(0,0,0)) { + public function addHTMLTOC($page=null, $toc_name='TOC', $templates=array(), $correct_align=true, $style='', $color=array(0,0,0)) { $filler = ' '; $prev_htmlLinkColorArray = $this->htmlLinkColorArray; $prev_htmlLinkFontStyle = $this->htmlLinkFontStyle; @@ -21580,12 +21689,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $dom = $this->getHtmlDomArray($html); foreach ($dom as $key => $value) { if ($value['value'] == '#TOC_PAGE_NUMBER#') { - $this->SetFont($dom[($key - 1)]['fontname']); + $this->setFont($dom[($key - 1)]['fontname']); $templates['F'.$level] = $this->isUnicodeFont(); } } } - $this->SetFont($current_font); + $this->setFont($current_font); $maxpage = 0; //used for pages on attached documents foreach ($this->outlines as $key => $outline) { // get HTML template @@ -21717,27 +21826,37 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: public function commitTransaction() { if (isset($this->objcopy)) { $this->objcopy->_destroy(true, true); + /* The unique file_id should not be used during cleanup again */ + $this->objcopy->file_id = NULL; unset($this->objcopy); } } /** * This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction(). - * @param $self (boolean) if true restores current class object to previous state without the need of reassignment via the returned value. + * @param boolean $self if true restores current class object to previous state without the need of reassignment via the returned value. * @return TCPDF object. * @public * @since 4.5.029 (2009-03-19) */ public function rollbackTransaction($self=false) { if (isset($this->objcopy)) { + $objcopy = $this->objcopy; $this->_destroy(true, true); if ($self) { - $objvars = get_object_vars($this->objcopy); + $objvars = get_object_vars($objcopy); foreach ($objvars as $key => $value) { $this->$key = $value; } + $objcopy->_destroy(true, true); + /* The unique file_id should not be used during cleanup again */ + $objcopy->file_id = NULL; + unset($objcopy); + return $this; } - return $this->objcopy; + /* The unique file_id should not be used during cleanup again */ + $this->file_id = NULL; + return $objcopy; } return $this; } @@ -21746,13 +21865,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set multiple columns of the same size - * @param $numcols (int) number of columns (set to zero to disable columns mode) - * @param $width (int) column width - * @param $y (int) column starting Y position (leave empty for current Y position) + * @param int $numcols number of columns (set to zero to disable columns mode) + * @param int $width column width + * @param int|null $y column starting Y position (leave empty for current Y position) * @public * @since 4.9.001 (2010-03-28) */ - public function setEqualColumns($numcols=0, $width=0, $y='') { + public function setEqualColumns($numcols=0, $width=0, $y=null) { $this->columns = array(); if ($numcols < 2) { $numcols = 0; @@ -21793,7 +21912,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set columns array. * Each column is represented by an array of arrays with the following keys: (w = width, s = space between columns, y = column top position). - * @param $columns (array) + * @param array $columns * @public * @since 4.9.001 (2010-03-28) */ @@ -21807,12 +21926,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set position at a given column - * @param $col (int) column number (from 0 to getNumberOfColumns()-1); empty string = current column. + * @param int|null $col column number (from 0 to getNumberOfColumns()-1); empty string = current column. * @public * @since 4.9.001 (2010-03-28) */ - public function selectColumn($col='') { - if (is_string($col)) { + public function selectColumn($col=null) { + if (TCPDF_STATIC::empty_string($col)) { $col = $this->current_column; } elseif ($col >= $this->num_columns) { $col = 0; @@ -21906,9 +22025,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set Text rendering mode. - * @param $stroke (int) outline size in user units (0 = disable). - * @param $fill (boolean) if true fills the text (default). - * @param $clip (boolean) if true activate clipping mode + * @param int $stroke outline size in user units (0 = disable). + * @param boolean $fill if true fills the text (default). + * @param boolean $clip if true activate clipping mode * @public * @since 4.9.008 (2009-04-02) */ @@ -21963,7 +22082,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set parameters for drop shadow effect for text. - * @param $params (array) Array of parameters: enabled (boolean) set to true to enable shadow; depth_w (float) shadow width in user units; depth_h (float) shadow height in user units; color (array) shadow color or false to use the stroke color; opacity (float) Alpha value: real value from 0 (transparent) to 1 (opaque); blend_mode (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity. + * @param array $params Array of parameters: enabled (boolean) set to true to enable shadow; depth_w (float) shadow width in user units; depth_h (float) shadow height in user units; color (array) shadow color or false to use the stroke color; opacity (float) Alpha value: real value from 0 (transparent) to 1 (opaque); blend_mode (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity. * @since 5.9.174 (2012-07-25) * @public */ @@ -22005,7 +22124,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Return the text shadow parameters array. - * @return Array of parameters. + * @return array array of parameters. * @since 5.9.174 (2012-07-25) * @public */ @@ -22015,13 +22134,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Returns an array of chars containing soft hyphens. - * @param $word (array) array of chars - * @param $patterns (array) Array of hypenation patterns. - * @param $dictionary (array) Array of words to be returned without applying the hyphenation algorithm. - * @param $leftmin (int) Minimum number of character to leave on the left of the word without applying the hyphens. - * @param $rightmin (int) Minimum number of character to leave on the right of the word without applying the hyphens. - * @param $charmin (int) Minimum word length to apply the hyphenation algorithm. - * @param $charmax (int) Maximum length of broken piece of word. + * @param array $word array of chars + * @param array $patterns Array of hypenation patterns. + * @param array $dictionary Array of words to be returned without applying the hyphenation algorithm. + * @param int $leftmin Minimum number of character to leave on the left of the word without applying the hyphens. + * @param int $rightmin Minimum number of character to leave on the right of the word without applying the hyphens. + * @param int $charmin Minimum word length to apply the hyphenation algorithm. + * @param int $charmax Maximum length of broken piece of word. * @return array text with soft hyphens * @author Nicola Asuni * @since 4.9.012 (2010-04-12) @@ -22095,14 +22214,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Returns text with soft hyphens. - * @param $text (string) text to process - * @param $patterns (mixed) Array of hypenation patterns or a TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/ - * @param $dictionary (array) Array of words to be returned without applying the hyphenation algorithm. - * @param $leftmin (int) Minimum number of character to leave on the left of the word without applying the hyphens. - * @param $rightmin (int) Minimum number of character to leave on the right of the word without applying the hyphens. - * @param $charmin (int) Minimum word length to apply the hyphenation algorithm. - * @param $charmax (int) Maximum length of broken piece of word. - * @return array text with soft hyphens + * @param string $text text to process + * @param mixed $patterns Array of hypenation patterns or a TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/ + * @param array $dictionary Array of words to be returned without applying the hyphenation algorithm. + * @param int $leftmin Minimum number of character to leave on the left of the word without applying the hyphens. + * @param int $rightmin Minimum number of character to leave on the right of the word without applying the hyphens. + * @param int $charmin Minimum word length to apply the hyphenation algorithm. + * @param int $charmax Maximum length of broken piece of word. + * @return string text with soft hyphens * @author Nicola Asuni * @since 4.9.012 (2010-04-12) * @public @@ -22167,7 +22286,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Enable/disable rasterization of vector images using ImageMagick library. - * @param $mode (boolean) if true enable rasterization, false otherwise. + * @param boolean $mode if true enable rasterization, false otherwise. * @public * @since 5.0.000 (2010-04-27) */ @@ -22177,7 +22296,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Enable or disable default option for font subsetting. - * @param $enable (boolean) if true enable font subsetting by default. + * @param boolean $enable if true enable font subsetting by default. * @author Nicola Asuni * @public * @since 5.3.002 (2010-06-07) @@ -22192,7 +22311,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Return the default option for font subsetting. - * @return boolean default font subsetting state. + * @return bool default font subsetting state. * @author Nicola Asuni * @public * @since 5.3.002 (2010-06-07) @@ -22203,9 +22322,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Left trim the input string - * @param $str (string) string to trim - * @param $replace (string) string that replace spaces. - * @return left trimmed string + * @param string $str string to trim + * @param string $replace string that replace spaces. + * @return string left trimmed string * @author Nicola Asuni * @public * @since 5.8.000 (2010-08-11) @@ -22216,9 +22335,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Right trim the input string - * @param $str (string) string to trim - * @param $replace (string) string that replace spaces. - * @return right trimmed string + * @param string $str string to trim + * @param string $replace string that replace spaces. + * @return string right trimmed string * @author Nicola Asuni * @public * @since 5.8.000 (2010-08-11) @@ -22229,9 +22348,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Trim the input string - * @param $str (string) string to trim - * @param $replace (string) string that replace spaces. - * @return trimmed string + * @param string $str string to trim + * @param string $replace string that replace spaces. + * @return string trimmed string * @author Nicola Asuni * @public * @since 5.8.000 (2010-08-11) @@ -22244,7 +22363,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Return true if the current font is unicode type. - * @return true for unicode font, false otherwise. + * @return bool true for unicode font, false otherwise. * @author Nicola Asuni * @public * @since 5.8.002 (2010-08-14) @@ -22255,7 +22374,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Return normalized font name - * @param $fontfamily (string) property string containing font family names + * @param string $fontfamily property string containing font family names * @return string normalized font name * @author Nicola Asuni * @public @@ -22296,10 +22415,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). * An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked. * Note: X,Y coordinates will be reset to 0,0. - * @param $w (int) Template width in user units (empty string or zero = page width less margins). - * @param $h (int) Template height in user units (empty string or zero = page height less margins). - * @param $group (mixed) Set transparency group. Can be a boolean value or an array specifying optional parameters: 'CS' (solour space name), 'I' (boolean flag to indicate isolated group) and 'K' (boolean flag to indicate knockout group). - * @return int the XObject Template ID in case of success or false in case of error. + * @param int $w Template width in user units (empty string or zero = page width less margins). + * @param int $h Template height in user units (empty string or zero = page height less margins). + * @param mixed $group Set transparency group. Can be a boolean value or an array specifying optional parameters: 'CS' (solour space name), 'I' (boolean flag to indicate isolated group) and 'K' (boolean flag to indicate knockout group). + * @return string|false the XObject Template ID in case of success or false in case of error. * @author Nicola Asuni * @public * @since 5.8.017 (2010-08-24) @@ -22332,7 +22451,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // set new environment $this->num_columns = 1; $this->current_column = 0; - $this->SetAutoPageBreak(false); + $this->setAutoPageBreak(false); if (($w === '') OR ($w <= 0)) { $w = $this->w - $this->lMargin - $this->rMargin; } @@ -22364,7 +22483,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * End the current XObject Template started with startTemplate() and restore the previous graphic state. * An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). * An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked. - * @return int the XObject Template ID in case of success or false in case of error. + * @return string|false the XObject Template ID in case of success or false in case of error. * @author Nicola Asuni * @public * @since 5.8.017 (2010-08-24) @@ -22386,20 +22505,20 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * You can print an XObject Template inside the currently opened Template. * An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). * An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked. - * @param $id (string) The ID of XObject Template to print. - * @param $x (int) X position in user units (empty string = current x position) - * @param $y (int) Y position in user units (empty string = current y position) - * @param $w (int) Width in user units (zero = remaining page width) - * @param $h (int) Height in user units (zero = remaining page height) - * @param $align (string) Indicates the alignment of the pointer next to template insertion relative to template height. The value can be:
                    • T: top-right for LTR or top-left for RTL
                    • M: middle-right for LTR or middle-left for RTL
                    • B: bottom-right for LTR or bottom-left for RTL
                    • N: next line
                    - * @param $palign (string) Allows to center or align the template on the current line. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    - * @param $fitonpage (boolean) If true the template is resized to not exceed page dimensions. + * @param string $id The ID of XObject Template to print. + * @param float|null $x X position in user units (empty string = current x position) + * @param float|null $y Y position in user units (empty string = current y position) + * @param float $w Width in user units (zero = remaining page width) + * @param float $h Height in user units (zero = remaining page height) + * @param string $align Indicates the alignment of the pointer next to template insertion relative to template height. The value can be:
                    • T: top-right for LTR or top-left for RTL
                    • M: middle-right for LTR or middle-left for RTL
                    • B: bottom-right for LTR or bottom-left for RTL
                    • N: next line
                    + * @param string $palign Allows to center or align the template on the current line. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    + * @param boolean $fitonpage If true the template is resized to not exceed page dimensions. * @author Nicola Asuni * @public * @since 5.8.017 (2010-08-24) * @see startTemplate(), endTemplate() */ - public function printTemplate($id, $x='', $y='', $w=0, $h=0, $align='', $palign='', $fitonpage=false) { + public function printTemplate($id, $x=null, $y=null, $w=0, $h=0, $align='', $palign='', $fitonpage=false) { if ($this->state != 2) { return; } @@ -22416,10 +22535,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } // set default values - if ($x === '') { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -22516,7 +22635,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'N': { - $this->SetY($rb_y); + $this->setY($rb_y); break; } default:{ @@ -22527,7 +22646,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set the percentage of character stretching. - * @param $perc (int) percentage of stretching (100 = no stretching) + * @param int $perc percentage of stretching (100 = no stretching) * @author Nicola Asuni * @public * @since 5.9.000 (2010-09-29) @@ -22549,7 +22668,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Set the amount to increase or decrease the space between characters in a text. - * @param $spacing (float) amount to increase or decrease the space between characters in a text (0 = default spacing) + * @param float $spacing amount to increase or decrease the space between characters in a text (0 = default spacing) * @author Nicola Asuni * @public * @since 5.9.000 (2010-09-29) @@ -22586,7 +22705,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. * A region is always aligned on the left or right side of the page ad is defined using a vertical segment. * You can set multiple regions for the same page. - * @param $regions (array) array of no-write regions. For each region you can define an array as follow: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right). Omit this parameter to remove all regions. + * @param array $regions array of no-write regions. For each region you can define an array as follow: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right). Omit this parameter to remove all regions. * @author Nicola Asuni * @public * @since 5.9.003 (2010-10-13) @@ -22606,7 +22725,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. * A region is always aligned on the left or right side of the page ad is defined using a vertical segment. * You can set multiple regions for the same page. - * @param $region (array) array of a single no-write region array: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right). + * @param array $region array of a single no-write region array: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right). * @author Nicola Asuni * @public * @since 5.9.003 (2010-10-13) @@ -22625,7 +22744,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Remove a single no-write region. - * @param $key (int) region key + * @param int $key region key * @author Nicola Asuni * @public * @since 5.9.003 (2010-10-13) @@ -22641,10 +22760,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Check page for no-write regions and adapt current coordinates and page margins if necessary. * A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. * A region is always aligned on the left or right side of the page ad is defined using a vertical segment. - * @param $h (float) height of the text/image/object to print in user units - * @param $x (float) current X coordinate in user units - * @param $y (float) current Y coordinate in user units - * @return array($x, $y) + * @param float $h height of the text/image/object to print in user units + * @param float $x current X coordinate in user units + * @param float $y current Y coordinate in user units + * @return float[] array($x, $y) * @author Nicola Asuni * @protected * @since 5.9.003 (2010-10-13) @@ -22738,21 +22857,21 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Embedd a Scalable Vector Graphics (SVG) image. * NOTE: SVG standard is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library. - * @param $file (string) Name of the SVG file or a '@' character followed by the SVG data string. - * @param $x (float) Abscissa of the upper-left corner. - * @param $y (float) Ordinate of the upper-left corner. - * @param $w (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $h (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. - * @param $link (mixed) URL or identifier returned by AddLink(). - * @param $align (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
                    • T: top-right for LTR or top-left for RTL
                    • M: middle-right for LTR or middle-left for RTL
                    • B: bottom-right for LTR or bottom-left for RTL
                    • N: next line
                    If the alignment is an empty string, then the pointer will be restored on the starting SVG position. - * @param $palign (string) Allows to center or align the image on the current line. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    - * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
                    • 0: no border (default)
                    • 1: frame
                    or a string containing some or all of the following characters (in any order):
                    • L: left
                    • T: top
                    • R: right
                    • B: bottom
                    or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $fitonpage (boolean) if true the image is resized to not exceed page dimensions. + * @param string $file Name of the SVG file or a '@' character followed by the SVG data string. + * @param float|null $x Abscissa of the upper-left corner. + * @param float|null $y Ordinate of the upper-left corner. + * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. + * @param mixed $link URL or identifier returned by AddLink(). + * @param string $align Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
                    • T: top-right for LTR or top-left for RTL
                    • M: middle-right for LTR or middle-left for RTL
                    • B: bottom-right for LTR or bottom-left for RTL
                    • N: next line
                    If the alignment is an empty string, then the pointer will be restored on the starting SVG position. + * @param string $palign Allows to center or align the image on the current line. Possible values are:
                    • L : left align
                    • C : center
                    • R : right align
                    • '' : empty string : left for LTR or right for RTL
                    + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be a number:
                    • 0: no border (default)
                    • 1: frame
                    or a string containing some or all of the following characters (in any order):
                    • L: left
                    • T: top
                    • R: right
                    • B: bottom
                    or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) + * @param boolean $fitonpage if true the image is resized to not exceed page dimensions. * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @public */ - public function ImageSVG($file, $x='', $y='', $w=0, $h=0, $link='', $align='', $palign='', $border=0, $fitonpage=false) { + public function ImageSVG($file, $x=null, $y=null, $w=0, $h=0, $link='', $align='', $palign='', $border=0, $fitonpage=false) { if ($this->state != 2) { return; } @@ -22776,15 +22895,15 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $svgdata = substr($file, 1); } else { // SVG file $this->svgdir = dirname($file); - $svgdata = TCPDF_STATIC::fileGetContents($file); + $svgdata = $this->getCachedFileContents($file); } if ($svgdata === FALSE) { $this->Error('SVG file not found: '.$file); } - if ($x === '') { + if (TCPDF_STATIC::empty_string($x)) { $x = $this->x; } - if ($y === '') { + if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } // check page for no-write regions and adapt page margins if necessary @@ -22975,8 +23094,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $page_break_mode = $this->AutoPageBreak; $page_break_margin = $this->getBreakMargin(); $cell_padding = $this->cell_padding; - $this->SetCellPadding(0); - $this->SetAutoPageBreak(false); + $this->setCellPadding(0); + $this->setAutoPageBreak(false); // save the current graphic state $this->_out('q'.$this->epsmarker); // set initial clipping mask @@ -22986,22 +23105,26 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $f = ($this->h - $oy) * $this->k * (1 - $svgscale_y); $this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y))); // creates a new XML parser to be used by the other XML functions - $this->parser = xml_parser_create('UTF-8'); + $parser = xml_parser_create('UTF-8'); // the following function allows to use parser inside object - xml_set_object($this->parser, $this); + xml_set_object($parser, $this); // disable case-folding for this XML parser - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); // sets the element handler functions for the XML parser - xml_set_element_handler($this->parser, 'startSVGElementHandler', 'endSVGElementHandler'); + xml_set_element_handler($parser, 'startSVGElementHandler', 'endSVGElementHandler'); // sets the character data handler function for the XML parser - xml_set_character_data_handler($this->parser, 'segSVGContentHandler'); + xml_set_character_data_handler($parser, 'segSVGContentHandler'); // start parsing an XML document - if (!xml_parse($this->parser, $svgdata)) { - $error_message = sprintf('SVG Error: %s at line %d', xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser)); + if (!xml_parse($parser, $svgdata)) { + $error_message = sprintf('SVG Error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); $this->Error($error_message); } // free this XML parser - xml_parser_free($this->parser); + xml_parser_free($parser); + + // >= PHP 7.0.0 "explicitly unset the reference to parser to avoid memory leaks" + unset($parser); + // restore previous graphic state $this->_out($this->epsmarker.'Q'); // restore graphic vars @@ -23040,7 +23163,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'N':{ - $this->SetY($this->img_rb_y); + $this->setY($this->img_rb_y); break; } default:{ @@ -23062,13 +23185,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } $this->endlinex = $this->img_rb_x; // restore page break - $this->SetAutoPageBreak($page_break_mode, $page_break_margin); + $this->setAutoPageBreak($page_break_mode, $page_break_margin); $this->cell_padding = $cell_padding; } /** * Convert SVG transformation matrix to PDF. - * @param $tm (array) original SVG transformation matrix + * @param array $tm original SVG transformation matrix * @return array transformation matrix * @protected * @since 5.0.000 (2010-05-02) @@ -23089,7 +23212,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Apply SVG graphic transformation matrix. - * @param $tm (array) original SVG transformation matrix + * @param array $tm original SVG transformation matrix * @protected * @since 5.0.000 (2010-05-02) */ @@ -23099,15 +23222,15 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Apply the requested SVG styles (*** TO BE COMPLETED ***) - * @param $svgstyle (array) array of SVG styles to apply - * @param $prevsvgstyle (array) array of previous SVG style - * @param $x (int) X origin of the bounding box - * @param $y (int) Y origin of the bounding box - * @param $w (int) width of the bounding box - * @param $h (int) height of the bounding box - * @param $clip_function (string) clip function - * @param $clip_params (array) array of parameters for clipping function - * @return object style + * @param array $svgstyle array of SVG styles to apply + * @param array $prevsvgstyle array of previous SVG style + * @param int $x X origin of the bounding box + * @param int $y Y origin of the bounding box + * @param int $w width of the bounding box + * @param int $h height of the bounding box + * @param string $clip_function clip function + * @param array $clip_params array of parameters for clipping function + * @return string style * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @protected @@ -23135,10 +23258,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // color $fill_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['color'], $this->spot_colors); - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); // text color $text_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['text-color'], $this->spot_colors); - $this->SetTextColorArray($text_color); + $this->setTextColorArray($text_color); // clip if (preg_match('/rect\(([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)\)/si', $svgstyle['clip'], $regs)) { $top = (isset($regs[1])?$this->getHTMLUnitToUnits($regs[1], 0, $this->svgunit, false):0); @@ -23265,7 +23388,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($svgstyle['fill-opacity'] != 1) { $this->setAlpha($this->alpha['CA'], 'Normal', $svgstyle['fill-opacity'], false); } - $this->SetFillColorArray($fill_color); + $this->setFillColorArray($fill_color); if ($svgstyle['fill-rule'] == 'evenodd') { $objstyle .= 'F*'; } else { @@ -23288,7 +23411,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (isset($svgstyle['stroke-dasharray']) AND !empty($svgstyle['stroke-dasharray']) AND ($svgstyle['stroke-dasharray'] != 'none')) { $stroke_style['dash'] = $svgstyle['stroke-dasharray']; } - $this->SetLineStyle($stroke_style); + $this->setLineStyle($stroke_style); $objstyle .= 'D'; } // font @@ -23383,7 +23506,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } } - $this->SetFont($font_family, $font_style, $font_size); + $this->setFont($font_family, $font_style, $font_size); $this->setFontStretching($font_stretch); $this->setFontSpacing($font_spacing); return $objstyle; @@ -23391,8 +23514,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Draws an SVG path - * @param $d (string) attribute d of the path SVG element - * @param $style (string) Style of rendering. Possible values are: + * @param string $d attribute d of the path SVG element + * @param string $style Style of rendering. Possible values are: *
                      *
                    • D or empty string: Draw (default).
                    • *
                    • F: Fill.
                    • @@ -23418,6 +23541,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } $paths = array(); $d = preg_replace('/([0-9ACHLMQSTVZ])([\-\+])/si', '\\1 \\2', $d); + $d = preg_replace('/(\.[0-9]+)(\.)/s', '\\1 \\2', $d); preg_match_all('/([ACHLMQSTVZ])[\s]*([^ACHLMQSTVZ\"]*)/si', $d, $paths, PREG_SET_ORDER); $x = 0; $y = 0; @@ -23767,7 +23891,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Return the tag name without the namespace - * @param $name (string) Tag name + * @param string $name Tag name * @protected */ protected function removeTagNamespace($name) { @@ -23780,10 +23904,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***) - * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler. - * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters. - * @param $attribs (array) The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on. - * @param $ctm (array) tranformation matrix for clipping mode (starting transformation matrix). + * @param resource|string $parser The first parameter, parser, is a reference to the XML parser calling the handler. + * @param string $name The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters. + * @param array $attribs The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on. + * @param array $ctm tranformation matrix for clipping mode (starting transformation matrix). * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @protected @@ -23978,7 +24102,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'linearGradient': { - if ($this->pdfa_mode) { + if ($this->pdfa_mode && $this->pdfa_version < 2) { break; } if (!isset($attribs['id'])) { @@ -24018,7 +24142,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'radialGradient': { - if ($this->pdfa_mode) { + if ($this->pdfa_mode && $this->pdfa_version < 2) { break; } if (!isset($attribs['id'])) { @@ -24452,8 +24576,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Sets the closing SVG element handler function for the XML parser. - * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler. - * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters. + * @param resource|string $parser The first parameter, parser, is a reference to the XML parser calling the handler. + * @param string $name The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters. * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @protected @@ -24559,8 +24683,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: /** * Sets the character data handler function for the XML parser. - * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler. - * @param $data (string) The second parameter, data, contains the character data as a string. + * @param resource $parser The first parameter, parser, is a reference to the XML parser calling the handler. + * @param string $data The second parameter, data, contains the character data as a string. * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @protected @@ -24571,6 +24695,33 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // --- END SVG METHODS ----------------------------------------------------- + /** + * Keeps files in memory, so it doesn't need to downloaded everytime in a loop + * @param string $file + * @return string + */ + protected function getCachedFileContents($file) + { + if (!isset($this->fileContentCache[$file])) { + $this->fileContentCache[$file] = TCPDF_STATIC::fileGetContents($file); + } + return $this->fileContentCache[$file]; + } + + /** + * Avoid multiple calls to an external server to see if a file exists + * @param string $file + * @return bool + */ + protected function fileExists($file) + { + if (isset($this->fileContentCache[$file]) || false !== $this->getImageBuffer($file)) { + return true; + } + + return TCPDF_STATIC::file_exists($file); + } + } // END OF TCPDF CLASS //============================================================+ diff --git a/lib/combodo/tcpdf/tcpdf_barcodes_1d.php b/lib/combodo/tcpdf/tcpdf_barcodes_1d.php index 78bfc5b5b..10a79a72e 100644 --- a/lib/combodo/tcpdf/tcpdf_barcodes_1d.php +++ b/lib/combodo/tcpdf/tcpdf_barcodes_1d.php @@ -53,7 +53,7 @@ class TCPDFBarcode { * Array representation of barcode. * @protected */ - protected $barcode_array; + protected $barcode_array = array(); /** * This is the class constructor. @@ -66,8 +66,8 @@ class TCPDFBarcode { *
                    • $arrcode['bcode'][$k]['w'] bar width in units.
                    • *
                    • $arrcode['bcode'][$k]['h'] bar height in units.
                    • *
                    • $arrcode['bcode'][$k]['p'] bar top position (0 = top, 1 = middle)
                    - * @param $code (string) code to print - * @param $type (string) type of barcode:
                    • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
                    • C39+ : CODE 39 with checksum
                    • C39E : CODE 39 EXTENDED
                    • C39E+ : CODE 39 EXTENDED + CHECKSUM
                    • C93 : CODE 93 - USS-93
                    • S25 : Standard 2 of 5
                    • S25+ : Standard 2 of 5 + CHECKSUM
                    • I25 : Interleaved 2 of 5
                    • I25+ : Interleaved 2 of 5 + CHECKSUM
                    • C128 : CODE 128
                    • C128A : CODE 128 A
                    • C128B : CODE 128 B
                    • C128C : CODE 128 C
                    • EAN2 : 2-Digits UPC-Based Extension
                    • EAN5 : 5-Digits UPC-Based Extension
                    • EAN8 : EAN 8
                    • EAN13 : EAN 13
                    • UPCA : UPC-A
                    • UPCE : UPC-E
                    • MSI : MSI (Variation of Plessey code)
                    • MSI+ : MSI + CHECKSUM (modulo 11)
                    • POSTNET : POSTNET
                    • PLANET : PLANET
                    • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
                    • KIX : KIX (Klant index - Customer index)
                    • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
                    • CODABAR : CODABAR
                    • CODE11 : CODE 11
                    • PHARMA : PHARMACODE
                    • PHARMA2T : PHARMACODE TWO-TRACKS
                    + * @param string $code code to print + * @param string $type type of barcode:
                    • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
                    • C39+ : CODE 39 with checksum
                    • C39E : CODE 39 EXTENDED
                    • C39E+ : CODE 39 EXTENDED + CHECKSUM
                    • C93 : CODE 93 - USS-93
                    • S25 : Standard 2 of 5
                    • S25+ : Standard 2 of 5 + CHECKSUM
                    • I25 : Interleaved 2 of 5
                    • I25+ : Interleaved 2 of 5 + CHECKSUM
                    • C128 : CODE 128
                    • C128A : CODE 128 A
                    • C128B : CODE 128 B
                    • C128C : CODE 128 C
                    • EAN2 : 2-Digits UPC-Based Extension
                    • EAN5 : 5-Digits UPC-Based Extension
                    • EAN8 : EAN 8
                    • EAN13 : EAN 13
                    • UPCA : UPC-A
                    • UPCE : UPC-E
                    • MSI : MSI (Variation of Plessey code)
                    • MSI+ : MSI + CHECKSUM (modulo 11)
                    • POSTNET : POSTNET
                    • PLANET : PLANET
                    • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
                    • KIX : KIX (Klant index - Customer index)
                    • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
                    • CODABAR : CODABAR
                    • CODE11 : CODE 11
                    • PHARMA : PHARMACODE
                    • PHARMA2T : PHARMACODE TWO-TRACKS
                    * @public */ public function __construct($code, $type) { @@ -85,9 +85,9 @@ class TCPDFBarcode { /** * Send barcode as SVG image object to the standard output. - * @param $w (int) Minimum width of a single bar in user units. - * @param $h (int) Height of barcode in user units. - * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @param int $w Minimum width of a single bar in user units. + * @param int $h Height of barcode in user units. + * @param string $color Foreground color (in SVG format) for bar elements (background is transparent). * @public */ public function getBarcodeSVG($w=2, $h=30, $color='black') { @@ -105,9 +105,9 @@ class TCPDFBarcode { /** * Return a SVG string representation of barcode. - * @param $w (int) Minimum width of a single bar in user units. - * @param $h (int) Height of barcode in user units. - * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @param int $w Minimum width of a single bar in user units. + * @param int $h Height of barcode in user units. + * @param string $color Foreground color (in SVG format) for bar elements (background is transparent). * @return string SVG code. * @public */ @@ -138,9 +138,9 @@ class TCPDFBarcode { /** * Return an HTML representation of barcode. - * @param $w (int) Width of a single bar element in pixels. - * @param $h (int) Height of a single bar element in pixels. - * @param $color (string) Foreground color for bar elements (background is transparent). + * @param int $w Width of a single bar element in pixels. + * @param int $h Height of a single bar element in pixels. + * @param string $color Foreground color for bar elements (background is transparent). * @return string HTML code. * @public */ @@ -164,9 +164,9 @@ class TCPDFBarcode { /** * Send a PNG image representation of barcode (requires GD or Imagick library). - * @param $w (int) Width of a single bar element in pixels. - * @param $h (int) Height of a single bar element in pixels. - * @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent). + * @param int $w Width of a single bar element in pixels. + * @param int $h Height of a single bar element in pixels. + * @param array $color RGB (0-255) foreground color for bar elements (background is transparent). * @public */ public function getBarcodePNG($w=2, $h=30, $color=array(0,0,0)) { @@ -183,10 +183,10 @@ class TCPDFBarcode { /** * Return a PNG image representation of barcode (requires GD or Imagick library). - * @param $w (int) Width of a single bar element in pixels. - * @param $h (int) Height of a single bar element in pixels. - * @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent). - * @return image or false in case of error. + * @param int $w Width of a single bar element in pixels. + * @param int $h Height of a single bar element in pixels. + * @param array $color RGB (0-255) foreground color for bar elements (background is transparent). + * @return string|Imagick|false image or false in case of error. * @public */ public function getBarcodePngData($w=2, $h=30, $color=array(0,0,0)) { @@ -241,9 +241,9 @@ class TCPDFBarcode { /** * Set the barcode. - * @param $code (string) code to print - * @param $type (string) type of barcode:
                    • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
                    • C39+ : CODE 39 with checksum
                    • C39E : CODE 39 EXTENDED
                    • C39E+ : CODE 39 EXTENDED + CHECKSUM
                    • C93 : CODE 93 - USS-93
                    • S25 : Standard 2 of 5
                    • S25+ : Standard 2 of 5 + CHECKSUM
                    • I25 : Interleaved 2 of 5
                    • I25+ : Interleaved 2 of 5 + CHECKSUM
                    • C128 : CODE 128
                    • C128A : CODE 128 A
                    • C128B : CODE 128 B
                    • C128C : CODE 128 C
                    • EAN2 : 2-Digits UPC-Based Extension
                    • EAN5 : 5-Digits UPC-Based Extension
                    • EAN8 : EAN 8
                    • EAN13 : EAN 13
                    • UPCA : UPC-A
                    • UPCE : UPC-E
                    • MSI : MSI (Variation of Plessey code)
                    • MSI+ : MSI + CHECKSUM (modulo 11)
                    • POSTNET : POSTNET
                    • PLANET : PLANET
                    • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
                    • KIX : KIX (Klant index - Customer index)
                    • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
                    • IMBPRE: Pre-processed Intelligent Mail Barcode - Onecode - USPS-B-3200, using only F,A,D,T letters
                    • CODABAR : CODABAR
                    • CODE11 : CODE 11
                    • PHARMA : PHARMACODE
                    • PHARMA2T : PHARMACODE TWO-TRACKS
                    - * @return array barcode array + * @param string $code code to print + * @param string $type type of barcode:
                    • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
                    • C39+ : CODE 39 with checksum
                    • C39E : CODE 39 EXTENDED
                    • C39E+ : CODE 39 EXTENDED + CHECKSUM
                    • C93 : CODE 93 - USS-93
                    • S25 : Standard 2 of 5
                    • S25+ : Standard 2 of 5 + CHECKSUM
                    • I25 : Interleaved 2 of 5
                    • I25+ : Interleaved 2 of 5 + CHECKSUM
                    • C128 : CODE 128
                    • C128A : CODE 128 A
                    • C128B : CODE 128 B
                    • C128C : CODE 128 C
                    • EAN2 : 2-Digits UPC-Based Extension
                    • EAN5 : 5-Digits UPC-Based Extension
                    • EAN8 : EAN 8
                    • EAN13 : EAN 13
                    • UPCA : UPC-A
                    • UPCE : UPC-E
                    • MSI : MSI (Variation of Plessey code)
                    • MSI+ : MSI + CHECKSUM (modulo 11)
                    • POSTNET : POSTNET
                    • PLANET : PLANET
                    • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
                    • KIX : KIX (Klant index - Customer index)
                    • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
                    • IMBPRE: Pre-processed Intelligent Mail Barcode - Onecode - USPS-B-3200, using only F,A,D,T letters
                    • CODABAR : CODABAR
                    • CODE11 : CODE 11
                    • PHARMA : PHARMACODE
                    • PHARMA2T : PHARMACODE TWO-TRACKS
                    + * @return void * @public */ public function setBarcode($code, $type) { @@ -373,7 +373,7 @@ class TCPDFBarcode { break; } default: { - $this->barcode_array = false; + $this->barcode_array = array(); $arrcode = false; break; } @@ -384,9 +384,9 @@ class TCPDFBarcode { /** * CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9. * General-purpose code in very wide use world-wide - * @param $code (string) code to represent. - * @param $extended (boolean) if true uses the extended mode. - * @param $checksum (boolean) if true add a checksum to the code. + * @param string $code code to represent. + * @param boolean $extended if true uses the extended mode. + * @param boolean $checksum if true add a checksum to the code. * @return array barcode representation. * @protected */ @@ -479,8 +479,8 @@ class TCPDFBarcode { /** * Encode a string to be used for CODE 39 Extended mode. - * @param $code (string) code to represent. - * @return encoded string. + * @param string $code code to represent. + * @return string encoded string. * @protected */ protected function encode_code39_ext($code) { @@ -530,8 +530,8 @@ class TCPDFBarcode { /** * Calculate CODE 39 checksum (modulo 43). - * @param $code (string) code to represent. - * @return char checksum. + * @param string $code code to represent. + * @return string char checksum. * @protected */ protected function checksum_code39($code) { @@ -553,7 +553,7 @@ class TCPDFBarcode { /** * CODE 93 - USS-93 * Compact code similar to Code 39 - * @param $code (string) code to represent. + * @param string $code code to represent. * @return array barcode representation. * @protected */ @@ -681,7 +681,7 @@ class TCPDFBarcode { /** * Calculate CODE 93 checksum (modulo 47). - * @param $code (string) code to represent. + * @param string $code code to represent. * @return string checksum code. * @protected */ @@ -730,7 +730,7 @@ class TCPDFBarcode { /** * Checksum for standard 2 of 5 barcodes. - * @param $code (string) code to process. + * @param string $code code to process. * @return int checksum. * @protected */ @@ -755,8 +755,8 @@ class TCPDFBarcode { * MSI. * Variation of Plessey code, with similar applications * Contains digits (0 to 9) and encodes the data only in the width of bars. - * @param $code (string) code to represent. - * @param $checksum (boolean) if true add a checksum to the code (modulo 11) + * @param string $code code to represent. + * @param boolean $checksum if true add a checksum to the code (modulo 11) * @return array barcode representation. * @protected */ @@ -814,8 +814,8 @@ class TCPDFBarcode { * Standard 2 of 5 barcodes. * Used in airline ticket marking, photofinishing * Contains digits (0 to 9) and encodes the data only in the width of bars. - * @param $code (string) code to represent. - * @param $checksum (boolean) if true add a checksum to the code + * @param string $code code to represent. + * @param boolean $checksum if true add a checksum to the code * @return array barcode representation. * @protected */ @@ -854,10 +854,9 @@ class TCPDFBarcode { } /** - * Convert binary barcode sequence to TCPDF barcode array. - * @param $seq (string) barcode as binary sequence. - * @param $bararray (array) barcode array. - * òparam array $bararray TCPDF barcode array to fill up + * Convert binary barcode sequence to WarnockPDF barcode array. + * @param string $seq barcode as binary sequence. + * @param array $bararray barcode array to fill up * @return array barcode representation. * @protected */ @@ -886,8 +885,8 @@ class TCPDFBarcode { * Interleaved 2 of 5 barcodes. * Compact numeric code, widely used in industry, air cargo * Contains digits (0 to 9) and encodes the data in the width of both bars and spaces. - * @param $code (string) code to represent. - * @param $checksum (boolean) if true add a checksum to the code + * @param string $code code to represent. + * @param boolean $checksum if true add a checksum to the code * @return array barcode representation. * @protected */ @@ -938,7 +937,7 @@ class TCPDFBarcode { } else { $t = false; // space } - $w = $seq[$j]; + $w = (float)$seq[$j]; $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); $bararray['maxw'] += $w; ++$k; @@ -950,8 +949,8 @@ class TCPDFBarcode { /** * C128 barcodes. * Very capable code, excellent density, high reliability; in very wide use world-wide - * @param $code (string) code to represent. - * @param $type (string) barcode type: A, B, C or empty for automatic switch (AUTO mode) + * @param string $code code to represent. + * @param string $type barcode type: A, B, C or empty for automatic switch (AUTO mode) * @return array barcode representation. * @protected */ @@ -1271,7 +1270,7 @@ class TCPDFBarcode { } else { $t = false; // space } - $w = $seq[$j]; + $w = (float)$seq[$j]; $bararray['bcode'][] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); $bararray['maxw'] += $w; } @@ -1281,7 +1280,7 @@ class TCPDFBarcode { /** * Split text code in A/B sequence for 128 code - * @param $code (string) code to split. + * @param string $code code to split. * @return array sequence * @protected */ @@ -1319,8 +1318,8 @@ class TCPDFBarcode { * EAN13: European Article Numbering international retail product code * UPC-A: Universal product code seen on almost all retail products in the USA and Canada * UPC-E: Short version of UPC symbol - * @param $code (string) code to represent. - * @param $len (string) barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A + * @param string $code code to represent. + * @param string $len barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A * @return array barcode representation. * @protected */ @@ -1512,8 +1511,8 @@ class TCPDFBarcode { * UPC-Based Extensions * 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers * 5-Digit Ext.: Used to mark suggested retail price of books - * @param $code (string) code to represent. - * @param $len (string) barcode type: 2 = 2-Digit, 5 = 5-Digit + * @param string $code code to represent. + * @param string $len barcode type: 2 = 2-Digit, 5 = 5-Digit * @return array barcode representation. * @protected */ @@ -1587,8 +1586,8 @@ class TCPDFBarcode { /** * POSTNET and PLANET barcodes. * Used by U.S. Postal Service for automated mail sorting - * @param $code (string) zip code to represent. Must be a string containing a zip code of the form DDDDD or DDDDD-DDDD. - * @param $planet (boolean) if true print the PLANET barcode, otherwise print POSTNET + * @param string $code zip code to represent. Must be a string containing a zip code of the form DDDDD or DDDDD-DDDD. + * @param boolean $planet if true print the PLANET barcode, otherwise print POSTNET * @return array barcode representation. * @protected */ @@ -1660,8 +1659,8 @@ class TCPDFBarcode { * RMS4CC - CBC - KIX * RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index) * RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service. - * @param $code (string) code to print - * @param $kix (boolean) if true prints the KIX variation (doesn't use the start and end symbols, and the checksum) - in this case the house number must be sufficed with an X and placed at the end of the code. + * @param string $code code to print + * @param boolean $kix if true prints the KIX variation (doesn't use the start and end symbols, and the checksum) - in this case the house number must be sufficed with an X and placed at the end of the code. * @return array barcode representation. * @protected */ @@ -1812,7 +1811,7 @@ class TCPDFBarcode { /** * CODABAR barcodes. * Older code often used in library systems, sometimes in blood banks - * @param $code (string) code to represent. + * @param string $code code to represent. * @return array barcode representation. * @protected */ @@ -1856,7 +1855,7 @@ class TCPDFBarcode { } else { $t = false; // space } - $w = $seq[$j]; + $w = (float)$seq[$j]; $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); $bararray['maxw'] += $w; ++$k; @@ -1868,7 +1867,7 @@ class TCPDFBarcode { /** * CODE11 barcodes. * Used primarily for labeling telecommunications equipment - * @param $code (string) code to represent. + * @param string $code code to represent. * @return array barcode representation. * @protected */ @@ -1947,7 +1946,7 @@ class TCPDFBarcode { } else { $t = false; // space } - $w = $seq[$j]; + $w = (float)$seq[$j]; $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); $bararray['maxw'] += $w; ++$k; @@ -1959,7 +1958,7 @@ class TCPDFBarcode { /** * Pharmacode * Contains digits (0 to 9) - * @param $code (string) code to represent. + * @param string $code code to represent. * @return array barcode representation. * @protected */ @@ -1985,7 +1984,7 @@ class TCPDFBarcode { /** * Pharmacode two-track * Contains digits (0 to 9) - * @param $code (string) code to represent. + * @param string $code code to represent. * @return array barcode representation. * @protected */ @@ -2047,7 +2046,7 @@ class TCPDFBarcode { * (requires PHP bcmath extension) * Intelligent Mail barcode is a 65-bar code for use on mail in the United States. * The fields are described as follows:
                    • The Barcode Identifier shall be assigned by USPS to encode the presort identification that is currently printed in human readable form on the optional endorsement line (OEL) as well as for future USPS use. This shall be two digits, with the second digit in the range of 0–4. The allowable encoding ranges shall be 00–04, 10–14, 20–24, 30–34, 40–44, 50–54, 60–64, 70–74, 80–84, and 90–94.
                    • The Service Type Identifier shall be assigned by USPS for any combination of services requested on the mailpiece. The allowable encoding range shall be 000http://it2.php.net/manual/en/function.dechex.php–999. Each 3-digit value shall correspond to a particular mail class with a particular combination of service(s). Each service program, such as OneCode Confirm and OneCode ACS, shall provide the list of Service Type Identifier values.
                    • The Mailer or Customer Identifier shall be assigned by USPS as a unique, 6 or 9 digit number that identifies a business entity. The allowable encoding range for the 6 digit Mailer ID shall be 000000- 899999, while the allowable encoding range for the 9 digit Mailer ID shall be 900000000-999999999.
                    • The Serial or Sequence Number shall be assigned by the mailer for uniquely identifying and tracking mailpieces. The allowable encoding range shall be 000000000–999999999 when used with a 6 digit Mailer ID and 000000-999999 when used with a 9 digit Mailer ID. e. The Delivery Point ZIP Code shall be assigned by the mailer for routing the mailpiece. This shall replace POSTNET for routing the mailpiece to its final delivery point. The length may be 0, 5, 9, or 11 digits. The allowable encoding ranges shall be no ZIP Code, 00000–99999, 000000000–999999999, and 00000000000–99999999999.
                    - * @param $code (string) code to print, separate the ZIP (routing code) from the rest using a minus char '-' (BarcodeID_ServiceTypeID_MailerID_SerialNumber-RoutingCode) + * @param string $code code to print, separate the ZIP (routing code) from the rest using a minus char '-' (BarcodeID_ServiceTypeID_MailerID_SerialNumber-RoutingCode) * @return array barcode representation. * @protected */ @@ -2171,8 +2170,8 @@ class TCPDFBarcode { /** * IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200 - * - * @param $code (string) pre-formatted IMB barcode (65 chars "FADT") + * + * @param string $code pre-formatted IMB barcode (65 chars "FADT") * @return array barcode representation. * @protected */ @@ -2223,7 +2222,7 @@ class TCPDFBarcode { /** * Convert large integer number to hexadecimal representation. * (requires PHP bcmath extension) - * @param $number (string) number to convert specified as a string + * @param string $number number to convert specified as a string * @return string hexadecimal representation */ public function dec_to_hex($number) { @@ -2247,7 +2246,7 @@ class TCPDFBarcode { /** * Convert large hexadecimal number to decimal representation (string). * (requires PHP bcmath extension) - * @param $hex (string) hexadecimal number to convert specified as a string + * @param string $hex hexadecimal number to convert specified as a string * @return string hexadecimal representation */ public function hex_to_dec($hex) { @@ -2263,7 +2262,7 @@ class TCPDFBarcode { /** * Intelligent Mail Barcode calculation of Frame Check Sequence - * @param $code_arr (string) array of hexadecimal values (13 bytes holding 102 bits right justified). + * @param string $code_arr array of hexadecimal values (13 bytes holding 102 bits right justified). * @return int 11 bit Frame Check Sequence as integer (decimal base) * @protected */ @@ -2299,7 +2298,7 @@ class TCPDFBarcode { /** * Reverse unsigned short value - * @param $num (int) value to reversr + * @param int $num value to reversr * @return int reversed value * @protected */ @@ -2315,8 +2314,8 @@ class TCPDFBarcode { /** * generate Nof13 tables used for Intelligent Mail Barcode - * @param $n (int) is the type of table: 2 for 2of13 table, 5 for 5of13table - * @param $size (int) size of table (78 for n=2 and 1287 for n=5) + * @param int $n is the type of table: 2 for 2of13 table, 5 for 5of13table + * @param int $size size of table (78 for n=2 and 1287 for n=5) * @return array requested table * @protected */ diff --git a/lib/combodo/tcpdf/tcpdf_barcodes_2d.php b/lib/combodo/tcpdf/tcpdf_barcodes_2d.php index 13e236552..730361bd8 100644 --- a/lib/combodo/tcpdf/tcpdf_barcodes_2d.php +++ b/lib/combodo/tcpdf/tcpdf_barcodes_2d.php @@ -53,7 +53,7 @@ class TCPDF2DBarcode { * Array representation of barcode. * @protected */ - protected $barcode_array = false; + protected $barcode_array = array(); /** * This is the class constructor. @@ -62,8 +62,8 @@ class TCPDF2DBarcode { *
                  • $arrcode['num_rows'] required number of rows
                  • *
                  • $arrcode['num_cols'] required number of columns
                  • *
                  • $arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)
                  - * @param $code (string) code to print - * @param $type (string) type of barcode:
                  • DATAMATRIX : Datamatrix (ISO/IEC 16022)
                  • PDF417 : PDF417 (ISO/IEC 15438:2006)
                  • PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".
                  • QRCODE : QRcode Low error correction
                  • QRCODE,L : QRcode Low error correction
                  • QRCODE,M : QRcode Medium error correction
                  • QRCODE,Q : QRcode Better error correction
                  • QRCODE,H : QR-CODE Best error correction
                  • RAW: raw mode - comma-separad list of array rows
                  • RAW2: raw mode - array rows are surrounded by square parenthesis.
                  • TEST : Test matrix
                  + * @param string $code code to print + * @param string $type type of barcode:
                  • DATAMATRIX : Datamatrix (ISO/IEC 16022)
                  • PDF417 : PDF417 (ISO/IEC 15438:2006)
                  • PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parameters are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".
                  • QRCODE : QRcode Low error correction
                  • QRCODE,L : QRcode Low error correction
                  • QRCODE,M : QRcode Medium error correction
                  • QRCODE,Q : QRcode Better error correction
                  • QRCODE,H : QR-CODE Best error correction
                  • RAW: raw mode - comma-separad list of array rows
                  • RAW2: raw mode - array rows are surrounded by square parenthesis.
                  • TEST : Test matrix
                  */ public function __construct($code, $type) { $this->setBarcode($code, $type); @@ -79,9 +79,9 @@ class TCPDF2DBarcode { /** * Send barcode as SVG image object to the standard output. - * @param $w (int) Width of a single rectangle element in user units. - * @param $h (int) Height of a single rectangle element in user units. - * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @param int $w Width of a single rectangle element in user units. + * @param int $h Height of a single rectangle element in user units. + * @param string $color Foreground color (in SVG format) for bar elements (background is transparent). * @public */ public function getBarcodeSVG($w=3, $h=3, $color='black') { @@ -99,9 +99,9 @@ class TCPDF2DBarcode { /** * Return a SVG string representation of barcode. - * @param $w (int) Width of a single rectangle element in user units. - * @param $h (int) Height of a single rectangle element in user units. - * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @param int $w Width of a single rectangle element in user units. + * @param int $h Height of a single rectangle element in user units. + * @param string $color Foreground color (in SVG format) for bar elements (background is transparent). * @return string SVG code. * @public */ @@ -135,9 +135,9 @@ class TCPDF2DBarcode { /** * Return an HTML representation of barcode. - * @param $w (int) Width of a single rectangle element in pixels. - * @param $h (int) Height of a single rectangle element in pixels. - * @param $color (string) Foreground color for bar elements (background is transparent). + * @param int $w Width of a single rectangle element in pixels. + * @param int $h Height of a single rectangle element in pixels. + * @param string $color Foreground color for bar elements (background is transparent). * @return string HTML code. * @public */ @@ -164,9 +164,9 @@ class TCPDF2DBarcode { /** * Send a PNG image representation of barcode (requires GD or Imagick library). - * @param $w (int) Width of a single rectangle element in pixels. - * @param $h (int) Height of a single rectangle element in pixels. - * @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent). + * @param int $w Width of a single rectangle element in pixels. + * @param int $h Height of a single rectangle element in pixels. + * @param array $color RGB (0-255) foreground color for bar elements (background is transparent). * @public */ public function getBarcodePNG($w=3, $h=3, $color=array(0,0,0)) { @@ -184,10 +184,10 @@ class TCPDF2DBarcode { /** * Return a PNG image representation of barcode (requires GD or Imagick library). - * @param $w (int) Width of a single rectangle element in pixels. - * @param $h (int) Height of a single rectangle element in pixels. - * @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent). - * @return image or false in case of error. + * @param int $w Width of a single rectangle element in pixels. + * @param int $h Height of a single rectangle element in pixels. + * @param array $color RGB (0-255) foreground color for bar elements (background is transparent). + * @return string|Imagick|false image or false in case of error. * @public */ public function getBarcodePngData($w=3, $h=3, $color=array(0,0,0)) { @@ -245,9 +245,9 @@ class TCPDF2DBarcode { /** * Set the barcode. - * @param $code (string) code to print - * @param $type (string) type of barcode:
                  • DATAMATRIX : Datamatrix (ISO/IEC 16022)
                  • PDF417 : PDF417 (ISO/IEC 15438:2006)
                  • PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parametrs are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".
                  • QRCODE : QRcode Low error correction
                  • QRCODE,L : QRcode Low error correction
                  • QRCODE,M : QRcode Medium error correction
                  • QRCODE,Q : QRcode Better error correction
                  • QRCODE,H : QR-CODE Best error correction
                  • RAW: raw mode - comma-separad list of array rows
                  • RAW2: raw mode - array rows are surrounded by square parenthesis.
                  • TEST : Test matrix
                  - * @return array + * @param string $code code to print + * @param string $type type of barcode:
                  • DATAMATRIX : Datamatrix (ISO/IEC 16022)
                  • PDF417 : PDF417 (ISO/IEC 15438:2006)
                  • PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parameters are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".
                  • QRCODE : QRcode Low error correction
                  • QRCODE,L : QRcode Low error correction
                  • QRCODE,M : QRcode Medium error correction
                  • QRCODE,Q : QRcode Better error correction
                  • QRCODE,H : QR-CODE Best error correction
                  • RAW: raw mode - comma-separad list of array rows
                  • RAW2: raw mode - array rows are surrounded by square parenthesis.
                  • TEST : Test matrix
                  + * @return void */ public function setBarcode($code, $type) { $mode = explode(',', $type); @@ -338,7 +338,7 @@ class TCPDF2DBarcode { break; } default: { - $this->barcode_array = false; + $this->barcode_array = array(); } } } diff --git a/lib/combodo/tcpdf/tcpdf_import.php b/lib/combodo/tcpdf/tcpdf_import.php index 09d726ba0..cc6fda780 100644 --- a/lib/combodo/tcpdf/tcpdf_import.php +++ b/lib/combodo/tcpdf/tcpdf_import.php @@ -60,7 +60,7 @@ class TCPDF_IMPORT extends TCPDF { /** * Import an existing PDF document - * @param $filename (string) Filename of the PDF document to import. + * @param string $filename Filename of the PDF document to import. * @return true in case of success, false otherwise * @public * @since 1.0.000 (2011-05-24) diff --git a/lib/combodo/tcpdf/tcpdf_parser.php b/lib/combodo/tcpdf/tcpdf_parser.php index bd3d719c7..4156230a3 100644 --- a/lib/combodo/tcpdf/tcpdf_parser.php +++ b/lib/combodo/tcpdf/tcpdf_parser.php @@ -91,8 +91,8 @@ class TCPDF_PARSER { /** * Parse a PDF document an return an array of objects. - * @param $data (string) PDF data to parse. - * @param $cfg (array) Array of configuration parameters: + * @param string $data PDF data to parse. + * @param array $cfg Array of configuration parameters: * 'die_for_errors' : if true termitate the program execution in case of error, otherwise thows an exception; * 'ignore_filter_decoding_errors' : if true ignore filter decoding errors; * 'ignore_missing_filter_decoders' : if true ignore missing filter decoding errors. @@ -130,7 +130,7 @@ class TCPDF_PARSER { /** * Set the configuration parameters. - * @param $cfg (array) Array of configuration parameters: + * @param array $cfg Array of configuration parameters: * 'die_for_errors' : if true termitate the program execution in case of error, otherwise thows an exception; * 'ignore_filter_decoding_errors' : if true ignore filter decoding errors; * 'ignore_missing_filter_decoders' : if true ignore missing filter decoding errors. @@ -150,7 +150,7 @@ class TCPDF_PARSER { /** * Return an array of parsed PDF document objects. - * @return (array) Array of parsed PDF document objects. + * @return array Array of parsed PDF document objects. * @public * @since 1.0.000 (2011-06-26) */ @@ -160,9 +160,9 @@ class TCPDF_PARSER { /** * Get Cross-Reference (xref) table and trailer data from PDF document data. - * @param $offset (int) xref offset (if know). - * @param $xref (array) previous xref array (if any). - * @return Array containing xref and trailer data. + * @param int $offset xref offset (if know). + * @param array $xref previous xref array (if any). + * @return array containing xref and trailer data. * @protected * @since 1.0.000 (2011-05-24) */ @@ -202,9 +202,9 @@ class TCPDF_PARSER { /** * Decode the Cross-Reference section - * @param $startxref (int) Offset at which the xref section starts (position of the 'xref' keyword). - * @param $xref (array) Previous xref array (if any). - * @return Array containing xref and trailer data. + * @param int $startxref Offset at which the xref section starts (position of the 'xref' keyword). + * @param array $xref Previous xref array (if any). + * @return array containing xref and trailer data. * @protected * @since 1.0.000 (2011-06-20) */ @@ -274,9 +274,9 @@ class TCPDF_PARSER { /** * Decode the Cross-Reference Stream section - * @param $startxref (int) Offset at which the xref section starts. - * @param $xref (array) Previous xref array (if any). - * @return Array containing xref and trailer data. + * @param int $startxref Offset at which the xref section starts. + * @param array $xref Previous xref array (if any). + * @return array containing xref and trailer data. * @protected * @since 1.0.003 (2013-03-16) */ @@ -489,7 +489,7 @@ class TCPDF_PARSER { /** * Get object type, raw value and offset to next object - * @param $offset (int) Object offset. + * @param int $offset Object offset. * @return array containing object type, raw value and offset to next object * @protected * @since 1.0.000 (2011-06-20) @@ -667,9 +667,9 @@ class TCPDF_PARSER { /** * Get content of indirect object. - * @param $obj_ref (string) Object number and generation number separated by underscore character. - * @param $offset (int) Object offset. - * @param $decoding (boolean) If true decode streams. + * @param string $obj_ref Object number and generation number separated by underscore character. + * @param int $offset Object offset. + * @param boolean $decoding If true decode streams. * @return array containing object data. * @protected * @since 1.0.000 (2011-05-24) @@ -712,7 +712,7 @@ class TCPDF_PARSER { /** * Get the content of object, resolving indect object reference if necessary. - * @param $obj (string) Object value. + * @param string $obj Object value. * @return array containing object data. * @protected * @since 1.0.000 (2011-06-26) @@ -734,8 +734,8 @@ class TCPDF_PARSER { /** * Decode the specified stream. - * @param $sdic (array) Stream's dictionary array. - * @param $stream (string) Stream to decode. + * @param array $sdic Stream's dictionary array. + * @param string $stream Stream to decode. * @return array containing decoded stream data and remaining filters. * @protected * @since 1.0.000 (2011-06-22) @@ -796,7 +796,7 @@ class TCPDF_PARSER { /** * Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true. - * @param $msg (string) The error message + * @param string $msg The error message * @public * @since 1.0.000 (2011-05-23) */ diff --git a/lib/composer/installed.json b/lib/composer/installed.json index 87a25eb41..2e88f259b 100644 --- a/lib/composer/installed.json +++ b/lib/composer/installed.json @@ -2,17 +2,17 @@ "packages": [ { "name": "combodo/tcpdf", - "version": "6.3.5", - "version_normalized": "6.3.5.0", + "version": "6.4.4", + "version_normalized": "6.4.4.0", "source": { "type": "git", "url": "https://github.com/combodo-itop-libs/TCPDF.git", - "reference": "aedd4b7b8cf7fcc24e617c405c9d3304150f4b94" + "reference": "0e31c013ccd000aa6762e9186778aa6e259ac8e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/aedd4b7b8cf7fcc24e617c405c9d3304150f4b94", - "reference": "aedd4b7b8cf7fcc24e617c405c9d3304150f4b94", + "url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/0e31c013ccd000aa6762e9186778aa6e259ac8e8", + "reference": "0e31c013ccd000aa6762e9186778aa6e259ac8e8", "shasum": "" }, "require": { @@ -21,7 +21,7 @@ "replace": { "tecnickcom/tcpdf": "self.version" }, - "time": "2020-09-28T12:19:09+00:00", + "time": "2022-03-10T14:36:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -59,8 +59,26 @@ "email": "contact@combodo.com" } ], - "description": "TCPDF fork adding requirements for iTop: Specific fonts.", + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", "homepage": "https://github.com/combodo-itop-libs/TCPDF", + "keywords": [ + "PDFD32000-2008", + "TCPDF", + "barcodes", + "datamatrix", + "pdf", + "pdf417", + "qrcode" + ], + "support": { + "source": "https://github.com/combodo-itop-libs/TCPDF/tree/6.4.4" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project", + "type": "custom" + } + ], "install-path": "../combodo/tcpdf" }, { diff --git a/lib/composer/installed.php b/lib/composer/installed.php index 4850fad9c..fbe3522ca 100644 --- a/lib/composer/installed.php +++ b/lib/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '9f9560f322ed091f816fa7c0b03442a02bb82325', + 'reference' => '33afa208a306f8486092ad9520344138ce45e780', 'name' => '__root__', 'dev' => true, ), @@ -16,16 +16,16 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '9f9560f322ed091f816fa7c0b03442a02bb82325', + 'reference' => '33afa208a306f8486092ad9520344138ce45e780', 'dev_requirement' => false, ), 'combodo/tcpdf' => array( - 'pretty_version' => '6.3.5', - 'version' => '6.3.5.0', + 'pretty_version' => '6.4.4', + 'version' => '6.4.4.0', 'type' => 'library', 'install_path' => __DIR__ . '/../combodo/tcpdf', 'aliases' => array(), - 'reference' => 'aedd4b7b8cf7fcc24e617c405c9d3304150f4b94', + 'reference' => '0e31c013ccd000aa6762e9186778aa6e259ac8e8', 'dev_requirement' => false, ), 'nikic/php-parser' => array( @@ -421,7 +421,7 @@ 'tecnickcom/tcpdf' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '6.3.5', + 0 => '6.4.4', ), ), 'twig/twig' => array( From b19c73a36e356065d102b60ac59a965ae5b306f1 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 12:24:23 +0200 Subject: [PATCH 05/15] =?UTF-8?q?:arrow=5Fup:=20N=C2=B04284=20Composer=20l?= =?UTF-8?q?ibs=20:=20update=20nikic/php-parser=20Was=20done=20in=203.0.0?= =?UTF-8?q?=20with=20N=C2=B03867?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- composer.lock | 21 +- lib/composer/autoload_classmap.php | 58 +- lib/composer/autoload_static.php | 58 +- lib/composer/installed.json | 23 +- lib/composer/installed.php | 10 +- lib/nikic/php-parser/.gitignore | 4 - lib/nikic/php-parser/.travis.yml | 31 - lib/nikic/php-parser/CHANGELOG.md | 422 -- lib/nikic/php-parser/LICENSE | 44 +- lib/nikic/php-parser/README.md | 238 +- lib/nikic/php-parser/UPGRADE-1.0.md | 121 - lib/nikic/php-parser/UPGRADE-2.0.md | 74 - lib/nikic/php-parser/UPGRADE-3.0.md | 160 - lib/nikic/php-parser/bin/php-parse | 55 +- lib/nikic/php-parser/composer.json | 29 +- .../php-parser/doc/0_Introduction.markdown | 80 - .../doc/2_Usage_of_basic_components.markdown | 438 -- ...3_Other_node_tree_representations.markdown | 330 - .../php-parser/doc/4_Code_generation.markdown | 84 - .../doc/component/Error_handling.markdown | 75 - .../php-parser/doc/component/Lexer.markdown | 152 - lib/nikic/php-parser/grammar/README.md | 12 +- lib/nikic/php-parser/grammar/parser.template | 27 +- lib/nikic/php-parser/grammar/php5.y | 245 +- lib/nikic/php-parser/grammar/php7.y | 571 +- lib/nikic/php-parser/grammar/phpyLang.php | 192 + .../php-parser/grammar/rebuildParsers.php | 218 +- lib/nikic/php-parser/grammar/tokens.y | 24 +- .../php-parser/lib/PhpParser/Autoloader.php | 40 - .../php-parser/lib/PhpParser/Builder.php | 6 +- .../lib/PhpParser/Builder/ClassConst.php | 132 + .../lib/PhpParser/Builder/Class_.php | 75 +- .../lib/PhpParser/Builder/Declaration.php | 15 +- .../lib/PhpParser/Builder/EnumCase.php | 85 + .../lib/PhpParser/Builder/Enum_.php | 117 + .../lib/PhpParser/Builder/FunctionLike.php | 16 +- .../lib/PhpParser/Builder/Function_.php | 32 +- .../lib/PhpParser/Builder/Interface_.php | 67 +- .../lib/PhpParser/Builder/Method.php | 44 +- .../lib/PhpParser/Builder/Namespace_.php | 13 +- .../lib/PhpParser/Builder/Param.php | 55 +- .../lib/PhpParser/Builder/Property.php | 84 +- .../lib/PhpParser/Builder/TraitUse.php | 64 + .../PhpParser/Builder/TraitUseAdaptation.php | 148 + .../lib/PhpParser/Builder/Trait_.php | 43 +- .../php-parser/lib/PhpParser/Builder/Use_.php | 35 +- .../lib/PhpParser/BuilderAbstract.php | 175 - .../lib/PhpParser/BuilderFactory.php | 328 +- .../lib/PhpParser/BuilderHelpers.php | 313 + .../php-parser/lib/PhpParser/Comment.php | 143 +- .../php-parser/lib/PhpParser/Comment/Doc.php | 4 +- .../ConstExprEvaluationException.php | 6 + .../lib/PhpParser/ConstExprEvaluator.php | 229 + lib/nikic/php-parser/lib/PhpParser/Error.php | 58 +- .../php-parser/lib/PhpParser/ErrorHandler.php | 4 +- .../lib/PhpParser/ErrorHandler/Collecting.php | 8 +- .../lib/PhpParser/ErrorHandler/Throwing.php | 4 +- .../lib/PhpParser/Internal/DiffElem.php | 27 + .../lib/PhpParser/Internal/Differ.php | 164 + .../Internal/PrintableNewAnonClassNode.php | 61 + .../lib/PhpParser/Internal/TokenStream.php | 281 + .../php-parser/lib/PhpParser/JsonDecoder.php | 103 + lib/nikic/php-parser/lib/PhpParser/Lexer.php | 349 +- .../lib/PhpParser/Lexer/Emulative.php | 354 +- .../Lexer/TokenEmulator/AttributeEmulator.php | 56 + .../CoaleseEqualTokenEmulator.php | 47 + .../Lexer/TokenEmulator/EnumTokenEmulator.php | 31 + .../TokenEmulator/ExplicitOctalEmulator.php | 44 + .../FlexibleDocStringEmulator.php | 76 + .../Lexer/TokenEmulator/FnTokenEmulator.php | 23 + .../Lexer/TokenEmulator/KeywordEmulator.php | 62 + .../TokenEmulator/MatchTokenEmulator.php | 23 + .../TokenEmulator/NullsafeTokenEmulator.php | 67 + .../NumericLiteralSeparatorEmulator.php | 105 + .../TokenEmulator/ReadonlyTokenEmulator.php | 23 + .../Lexer/TokenEmulator/ReverseEmulator.php | 36 + .../Lexer/TokenEmulator/TokenEmulator.php | 25 + .../php-parser/lib/PhpParser/NameContext.php | 285 + lib/nikic/php-parser/lib/PhpParser/Node.php | 97 +- .../php-parser/lib/PhpParser/Node/Arg.php | 22 +- .../lib/PhpParser/Node/Attribute.php | 34 + .../lib/PhpParser/Node/AttributeGroup.php | 29 + .../lib/PhpParser/Node/ComplexType.php | 14 + .../php-parser/lib/PhpParser/Node/Const_.php | 27 +- .../php-parser/lib/PhpParser/Node/Expr.php | 4 +- .../lib/PhpParser/Node/Expr/ArrayDimFetch.php | 14 +- .../lib/PhpParser/Node/Expr/ArrayItem.php | 17 +- .../lib/PhpParser/Node/Expr/Array_.php | 18 +- .../lib/PhpParser/Node/Expr/ArrowFunction.php | 79 + .../lib/PhpParser/Node/Expr/Assign.php | 14 +- .../lib/PhpParser/Node/Expr/AssignOp.php | 10 +- .../Node/Expr/AssignOp/BitwiseAnd.php | 7 +- .../Node/Expr/AssignOp/BitwiseOr.php | 7 +- .../Node/Expr/AssignOp/BitwiseXor.php | 7 +- .../PhpParser/Node/Expr/AssignOp/Coalesce.php | 12 + .../PhpParser/Node/Expr/AssignOp/Concat.php | 7 +- .../lib/PhpParser/Node/Expr/AssignOp/Div.php | 7 +- .../PhpParser/Node/Expr/AssignOp/Minus.php | 7 +- .../lib/PhpParser/Node/Expr/AssignOp/Mod.php | 7 +- .../lib/PhpParser/Node/Expr/AssignOp/Mul.php | 7 +- .../lib/PhpParser/Node/Expr/AssignOp/Plus.php | 7 +- .../lib/PhpParser/Node/Expr/AssignOp/Pow.php | 7 +- .../Node/Expr/AssignOp/ShiftLeft.php | 7 +- .../Node/Expr/AssignOp/ShiftRight.php | 7 +- .../lib/PhpParser/Node/Expr/AssignRef.php | 14 +- .../lib/PhpParser/Node/Expr/BinaryOp.php | 22 +- .../Node/Expr/BinaryOp/BitwiseAnd.php | 11 +- .../Node/Expr/BinaryOp/BitwiseOr.php | 11 +- .../Node/Expr/BinaryOp/BitwiseXor.php | 11 +- .../Node/Expr/BinaryOp/BooleanAnd.php | 11 +- .../Node/Expr/BinaryOp/BooleanOr.php | 11 +- .../PhpParser/Node/Expr/BinaryOp/Coalesce.php | 9 +- .../PhpParser/Node/Expr/BinaryOp/Concat.php | 11 +- .../lib/PhpParser/Node/Expr/BinaryOp/Div.php | 11 +- .../PhpParser/Node/Expr/BinaryOp/Equal.php | 11 +- .../PhpParser/Node/Expr/BinaryOp/Greater.php | 11 +- .../Node/Expr/BinaryOp/GreaterOrEqual.php | 11 +- .../Node/Expr/BinaryOp/Identical.php | 11 +- .../Node/Expr/BinaryOp/LogicalAnd.php | 11 +- .../Node/Expr/BinaryOp/LogicalOr.php | 11 +- .../Node/Expr/BinaryOp/LogicalXor.php | 11 +- .../PhpParser/Node/Expr/BinaryOp/Minus.php | 11 +- .../lib/PhpParser/Node/Expr/BinaryOp/Mod.php | 11 +- .../lib/PhpParser/Node/Expr/BinaryOp/Mul.php | 11 +- .../PhpParser/Node/Expr/BinaryOp/NotEqual.php | 11 +- .../Node/Expr/BinaryOp/NotIdentical.php | 11 +- .../lib/PhpParser/Node/Expr/BinaryOp/Plus.php | 11 +- .../lib/PhpParser/Node/Expr/BinaryOp/Pow.php | 11 +- .../Node/Expr/BinaryOp/ShiftLeft.php | 11 +- .../Node/Expr/BinaryOp/ShiftRight.php | 11 +- .../PhpParser/Node/Expr/BinaryOp/Smaller.php | 11 +- .../Node/Expr/BinaryOp/SmallerOrEqual.php | 11 +- .../Node/Expr/BinaryOp/Spaceship.php | 9 +- .../lib/PhpParser/Node/Expr/BitwiseNot.php | 14 +- .../lib/PhpParser/Node/Expr/BooleanNot.php | 14 +- .../lib/PhpParser/Node/Expr/CallLike.php | 39 + .../lib/PhpParser/Node/Expr/Cast.php | 10 +- .../lib/PhpParser/Node/Expr/Cast/Array_.php | 7 +- .../lib/PhpParser/Node/Expr/Cast/Bool_.php | 5 +- .../lib/PhpParser/Node/Expr/Cast/Double.php | 10 +- .../lib/PhpParser/Node/Expr/Cast/Int_.php | 5 +- .../lib/PhpParser/Node/Expr/Cast/Object_.php | 5 +- .../lib/PhpParser/Node/Expr/Cast/String_.php | 5 +- .../lib/PhpParser/Node/Expr/Cast/Unset_.php | 7 +- .../PhpParser/Node/Expr/ClassConstFetch.php | 25 +- .../lib/PhpParser/Node/Expr/Clone_.php | 14 +- .../lib/PhpParser/Node/Expr/Closure.php | 46 +- .../lib/PhpParser/Node/Expr/ClosureUse.php | 22 +- .../lib/PhpParser/Node/Expr/ConstFetch.php | 14 +- .../lib/PhpParser/Node/Expr/Empty_.php | 14 +- .../lib/PhpParser/Node/Expr/Error.php | 14 +- .../lib/PhpParser/Node/Expr/ErrorSuppress.php | 14 +- .../lib/PhpParser/Node/Expr/Eval_.php | 14 +- .../lib/PhpParser/Node/Expr/Exit_.php | 14 +- .../lib/PhpParser/Node/Expr/FuncCall.php | 28 +- .../lib/PhpParser/Node/Expr/Include_.php | 14 +- .../lib/PhpParser/Node/Expr/Instanceof_.php | 14 +- .../lib/PhpParser/Node/Expr/Isset_.php | 14 +- .../lib/PhpParser/Node/Expr/List_.php | 20 +- .../lib/PhpParser/Node/Expr/Match_.php | 31 + .../lib/PhpParser/Node/Expr/MethodCall.php | 36 +- .../lib/PhpParser/Node/Expr/New_.php | 26 +- .../Node/Expr/NullsafeMethodCall.php | 45 + .../Node/Expr/NullsafePropertyFetch.php | 35 + .../lib/PhpParser/Node/Expr/PostDec.php | 14 +- .../lib/PhpParser/Node/Expr/PostInc.php | 14 +- .../lib/PhpParser/Node/Expr/PreDec.php | 14 +- .../lib/PhpParser/Node/Expr/PreInc.php | 14 +- .../lib/PhpParser/Node/Expr/Print_.php | 14 +- .../lib/PhpParser/Node/Expr/PropertyFetch.php | 25 +- .../lib/PhpParser/Node/Expr/ShellExec.php | 14 +- .../lib/PhpParser/Node/Expr/StaticCall.php | 37 +- .../Node/Expr/StaticPropertyFetch.php | 25 +- .../lib/PhpParser/Node/Expr/Ternary.php | 14 +- .../lib/PhpParser/Node/Expr/Throw_.php | 30 + .../lib/PhpParser/Node/Expr/UnaryMinus.php | 14 +- .../lib/PhpParser/Node/Expr/UnaryPlus.php | 14 +- .../lib/PhpParser/Node/Expr/Variable.php | 16 +- .../lib/PhpParser/Node/Expr/YieldFrom.php | 14 +- .../lib/PhpParser/Node/Expr/Yield_.php | 14 +- .../lib/PhpParser/Node/FunctionLike.php | 21 +- .../lib/PhpParser/Node/Identifier.php | 75 + .../lib/PhpParser/Node/IntersectionType.php | 30 + .../lib/PhpParser/Node/MatchArm.php | 31 + .../php-parser/lib/PhpParser/Node/Name.php | 104 +- .../PhpParser/Node/Name/FullyQualified.php | 20 +- .../lib/PhpParser/Node/Name/Relative.php | 20 +- .../lib/PhpParser/Node/NullableType.php | 26 +- .../php-parser/lib/PhpParser/Node/Param.php | 50 +- .../php-parser/lib/PhpParser/Node/Scalar.php | 4 +- .../lib/PhpParser/Node/Scalar/DNumber.php | 18 +- .../lib/PhpParser/Node/Scalar/Encapsed.php | 18 +- .../Node/Scalar/EncapsedStringPart.php | 14 +- .../lib/PhpParser/Node/Scalar/LNumber.php | 23 +- .../lib/PhpParser/Node/Scalar/MagicConst.php | 12 +- .../Node/Scalar/MagicConst/Class_.php | 10 +- .../PhpParser/Node/Scalar/MagicConst/Dir.php | 10 +- .../PhpParser/Node/Scalar/MagicConst/File.php | 10 +- .../Node/Scalar/MagicConst/Function_.php | 10 +- .../PhpParser/Node/Scalar/MagicConst/Line.php | 10 +- .../Node/Scalar/MagicConst/Method.php | 10 +- .../Node/Scalar/MagicConst/Namespace_.php | 10 +- .../Node/Scalar/MagicConst/Trait_.php | 10 +- .../lib/PhpParser/Node/Scalar/String_.php | 56 +- .../php-parser/lib/PhpParser/Node/Stmt.php | 4 +- .../lib/PhpParser/Node/Stmt/Break_.php | 14 +- .../lib/PhpParser/Node/Stmt/Case_.php | 20 +- .../lib/PhpParser/Node/Stmt/Catch_.php | 29 +- .../lib/PhpParser/Node/Stmt/ClassConst.php | 59 +- .../lib/PhpParser/Node/Stmt/ClassLike.php | 81 +- .../lib/PhpParser/Node/Stmt/ClassMethod.php | 133 +- .../lib/PhpParser/Node/Stmt/Class_.php | 75 +- .../lib/PhpParser/Node/Stmt/Const_.php | 14 +- .../lib/PhpParser/Node/Stmt/Continue_.php | 14 +- .../PhpParser/Node/Stmt/DeclareDeclare.php | 24 +- .../lib/PhpParser/Node/Stmt/Declare_.php | 18 +- .../lib/PhpParser/Node/Stmt/Do_.php | 24 +- .../lib/PhpParser/Node/Stmt/Echo_.php | 14 +- .../lib/PhpParser/Node/Stmt/ElseIf_.php | 22 +- .../lib/PhpParser/Node/Stmt/Else_.php | 20 +- .../lib/PhpParser/Node/Stmt/EnumCase.php | 37 + .../lib/PhpParser/Node/Stmt/Enum_.php | 40 + .../lib/PhpParser/Node/Stmt/Expression.php | 33 + .../lib/PhpParser/Node/Stmt/Finally_.php | 20 +- .../lib/PhpParser/Node/Stmt/For_.php | 24 +- .../lib/PhpParser/Node/Stmt/Foreach_.php | 22 +- .../lib/PhpParser/Node/Stmt/Function_.php | 51 +- .../lib/PhpParser/Node/Stmt/Global_.php | 14 +- .../lib/PhpParser/Node/Stmt/Goto_.php | 23 +- .../lib/PhpParser/Node/Stmt/GroupUse.php | 14 +- .../lib/PhpParser/Node/Stmt/HaltCompiler.php | 14 +- .../lib/PhpParser/Node/Stmt/If_.php | 22 +- .../lib/PhpParser/Node/Stmt/InlineHTML.php | 14 +- .../lib/PhpParser/Node/Stmt/Interface_.php | 28 +- .../lib/PhpParser/Node/Stmt/Label.php | 23 +- .../lib/PhpParser/Node/Stmt/Namespace_.php | 22 +- .../lib/PhpParser/Node/Stmt/Nop.php | 10 +- .../lib/PhpParser/Node/Stmt/Property.php | 70 +- .../PhpParser/Node/Stmt/PropertyProperty.php | 24 +- .../lib/PhpParser/Node/Stmt/Return_.php | 14 +- .../lib/PhpParser/Node/Stmt/StaticVar.php | 25 +- .../lib/PhpParser/Node/Stmt/Static_.php | 14 +- .../lib/PhpParser/Node/Stmt/Switch_.php | 14 +- .../lib/PhpParser/Node/Stmt/Throw_.php | 16 +- .../lib/PhpParser/Node/Stmt/TraitUse.php | 15 +- .../Node/Stmt/TraitUseAdaptation.php | 6 +- .../Node/Stmt/TraitUseAdaptation/Alias.php | 30 +- .../Stmt/TraitUseAdaptation/Precedence.php | 24 +- .../lib/PhpParser/Node/Stmt/Trait_.php | 24 +- .../lib/PhpParser/Node/Stmt/TryCatch.php | 22 +- .../lib/PhpParser/Node/Stmt/Unset_.php | 14 +- .../lib/PhpParser/Node/Stmt/UseUse.php | 44 +- .../lib/PhpParser/Node/Stmt/Use_.php | 14 +- .../lib/PhpParser/Node/Stmt/While_.php | 22 +- .../lib/PhpParser/Node/UnionType.php | 28 + .../lib/PhpParser/Node/VarLikeIdentifier.php | 17 + .../PhpParser/Node/VariadicPlaceholder.php | 27 + .../php-parser/lib/PhpParser/NodeAbstract.php | 156 +- .../php-parser/lib/PhpParser/NodeDumper.php | 30 +- .../php-parser/lib/PhpParser/NodeFinder.php | 81 + .../lib/PhpParser/NodeTraverser.php | 191 +- .../lib/PhpParser/NodeTraverserInterface.php | 9 +- .../php-parser/lib/PhpParser/NodeVisitor.php | 8 +- .../PhpParser/NodeVisitor/CloningVisitor.php | 20 + .../PhpParser/NodeVisitor/FindingVisitor.php | 48 + .../NodeVisitor/FirstFindingVisitor.php | 50 + .../PhpParser/NodeVisitor/NameResolver.php | 237 +- .../NodeVisitor/NodeConnectingVisitor.php | 52 + .../NodeVisitor/ParentConnectingVisitor.php | 41 + .../lib/PhpParser/NodeVisitorAbstract.php | 23 +- lib/nikic/php-parser/lib/PhpParser/Parser.php | 11 +- .../lib/PhpParser/Parser/Multiple.php | 7 +- .../php-parser/lib/PhpParser/Parser/Php5.php | 5301 ++++++++--------- .../php-parser/lib/PhpParser/Parser/Php7.php | 5148 ++++++++-------- .../lib/PhpParser/Parser/Tokens.php | 254 +- .../lib/PhpParser/ParserAbstract.php | 572 +- .../lib/PhpParser/ParserFactory.php | 7 +- .../lib/PhpParser/PrettyPrinter/Standard.php | 480 +- .../lib/PhpParser/PrettyPrinterAbstract.php | 1406 ++++- .../php-parser/lib/PhpParser/Serializer.php | 18 - .../lib/PhpParser/Serializer/XML.php | 89 - .../php-parser/lib/PhpParser/Unserializer.php | 18 - .../lib/PhpParser/Unserializer/XML.php | 155 - lib/nikic/php-parser/lib/bootstrap.php | 6 - lib/nikic/php-parser/phpunit.xml.dist | 24 - lib/nikic/php-parser/test_old/run-php-src.sh | 4 - lib/nikic/php-parser/test_old/run.php | 220 - 288 files changed, 15609 insertions(+), 11148 deletions(-) delete mode 100644 lib/nikic/php-parser/.gitignore delete mode 100644 lib/nikic/php-parser/.travis.yml delete mode 100644 lib/nikic/php-parser/CHANGELOG.md delete mode 100644 lib/nikic/php-parser/UPGRADE-1.0.md delete mode 100644 lib/nikic/php-parser/UPGRADE-2.0.md delete mode 100644 lib/nikic/php-parser/UPGRADE-3.0.md delete mode 100644 lib/nikic/php-parser/doc/0_Introduction.markdown delete mode 100644 lib/nikic/php-parser/doc/2_Usage_of_basic_components.markdown delete mode 100644 lib/nikic/php-parser/doc/3_Other_node_tree_representations.markdown delete mode 100644 lib/nikic/php-parser/doc/4_Code_generation.markdown delete mode 100644 lib/nikic/php-parser/doc/component/Error_handling.markdown delete mode 100644 lib/nikic/php-parser/doc/component/Lexer.markdown create mode 100644 lib/nikic/php-parser/grammar/phpyLang.php delete mode 100644 lib/nikic/php-parser/lib/PhpParser/Autoloader.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Builder/Enum_.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php delete mode 100644 lib/nikic/php-parser/lib/PhpParser/BuilderAbstract.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/BuilderHelpers.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Internal/Differ.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/JsonDecoder.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/NameContext.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Attribute.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/ComplexType.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Identifier.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/MatchArm.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/UnionType.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/NodeFinder.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php create mode 100644 lib/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php delete mode 100644 lib/nikic/php-parser/lib/PhpParser/Serializer.php delete mode 100644 lib/nikic/php-parser/lib/PhpParser/Serializer/XML.php delete mode 100644 lib/nikic/php-parser/lib/PhpParser/Unserializer.php delete mode 100644 lib/nikic/php-parser/lib/PhpParser/Unserializer/XML.php delete mode 100644 lib/nikic/php-parser/lib/bootstrap.php delete mode 100644 lib/nikic/php-parser/phpunit.xml.dist delete mode 100755 lib/nikic/php-parser/test_old/run-php-src.sh delete mode 100644 lib/nikic/php-parser/test_old/run.php diff --git a/composer.json b/composer.json index 707ad5051..be32dcb4b 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "ext-mysqli": "*", "ext-soap": "*", "combodo/tcpdf": "~6.4.4", - "nikic/php-parser": "^3.1", + "nikic/php-parser": "~4.13.2", "pear/archive_tar": "1.4.14", "pelago/emogrifier": "2.1.0", "scssphp/scssphp": "1.0.6", diff --git a/composer.lock b/composer.lock index f6e6277e3..b36f69a74 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": "8efc1677968f1aeda2977543982242e6", + "content-hash": "2dff3cf0e45834a895b6f81f1af4016c", "packages": [ { "name": "combodo/tcpdf", @@ -86,24 +86,25 @@ }, { "name": "nikic/php-parser", - "version": "v3.1.5", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.5" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -111,7 +112,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.9-dev" } }, "autoload": { @@ -135,9 +136,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v3.1.5" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2018-02-28T20:30:58+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "paragonie/random_compat", diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index 0961e54e0..6cc6fef1e 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -390,12 +390,14 @@ return array( 'Pelago\\Emogrifier\\HtmlProcessor\\AbstractHtmlProcessor' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/AbstractHtmlProcessor.php', 'Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/CssToAttributeConverter.php', 'Pelago\\Emogrifier\\HtmlProcessor\\HtmlNormalizer' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/HtmlNormalizer.php', - 'PhpParser\\Autoloader' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Autoloader.php', 'PhpParser\\Builder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder.php', - 'PhpParser\\BuilderAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderAbstract.php', 'PhpParser\\BuilderFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', + 'PhpParser\\BuilderHelpers' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderHelpers.php', + 'PhpParser\\Builder\\ClassConst' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php', 'PhpParser\\Builder\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Class_.php', 'PhpParser\\Builder\\Declaration' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Declaration.php', + 'PhpParser\\Builder\\EnumCase' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php', + 'PhpParser\\Builder\\Enum_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Enum_.php', 'PhpParser\\Builder\\FunctionLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php', 'PhpParser\\Builder\\Function_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Function_.php', 'PhpParser\\Builder\\Interface_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Interface_.php', @@ -403,35 +405,69 @@ return array( 'PhpParser\\Builder\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php', 'PhpParser\\Builder\\Param' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Param.php', 'PhpParser\\Builder\\Property' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Property.php', + 'PhpParser\\Builder\\TraitUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php', + 'PhpParser\\Builder\\TraitUseAdaptation' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php', 'PhpParser\\Builder\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Trait_.php', 'PhpParser\\Builder\\Use_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Use_.php', 'PhpParser\\Comment' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Comment.php', 'PhpParser\\Comment\\Doc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Comment/Doc.php', + 'PhpParser\\ConstExprEvaluationException' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php', + 'PhpParser\\ConstExprEvaluator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php', 'PhpParser\\Error' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Error.php', 'PhpParser\\ErrorHandler' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ErrorHandler.php', 'PhpParser\\ErrorHandler\\Collecting' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php', 'PhpParser\\ErrorHandler\\Throwing' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php', + 'PhpParser\\Internal\\DiffElem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php', + 'PhpParser\\Internal\\Differ' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/Differ.php', + 'PhpParser\\Internal\\PrintableNewAnonClassNode' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php', + 'PhpParser\\Internal\\TokenStream' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php', + 'PhpParser\\JsonDecoder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/JsonDecoder.php', 'PhpParser\\Lexer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer.php', 'PhpParser\\Lexer\\Emulative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php', + 'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', + 'PhpParser\\NameContext' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NameContext.php', 'PhpParser\\Node' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node.php', 'PhpParser\\NodeAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php', 'PhpParser\\NodeDumper' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeDumper.php', + 'PhpParser\\NodeFinder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeFinder.php', 'PhpParser\\NodeTraverser' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeTraverser.php', 'PhpParser\\NodeTraverserInterface' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php', 'PhpParser\\NodeVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php', 'PhpParser\\NodeVisitorAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php', + 'PhpParser\\NodeVisitor\\CloningVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php', + 'PhpParser\\NodeVisitor\\FindingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php', + 'PhpParser\\NodeVisitor\\FirstFindingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php', 'PhpParser\\NodeVisitor\\NameResolver' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php', + 'PhpParser\\NodeVisitor\\NodeConnectingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php', + 'PhpParser\\NodeVisitor\\ParentConnectingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php', 'PhpParser\\Node\\Arg' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Arg.php', + 'PhpParser\\Node\\Attribute' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Attribute.php', + 'PhpParser\\Node\\AttributeGroup' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php', + 'PhpParser\\Node\\ComplexType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/ComplexType.php', 'PhpParser\\Node\\Const_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Const_.php', 'PhpParser\\Node\\Expr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr.php', 'PhpParser\\Node\\Expr\\ArrayDimFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php', 'PhpParser\\Node\\Expr\\ArrayItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php', 'PhpParser\\Node\\Expr\\Array_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php', + 'PhpParser\\Node\\Expr\\ArrowFunction' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php', 'PhpParser\\Node\\Expr\\Assign' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php', 'PhpParser\\Node\\Expr\\AssignOp' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php', 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Coalesce' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php', 'PhpParser\\Node\\Expr\\AssignOp\\Concat' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php', 'PhpParser\\Node\\Expr\\AssignOp\\Div' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php', 'PhpParser\\Node\\Expr\\AssignOp\\Minus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php', @@ -472,6 +508,7 @@ return array( 'PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php', 'PhpParser\\Node\\Expr\\BitwiseNot' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php', 'PhpParser\\Node\\Expr\\BooleanNot' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php', + 'PhpParser\\Node\\Expr\\CallLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php', 'PhpParser\\Node\\Expr\\Cast' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php', 'PhpParser\\Node\\Expr\\Cast\\Array_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php', 'PhpParser\\Node\\Expr\\Cast\\Bool_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php', @@ -495,8 +532,11 @@ return array( 'PhpParser\\Node\\Expr\\Instanceof_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php', 'PhpParser\\Node\\Expr\\Isset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php', 'PhpParser\\Node\\Expr\\List_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php', + 'PhpParser\\Node\\Expr\\Match_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php', 'PhpParser\\Node\\Expr\\MethodCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php', 'PhpParser\\Node\\Expr\\New_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php', + 'PhpParser\\Node\\Expr\\NullsafeMethodCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php', + 'PhpParser\\Node\\Expr\\NullsafePropertyFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php', 'PhpParser\\Node\\Expr\\PostDec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php', 'PhpParser\\Node\\Expr\\PostInc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php', 'PhpParser\\Node\\Expr\\PreDec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php', @@ -507,12 +547,16 @@ return array( 'PhpParser\\Node\\Expr\\StaticCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php', 'PhpParser\\Node\\Expr\\StaticPropertyFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php', 'PhpParser\\Node\\Expr\\Ternary' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php', + 'PhpParser\\Node\\Expr\\Throw_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php', 'PhpParser\\Node\\Expr\\UnaryMinus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php', 'PhpParser\\Node\\Expr\\UnaryPlus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php', 'PhpParser\\Node\\Expr\\Variable' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php', 'PhpParser\\Node\\Expr\\YieldFrom' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php', 'PhpParser\\Node\\Expr\\Yield_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php', 'PhpParser\\Node\\FunctionLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php', + 'PhpParser\\Node\\Identifier' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Identifier.php', + 'PhpParser\\Node\\IntersectionType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php', + 'PhpParser\\Node\\MatchArm' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/MatchArm.php', 'PhpParser\\Node\\Name' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name.php', 'PhpParser\\Node\\Name\\FullyQualified' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php', 'PhpParser\\Node\\Name\\Relative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php', @@ -549,6 +593,9 @@ return array( 'PhpParser\\Node\\Stmt\\Echo_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php', 'PhpParser\\Node\\Stmt\\ElseIf_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php', 'PhpParser\\Node\\Stmt\\Else_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php', + 'PhpParser\\Node\\Stmt\\EnumCase' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php', + 'PhpParser\\Node\\Stmt\\Enum_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php', + 'PhpParser\\Node\\Stmt\\Expression' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php', 'PhpParser\\Node\\Stmt\\Finally_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php', 'PhpParser\\Node\\Stmt\\For_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php', 'PhpParser\\Node\\Stmt\\Foreach_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php', @@ -580,6 +627,9 @@ return array( 'PhpParser\\Node\\Stmt\\UseUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php', 'PhpParser\\Node\\Stmt\\Use_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php', 'PhpParser\\Node\\Stmt\\While_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php', + 'PhpParser\\Node\\UnionType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/UnionType.php', + 'PhpParser\\Node\\VarLikeIdentifier' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php', + 'PhpParser\\Node\\VariadicPlaceholder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php', 'PhpParser\\Parser' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser.php', 'PhpParser\\ParserAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php', 'PhpParser\\ParserFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserFactory.php', @@ -589,10 +639,6 @@ return array( 'PhpParser\\Parser\\Tokens' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php', 'PhpParser\\PrettyPrinterAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php', 'PhpParser\\PrettyPrinter\\Standard' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php', - 'PhpParser\\Serializer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Serializer.php', - 'PhpParser\\Serializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php', - 'PhpParser\\Unserializer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer.php', - 'PhpParser\\Unserializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php', 'PortalDispatcher' => $baseDir . '/application/portaldispatcher.class.inc.php', 'PortalURLMaker' => $baseDir . '/application/applicationcontext.class.inc.php', 'PrintableDataTable' => $baseDir . '/application/datatable.class.inc.php', diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php index 8afe4c51d..642367c39 100644 --- a/lib/composer/autoload_static.php +++ b/lib/composer/autoload_static.php @@ -620,12 +620,14 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'Pelago\\Emogrifier\\HtmlProcessor\\AbstractHtmlProcessor' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/AbstractHtmlProcessor.php', 'Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/CssToAttributeConverter.php', 'Pelago\\Emogrifier\\HtmlProcessor\\HtmlNormalizer' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/HtmlNormalizer.php', - 'PhpParser\\Autoloader' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Autoloader.php', 'PhpParser\\Builder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder.php', - 'PhpParser\\BuilderAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderAbstract.php', 'PhpParser\\BuilderFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', + 'PhpParser\\BuilderHelpers' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderHelpers.php', + 'PhpParser\\Builder\\ClassConst' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php', 'PhpParser\\Builder\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Class_.php', 'PhpParser\\Builder\\Declaration' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Declaration.php', + 'PhpParser\\Builder\\EnumCase' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php', + 'PhpParser\\Builder\\Enum_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Enum_.php', 'PhpParser\\Builder\\FunctionLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php', 'PhpParser\\Builder\\Function_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Function_.php', 'PhpParser\\Builder\\Interface_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Interface_.php', @@ -633,35 +635,69 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'PhpParser\\Builder\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php', 'PhpParser\\Builder\\Param' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Param.php', 'PhpParser\\Builder\\Property' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Property.php', + 'PhpParser\\Builder\\TraitUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php', + 'PhpParser\\Builder\\TraitUseAdaptation' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php', 'PhpParser\\Builder\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Trait_.php', 'PhpParser\\Builder\\Use_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Use_.php', 'PhpParser\\Comment' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Comment.php', 'PhpParser\\Comment\\Doc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Comment/Doc.php', + 'PhpParser\\ConstExprEvaluationException' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php', + 'PhpParser\\ConstExprEvaluator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php', 'PhpParser\\Error' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Error.php', 'PhpParser\\ErrorHandler' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ErrorHandler.php', 'PhpParser\\ErrorHandler\\Collecting' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php', 'PhpParser\\ErrorHandler\\Throwing' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php', + 'PhpParser\\Internal\\DiffElem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php', + 'PhpParser\\Internal\\Differ' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/Differ.php', + 'PhpParser\\Internal\\PrintableNewAnonClassNode' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php', + 'PhpParser\\Internal\\TokenStream' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php', + 'PhpParser\\JsonDecoder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/JsonDecoder.php', 'PhpParser\\Lexer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer.php', 'PhpParser\\Lexer\\Emulative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php', + 'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', + 'PhpParser\\NameContext' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NameContext.php', 'PhpParser\\Node' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node.php', 'PhpParser\\NodeAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php', 'PhpParser\\NodeDumper' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeDumper.php', + 'PhpParser\\NodeFinder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeFinder.php', 'PhpParser\\NodeTraverser' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeTraverser.php', 'PhpParser\\NodeTraverserInterface' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php', 'PhpParser\\NodeVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php', 'PhpParser\\NodeVisitorAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php', + 'PhpParser\\NodeVisitor\\CloningVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php', + 'PhpParser\\NodeVisitor\\FindingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php', + 'PhpParser\\NodeVisitor\\FirstFindingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php', 'PhpParser\\NodeVisitor\\NameResolver' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php', + 'PhpParser\\NodeVisitor\\NodeConnectingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php', + 'PhpParser\\NodeVisitor\\ParentConnectingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php', 'PhpParser\\Node\\Arg' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Arg.php', + 'PhpParser\\Node\\Attribute' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Attribute.php', + 'PhpParser\\Node\\AttributeGroup' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php', + 'PhpParser\\Node\\ComplexType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/ComplexType.php', 'PhpParser\\Node\\Const_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Const_.php', 'PhpParser\\Node\\Expr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr.php', 'PhpParser\\Node\\Expr\\ArrayDimFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php', 'PhpParser\\Node\\Expr\\ArrayItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php', 'PhpParser\\Node\\Expr\\Array_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php', + 'PhpParser\\Node\\Expr\\ArrowFunction' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php', 'PhpParser\\Node\\Expr\\Assign' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php', 'PhpParser\\Node\\Expr\\AssignOp' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php', 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php', 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php', 'PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php', + 'PhpParser\\Node\\Expr\\AssignOp\\Coalesce' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php', 'PhpParser\\Node\\Expr\\AssignOp\\Concat' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php', 'PhpParser\\Node\\Expr\\AssignOp\\Div' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php', 'PhpParser\\Node\\Expr\\AssignOp\\Minus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php', @@ -702,6 +738,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php', 'PhpParser\\Node\\Expr\\BitwiseNot' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php', 'PhpParser\\Node\\Expr\\BooleanNot' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php', + 'PhpParser\\Node\\Expr\\CallLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php', 'PhpParser\\Node\\Expr\\Cast' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php', 'PhpParser\\Node\\Expr\\Cast\\Array_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php', 'PhpParser\\Node\\Expr\\Cast\\Bool_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php', @@ -725,8 +762,11 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'PhpParser\\Node\\Expr\\Instanceof_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php', 'PhpParser\\Node\\Expr\\Isset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php', 'PhpParser\\Node\\Expr\\List_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php', + 'PhpParser\\Node\\Expr\\Match_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php', 'PhpParser\\Node\\Expr\\MethodCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php', 'PhpParser\\Node\\Expr\\New_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php', + 'PhpParser\\Node\\Expr\\NullsafeMethodCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php', + 'PhpParser\\Node\\Expr\\NullsafePropertyFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php', 'PhpParser\\Node\\Expr\\PostDec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php', 'PhpParser\\Node\\Expr\\PostInc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php', 'PhpParser\\Node\\Expr\\PreDec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php', @@ -737,12 +777,16 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'PhpParser\\Node\\Expr\\StaticCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php', 'PhpParser\\Node\\Expr\\StaticPropertyFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php', 'PhpParser\\Node\\Expr\\Ternary' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php', + 'PhpParser\\Node\\Expr\\Throw_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php', 'PhpParser\\Node\\Expr\\UnaryMinus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php', 'PhpParser\\Node\\Expr\\UnaryPlus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php', 'PhpParser\\Node\\Expr\\Variable' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php', 'PhpParser\\Node\\Expr\\YieldFrom' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php', 'PhpParser\\Node\\Expr\\Yield_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php', 'PhpParser\\Node\\FunctionLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php', + 'PhpParser\\Node\\Identifier' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Identifier.php', + 'PhpParser\\Node\\IntersectionType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php', + 'PhpParser\\Node\\MatchArm' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/MatchArm.php', 'PhpParser\\Node\\Name' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name.php', 'PhpParser\\Node\\Name\\FullyQualified' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php', 'PhpParser\\Node\\Name\\Relative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php', @@ -779,6 +823,9 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'PhpParser\\Node\\Stmt\\Echo_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php', 'PhpParser\\Node\\Stmt\\ElseIf_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php', 'PhpParser\\Node\\Stmt\\Else_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php', + 'PhpParser\\Node\\Stmt\\EnumCase' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php', + 'PhpParser\\Node\\Stmt\\Enum_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php', + 'PhpParser\\Node\\Stmt\\Expression' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php', 'PhpParser\\Node\\Stmt\\Finally_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php', 'PhpParser\\Node\\Stmt\\For_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php', 'PhpParser\\Node\\Stmt\\Foreach_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php', @@ -810,6 +857,9 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'PhpParser\\Node\\Stmt\\UseUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php', 'PhpParser\\Node\\Stmt\\Use_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php', 'PhpParser\\Node\\Stmt\\While_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php', + 'PhpParser\\Node\\UnionType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/UnionType.php', + 'PhpParser\\Node\\VarLikeIdentifier' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php', + 'PhpParser\\Node\\VariadicPlaceholder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php', 'PhpParser\\Parser' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser.php', 'PhpParser\\ParserAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php', 'PhpParser\\ParserFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserFactory.php', @@ -819,10 +869,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'PhpParser\\Parser\\Tokens' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php', 'PhpParser\\PrettyPrinterAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php', 'PhpParser\\PrettyPrinter\\Standard' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php', - 'PhpParser\\Serializer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Serializer.php', - 'PhpParser\\Serializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php', - 'PhpParser\\Unserializer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer.php', - 'PhpParser\\Unserializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php', 'PortalDispatcher' => __DIR__ . '/../..' . '/application/portaldispatcher.class.inc.php', 'PortalURLMaker' => __DIR__ . '/../..' . '/application/applicationcontext.class.inc.php', 'PrintableDataTable' => __DIR__ . '/../..' . '/application/datatable.class.inc.php', diff --git a/lib/composer/installed.json b/lib/composer/installed.json index 2e88f259b..4ada053c3 100644 --- a/lib/composer/installed.json +++ b/lib/composer/installed.json @@ -83,34 +83,35 @@ }, { "name": "nikic/php-parser", - "version": "v3.1.5", - "version_normalized": "3.1.5.0", + "version": "v4.13.2", + "version_normalized": "4.13.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.5" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, - "time": "2018-02-28T20:30:58+00:00", + "time": "2021-11-30T19:35:32+00:00", "bin": [ "bin/php-parse" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.9-dev" } }, "installation-source": "dist", @@ -133,6 +134,10 @@ "parser", "php" ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + }, "install-path": "../nikic/php-parser" }, { diff --git a/lib/composer/installed.php b/lib/composer/installed.php index fbe3522ca..e46a0ff33 100644 --- a/lib/composer/installed.php +++ b/lib/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '33afa208a306f8486092ad9520344138ce45e780', + 'reference' => '1882b696c58d1e8e3d687196b0974e6b9ec64312', 'name' => '__root__', 'dev' => true, ), @@ -16,7 +16,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '33afa208a306f8486092ad9520344138ce45e780', + 'reference' => '1882b696c58d1e8e3d687196b0974e6b9ec64312', 'dev_requirement' => false, ), 'combodo/tcpdf' => array( @@ -29,12 +29,12 @@ 'dev_requirement' => false, ), 'nikic/php-parser' => array( - 'pretty_version' => 'v3.1.5', - 'version' => '3.1.5.0', + 'pretty_version' => 'v4.13.2', + 'version' => '4.13.2.0', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), - 'reference' => 'bb87e28e7d7b8d9a7fda231d37457c9210faf6ce', + 'reference' => '210577fe3cf7badcc5814d99455df46564f3c077', 'dev_requirement' => false, ), 'paragonie/random_compat' => array( diff --git a/lib/nikic/php-parser/.gitignore b/lib/nikic/php-parser/.gitignore deleted file mode 100644 index 8c7db2a6e..000000000 --- a/lib/nikic/php-parser/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -vendor/ -composer.lock -grammar/kmyacc.exe -grammar/y.output diff --git a/lib/nikic/php-parser/.travis.yml b/lib/nikic/php-parser/.travis.yml deleted file mode 100644 index 9cd00253e..000000000 --- a/lib/nikic/php-parser/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: php -dist: trusty -sudo: false - -cache: - directories: - - $HOME/.composer/cache - -php: - - 5.5 - - 5.6 - - 7.0 - - nightly - - hhvm - -install: - - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then composer require satooshi/php-coveralls '~1.0'; fi - - composer install --prefer-dist - -matrix: - allow_failures: - - php: nightly - fast_finish: true - -script: - - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; else vendor/bin/phpunit; fi - - if [ $TRAVIS_PHP_VERSION = '7.0' ]; then test_old/run-php-src.sh; fi - -after_success: - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then php vendor/bin/coveralls; fi - diff --git a/lib/nikic/php-parser/CHANGELOG.md b/lib/nikic/php-parser/CHANGELOG.md deleted file mode 100644 index c2d953393..000000000 --- a/lib/nikic/php-parser/CHANGELOG.md +++ /dev/null @@ -1,422 +0,0 @@ -Version 3.1.6-dev ------------------ - -Nothing yet. - -Version 3.1.5 (2018-02-28) --------------------------- - -### Fixed - -* Fixed duplicate comment assignment in switch statements. (#469) -* Improve compatibility with PHP-Scoper. (#477) - -Version 3.1.4 (2018-01-25) --------------------------- - -### Fixed - -* Fixed pretty printing of `-(-$x)` and `+(+$x)`. (#459) - -Version 3.1.3 (2017-12-26) --------------------------- - -### Fixed - -* Improve compatibility with php-scoper, by supporting prefixed namespaces in - `NodeAbstract::getType()`. - -Version 3.1.2 (2017-11-04) --------------------------- - -### Fixed - -* Comments on empty blocks are now preserved on a `Stmt\Nop` node. (#382) - -### Added - -* Added `kind` attribute for `Stmt\Namespace_` node, which is one of `KIND_SEMICOLON` or - `KIND_BRACED`. (#417) -* Added `setDocComment()` method to namespace builder. (#437) - -Version 3.1.1 (2017-09-02) --------------------------- - -### Fixed - -* Fixed syntax error on comment after brace-style namespace declaration. (#412) -* Added support for TraitUse statements in trait builder. (#413) - -Version 3.1.0 (2017-07-28) --------------------------- - -### Added - -* [PHP 7.2] Added support for trailing comma in group use statements. -* [PHP 7.2] Added support for `object` type. This means `object` types will now be represented as a - builtin type (a simple `"object"` string), rather than a class `Name`. - -### Fixed - -* Floating-point numbers are now printed correctly if the LC_NUMERIC locale uses a comma as decimal - separator. - -### Changed - -* `Name::$parts` is no longer deprecated. - -Version 3.0.6 (2017-06-28) --------------------------- - -### Fixed - -* Fixed the spelling of `Class_::VISIBILITY_MODIFIER_MASK`. The previous spelling of - `Class_::VISIBILITY_MODIFER_MASK` is preserved for backwards compatibility. -* The pretty printing will now preserve comments inside array literals and function calls by - printing the array items / function arguments on separate lines. Array literals and functions that - do not contain comments are not affected. - -### Added - -* Added `Builder\Param::makeVariadic()`. - -### Deprecated - -* The `Node::setLine()` method has been deprecated. - -Version 3.0.5 (2017-03-05) --------------------------- - -### Fixed - -* Name resolution of `NullableType`s is now performed earlier, so that a fully resolved signature is - available when a function is entered. (#360) -* `Error` nodes are now considered empty, while previously they extended until the token where the - error occurred. This made some nodes larger than expected. (#359) -* Fixed notices being thrown during error recovery in some situations. (#362) - -Version 3.0.4 (2017-02-10) --------------------------- - -### Fixed - -* Fixed some extensibility issues in pretty printer (`pUseType()` is now public and `pPrec()` calls - into `p()`, instead of directly dispatching to the type-specific printing method). -* Fixed notice in `bin/php-parse` script. - -### Added - -* Error recovery from missing semicolons is now supported in more cases. -* Error recovery from trailing commas in positions where PHP does not support them is now supported. - -Version 3.0.3 (2017-02-03) --------------------------- - -### Fixed - -* In `"$foo[0]"` the `0` is now parsed as an `LNumber` rather than `String`. (#325) -* Ensure integers and floats are always pretty printed preserving semantics, even if the particular - value can only be manually constructed. -* Throw a `LogicException` when trying to pretty-print an `Error` node. Previously this resulted in - an undefined method exception or fatal error. - -### Added - -* [PHP 7.1] Added support for negative interpolated offsets: `"$foo[-1]"` -* Added `preserveOriginalNames` option to `NameResolver`. If this option is enabled, an - `originalName` attribute, containing the unresolved name, will be added to each resolved name. -* Added `php-parse --with-positions` option, which dumps nodes with position information. - -### Deprecated - -* The XML serializer has been deprecated. In particular, the classes `Serializer\XML`, - `Unserializer\XML`, as well as the interfaces `Serializer` and `Unserializer` are deprecated. - -Version 3.0.2 (2016-12-06) --------------------------- - -### Fixed - -* Fixed name resolution of nullable types. (#324) -* Fixed pretty-printing of nullable types. - -Version 3.0.1 (2016-12-01) --------------------------- - -### Fixed - -* Fixed handling of nested `list()`s: If the nested list was unkeyed, it was directly included in - the list items. If it was keyed, it was wrapped in `ArrayItem`. Now nested `List_` nodes are - always wrapped in `ArrayItem`s. (#321) - -Version 3.0.0 (2016-11-30) --------------------------- - -### Added - -* Added support for dumping node positions in the NodeDumper through the `dumpPositions` option. -* Added error recovery support for `$`, `new`, `Foo::`. - -Version 3.0.0-beta2 (2016-10-29) --------------------------------- - -This release primarily improves our support for error recovery. - -### Added - -* Added `Node::setDocComment()` method. -* Added `Error::getMessageWithColumnInfo()` method. -* Added support for recovery from lexer errors. -* Added support for recovering from "special" errors (i.e. non-syntax parse errors). -* Added precise location information for lexer errors. -* Added `ErrorHandler` interface, and `ErrorHandler\Throwing` and `ErrorHandler\Collecting` as - specific implementations. These provide a general mechanism for handling error recovery. -* Added optional `ErrorHandler` argument to `Parser::parse()`, `Lexer::startLexing()` and - `NameResolver::__construct()`. -* The `NameResolver` now adds a `namespacedName` attribute on name nodes that cannot be statically - resolved (unqualified unaliased function or constant names in namespaces). - -### Fixed - -* Fixed attribute assignment for `GroupUse` prefix and variables in interpolated strings. - -### Changed - -* The constants on `NameTraverserInterface` have been moved into the `NameTraverser` class. -* Due to the error handling changes, the `Parser` interface and `Lexer` API have changed. -* The emulative lexer now directly postprocesses tokens, instead of using `~__EMU__~` sequences. - This changes the protected API of the lexer. -* The `Name::slice()` method now returns `null` for empty slices, previously `new Name([])` was - used. `Name::concat()` now also supports concatenation with `null`. - -### Removed - -* Removed `Name::append()` and `Name::prepend()`. These mutable methods have been superseded by - the immutable `Name::concat()`. -* Removed `Error::getRawLine()` and `Error::setRawLine()`. These methods have been superseded by - `Error::getStartLine()` and `Error::setStartLine()`. -* Removed support for node cloning in the `NodeTraverser`. -* Removed `$separator` argument from `Name::toString()`. -* Removed `throw_on_error` parser option and `Parser::getErrors()` method. Use the `ErrorHandler` - mechanism instead. - -Version 3.0.0-beta1 (2016-09-16) --------------------------------- - -### Added - -* [7.1] Function/method and parameter builders now support PHP 7.1 type hints (void, iterable and - nullable types). -* Nodes and Comments now implement `JsonSerializable`. The node kind is stored in a `nodeType` - property. -* The `InlineHTML` node now has an `hasLeadingNewline` attribute, that specifies whether the - preceding closing tag contained a newline. The pretty printer honors this attribute. -* Partial parsing of `$obj->` (with missing property name) is now supported in error recovery mode. -* The error recovery mode is now exposed in the `php-parse` script through the `--with-recovery` - or `-r` flags. - -The following changes are also part of PHP-Parser 2.1.1: - -* The PHP 7 parser will now generate a parse error for `$var =& new Obj` assignments. -* Comments on free-standing code blocks will now be retained as comments on the first statement in - the code block. - -Version 3.0.0-alpha1 (2016-07-25) ---------------------------------- - -### Added - -* [7.1] Added support for `void` and `iterable` types. These will now be represented as strings - (instead of `Name` instances) similar to other builtin types. -* [7.1] Added support for class constant visibility. The `ClassConst` node now has a `flags` subnode - holding the visibility modifier, as well as `isPublic()`, `isProtected()` and `isPrivate()` - methods. The constructor changed to accept the additional subnode. -* [7.1] Added support for nullable types. These are represented using a new `NullableType` node - with a single `type` subnode. -* [7.1] Added support for short array destructuring syntax. This means that `Array` nodes may now - appear as the left-hand-side of assignments and foreach value targets. Additionally the array - items may now contain `null` values if elements are skipped. -* [7.1] Added support for keys in list() destructuring. The `List` subnode `vars` has been renamed - to `items` and now contains `ArrayItem`s instead of plain variables. -* [7.1] Added support for multi-catch. The `Catch` subnode `type` has been renamed to `types` and - is now an array of `Name`s. -* `Name::slice()` now supports lengths and negative offsets. This brings it in line with - `array_slice()` functionality. - -### Changed - -Due to PHP 7.1 support additions described above, the node structure changed as follows: - -* `void` and `iterable` types are now stored as strings if the PHP 7 parser is used. -* The `ClassConst` constructor changed to accept an additional `flags` subnode. -* The `Array` subnode `items` may now contain `null` elements (destructuring). -* The `List` subnode `vars` has been renamed to `items` and now contains `ArrayItem`s instead of - plain variables. -* The `Catch` subnode `type` has been renamed to `types` and is now an array of `Name`s. - -Additionally the following changes were made: - -* The `type` subnode on `Class`, `ClassMethod` and `Property` has been renamed to `flags`. The - `type` subnode has retained for backwards compatibility and is populated to the same value as - `flags`. However, writes to `type` will not update `flags`. -* The `TryCatch` subnode `finallyStmts` has been replaced with a `finally` subnode that holds an - explicit `Finally` node. This allows for more accurate attribute assignment. -* The `Trait` constructor now has the same form as the `Class` and `Interface` constructors: It - takes an array of subnodes. Unlike classes/interfaces, traits can only have a `stmts` subnode. -* The `NodeDumper` now prints class/method/property/constant modifiers, as well as the include and - use type in a textual representation, instead of only showing the number. -* All methods on `PrettyPrinter\Standard` are now protected. Previoulsy most of them were public. - -### Removed - -* Removed support for running on PHP 5.4. It is however still possible to parse PHP 5.2-5.4 code - while running on a newer version. -* The deprecated `Comment::setLine()` and `Comment::setText()` methods have been removed. -* The deprecated `Name::set()`, `Name::setFirst()` and `Name::setLast()` methods have been removed. - -Version 2.1.1 (2016-09-16) --------------------------- - -### Changed - -* The pretty printer will now escape all control characters in the range `\x00-\x1F` inside double - quoted strings. If no special escape sequence is available, an octal escape will be used. -* The quality of the error recovery has been improved. In particular unterminated expressions should - be handled more gracefully. -* The PHP 7 parser will now generate a parse error for `$var =& new Obj` assignments. -* Comments on free-standing code blocks will no be retained as comments on the first statement in - the code block. - -Version 2.1.0 (2016-04-19) --------------------------- - -### Fixed - -* Properly support `B""` strings (with uppercase `B`) in a number of places. -* Fixed reformatting of indented parts in a certain non-standard comment style. - -### Added - -* Added `dumpComments` option to node dumper, to enable dumping of comments associated with nodes. -* Added `Stmt\Nop` node, that is used to collect comments located at the end of a block or at the - end of a file (without a following node with which they could otherwise be associated). -* Added `kind` attribute to `Expr\Exit` to distinguish between `exit` and `die`. -* Added `kind` attribute to `Scalar\LNumber` to distinguish between decimal, binary, octal and - hexadecimal numbers. -* Added `kind` attribtue to `Expr\Array` to distinguish between `array()` and `[]`. -* Added `kind` attribute to `Scalar\String` and `Scalar\Encapsed` to distinguish between - single-quoted, double-quoted, heredoc and nowdoc string. -* Added `docLabel` attribute to `Scalar\String` and `Scalar\Encapsed`, if it is a heredoc or - nowdoc string. -* Added start file offset information to `Comment` nodes. -* Added `setReturnType()` method to function and method builders. -* Added `-h` and `--help` options to `php-parse` script. - -### Changed - -* Invalid octal literals now throw a parse error in PHP 7 mode. -* The pretty printer takes all the new attributes mentioned in the previous section into account. -* The protected `AbstractPrettyPrinter::pComments()` method no longer returns a trailing newline. -* The bundled autoloader supports library files being stored in a different directory than - `PhpParser` for easier downstream distribution. - -### Deprecated - -* The `Comment::setLine()` and `Comment::setText()` methods have been deprecated. Construct new - objects instead. - -### Removed - -* The internal (but public) method `Scalar\LNumber::parse()` has been removed. A non-internal - `LNumber::fromString()` method has been added instead. - -Version 2.0.1 (2016-02-28) --------------------------- - -### Fixed - -* `declare() {}` and `declare();` are not semantically equivalent and will now result in different - ASTs. The format case will have an empty `stmts` array, while the latter will set `stmts` to - `null`. -* Magic constants are now supported as semi-reserved keywords. -* A shebang line like `#!/usr/bin/env php` is now allowed at the start of a namespaced file. - Previously this generated an exception. -* The `prettyPrintFile()` method will not strip a trailing `?>` from the raw data that follows a - `__halt_compiler()` statement. -* The `prettyPrintFile()` method will not strip an opening `slice()` which takes a subslice of a name. - -### Changed - -* `PhpParser\Parser` is now an interface, implemented by `Parser\Php5`, `Parser\Php7` and - `Parser\Multiple`. The `Multiple` parser will try multiple parsers, until one succeeds. -* Token constants are now defined on `PhpParser\Parser\Tokens` rather than `PhpParser\Parser`. -* The `Name->set()`, `Name->append()`, `Name->prepend()` and `Name->setFirst()` methods are - deprecated in favor of `Name::concat()` and `Name->slice()`. -* The `NodeTraverser` no longer clones nodes by default. The old behavior can be restored by - passing `true` to the constructor. -* The constructor for `Scalar` nodes no longer has a default value. E.g. `new LNumber()` should now - be written as `new LNumber(0)`. - ---- - -**This changelog only includes changes from the 2.0 series. For older changes see the -[1.x series changelog](https://github.com/nikic/PHP-Parser/blob/1.x/CHANGELOG.md) and the -[0.9 series changelog](https://github.com/nikic/PHP-Parser/blob/0.9/CHANGELOG.md).** \ No newline at end of file diff --git a/lib/nikic/php-parser/LICENSE b/lib/nikic/php-parser/LICENSE index 920cc5b1f..2e5671835 100644 --- a/lib/nikic/php-parser/LICENSE +++ b/lib/nikic/php-parser/LICENSE @@ -1,31 +1,29 @@ -Copyright (c) 2011-2018 by Nikita Popov. +BSD 3-Clause License -Some rights reserved. +Copyright (c) 2011, Nikita Popov +All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: +modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/nikic/php-parser/README.md b/lib/nikic/php-parser/README.md index 2f62754ce..e5b26bf5c 100644 --- a/lib/nikic/php-parser/README.md +++ b/lib/nikic/php-parser/README.md @@ -1,99 +1,225 @@ PHP Parser ========== -[![Build Status](https://travis-ci.org/nikic/PHP-Parser.svg?branch=master)](https://travis-ci.org/nikic/PHP-Parser) [![Coverage Status](https://coveralls.io/repos/github/nikic/PHP-Parser/badge.svg?branch=master)](https://coveralls.io/github/nikic/PHP-Parser?branch=master) +[![Coverage Status](https://coveralls.io/repos/github/nikic/PHP-Parser/badge.svg?branch=master)](https://coveralls.io/github/nikic/PHP-Parser?branch=master) -This is a PHP 5.2 to PHP 7.1 parser written in PHP. Its purpose is to simplify static code analysis and +This is a PHP 5.2 to PHP 8.0 parser written in PHP. Its purpose is to simplify static code analysis and manipulation. -[**Documentation for version 3.x**][doc_master] (stable; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.1). +[**Documentation for version 4.x**][doc_master] (stable; for running on PHP >= 7.0; for parsing PHP 5.2 to PHP 8.0). -[Documentation for version 2.x][doc_2_x] (stable; for running on PHP >= 5.4; for parsing PHP 5.2 to PHP 7.0). +[Documentation for version 3.x][doc_3_x] (unsupported; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.2). -[Documentation for version 1.x][doc_1_x] (unsupported; for running on PHP >= 5.3; for parsing PHP 5.2 to PHP 5.6). +Features +-------- -In a Nutshell -------------- +The main features provided by this library are: -The parser turns PHP source code into an abstract syntax tree. For example, if you pass the following code into the -parser: + * Parsing PHP 5, PHP 7, and PHP 8 code into an abstract syntax tree (AST). + * Invalid code can be parsed into a partial AST. + * The AST contains accurate location information. + * Dumping the AST in human-readable form. + * Converting an AST back to PHP code. + * Experimental: Formatting can be preserved for partially changed ASTs. + * Infrastructure to traverse and modify ASTs. + * Resolution of namespaced names. + * Evaluation of constant expressions. + * Builders to simplify AST construction for code generation. + * Converting an AST into JSON and back. + +Quick Start +----------- + +Install the library using [composer](https://getcomposer.org): + + php composer.phar require nikic/php-parser + +Parse some PHP code into an AST and dump the result in human-readable form: ```php create(ParserFactory::PREFER_PHP7); +try { + $ast = $parser->parse($code); +} catch (Error $error) { + echo "Parse error: {$error->getMessage()}\n"; + return; +} + +$dumper = new NodeDumper; +echo $dumper->dump($ast) . "\n"; ``` -You'll get a syntax tree looking roughly like this: +This dumps an AST looking something like this: -```php +``` array( - 0: Stmt_Echo( - exprs: array( - 0: Scalar_String( - value: Hi - ) - 1: Scalar_String( - value: World + 0: Stmt_Function( + byRef: false + name: Identifier( + name: test + ) + params: array( + 0: Param( + type: null + byRef: false + variadic: false + var: Expr_Variable( + name: foo + ) + default: null ) ) - ) - 1: Expr_FuncCall( - name: Name( - parts: array( - 0: hello - 1: world - ) - ) - args: array( - 0: Arg( - value: Scalar_String( - value: foo - ) - byRef: false - ) - 1: Arg( - value: Expr_Concat( - left: Scalar_String( - value: bar + returnType: null + stmts: array( + 0: Stmt_Expression( + expr: Expr_FuncCall( + name: Name( + parts: array( + 0: var_dump + ) ) - right: Scalar_String( - value: baz + args: array( + 0: Arg( + value: Expr_Variable( + name: foo + ) + byRef: false + unpack: false + ) ) ) - byRef: false ) ) ) ) ``` -You can then work with this syntax tree, for example to statically analyze the code (e.g. to find -programming errors or security issues). +Let's traverse the AST and perform some kind of modification. For example, drop all function bodies: -Additionally, you can convert a syntax tree back to PHP code. This allows you to do code preprocessing -(like automatedly porting code to older PHP versions). +```php +use PhpParser\Node; +use PhpParser\Node\Stmt\Function_; +use PhpParser\NodeTraverser; +use PhpParser\NodeVisitorAbstract; -Installation ------------- +$traverser = new NodeTraverser(); +$traverser->addVisitor(new class extends NodeVisitorAbstract { + public function enterNode(Node $node) { + if ($node instanceof Function_) { + // Clean out the function body + $node->stmts = []; + } + } +}); -The preferred installation method is [composer](https://getcomposer.org): +$ast = $traverser->traverse($ast); +echo $dumper->dump($ast) . "\n"; +``` - php composer.phar require nikic/php-parser +This gives us an AST where the `Function_::$stmts` are empty: + +``` +array( + 0: Stmt_Function( + byRef: false + name: Identifier( + name: test + ) + params: array( + 0: Param( + type: null + byRef: false + variadic: false + var: Expr_Variable( + name: foo + ) + default: null + ) + ) + returnType: null + stmts: array( + ) + ) +) +``` + +Finally, we can convert the new AST back to PHP code: + +```php +use PhpParser\PrettyPrinter; + +$prettyPrinter = new PrettyPrinter\Standard; +echo $prettyPrinter->prettyPrintFile($ast); +``` + +This gives us our original code, minus the `var_dump()` call inside the function: + +```php + Expr_AssignOp_BitwiseAnd -Expr_AssignBitwiseOr => Expr_AssignOp_BitwiseOr -Expr_AssignBitwiseXor => Expr_AssignOp_BitwiseXor -Expr_AssignConcat => Expr_AssignOp_Concat -Expr_AssignDiv => Expr_AssignOp_Div -Expr_AssignMinus => Expr_AssignOp_Minus -Expr_AssignMod => Expr_AssignOp_Mod -Expr_AssignMul => Expr_AssignOp_Mul -Expr_AssignPlus => Expr_AssignOp_Plus -Expr_AssignShiftLeft => Expr_AssignOp_ShiftLeft -Expr_AssignShiftRight => Expr_AssignOp_ShiftRight - -Expr_BitwiseAnd => Expr_BinaryOp_BitwiseAnd -Expr_BitwiseOr => Expr_BinaryOp_BitwiseOr -Expr_BitwiseXor => Expr_BinaryOp_BitwiseXor -Expr_BooleanAnd => Expr_BinaryOp_BooleanAnd -Expr_BooleanOr => Expr_BinaryOp_BooleanOr -Expr_Concat => Expr_BinaryOp_Concat -Expr_Div => Expr_BinaryOp_Div -Expr_Equal => Expr_BinaryOp_Equal -Expr_Greater => Expr_BinaryOp_Greater -Expr_GreaterOrEqual => Expr_BinaryOp_GreaterOrEqual -Expr_Identical => Expr_BinaryOp_Identical -Expr_LogicalAnd => Expr_BinaryOp_LogicalAnd -Expr_LogicalOr => Expr_BinaryOp_LogicalOr -Expr_LogicalXor => Expr_BinaryOp_LogicalXor -Expr_Minus => Expr_BinaryOp_Minus -Expr_Mod => Expr_BinaryOp_Mod -Expr_Mul => Expr_BinaryOp_Mul -Expr_NotEqual => Expr_BinaryOp_NotEqual -Expr_NotIdentical => Expr_BinaryOp_NotIdentical -Expr_Plus => Expr_BinaryOp_Plus -Expr_ShiftLeft => Expr_BinaryOp_ShiftLeft -Expr_ShiftRight => Expr_BinaryOp_ShiftRight -Expr_Smaller => Expr_BinaryOp_Smaller -Expr_SmallerOrEqual => Expr_BinaryOp_SmallerOrEqual - -Scalar_ClassConst => Scalar_MagicConst_Class -Scalar_DirConst => Scalar_MagicConst_Dir -Scalar_FileConst => Scalar_MagicConst_File -Scalar_FuncConst => Scalar_MagicConst_Function -Scalar_LineConst => Scalar_MagicConst_Line -Scalar_MethodConst => Scalar_MagicConst_Method -Scalar_NSConst => Scalar_MagicConst_Namespace -Scalar_TraitConst => Scalar_MagicConst_Trait -``` - -These changes may affect custom pretty printers and code comparing the return value of `Node::getType()` to specific -strings. - -### Miscellaneous - - * The classes `Template` and `TemplateLoader` have been removed. You should use some other [code generation][code_gen] - project built on top of PHP-Parser instead. - - * The `PrettyPrinterAbstract::pStmts()` method now emits a leading newline if the statement list is not empty. - Custom pretty printers should remove the explicit newline before `pStmts()` calls. - - Old: - - ```php - public function pStmt_Trait(PHPParser_Node_Stmt_Trait $node) { - return 'trait ' . $node->name - . "\n" . '{' . "\n" . $this->pStmts($node->stmts) . "\n" . '}'; - } - ``` - - New: - - ```php - public function pStmt_Trait(Stmt\Trait_ $node) { - return 'trait ' . $node->name - . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'; - } - ``` - - [code_gen]: https://github.com/nikic/PHP-Parser/wiki/Projects-using-the-PHP-Parser#code-generation \ No newline at end of file diff --git a/lib/nikic/php-parser/UPGRADE-2.0.md b/lib/nikic/php-parser/UPGRADE-2.0.md deleted file mode 100644 index 1c61de54f..000000000 --- a/lib/nikic/php-parser/UPGRADE-2.0.md +++ /dev/null @@ -1,74 +0,0 @@ -Upgrading from PHP-Parser 1.x to 2.0 -==================================== - -### PHP version requirements - -PHP-Parser now requires PHP 5.4 or newer to run. It is however still possible to *parse* PHP 5.2 and -PHP 5.3 source code, while running on a newer version. - -### Creating a parser instance - -Parser instances should now be created through the `ParserFactory`. Old direct instantiation code -will not work, because the parser class was renamed. - -Old: - -```php -use PhpParser\Parser, PhpParser\Lexer; -$parser = new Parser(new Lexer\Emulative); -``` - -New: - -```php -use PhpParser\ParserFactory; -$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); -``` - -The first argument to `ParserFactory` determines how different PHP versions are handled. The -possible values are: - - * `ParserFactory::PREFER_PHP7`: Try to parse code as PHP 7. If this fails, try to parse it as PHP 5. - * `ParserFactory::PREFER_PHP5`: Try to parse code as PHP 5. If this fails, try to parse it as PHP 7. - * `ParserFactory::ONLY_PHP7`: Parse code as PHP 7. - * `ParserFactory::ONLY_PHP5`: Parse code as PHP 5. - -For most practical purposes the difference between `PREFER_PHP7` and `PREFER_PHP5` is mainly whether -a scalar type hint like `string` will be stored as `'string'` (PHP 7) or as `new Name('string')` -(PHP 5). - -To use a custom lexer, pass it as the second argument to the `create()` method: - -```php -use PhpParser\ParserFactory; -$lexer = new MyLexer; -$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7, $lexer); -``` - -### Rename of the `PhpParser\Parser` class - -`PhpParser\Parser` is now an interface, which is implemented by `Parser\Php5`, `Parser\Php7` and -`Parser\Multiple`. Parser tokens are now defined in `Parser\Tokens`. If you use the `ParserFactory` -described above to create your parser instance, these changes should have no further impact on you. - -### Removal of legacy aliases - -All legacy aliases for classes have been removed. This includes the old non-namespaced `PHPParser_` -classes, as well as the classes that had to be renamed for PHP 7 support. - -### Deprecations - -The `set()`, `setFirst()`, `append()` and `prepend()` methods of the `Node\Name` class have been -deprecated. Instead `Name::concat()` and `Name->slice()` should be used. - -### Miscellaneous - -* The `NodeTraverser` no longer clones nodes by default. If you want to restore the old behavior, - pass `true` to the constructor. -* The legacy node format has been removed. If you use custom nodes, they are now expected to - implement a `getSubNodeNames()` method. -* The default value for `Scalar` node constructors was removed. This means that something like - `new LNumber()` should be replaced by `new LNumber(0)`. -* String parts of encapsed strings are now represented using `Scalar\EncapsStringPart` nodes, while - previously raw strings were used. This affects the `parts` child of `Scalar\Encaps` and - `Expr\ShellExec`. \ No newline at end of file diff --git a/lib/nikic/php-parser/UPGRADE-3.0.md b/lib/nikic/php-parser/UPGRADE-3.0.md deleted file mode 100644 index 9e04f2afd..000000000 --- a/lib/nikic/php-parser/UPGRADE-3.0.md +++ /dev/null @@ -1,160 +0,0 @@ -Upgrading from PHP-Parser 2.x to 3.0 -==================================== - -The backwards-incompatible changes in this release may be summarized as follows: - - * The specific details of the node representation have changed in some cases, primarily to - accomodate new PHP 7.1 features. - * There have been significant changes to the error recovery implementation. This may affect you, - if you used the error recovery mode or have a custom lexer implementation. - * A number of deprecated methods were removed. - -### PHP version requirements - -PHP-Parser now requires PHP 5.5 or newer to run. It is however still possible to *parse* PHP 5.2, -5.3 and 5.4 source code, while running on a newer version. - -### Changes to the node structure - -The following changes are likely to require code changes if the respective nodes are used: - - * The `List` subnode `vars` has been renamed to `items` and now contains `ArrayItem`s instead of - plain variables. - * The `Catch` subnode `type` has been renamed to `types` and is now an array of `Name`s. - * The `TryCatch` subnode `finallyStmts` has been replaced with a `finally` subnode that holds an - explicit `Finally` node. - * The `type` subnode on `Class`, `ClassMethod` and `Property` has been renamed to `flags`. The - `type` subnode has retained for backwards compatibility and is populated to the same value as - `flags`. However, writes to `type` will not update `flags` and use of `type` is discouraged. - -The following changes are unlikely to require code changes: - - * The `ClassConst` constructor changed to accept an additional `flags` subnode. - * The `Trait` constructor now has the same form as the `Class` and `Interface` constructors: It - takes an array of subnodes. Unlike classes/interfaces, traits can only have a `stmts` subnode. - * The `Array` subnode `items` may now contain `null` elements (due to destructuring). - * `void` and `iterable` types are now stored as strings if the PHP 7 parser is used. Previously - these would have been represented as `Name` instances. - -### Changes to error recovery mode - -Previously, error recovery mode was enabled by setting the `throwOnError` option to `false` when -creating the parser, while collected errors were retrieved using the `getErrors()` method: - -```php -$lexer = ...; -$parser = (new ParserFactory)->create(ParserFactor::ONLY_PHP7, $lexer, [ - 'throwOnError' => true, -]); - -$stmts = $parser->parse($code); -$errors = $parser->getErrors(); -if ($errors) { - handleErrors($errors); -} -processAst($stmts); -``` - -Both the `throwOnError` option and the `getErrors()` method have been removed in PHP-Parser 3.0. -Instead an instance of `ErrorHandler\Collecting` should be passed to the `parse()` method: - -```php -$lexer = ...; -$parser = (new ParserFactory)->create(ParserFactor::ONLY_PHP7, $lexer); - -$errorHandler = new ErrorHandler\Collecting; -$stmts = $parser->parse($code, $errorHandler); -if ($errorHandler->hasErrors()) { - handleErrors($errorHandler->getErrors()); -} -processAst($stmts); -``` - -#### Multiple parser fallback in error recovery mode - -As a result of this change, if a `Multiple` parser is used (e.g. through the `ParserFactory` using -`PREFER_PHP7` or `PREFER_PHP5`), it will now return the result of the first *non-throwing* parse. As -parsing never throws in error recovery mode, the result from the first parser will always be -returned. - -The PHP 7 parser is a superset of the PHP 5 parser, with the exceptions that `=& new` and -`global $$foo->bar` are not supported (other differences are in representation only). The PHP 7 -parser will be able to recover from the error in both cases. For this reason, this change will -likely pass unnoticed if you do not specifically test for this syntax. - -It is possible to restore the precise previous behavior with the following code: - -```php -$lexer = ...; -$parser7 = new Parser\Php7($lexer); -$parser5 = new Parser\Php5($lexer); - -$errors7 = new ErrorHandler\Collecting(); -$stmts7 = $parser7->parse($code, $errors7); -if ($errors7->hasErrors()) { - $errors5 = new ErrorHandler\Collecting(); - $stmts5 = $parser5->parse($code, $errors5); - if (!$errors5->hasErrors()) { - // If PHP 7 parse has errors but PHP 5 parse has no errors, use PHP 5 result - return [$stmts5, $errors5]; - } -} -// If PHP 7 succeeds or both fail use PHP 7 result -return [$stmts7, $errors7]; -``` - -#### Error handling in the lexer - -In order to support recovery from lexer errors, the signature of the `startLexing()` method changed -to optionally accept an `ErrorHandler`: - -```php -// OLD -public function startLexing($code); -// NEW -public function startLexing($code, ErrorHandler $errorHandler = null); -``` - -If you use a custom lexer with overriden `startLexing()` method, it needs to be changed to accept -the extra parameter. The value should be passed on to the parent method. - -#### Error checks in node constructors - -The constructors of certain nodes used to contain additional checks for semantic errors, such as -creating a try block without either catch or finally. These checks have been moved from the node -constructors into the parser. This allows recovery from such errors, as well as representing the -resulting (invalid) AST. - -This means that certain error conditions are no longer checked for manually constructed nodes. - -### Removed methods, arguments, options - -The following methods, arguments or options have been removed: - - * `Comment::setLine()`, `Comment::setText()`: Create new `Comment` instances instead. - * `Name::set()`, `Name::setFirst()`, `Name::setLast()`, `Name::append()`, `Name::prepend()`: - Use `Name::concat()` in combination with `Name::slice()` instead. - * `Error::getRawLine()`, `Error::setRawLine()`. Use `Error::getStartLine()` and - `Error::setStartLine()` instead. - * `Parser::getErrors()`. Use `ErrorHandler\Collecting` instead. - * `$separator` argument of `Name::toString()`. Use `strtr()` instead, if you really need it. - * `$cloneNodes` argument of `NodeTraverser::__construct()`. Explicitly clone nodes in the visitor - instead. - * `throwOnError` parser option. Use `ErrorHandler\Collecting` instead. - -### Miscellaneous - - * The `NameResolver` will now resolve unqualified function and constant names in the global - namespace into fully qualified names. For example `foo()` in the global namespace resolves to - `\foo()`. For names where no static resolution is possible, a `namespacedName` attribute is - added now, containing the namespaced variant of the name. - * All methods on `PrettyPrinter\Standard` are now protected. Previoulsy most of them were public. - The pretty printer should only be invoked using the `prettyPrint()`, `prettyPrintFile()` and - `prettyPrintExpr()` methods. - * The node dumper now prints numeric values that act as enums/flags in a string representation. - If node dumper results are used in tests, updates may be needed to account for this. - * The constants on `NameTraverserInterface` have been moved into the `NameTraverser` class. - * The emulative lexer now directly postprocesses tokens, instead of using `~__EMU__~` sequences. - This changes the protected API of the emulative lexer. - * The `Name::slice()` method now returns `null` for empty slices, previously `new Name([])` was - used. `Name::concat()` now also supports concatenation with `null`. diff --git a/lib/nikic/php-parser/bin/php-parse b/lib/nikic/php-parser/bin/php-parse index 1760e758d..bb3e46df4 100755 --- a/lib/nikic/php-parser/bin/php-parse +++ b/lib/nikic/php-parser/bin/php-parse @@ -10,7 +10,7 @@ foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php ini_set('xdebug.max_nesting_level', 3000); -// Disable XDebug var_dump() output truncation +// Disable Xdebug var_dump() output truncation ini_set('xdebug.var_display_max_children', -1); ini_set('xdebug.var_display_max_data', -1); ini_set('xdebug.var_display_max_depth', -1); @@ -26,9 +26,9 @@ if (empty($files)) { showHelp("Must specify at least one file."); } -$lexer = new PhpParser\Lexer\Emulative(array('usedAttributes' => array( +$lexer = new PhpParser\Lexer\Emulative(['usedAttributes' => [ 'startLine', 'endLine', 'startFilePos', 'endFilePos', 'comments' -))); +]]); $parser = (new PhpParser\ParserFactory)->create( PhpParser\ParserFactory::PREFER_PHP7, $lexer @@ -38,7 +38,6 @@ $dumper = new PhpParser\NodeDumper([ 'dumpPositions' => $attributes['with-positions'], ]); $prettyPrinter = new PhpParser\PrettyPrinter\Standard; -$serializer = new PhpParser\Serializer\XML; $traverser = new PhpParser\NodeTraverser(); $traverser->addVisitor(new PhpParser\NodeVisitor\NameResolver); @@ -46,14 +45,15 @@ $traverser->addVisitor(new PhpParser\NodeVisitor\NameResolver); foreach ($files as $file) { if (strpos($file, ' Code $code\n"; + fwrite(STDERR, "====> Code $code\n"); } else { if (!file_exists($file)) { - die("File $file does not exist.\n"); + fwrite(STDERR, "File $file does not exist.\n"); + exit(1); } $code = file_get_contents($file); - echo "====> File $file:\n"; + fwrite(STDERR, "====> File $file:\n"); } if ($attributes['with-recovery']) { @@ -61,7 +61,7 @@ foreach ($files as $file) { $stmts = $parser->parse($code, $errorHandler); foreach ($errorHandler->getErrors() as $error) { $message = formatErrorMessage($error, $code, $attributes['with-column-info']); - echo $message . "\n"; + fwrite(STDERR, $message . "\n"); } if (null === $stmts) { continue; @@ -71,25 +71,26 @@ foreach ($files as $file) { $stmts = $parser->parse($code); } catch (PhpParser\Error $error) { $message = formatErrorMessage($error, $code, $attributes['with-column-info']); - die($message . "\n"); + fwrite(STDERR, $message . "\n"); + exit(1); } } foreach ($operations as $operation) { if ('dump' === $operation) { - echo "==> Node dump:\n"; + fwrite(STDERR, "==> Node dump:\n"); echo $dumper->dump($stmts, $code), "\n"; } elseif ('pretty-print' === $operation) { - echo "==> Pretty print:\n"; + fwrite(STDERR, "==> Pretty print:\n"); echo $prettyPrinter->prettyPrintFile($stmts), "\n"; - } elseif ('serialize-xml' === $operation) { - echo "==> Serialized XML:\n"; - echo $serializer->serialize($stmts), "\n"; + } elseif ('json-dump' === $operation) { + fwrite(STDERR, "==> JSON dump:\n"); + echo json_encode($stmts, JSON_PRETTY_PRINT), "\n"; } elseif ('var-dump' === $operation) { - echo "==> var_dump():\n"; + fwrite(STDERR, "==> var_dump():\n"); var_dump($stmts); } elseif ('resolve-names' === $operation) { - echo "==> Resolved names.\n"; + fwrite(STDERR, "==> Resolved names.\n"); $stmts = $traverser->traverse($stmts); } } @@ -105,9 +106,9 @@ function formatErrorMessage(PhpParser\Error $e, $code, $withColumnInfo) { function showHelp($error = '') { if ($error) { - echo $error . "\n\n"; + fwrite(STDERR, $error . "\n\n"); } - die(<< false, 'with-positions' => false, 'with-recovery' => false, - ); + ]; array_shift($args); $parseOptions = true; @@ -160,8 +162,9 @@ function parseArgs($args) { case '-p': $operations[] = 'pretty-print'; break; - case '--serialize-xml': - $operations[] = 'serialize-xml'; + case '--json-dump': + case '-j': + $operations[] = 'json-dump'; break; case '--var-dump': $operations[] = 'var-dump'; @@ -198,5 +201,5 @@ function parseArgs($args) { } } - return array($operations, $files, $attributes); + return [$operations, $files, $attributes]; } diff --git a/lib/nikic/php-parser/composer.json b/lib/nikic/php-parser/composer.json index 66df90a8f..2fd064a21 100644 --- a/lib/nikic/php-parser/composer.json +++ b/lib/nikic/php-parser/composer.json @@ -1,8 +1,11 @@ { "name": "nikic/php-parser", - "description": "A PHP parser written in PHP", - "keywords": ["php", "parser"], "type": "library", + "description": "A PHP parser written in PHP", + "keywords": [ + "php", + "parser" + ], "license": "BSD-3-Clause", "authors": [ { @@ -10,21 +13,29 @@ } ], "require": { - "php": ">=5.5", + "php": ">=7.0", "ext-tokenizer": "*" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0", + "ircmaxell/php-yacc": "^0.0.7" + }, + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } }, "autoload": { "psr-4": { "PhpParser\\": "lib/PhpParser" } }, - "bin": ["bin/php-parse"], - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" + "autoload-dev": { + "psr-4": { + "PhpParser\\": "test/PhpParser/" } - } + }, + "bin": [ + "bin/php-parse" + ] } diff --git a/lib/nikic/php-parser/doc/0_Introduction.markdown b/lib/nikic/php-parser/doc/0_Introduction.markdown deleted file mode 100644 index ca1ceb2ec..000000000 --- a/lib/nikic/php-parser/doc/0_Introduction.markdown +++ /dev/null @@ -1,80 +0,0 @@ -Introduction -============ - -This project is a PHP 5.2 to PHP 7.1 parser **written in PHP itself**. - -What is this for? ------------------ - -A parser is useful for [static analysis][0], manipulation of code and basically any other -application dealing with code programmatically. A parser constructs an [Abstract Syntax Tree][1] -(AST) of the code and thus allows dealing with it in an abstract and robust way. - -There are other ways of processing source code. One that PHP supports natively is using the -token stream generated by [`token_get_all`][2]. The token stream is much more low level than -the AST and thus has different applications: It allows to also analyze the exact formatting of -a file. On the other hand the token stream is much harder to deal with for more complex analysis. -For example an AST abstracts away the fact that in PHP variables can be written as `$foo`, but also -as `$$bar`, `${'foobar'}` or even `${!${''}=barfoo()}`. You don't have to worry about recognizing -all the different syntaxes from a stream of tokens. - -Another question is: Why would I want to have a PHP parser *written in PHP*? Well, PHP might not be -a language especially suited for fast parsing, but processing the AST is much easier in PHP than it -would be in other, faster languages like C. Furthermore the people most probably wanting to do -programmatic PHP code analysis are incidentally PHP developers, not C developers. - -What can it parse? ------------------- - -The parser supports parsing PHP 5.2-5.6 and PHP 7. - -As the parser is based on the tokens returned by `token_get_all` (which is only able to lex the PHP -version it runs on), additionally a wrapper for emulating tokens from newer versions is provided. -This allows to parse PHP 7.1 source code running on PHP 5.5, for example. This emulation is somewhat -hacky and not perfect, but it should work well on any sane code. - -What output does it produce? ----------------------------- - -The parser produces an [Abstract Syntax Tree][1] (AST) also known as a node tree. How this looks like -can best be seen in an example. The program `create(ParserFactory::PREFER_PHP7); -``` - -The factory accepts a kind argument, that determines how different PHP versions are treated: - -Kind | Behavior ------|--------- -`ParserFactory::PREFER_PHP7` | Try to parse code as PHP 7. If this fails, try to parse it as PHP 5. -`ParserFactory::PREFER_PHP5` | Try to parse code as PHP 5. If this fails, try to parse it as PHP 7. -`ParserFactory::ONLY_PHP7` | Parse code as PHP 7. -`ParserFactory::ONLY_PHP5` | Parse code as PHP 5. - -Unless you have strong reason to use something else, `PREFER_PHP7` is a reasonable default. - -The `create()` method optionally accepts a `Lexer` instance as the second argument. Some use cases -that require customized lexers are discussed in the [lexer documentation](component/Lexer.markdown). - -Subsequently you can pass PHP code (including the opening `create(ParserFactory::PREFER_PHP7); - -try { - $stmts = $parser->parse($code); - // $stmts is an array of statement nodes -} catch (Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -A parser instance can be reused to parse multiple files. - -Node tree ---------- - -If you use the above code with `$code = "subNodeName`. The `Stmt\Echo_` node has only one subnode `exprs`. So in order to access it -in the above example you would write `$stmts[0]->exprs`. If you wanted to access the name of the function -call, you would write `$stmts[0]->exprs[1]->name`. - -All nodes also define a `getType()` method that returns the node type. The type is the class name -without the `PhpParser\Node\` prefix and `\` replaced with `_`. It also does not contain a trailing -`_` for reserved-keyword class names. - -It is possible to associate custom metadata with a node using the `setAttribute()` method. This data -can then be retrieved using `hasAttribute()`, `getAttribute()` and `getAttributes()`. - -By default the lexer adds the `startLine`, `endLine` and `comments` attributes. `comments` is an array -of `PhpParser\Comment[\Doc]` instances. - -The start line can also be accessed using `getLine()`/`setLine()` (instead of `getAttribute('startLine')`). -The last doc comment from the `comments` attribute can be obtained using `getDocComment()`. - -Pretty printer --------------- - -The pretty printer component compiles the AST back to PHP code. As the parser does not retain formatting -information the formatting is done using a specified scheme. Currently there is only one scheme available, -namely `PhpParser\PrettyPrinter\Standard`. - -```php -use PhpParser\Error; -use PhpParser\ParserFactory; -use PhpParser\PrettyPrinter; - -$code = "create(ParserFactory::PREFER_PHP7); -$prettyPrinter = new PrettyPrinter\Standard; - -try { - // parse - $stmts = $parser->parse($code); - - // change - $stmts[0] // the echo statement - ->exprs // sub expressions - [0] // the first of them (the string node) - ->value // it's value, i.e. 'Hi ' - = 'Hello '; // change to 'Hello ' - - // pretty print - $code = $prettyPrinter->prettyPrint($stmts); - - echo $code; -} catch (Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -The above code will output: - - parse()`, then changed and then -again converted to code using `PhpParser\PrettyPrinter\Standard->prettyPrint()`. - -The `prettyPrint()` method pretty prints a statements array. It is also possible to pretty print only a -single expression using `prettyPrintExpr()`. - -The `prettyPrintFile()` method can be used to print an entire file. This will include the opening `create(ParserFactory::PREFER_PHP7); -$traverser = new NodeTraverser; -$prettyPrinter = new PrettyPrinter\Standard; - -// add your visitor -$traverser->addVisitor(new MyNodeVisitor); - -try { - $code = file_get_contents($fileName); - - // parse - $stmts = $parser->parse($code); - - // traverse - $stmts = $traverser->traverse($stmts); - - // pretty print - $code = $prettyPrinter->prettyPrintFile($stmts); - - echo $code; -} catch (PhpParser\Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -The corresponding node visitor might look like this: - -```php -use PhpParser\Node; -use PhpParser\NodeVisitorAbstract; - -class MyNodeVisitor extends NodeVisitorAbstract -{ - public function leaveNode(Node $node) { - if ($node instanceof Node\Scalar\String_) { - $node->value = 'foo'; - } - } -} -``` - -The above node visitor would change all string literals in the program to `'foo'`. - -All visitors must implement the `PhpParser\NodeVisitor` interface, which defines the following four -methods: - -```php -public function beforeTraverse(array $nodes); -public function enterNode(\PhpParser\Node $node); -public function leaveNode(\PhpParser\Node $node); -public function afterTraverse(array $nodes); -``` - -The `beforeTraverse()` method is called once before the traversal begins and is passed the nodes the -traverser was called with. This method can be used for resetting values before traversation or -preparing the tree for traversal. - -The `afterTraverse()` method is similar to the `beforeTraverse()` method, with the only difference that -it is called once after the traversal. - -The `enterNode()` and `leaveNode()` methods are called on every node, the former when it is entered, -i.e. before its subnodes are traversed, the latter when it is left. - -All four methods can either return the changed node or not return at all (i.e. `null`) in which -case the current node is not changed. - -The `enterNode()` method can additionally return the value `NodeTraverser::DONT_TRAVERSE_CHILDREN`, -which instructs the traverser to skip all children of the current node. - -The `leaveNode()` method can additionally return the value `NodeTraverser::REMOVE_NODE`, in which -case the current node will be removed from the parent array. Furthermore it is possible to return -an array of nodes, which will be merged into the parent array at the offset of the current node. -I.e. if in `array(A, B, C)` the node `B` should be replaced with `array(X, Y, Z)` the result will -be `array(A, X, Y, Z, C)`. - -Instead of manually implementing the `NodeVisitor` interface you can also extend the `NodeVisitorAbstract` -class, which will define empty default implementations for all the above methods. - -The NameResolver node visitor ------------------------------ - -One visitor is already bundled with the package: `PhpParser\NodeVisitor\NameResolver`. This visitor -helps you work with namespaced code by trying to resolve most names to fully qualified ones. - -For example, consider the following code: - - use A as B; - new B\C(); - -In order to know that `B\C` really is `A\C` you would need to track aliases and namespaces yourself. -The `NameResolver` takes care of that and resolves names as far as possible. - -After running it most names will be fully qualified. The only names that will stay unqualified are -unqualified function and constant names. These are resolved at runtime and thus the visitor can't -know which function they are referring to. In most cases this is a non-issue as the global functions -are meant. - -Also the `NameResolver` adds a `namespacedName` subnode to class, function and constant declarations -that contains the namespaced name instead of only the shortname that is available via `name`. - -Example: Converting namespaced code to pseudo namespaces --------------------------------------------------------- - -A small example to understand the concept: We want to convert namespaced code to pseudo namespaces -so it works on 5.2, i.e. names like `A\\B` should be converted to `A_B`. Note that such conversions -are fairly complicated if you take PHP's dynamic features into account, so our conversion will -assume that no dynamic features are used. - -We start off with the following base code: - -```php -use PhpParser\ParserFactory; -use PhpParser\PrettyPrinter; -use PhpParser\NodeTraverser; -use PhpParser\NodeVisitor\NameResolver; - -$inDir = '/some/path'; -$outDir = '/some/other/path'; - -$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); -$traverser = new NodeTraverser; -$prettyPrinter = new PrettyPrinter\Standard; - -$traverser->addVisitor(new NameResolver); // we will need resolved names -$traverser->addVisitor(new NamespaceConverter); // our own node visitor - -// iterate over all .php files in the directory -$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($inDir)); -$files = new \RegexIterator($files, '/\.php$/'); - -foreach ($files as $file) { - try { - // read the file that should be converted - $code = file_get_contents($file); - - // parse - $stmts = $parser->parse($code); - - // traverse - $stmts = $traverser->traverse($stmts); - - // pretty print - $code = $prettyPrinter->prettyPrintFile($stmts); - - // write the converted file to the target directory - file_put_contents( - substr_replace($file->getPathname(), $outDir, 0, strlen($inDir)), - $code - ); - } catch (PhpParser\Error $e) { - echo 'Parse Error: ', $e->getMessage(); - } -} -``` - -Now lets start with the main code, the `NodeVisitor\NamespaceConverter`. One thing it needs to do -is convert `A\\B` style names to `A_B` style ones. - -```php -use PhpParser\Node; - -class NamespaceConverter extends \PhpParser\NodeVisitorAbstract -{ - public function leaveNode(Node $node) { - if ($node instanceof Node\Name) { - return new Node\Name($node->toString('_')); - } - } -} -``` - -The above code profits from the fact that the `NameResolver` already resolved all names as far as -possible, so we don't need to do that. We only need to create a string with the name parts separated -by underscores instead of backslashes. This is what `$node->toString('_')` does. (If you want to -create a name with backslashes either write `$node->toString()` or `(string) $node`.) Then we create -a new name from the string and return it. Returning a new node replaces the old node. - -Another thing we need to do is change the class/function/const declarations. Currently they contain -only the shortname (i.e. the last part of the name), but they need to contain the complete name including -the namespace prefix: - -```php -use PhpParser\Node; -use PhpParser\Node\Stmt; - -class NodeVisitor_NamespaceConverter extends \PhpParser\NodeVisitorAbstract -{ - public function leaveNode(Node $node) { - if ($node instanceof Node\Name) { - return new Node\Name($node->toString('_')); - } elseif ($node instanceof Stmt\Class_ - || $node instanceof Stmt\Interface_ - || $node instanceof Stmt\Function_) { - $node->name = $node->namespacedName->toString('_'); - } elseif ($node instanceof Stmt\Const_) { - foreach ($node->consts as $const) { - $const->name = $const->namespacedName->toString('_'); - } - } - } -} -``` - -There is not much more to it than converting the namespaced name to string with `_` as separator. - -The last thing we need to do is remove the `namespace` and `use` statements: - -```php -use PhpParser\Node; -use PhpParser\Node\Stmt; - -class NodeVisitor_NamespaceConverter extends \PhpParser\NodeVisitorAbstract -{ - public function leaveNode(Node $node) { - if ($node instanceof Node\Name) { - return new Node\Name($node->toString('_')); - } elseif ($node instanceof Stmt\Class_ - || $node instanceof Stmt\Interface_ - || $node instanceof Stmt\Function_) { - $node->name = $node->namespacedName->toString('_'); - } elseif ($node instanceof Stmt\Const_) { - foreach ($node->consts as $const) { - $const->name = $const->namespacedName->toString('_'); - } - } elseif ($node instanceof Stmt\Namespace_) { - // returning an array merges is into the parent array - return $node->stmts; - } elseif ($node instanceof Stmt\Use_) { - // returning false removed the node altogether - return false; - } - } -} -``` - -That's all. diff --git a/lib/nikic/php-parser/doc/3_Other_node_tree_representations.markdown b/lib/nikic/php-parser/doc/3_Other_node_tree_representations.markdown deleted file mode 100644 index 0830f399c..000000000 --- a/lib/nikic/php-parser/doc/3_Other_node_tree_representations.markdown +++ /dev/null @@ -1,330 +0,0 @@ -Other node tree representations -=============================== - -It is possible to convert the AST into several textual representations, which serve different uses. - -Simple serialization --------------------- - -It is possible to serialize the node tree using `serialize()` and also unserialize it using -`unserialize()`. The output is not human readable and not easily processable from anything -but PHP, but it is compact and generates quickly. The main application thus is in caching. - -Human readable dumping ----------------------- - -Furthermore it is possible to dump nodes into a human readable format using the `dump` method of -`PhpParser\NodeDumper`. This can be used for debugging. - -```php -$code = <<<'CODE' -create(PhpParser\ParserFactory::PREFER_PHP7); -$nodeDumper = new PhpParser\NodeDumper; - -try { - $stmts = $parser->parse($code); - - echo $nodeDumper->dump($stmts), "\n"; -} catch (PhpParser\Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -The above script will have an output looking roughly like this: - -``` -array( - 0: Stmt_Function( - byRef: false - params: array( - 0: Param( - name: msg - default: null - type: null - byRef: false - ) - ) - stmts: array( - 0: Stmt_Echo( - exprs: array( - 0: Expr_Variable( - name: msg - ) - 1: Scalar_String( - value: - - ) - ) - ) - ) - name: printLine - ) - 1: Expr_FuncCall( - name: Name( - parts: array( - 0: printLine - ) - ) - args: array( - 0: Arg( - value: Scalar_String( - value: Hello World!!! - ) - byRef: false - ) - ) - ) -) -``` - -JSON encoding -------------- - -Nodes (and comments) implement the `JsonSerializable` interface. As such, it is possible to JSON -encode the AST directly using `json_encode()`: - -```php -$code = <<<'CODE' -create(PhpParser\ParserFactory::PREFER_PHP7); -$nodeDumper = new PhpParser\NodeDumper; - -try { - $stmts = $parser->parse($code); - - echo json_encode($stmts, JSON_PRETTY_PRINT), "\n"; -} catch (PhpParser\Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -This will result in the following output (which includes attributes): - -```json -[ - { - "nodeType": "Stmt_Function", - "byRef": false, - "name": "printLine", - "params": [ - { - "nodeType": "Param", - "type": null, - "byRef": false, - "variadic": false, - "name": "msg", - "default": null, - "attributes": { - "startLine": 3, - "endLine": 3 - } - } - ], - "returnType": null, - "stmts": [ - { - "nodeType": "Stmt_Echo", - "exprs": [ - { - "nodeType": "Expr_Variable", - "name": "msg", - "attributes": { - "startLine": 4, - "endLine": 4 - } - }, - { - "nodeType": "Scalar_String", - "value": "\n", - "attributes": { - "startLine": 4, - "endLine": 4, - "kind": 2 - } - } - ], - "attributes": { - "startLine": 4, - "endLine": 4 - } - } - ], - "attributes": { - "startLine": 3, - "endLine": 5 - } - }, - { - "nodeType": "Expr_FuncCall", - "name": { - "nodeType": "Name", - "parts": [ - "printLine" - ], - "attributes": { - "startLine": 7, - "endLine": 7 - } - }, - "args": [ - { - "nodeType": "Arg", - "value": { - "nodeType": "Scalar_String", - "value": "Hello World!!!", - "attributes": { - "startLine": 7, - "endLine": 7, - "kind": 1 - } - }, - "byRef": false, - "unpack": false, - "attributes": { - "startLine": 7, - "endLine": 7 - } - } - ], - "attributes": { - "startLine": 7, - "endLine": 7 - } - } -] -``` - -There is currently no mechanism to convert JSON back into a node tree. Furthermore, not all ASTs -can be JSON encoded. In particular, JSON only supports UTF-8 strings. - -Serialization to XML --------------------- - -It is also possible to serialize the node tree to XML using `PhpParser\Serializer\XML->serialize()` -and to unserialize it using `PhpParser\Unserializer\XML->unserialize()`. This is useful for -interfacing with other languages and applications or for doing transformation using XSLT. - -```php -create(PhpParser\ParserFactory::PREFER_PHP7); -$serializer = new PhpParser\Serializer\XML; - -try { - $stmts = $parser->parse($code); - - echo $serializer->serialize($stmts); -} catch (PhpParser\Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -Produces: - -```xml - - - - - - - - - - - - msg - - - - - - - - - - - - - - - - - - - - - msg - - - - - - - - - - - - - - - printLine - - - - - - - - printLine - - - - - - - - - - - Hello World!!! - - - - - - - - - - - - -``` \ No newline at end of file diff --git a/lib/nikic/php-parser/doc/4_Code_generation.markdown b/lib/nikic/php-parser/doc/4_Code_generation.markdown deleted file mode 100644 index 2c0aa0ede..000000000 --- a/lib/nikic/php-parser/doc/4_Code_generation.markdown +++ /dev/null @@ -1,84 +0,0 @@ -Code generation -=============== - -It is also possible to generate code using the parser, by first creating an Abstract Syntax Tree and then using the -pretty printer to convert it to PHP code. To simplify code generation, the project comes with builders which allow -creating node trees using a fluid interface, instead of instantiating all nodes manually. Builders are available for -the following syntactic elements: - - * namespaces and use statements - * classes, interfaces and traits - * methods, functions and parameters - * properties - -Here is an example: - -```php -use PhpParser\BuilderFactory; -use PhpParser\PrettyPrinter; -use PhpParser\Node; - -$factory = new BuilderFactory; -$node = $factory->namespace('Name\Space') - ->addStmt($factory->use('Some\Other\Thingy')->as('SomeOtherClass')) - ->addStmt($factory->class('SomeClass') - ->extend('SomeOtherClass') - ->implement('A\Few', '\Interfaces') - ->makeAbstract() // ->makeFinal() - - ->addStmt($factory->method('someMethod') - ->makePublic() - ->makeAbstract() // ->makeFinal() - ->setReturnType('bool') - ->addParam($factory->param('someParam')->setTypeHint('SomeClass')) - ->setDocComment('/** - * This method does something. - * - * @param SomeClass And takes a parameter - */') - ) - - ->addStmt($factory->method('anotherMethod') - ->makeProtected() // ->makePublic() [default], ->makePrivate() - ->addParam($factory->param('someParam')->setDefault('test')) - // it is possible to add manually created nodes - ->addStmt(new Node\Expr\Print_(new Node\Expr\Variable('someParam'))) - ) - - // properties will be correctly reordered above the methods - ->addStmt($factory->property('someProperty')->makeProtected()) - ->addStmt($factory->property('anotherProperty')->makePrivate()->setDefault(array(1, 2, 3))) - ) - - ->getNode() -; - -$stmts = array($node); -$prettyPrinter = new PrettyPrinter\Standard(); -echo $prettyPrinter->prettyPrintFile($stmts); -``` - -This will produce the following output with the standard pretty printer: - -```php - array('comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos'), -)); -$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer); - -try { - $stmts = $parser->parse($code); - // ... -} catch (PhpParser\Error $e) { - // ... -} -``` - -Before using column information its availability needs to be checked with `$e->hasColumnInfo()`, as the precise -location of an error cannot always be determined. The methods for retrieving column information also have to be passed -the source code of the parsed file. An example for printing an error: - -```php -if ($e->hasColumnInfo()) { - echo $e->getRawMessage() . ' from ' . $e->getStartLine() . ':' . $e->getStartColumn($code) - . ' to ' . $e->getEndLine() . ':' . $e->getEndColumn($code); - // or: - echo $e->getMessageWithColumnInfo(); -} else { - echo $e->getMessage(); -} -``` - -Both line numbers and column numbers are 1-based. EOF errors will be located at the position one past the end of the -file. - -Error recovery --------------- - -The error behavior of the parser (and other components) is controlled by an `ErrorHandler`. Whenever an error is -encountered, `ErrorHandler::handleError()` is invoked. The default error handling strategy is `ErrorHandler\Throwing`, -which will immediately throw when an error is encountered. - -To instead collect all encountered errors into an array, while trying to continue parsing the rest of the source code, -an instance of `ErrorHandler\Collecting` can be passed to the `Parser::parse()` method. A usage example: - -```php -$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::ONLY_PHP7); -$errorHandler = new PhpParser\ErrorHandler\Collecting; - -$stmts = $parser->parse($code, $errorHandler); - -if ($errorHandler->hasErrors()) { - foreach ($errorHandler->getErrors() as $error) { - // $error is an ordinary PhpParser\Error - } -} - -if (null !== $stmts) { - // $stmts is a best-effort partial AST -} -``` - -The `NameResolver` visitor also accepts an `ErrorHandler` as a constructor argument. \ No newline at end of file diff --git a/lib/nikic/php-parser/doc/component/Lexer.markdown b/lib/nikic/php-parser/doc/component/Lexer.markdown deleted file mode 100644 index b22942dd1..000000000 --- a/lib/nikic/php-parser/doc/component/Lexer.markdown +++ /dev/null @@ -1,152 +0,0 @@ -Lexer component documentation -============================= - -The lexer is responsible for providing tokens to the parser. The project comes with two lexers: `PhpParser\Lexer` and -`PhpParser\Lexer\Emulative`. The latter is an extension of the former, which adds the ability to emulate tokens of -newer PHP versions and thus allows parsing of new code on older versions. - -This documentation discusses options available for the default lexers and explains how lexers can be extended. - -Lexer options -------------- - -The two default lexers accept an `$options` array in the constructor. Currently only the `'usedAttributes'` option is -supported, which allows you to specify which attributes will be added to the AST nodes. The attributes can then be -accessed using `$node->getAttribute()`, `$node->setAttribute()`, `$node->hasAttribute()` and `$node->getAttributes()` -methods. A sample options array: - -```php -$lexer = new PhpParser\Lexer(array( - 'usedAttributes' => array( - 'comments', 'startLine', 'endLine' - ) -)); -``` - -The attributes used in this example match the default behavior of the lexer. The following attributes are supported: - - * `comments`: Array of `PhpParser\Comment` or `PhpParser\Comment\Doc` instances, representing all comments that occurred - between the previous non-discarded token and the current one. Use of this attribute is required for the - `$node->getDocComment()` method to work. The attribute is also needed if you wish the pretty printer to retain - comments present in the original code. - * `startLine`: Line in which the node starts. This attribute is required for the `$node->getLine()` to work. It is also - required if syntax errors should contain line number information. - * `endLine`: Line in which the node ends. - * `startTokenPos`: Offset into the token array of the first token in the node. - * `endTokenPos`: Offset into the token array of the last token in the node. - * `startFilePos`: Offset into the code string of the first character that is part of the node. - * `endFilePos`: Offset into the code string of the last character that is part of the node. - -### Using token positions - -The token offset information is useful if you wish to examine the exact formatting used for a node. For example the AST -does not distinguish whether a property was declared using `public` or using `var`, but you can retrieve this -information based on the token position: - -```php -function isDeclaredUsingVar(array $tokens, PhpParser\Node\Stmt\Property $prop) { - $i = $prop->getAttribute('startTokenPos'); - return $tokens[$i][0] === T_VAR; -} -``` - -In order to make use of this function, you will have to provide the tokens from the lexer to your node visitor using -code similar to the following: - -```php -class MyNodeVisitor extends PhpParser\NodeVisitorAbstract { - private $tokens; - public function setTokens(array $tokens) { - $this->tokens = $tokens; - } - - public function leaveNode(PhpParser\Node $node) { - if ($node instanceof PhpParser\Node\Stmt\Property) { - var_dump(isDeclaredUsingVar($this->tokens, $node)); - } - } -} - -$lexer = new PhpParser\Lexer(array( - 'usedAttributes' => array( - 'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos' - ) -)); -$parser = (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7, $lexer); - -$visitor = new MyNodeVisitor(); -$traverser = new PhpParser\NodeTraverser(); -$traverser->addVisitor($visitor); - -try { - $stmts = $parser->parse($code); - $visitor->setTokens($lexer->getTokens()); - $stmts = $traverser->traverse($stmts); -} catch (PhpParser\Error $e) { - echo 'Parse Error: ', $e->getMessage(); -} -``` - -The same approach can also be used to perform specific modifications in the code, without changing the formatting in -other places (which is the case when using the pretty printer). - -Lexer extension ---------------- - -A lexer has to define the following public interface: - - void startLexing(string $code, ErrorHandler $errorHandler = null); - array getTokens(); - string handleHaltCompiler(); - int getNextToken(string &$value = null, array &$startAttributes = null, array &$endAttributes = null); - -The `startLexing()` method is invoked with the source code that is to be lexed (including the opening tag) whenever the -`parse()` method of the parser is called. It can be used to reset state or preprocess the source code or tokens. The -passes `ErrorHandler` should be used to report lexing errors. - -The `getTokens()` method returns the current token array, in the usual `token_get_all()` format. This method is not -used by the parser (which uses `getNextToken()`), but is useful in combination with the token position attributes. - -The `handleHaltCompiler()` method is called whenever a `T_HALT_COMPILER` token is encountered. It has to return the -remaining string after the construct (not including `();`). - -The `getNextToken()` method returns the ID of the next token (as defined by the `Parser::T_*` constants). If no more -tokens are available it must return `0`, which is the ID of the `EOF` token. Furthermore the string content of the -token should be written into the by-reference `$value` parameter (which will then be available as `$n` in the parser). - -### Attribute handling - -The other two by-ref variables `$startAttributes` and `$endAttributes` define which attributes will eventually be -assigned to the generated nodes: The parser will take the `$startAttributes` from the first token which is part of the -node and the `$endAttributes` from the last token that is part of the node. - -E.g. if the tokens `T_FUNCTION T_STRING ... '{' ... '}'` constitute a node, then the `$startAttributes` from the -`T_FUNCTION` token will be taken and the `$endAttributes` from the `'}'` token. - -An application of custom attributes is storing the exact original formatting of literals: While the parser does retain -some information about the formatting of integers (like decimal vs. hexadecimal) or strings (like used quote type), it -does not preserve the exact original formatting (e.g. leading zeros for integers or escape sequences in strings). This -can be remedied by storing the original value in an attribute: - -```php -use PhpParser\Lexer; -use PhpParser\Parser\Tokens; - -class KeepOriginalValueLexer extends Lexer // or Lexer\Emulative -{ - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) { - $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes); - - if ($tokenId == Tokens::T_CONSTANT_ENCAPSED_STRING // non-interpolated string - || $tokenId == Tokens::T_ENCAPSED_AND_WHITESPACE // interpolated string - || $tokenId == Tokens::T_LNUMBER // integer - || $tokenId == Tokens::T_DNUMBER // floating point number - ) { - // could also use $startAttributes, doesn't really matter here - $endAttributes['originalValue'] = $value; - } - - return $tokenId; - } -} -``` diff --git a/lib/nikic/php-parser/grammar/README.md b/lib/nikic/php-parser/grammar/README.md index 3f1698a68..4bae11d82 100644 --- a/lib/nikic/php-parser/grammar/README.md +++ b/lib/nikic/php-parser/grammar/README.md @@ -11,7 +11,7 @@ What do all those files mean? .phpy pseudo language ===================== -The `.y` file is a normal grammer in `kmyacc` (`yacc`) style, with some transformations +The `.y` file is a normal grammar in `kmyacc` (`yacc`) style, with some transformations applied to it: * Nodes are created using the syntax `Name[..., ...]`. This is transformed into @@ -21,8 +21,10 @@ applied to it: Building the parser =================== -In order to rebuild the parser, you need [moriyoshi's fork of kmyacc](https://github.com/moriyoshi/kmyacc-forked). -After you compiled/installed it, run the `rebuildParsers.php` script. +Run `php grammar/rebuildParsers.php` to rebuild the parsers. Additional options: -By default only the `Parser.php` is built. If you want to additionally emit debug symbols and create `y.output`, run the -script with `--debug`. If you want to retain the preprocessed grammar pass `--keep-tmp-grammar`. + * The `KMYACC` environment variable can be used to specify an alternative `kmyacc` binary. + By default the `phpyacc` dev dependency will be used. To use the original `kmyacc`, you + need to compile [moriyoshi's fork](https://github.com/moriyoshi/kmyacc-forked). + * The `--debug` option enables emission of debug symbols and creates the `y.output` file. + * The `--keep-tmp-grammar` option preserves the preprocessed grammar file. diff --git a/lib/nikic/php-parser/grammar/parser.template b/lib/nikic/php-parser/grammar/parser.template index fff893ff4..6166607c9 100644 --- a/lib/nikic/php-parser/grammar/parser.template +++ b/lib/nikic/php-parser/grammar/parser.template @@ -2,8 +2,8 @@ $meta # #semval($) $this->semValue #semval($,%t) $this->semValue -#semval(%n) $this->stackPos-(%l-%n) -#semval(%n,%t) $this->stackPos-(%l-%n) +#semval(%n) $stackPos-(%l-%n) +#semval(%n,%t) $stackPos-(%l-%n) namespace PhpParser\Parser; @@ -32,8 +32,8 @@ class #(-p) extends \PhpParser\ParserAbstract protected $defaultAction = #(YYDEFAULT); protected $unexpectedTokenRule = #(YYUNEXPECTED); - protected $YY2TBLSTATE = #(YY2TBLSTATE); - protected $YYNLSTATES = #(YYNLSTATES); + protected $YY2TBLSTATE = #(YY2TBLSTATE); + protected $numNonLeafStates = #(YYNLSTATES); protected $symbolToName = array( #listvar terminals @@ -88,16 +88,19 @@ class #(-p) extends \PhpParser\ParserAbstract #production-strings; ); #endif + + protected function initReduceCallbacks() { + $this->reduceCallbacks = [ #reduce - - protected function reduceRule%n() { - %b - } + %n => function ($stackPos) { + %b + }, #noact - - protected function reduceRule%n() { - $this->semValue = $this->semStack[$this->stackPos]; - } + %n => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, #endreduce + ]; + } } #tailcode; diff --git a/lib/nikic/php-parser/grammar/php5.y b/lib/nikic/php-parser/grammar/php5.y index 79384381f..f9e7e7dd1 100644 --- a/lib/nikic/php-parser/grammar/php5.y +++ b/lib/nikic/php-parser/grammar/php5.y @@ -16,10 +16,15 @@ top_statement_list_ex: top_statement_list: top_statement_list_ex - { makeNop($nop, $this->lookaheadStartAttributes); + { makeZeroLengthNop($nop, $this->lookaheadStartAttributes); if ($nop !== null) { $1[] = $nop; } $$ = $1; } ; +ampersand: + T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG + | T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG +; + reserved_non_modifiers: T_INCLUDE | T_INCLUDE_ONCE | T_EVAL | T_REQUIRE | T_REQUIRE_ONCE | T_LOGICAL_OR | T_LOGICAL_XOR | T_LOGICAL_AND | T_INSTANCEOF | T_NEW | T_CLONE | T_EXIT | T_IF | T_ELSEIF | T_ELSE | T_ENDIF | T_ECHO | T_DO | T_WHILE @@ -27,7 +32,8 @@ reserved_non_modifiers: | T_FINALLY | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO | T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT | T_BREAK | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS - | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER + | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER | T_FN + | T_MATCH ; semi_reserved: @@ -35,18 +41,31 @@ semi_reserved: | T_STATIC | T_ABSTRACT | T_FINAL | T_PRIVATE | T_PROTECTED | T_PUBLIC ; -identifier: - T_STRING { $$ = $1; } - | semi_reserved { $$ = $1; } +identifier_ex: + T_STRING { $$ = Node\Identifier[$1]; } + | semi_reserved { $$ = Node\Identifier[$1]; } ; -namespace_name_parts: - T_STRING { init($1); } - | namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); } +identifier: + T_STRING { $$ = Node\Identifier[$1]; } +; + +reserved_non_modifiers_identifier: + reserved_non_modifiers { $$ = Node\Identifier[$1]; } ; namespace_name: - namespace_name_parts { $$ = Name[$1]; } + T_STRING { $$ = Name[$1]; } + | T_NAME_QUALIFIED { $$ = Name[$1]; } +; + +legacy_namespace_name: + namespace_name { $$ = $1; } + | T_NAME_FULLY_QUALIFIED { $$ = Name[substr($1, 1)]; } +; + +plain_variable: + T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } ; top_statement: @@ -78,16 +97,11 @@ use_type: | T_CONST { $$ = Stmt\Use_::TYPE_CONSTANT; } ; -/* Using namespace_name_parts here to avoid s/r conflict on T_NS_SEPARATOR */ group_use_declaration: - T_USE use_type namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($3, stackAttributes(#3)), $6, $2]; } - | T_USE use_type T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($4, stackAttributes(#4)), $7, $2]; } - | T_USE namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($2, stackAttributes(#2)), $5, Stmt\Use_::TYPE_UNKNOWN]; } - | T_USE T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($3, stackAttributes(#3)), $6, Stmt\Use_::TYPE_UNKNOWN]; } + T_USE use_type legacy_namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}' + { $$ = Stmt\GroupUse[$3, $6, $2]; } + | T_USE legacy_namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}' + { $$ = Stmt\GroupUse[$2, $5, Stmt\Use_::TYPE_UNKNOWN]; } ; unprefixed_use_declarations: @@ -109,13 +123,15 @@ inline_use_declarations: unprefixed_use_declaration: namespace_name { $$ = Stmt\UseUse[$1, null, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #1); } - | namespace_name T_AS T_STRING + | namespace_name T_AS identifier { $$ = Stmt\UseUse[$1, $3, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #3); } ; use_declaration: - unprefixed_use_declaration { $$ = $1; } - | T_NS_SEPARATOR unprefixed_use_declaration { $$ = $2; } + legacy_namespace_name + { $$ = Stmt\UseUse[$1, null, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #1); } + | legacy_namespace_name T_AS identifier + { $$ = Stmt\UseUse[$1, $3, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #3); } ; inline_use_declaration: @@ -129,7 +145,7 @@ constant_declaration_list: ; constant_declaration: - T_STRING '=' static_scalar { $$ = Node\Const_[$1, $3]; } + identifier '=' static_scalar { $$ = Node\Const_[$1, $3]; } ; class_const_list: @@ -138,7 +154,7 @@ class_const_list: ; class_const: - identifier '=' static_scalar { $$ = Node\Const_[$1, $3]; } + identifier_ex '=' static_scalar { $$ = Node\Const_[$1, $3]; } ; inner_statement_list_ex: @@ -148,7 +164,7 @@ inner_statement_list_ex: inner_statement_list: inner_statement_list_ex - { makeNop($nop, $this->lookaheadStartAttributes); + { makeZeroLengthNop($nop, $this->lookaheadStartAttributes); if ($nop !== null) { $1[] = $nop; } $$ = $1; } ; @@ -166,7 +182,7 @@ non_empty_statement: if ($2) { $$ = $2; prependLeadingComments($$); } else { - makeNop($$, $this->startAttributeStack[#1]); + makeNop($$, $this->startAttributeStack[#1], $this->endAttributes); if (null === $$) { $$ = array(); } } } @@ -185,12 +201,12 @@ non_empty_statement: | T_CONTINUE expr ';' { $$ = Stmt\Continue_[$2]; } | T_RETURN ';' { $$ = Stmt\Return_[null]; } | T_RETURN expr ';' { $$ = Stmt\Return_[$2]; } - | yield_expr ';' { $$ = $1; } | T_GLOBAL global_var_list ';' { $$ = Stmt\Global_[$2]; } | T_STATIC static_var_list ';' { $$ = Stmt\Static_[$2]; } | T_ECHO expr_list ';' { $$ = Stmt\Echo_[$2]; } | T_INLINE_HTML { $$ = Stmt\InlineHTML[$1]; } - | expr ';' { $$ = $1; } + | yield_expr ';' { $$ = Stmt\Expression[$1]; } + | expr ';' { $$ = Stmt\Expression[$1]; } | T_UNSET '(' variables_list ')' ';' { $$ = Stmt\Unset_[$3]; } | T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement { $$ = Stmt\Foreach_[$3, $5[0], ['keyVar' => null, 'byRef' => $5[1], 'stmts' => $7]]; } @@ -200,16 +216,16 @@ non_empty_statement: | T_TRY '{' inner_statement_list '}' catches optional_finally { $$ = Stmt\TryCatch[$3, $5, $6]; $this->checkTryCatch($$); } | T_THROW expr ';' { $$ = Stmt\Throw_[$2]; } - | T_GOTO T_STRING ';' { $$ = Stmt\Goto_[$2]; } - | T_STRING ':' { $$ = Stmt\Label[$1]; } - | expr error { $$ = $1; } + | T_GOTO identifier ';' { $$ = Stmt\Goto_[$2]; } + | identifier ':' { $$ = Stmt\Label[$1]; } + | expr error { $$ = Stmt\Expression[$1]; } | error { $$ = array(); /* means: no statement */ } ; statement: non_empty_statement { $$ = $1; } | ';' - { makeNop($$, $this->startAttributeStack[#1]); + { makeNop($$, $this->startAttributeStack[#1], $this->endAttributes); if ($$ === null) $$ = array(); /* means: no statement */ } ; @@ -219,8 +235,8 @@ catches: ; catch: - T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}' - { $$ = Stmt\Catch_[array($3), parseVar($4), $7]; } + T_CATCH '(' name plain_variable ')' '{' inner_statement_list '}' + { $$ = Stmt\Catch_[array($3), $4, $7]; } ; optional_finally: @@ -235,7 +251,12 @@ variables_list: optional_ref: /* empty */ { $$ = false; } - | '&' { $$ = true; } + | ampersand { $$ = true; } +; + +optional_arg_ref: + /* empty */ { $$ = false; } + | T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG { $$ = true; } ; optional_ellipsis: @@ -244,18 +265,18 @@ optional_ellipsis: ; function_declaration_statement: - T_FUNCTION optional_ref T_STRING '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' + T_FUNCTION optional_ref identifier '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' { $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $9]]; } ; class_declaration_statement: - class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}' + class_entry_type identifier extends_from implements_list '{' class_statement_list '}' { $$ = Stmt\Class_[$2, ['type' => $1, 'extends' => $3, 'implements' => $4, 'stmts' => $6]]; $this->checkClass($$, #2); } - | T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}' + | T_INTERFACE identifier interface_extends_list '{' class_statement_list '}' { $$ = Stmt\Interface_[$2, ['extends' => $3, 'stmts' => $5]]; $this->checkInterface($$, #2); } - | T_TRAIT T_STRING '{' class_statement_list '}' + | T_TRAIT identifier '{' class_statement_list '}' { $$ = Stmt\Trait_[$2, ['stmts' => $4]]; } ; @@ -307,7 +328,7 @@ declare_list: ; declare_list_element: - T_STRING '=' static_scalar { $$ = Stmt\DeclareDeclare[$1, $3]; } + identifier '=' static_scalar { $$ = Stmt\DeclareDeclare[$1, $3]; } ; switch_case_list: @@ -367,7 +388,7 @@ new_else_single: foreach_variable: variable { $$ = array($1, false); } - | '&' variable { $$ = array($2, true); } + | ampersand variable { $$ = array($2, true); } | list_expr { $$ = array($1, false); } ; @@ -382,16 +403,16 @@ non_empty_parameter_list: ; parameter: - optional_param_type optional_ref optional_ellipsis T_VARIABLE - { $$ = Node\Param[parseVar($4), null, $1, $2, $3]; $this->checkParam($$); } - | optional_param_type optional_ref optional_ellipsis T_VARIABLE '=' static_scalar - { $$ = Node\Param[parseVar($4), $6, $1, $2, $3]; $this->checkParam($$); } + optional_param_type optional_arg_ref optional_ellipsis plain_variable + { $$ = Node\Param[$4, null, $1, $2, $3]; $this->checkParam($$); } + | optional_param_type optional_arg_ref optional_ellipsis plain_variable '=' static_scalar + { $$ = Node\Param[$4, $6, $1, $2, $3]; $this->checkParam($$); } ; type: name { $$ = $1; } - | T_ARRAY { $$ = 'array'; } - | T_CALLABLE { $$ = 'callable'; } + | T_ARRAY { $$ = Node\Identifier['array']; } + | T_CALLABLE { $$ = Node\Identifier['callable']; } ; optional_param_type: @@ -417,7 +438,7 @@ non_empty_argument_list: argument: expr { $$ = Node\Arg[$1, false, false]; } - | '&' variable { $$ = Node\Arg[$2, true, false]; } + | ampersand variable { $$ = Node\Arg[$2, true, false]; } | T_ELLIPSIS expr { $$ = Node\Arg[$2, false, true]; } ; @@ -427,7 +448,7 @@ global_var_list: ; global_var: - T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + plain_variable { $$ = $1; } | '$' variable { $$ = Expr\Variable[$2]; } | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } ; @@ -438,20 +459,26 @@ static_var_list: ; static_var: - T_VARIABLE { $$ = Stmt\StaticVar[parseVar($1), null]; } - | T_VARIABLE '=' static_scalar { $$ = Stmt\StaticVar[parseVar($1), $3]; } + plain_variable { $$ = Stmt\StaticVar[$1, null]; } + | plain_variable '=' static_scalar { $$ = Stmt\StaticVar[$1, $3]; } +; + +class_statement_list_ex: + class_statement_list_ex class_statement { if ($2 !== null) { push($1, $2); } } + | /* empty */ { init(); } ; class_statement_list: - class_statement_list class_statement { push($1, $2); } - | /* empty */ { init(); } + class_statement_list_ex + { makeZeroLengthNop($nop, $this->lookaheadStartAttributes); + if ($nop !== null) { $1[] = $nop; } $$ = $1; } ; class_statement: variable_modifiers property_declaration_list ';' { $$ = Stmt\Property[$1, $2]; $this->checkProperty($$, #1); } | T_CONST class_const_list ';' { $$ = Stmt\ClassConst[$2, 0]; } - | method_modifiers T_FUNCTION optional_ref identifier '(' parameter_list ')' optional_return_type method_body + | method_modifiers T_FUNCTION optional_ref identifier_ex '(' parameter_list ')' optional_return_type method_body { $$ = Stmt\ClassMethod[$4, ['type' => $1, 'byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9]]; $this->checkClassMethod($$, #1); } | T_USE class_name_list trait_adaptations { $$ = Stmt\TraitUse[$2, $3]; } @@ -470,22 +497,22 @@ trait_adaptation_list: trait_adaptation: trait_method_reference_fully_qualified T_INSTEADOF class_name_list ';' { $$ = Stmt\TraitUseAdaptation\Precedence[$1[0], $1[1], $3]; } - | trait_method_reference T_AS member_modifier identifier ';' + | trait_method_reference T_AS member_modifier identifier_ex ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, $4]; } | trait_method_reference T_AS member_modifier ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; } - | trait_method_reference T_AS T_STRING ';' + | trait_method_reference T_AS identifier ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } - | trait_method_reference T_AS reserved_non_modifiers ';' + | trait_method_reference T_AS reserved_non_modifiers_identifier ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } ; trait_method_reference_fully_qualified: - name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = array($1, $3); } + name T_PAAMAYIM_NEKUDOTAYIM identifier_ex { $$ = array($1, $3); } ; trait_method_reference: trait_method_reference_fully_qualified { $$ = $1; } - | identifier { $$ = array(null, $1); } + | identifier_ex { $$ = array(null, $1); } ; method_body: @@ -522,9 +549,13 @@ property_declaration_list: | property_declaration_list ',' property_declaration { push($1, $3); } ; +property_decl_name: + T_VARIABLE { $$ = Node\VarLikeIdentifier[parseVar($1)]; } +; + property_declaration: - T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; } - | T_VARIABLE '=' static_scalar { $$ = Stmt\PropertyProperty[parseVar($1), $3]; } + property_decl_name { $$ = Stmt\PropertyProperty[$1, null]; } + | property_decl_name '=' static_scalar { $$ = Stmt\PropertyProperty[$1, $3]; } ; expr_list: @@ -541,8 +572,8 @@ expr: variable { $$ = $1; } | list_expr '=' expr { $$ = Expr\Assign[$1, $3]; } | variable '=' expr { $$ = Expr\Assign[$1, $3]; } - | variable '=' '&' variable { $$ = Expr\AssignRef[$1, $4]; } - | variable '=' '&' new_expr { $$ = Expr\AssignRef[$1, $4]; } + | variable '=' ampersand variable { $$ = Expr\AssignRef[$1, $4]; } + | variable '=' ampersand new_expr { $$ = Expr\AssignRef[$1, $4]; } | new_expr { $$ = $1; } | T_CLONE expr { $$ = Expr\Clone_[$2]; } | variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; } @@ -557,6 +588,7 @@ expr: | variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; } | variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; } | variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; } + | variable T_COALESCE_EQUAL expr { $$ = Expr\AssignOp\Coalesce [$1, $3]; } | variable T_INC { $$ = Expr\PostInc[$1]; } | T_INC variable { $$ = Expr\PreInc [$2]; } | variable T_DEC { $$ = Expr\PostDec[$1]; } @@ -567,7 +599,8 @@ expr: | expr T_LOGICAL_AND expr { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } | expr T_LOGICAL_XOR expr { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } | expr '|' expr { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } - | expr '&' expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | expr T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | expr T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } | expr '^' expr { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } | expr '.' expr { $$ = Expr\BinaryOp\Concat [$1, $3]; } | expr '+' expr { $$ = Expr\BinaryOp\Plus [$1, $3]; } @@ -606,7 +639,10 @@ expr: | T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; } | T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; } | T_INT_CAST expr { $$ = Expr\Cast\Int_ [$2]; } - | T_DOUBLE_CAST expr { $$ = Expr\Cast\Double [$2]; } + | T_DOUBLE_CAST expr + { $attrs = attributes(); + $attrs['kind'] = $this->getFloatCastKind($1); + $$ = new Expr\Cast\Double($2, $attrs); } | T_STRING_CAST expr { $$ = Expr\Cast\String_ [$2]; } | T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; } | T_OBJECT_CAST expr { $$ = Expr\Cast\Object_ [$2]; } @@ -665,6 +701,7 @@ anonymous_class: T_CLASS ctor_arguments extends_from implements_list '{' class_statement_list '}' { $$ = array(Stmt\Class_[null, ['type' => 0, 'extends' => $3, 'implements' => $4, 'stmts' => $6]], $2); $this->checkClass($$[0], -1); } +; new_expr: T_NEW class_name_reference ctor_arguments { $$ = Expr\New_[$2, $3]; } @@ -683,30 +720,17 @@ lexical_var_list: ; lexical_var: - optional_ref T_VARIABLE { $$ = Expr\ClosureUse[parseVar($2), $1]; } + optional_ref plain_variable { $$ = Expr\ClosureUse[$2, $1]; } ; function_call: name argument_list { $$ = Expr\FuncCall[$1, $2]; } - | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier argument_list + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier_ex argument_list { $$ = Expr\StaticCall[$1, $3, $4]; } | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '{' expr '}' argument_list { $$ = Expr\StaticCall[$1, $4, $6]; } - | static_property argument_list { - if ($1 instanceof Node\Expr\StaticPropertyFetch) { - $$ = Expr\StaticCall[$1->class, Expr\Variable[$1->name], $2]; - } elseif ($1 instanceof Node\Expr\ArrayDimFetch) { - $tmp = $1; - while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { - $tmp = $tmp->var; - } - - $$ = Expr\StaticCall[$tmp->var->class, $1, $2]; - $tmp->var = Expr\Variable[$tmp->var->name]; - } else { - throw new \Exception; - } - } + | static_property argument_list + { $$ = $this->fixupPhp5StaticPropCall($1, $2, attributes()); } | variable_without_objects argument_list { $$ = Expr\FuncCall[$1, $2]; } | function_call '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } @@ -719,9 +743,10 @@ class_name: ; name: - namespace_name_parts { $$ = Name[$1]; } - | T_NS_SEPARATOR namespace_name_parts { $$ = Name\FullyQualified[$2]; } - | T_NAMESPACE T_NS_SEPARATOR namespace_name_parts { $$ = Name\Relative[$3]; } + T_STRING { $$ = Name[$1]; } + | T_NAME_QUALIFIED { $$ = Name[$1]; } + | T_NAME_FULLY_QUALIFIED { $$ = Name\FullyQualified[substr($1, 1)]; } + | T_NAME_RELATIVE { $$ = Name\Relative[substr($1, 10)]; } ; class_name_reference: @@ -781,16 +806,14 @@ common_scalar: | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; } | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; } | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC - { $attrs = attributes(); setDocStringAttrs($attrs, $1); - $$ = new Scalar\String_(Scalar\String_::parseDocString($1, $2, false), $attrs); } + { $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), false); } | T_START_HEREDOC T_END_HEREDOC - { $attrs = attributes(); setDocStringAttrs($attrs, $1); - $$ = new Scalar\String_('', $attrs); } + { $$ = $this->parseDocString($1, '', $2, attributes(), stackAttributes(#2), false); } ; static_scalar: common_scalar { $$ = $1; } - | class_name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = Expr\ClassConstFetch[$1, $3]; } + | class_name T_PAAMAYIM_NEKUDOTAYIM identifier_ex { $$ = Expr\ClassConstFetch[$1, $3]; } | name { $$ = Expr\ConstFetch[$1]; } | T_ARRAY '(' static_array_pair_list ')' { $$ = Expr\Array_[$3]; } | '[' static_array_pair_list ']' { $$ = Expr\Array_[$2]; } @@ -804,7 +827,10 @@ static_operation: | static_scalar T_LOGICAL_AND static_scalar { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } | static_scalar T_LOGICAL_XOR static_scalar { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } | static_scalar '|' static_scalar { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } - | static_scalar '&' static_scalar { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | static_scalar T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG static_scalar + { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | static_scalar T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG static_scalar + { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } | static_scalar '^' static_scalar { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } | static_scalar '.' static_scalar { $$ = Expr\BinaryOp\Concat [$1, $3]; } | static_scalar '+' static_scalar { $$ = Expr\BinaryOp\Plus [$1, $3]; } @@ -835,7 +861,7 @@ static_operation: constant: name { $$ = Expr\ConstFetch[$1]; } - | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier + | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier_ex { $$ = Expr\ClassConstFetch[$1, $3]; } ; @@ -846,8 +872,7 @@ scalar: { $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); } | T_START_HEREDOC encaps_list T_END_HEREDOC - { $attrs = attributes(); setDocStringAttrs($attrs, $1); - parseEncapsedDoc($2, true); $$ = new Scalar\Encapsed($2, $attrs); } + { $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), true); } ; static_array_pair_list: @@ -914,9 +939,14 @@ static_property: | static_property_with_arrays { $$ = $1; } ; +static_property_simple_name: + T_VARIABLE + { $var = parseVar($1); $$ = \is_string($var) ? Node\VarLikeIdentifier[$var] : $var; } +; + static_property_with_arrays: - class_name_or_var T_PAAMAYIM_NEKUDOTAYIM T_VARIABLE - { $$ = Expr\StaticPropertyFetch[$1, parseVar($3)]; } + class_name_or_var T_PAAMAYIM_NEKUDOTAYIM static_property_simple_name + { $$ = Expr\StaticPropertyFetch[$1, $3]; } | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM '$' '{' expr '}' { $$ = Expr\StaticPropertyFetch[$1, $5]; } | static_property_with_arrays '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } @@ -926,7 +956,7 @@ static_property_with_arrays: reference_variable: reference_variable '[' dim_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } | reference_variable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + | plain_variable { $$ = $1; } | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } ; @@ -936,7 +966,7 @@ dim_offset: ; object_property: - T_STRING { $$ = $1; } + identifier { $$ = $1; } | '{' expr '}' { $$ = $2; } | variable_without_objects { $$ = $1; } | error { $$ = Expr\Error[]; $this->errorState = 2; } @@ -970,8 +1000,9 @@ non_empty_array_pair_list: array_pair: expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; } | expr { $$ = Expr\ArrayItem[$1, null, false]; } - | expr T_DOUBLE_ARROW '&' variable { $$ = Expr\ArrayItem[$4, $1, true]; } - | '&' variable { $$ = Expr\ArrayItem[$2, null, true]; } + | expr T_DOUBLE_ARROW ampersand variable { $$ = Expr\ArrayItem[$4, $1, true]; } + | ampersand variable { $$ = Expr\ArrayItem[$2, null, true]; } + | T_ELLIPSIS expr { $$ = Expr\ArrayItem[$2, null, false, attributes(), true]; } ; encaps_list: @@ -985,25 +1016,25 @@ encaps_string_part: T_ENCAPSED_AND_WHITESPACE { $$ = Scalar\EncapsedStringPart[$1]; } ; -encaps_base_var: - T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } +encaps_str_varname: + T_STRING_VARNAME { $$ = Expr\Variable[$1]; } ; encaps_var: - encaps_base_var { $$ = $1; } - | encaps_base_var '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | encaps_base_var T_OBJECT_OPERATOR T_STRING { $$ = Expr\PropertyFetch[$1, $3]; } + plain_variable { $$ = $1; } + | plain_variable '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | plain_variable T_OBJECT_OPERATOR identifier { $$ = Expr\PropertyFetch[$1, $3]; } | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = Expr\Variable[$2]; } | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = Expr\Variable[$2]; } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' - { $$ = Expr\ArrayDimFetch[Expr\Variable[$2], $4]; } + | T_DOLLAR_OPEN_CURLY_BRACES encaps_str_varname '[' expr ']' '}' + { $$ = Expr\ArrayDimFetch[$2, $4]; } | T_CURLY_OPEN variable '}' { $$ = $2; } ; encaps_var_offset: T_STRING { $$ = Scalar\String_[$1]; } | T_NUM_STRING { $$ = $this->parseNumString($1, attributes()); } - | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + | plain_variable { $$ = $1; } ; %% diff --git a/lib/nikic/php-parser/grammar/php7.y b/lib/nikic/php-parser/grammar/php7.y index f9b599b8d..eac68d095 100644 --- a/lib/nikic/php-parser/grammar/php7.y +++ b/lib/nikic/php-parser/grammar/php7.y @@ -16,10 +16,15 @@ top_statement_list_ex: top_statement_list: top_statement_list_ex - { makeNop($nop, $this->lookaheadStartAttributes); + { makeZeroLengthNop($nop, $this->lookaheadStartAttributes); if ($nop !== null) { $1[] = $nop; } $$ = $1; } ; +ampersand: + T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG + | T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG +; + reserved_non_modifiers: T_INCLUDE | T_INCLUDE_ONCE | T_EVAL | T_REQUIRE | T_REQUIRE_ONCE | T_LOGICAL_OR | T_LOGICAL_XOR | T_LOGICAL_AND | T_INSTANCEOF | T_NEW | T_CLONE | T_EXIT | T_IF | T_ELSEIF | T_ELSE | T_ENDIF | T_ECHO | T_DO | T_WHILE @@ -27,26 +32,46 @@ reserved_non_modifiers: | T_FINALLY | T_THROW | T_USE | T_INSTEADOF | T_GLOBAL | T_VAR | T_UNSET | T_ISSET | T_EMPTY | T_CONTINUE | T_GOTO | T_FUNCTION | T_CONST | T_RETURN | T_PRINT | T_YIELD | T_LIST | T_SWITCH | T_ENDSWITCH | T_CASE | T_DEFAULT | T_BREAK | T_ARRAY | T_CALLABLE | T_EXTENDS | T_IMPLEMENTS | T_NAMESPACE | T_TRAIT | T_INTERFACE | T_CLASS - | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER + | T_CLASS_C | T_TRAIT_C | T_FUNC_C | T_METHOD_C | T_LINE | T_FILE | T_DIR | T_NS_C | T_HALT_COMPILER | T_FN + | T_MATCH | T_ENUM ; semi_reserved: reserved_non_modifiers - | T_STATIC | T_ABSTRACT | T_FINAL | T_PRIVATE | T_PROTECTED | T_PUBLIC + | T_STATIC | T_ABSTRACT | T_FINAL | T_PRIVATE | T_PROTECTED | T_PUBLIC | T_READONLY ; -identifier: - T_STRING { $$ = $1; } - | semi_reserved { $$ = $1; } +identifier_maybe_reserved: + T_STRING { $$ = Node\Identifier[$1]; } + | semi_reserved { $$ = Node\Identifier[$1]; } ; -namespace_name_parts: - T_STRING { init($1); } - | namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); } +identifier_not_reserved: + T_STRING { $$ = Node\Identifier[$1]; } +; + +reserved_non_modifiers_identifier: + reserved_non_modifiers { $$ = Node\Identifier[$1]; } +; + +namespace_declaration_name: + T_STRING { $$ = Name[$1]; } + | semi_reserved { $$ = Name[$1]; } + | T_NAME_QUALIFIED { $$ = Name[$1]; } ; namespace_name: - namespace_name_parts { $$ = Name[$1]; } + T_STRING { $$ = Name[$1]; } + | T_NAME_QUALIFIED { $$ = Name[$1]; } +; + +legacy_namespace_name: + namespace_name { $$ = $1; } + | T_NAME_FULLY_QUALIFIED { $$ = Name[substr($1, 1)]; } +; + +plain_variable: + T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } ; semi: @@ -62,6 +87,31 @@ no_comma: optional_comma: /* empty */ | ',' +; + +attribute_decl: + class_name { $$ = Node\Attribute[$1, []]; } + | class_name argument_list { $$ = Node\Attribute[$1, $2]; } +; + +attribute_group: + attribute_decl { init($1); } + | attribute_group ',' attribute_decl { push($1, $3); } +; + +attribute: + T_ATTRIBUTE attribute_group optional_comma ']' { $$ = Node\AttributeGroup[$2]; } +; + +attributes: + attribute { init($1); } + | attributes attribute { push($1, $2); } +; + +optional_attributes: + /* empty */ { $$ = []; } + | attributes { $$ = $1; } +; top_statement: statement { $$ = $1; } @@ -69,11 +119,11 @@ top_statement: | class_declaration_statement { $$ = $1; } | T_HALT_COMPILER { $$ = Stmt\HaltCompiler[$this->lexer->handleHaltCompiler()]; } - | T_NAMESPACE namespace_name semi + | T_NAMESPACE namespace_declaration_name semi { $$ = Stmt\Namespace_[$2, null]; $$->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); $this->checkNamespace($$); } - | T_NAMESPACE namespace_name '{' top_statement_list '}' + | T_NAMESPACE namespace_declaration_name '{' top_statement_list '}' { $$ = Stmt\Namespace_[$2, $4]; $$->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); $this->checkNamespace($$); } @@ -92,16 +142,11 @@ use_type: | T_CONST { $$ = Stmt\Use_::TYPE_CONSTANT; } ; -/* Using namespace_name_parts here to avoid s/r conflict on T_NS_SEPARATOR */ group_use_declaration: - T_USE use_type namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($3, stackAttributes(#3)), $6, $2]; } - | T_USE use_type T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' unprefixed_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($4, stackAttributes(#4)), $7, $2]; } - | T_USE namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($2, stackAttributes(#2)), $5, Stmt\Use_::TYPE_UNKNOWN]; } - | T_USE T_NS_SEPARATOR namespace_name_parts T_NS_SEPARATOR '{' inline_use_declarations '}' - { $$ = Stmt\GroupUse[new Name($3, stackAttributes(#3)), $6, Stmt\Use_::TYPE_UNKNOWN]; } + T_USE use_type legacy_namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}' + { $$ = Stmt\GroupUse[$3, $6, $2]; } + | T_USE legacy_namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}' + { $$ = Stmt\GroupUse[$2, $5, Stmt\Use_::TYPE_UNKNOWN]; } ; unprefixed_use_declarations: @@ -136,13 +181,15 @@ non_empty_inline_use_declarations: unprefixed_use_declaration: namespace_name { $$ = Stmt\UseUse[$1, null, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #1); } - | namespace_name T_AS T_STRING + | namespace_name T_AS identifier_not_reserved { $$ = Stmt\UseUse[$1, $3, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #3); } ; use_declaration: - unprefixed_use_declaration { $$ = $1; } - | T_NS_SEPARATOR unprefixed_use_declaration { $$ = $2; } + legacy_namespace_name + { $$ = Stmt\UseUse[$1, null, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #1); } + | legacy_namespace_name T_AS identifier_not_reserved + { $$ = Stmt\UseUse[$1, $3, Stmt\Use_::TYPE_UNKNOWN]; $this->checkUseUse($$, #3); } ; inline_use_declaration: @@ -161,7 +208,7 @@ non_empty_constant_declaration_list: ; constant_declaration: - T_STRING '=' expr { $$ = Node\Const_[$1, $3]; } + identifier_not_reserved '=' expr { $$ = Node\Const_[$1, $3]; } ; class_const_list: @@ -174,7 +221,7 @@ non_empty_class_const_list: ; class_const: - identifier '=' expr { $$ = Node\Const_[$1, $3]; } + identifier_maybe_reserved '=' expr { $$ = Node\Const_[$1, $3]; } ; inner_statement_list_ex: @@ -184,7 +231,7 @@ inner_statement_list_ex: inner_statement_list: inner_statement_list_ex - { makeNop($nop, $this->lookaheadStartAttributes); + { makeZeroLengthNop($nop, $this->lookaheadStartAttributes); if ($nop !== null) { $1[] = $nop; } $$ = $1; } ; @@ -202,7 +249,7 @@ non_empty_statement: if ($2) { $$ = $2; prependLeadingComments($$); } else { - makeNop($$, $this->startAttributeStack[#1]); + makeNop($$, $this->startAttributeStack[#1], $this->endAttributes); if (null === $$) { $$ = array(); } } } @@ -220,27 +267,37 @@ non_empty_statement: | T_RETURN optional_expr semi { $$ = Stmt\Return_[$2]; } | T_GLOBAL global_var_list semi { $$ = Stmt\Global_[$2]; } | T_STATIC static_var_list semi { $$ = Stmt\Static_[$2]; } - | T_ECHO expr_list semi { $$ = Stmt\Echo_[$2]; } + | T_ECHO expr_list_forbid_comma semi { $$ = Stmt\Echo_[$2]; } | T_INLINE_HTML { $$ = Stmt\InlineHTML[$1]; } - | expr semi { $$ = $1; } + | expr semi { + $e = $1; + if ($e instanceof Expr\Throw_) { + // For backwards-compatibility reasons, convert throw in statement position into + // Stmt\Throw_ rather than Stmt\Expression(Expr\Throw_). + $$ = Stmt\Throw_[$e->expr]; + } else { + $$ = Stmt\Expression[$e]; + } + } | T_UNSET '(' variables_list ')' semi { $$ = Stmt\Unset_[$3]; } | T_FOREACH '(' expr T_AS foreach_variable ')' foreach_statement { $$ = Stmt\Foreach_[$3, $5[0], ['keyVar' => null, 'byRef' => $5[1], 'stmts' => $7]]; } | T_FOREACH '(' expr T_AS variable T_DOUBLE_ARROW foreach_variable ')' foreach_statement { $$ = Stmt\Foreach_[$3, $7[0], ['keyVar' => $5, 'byRef' => $7[1], 'stmts' => $9]]; } + | T_FOREACH '(' expr error ')' foreach_statement + { $$ = Stmt\Foreach_[$3, new Expr\Error(stackAttributes(#4)), ['stmts' => $6]]; } | T_DECLARE '(' declare_list ')' declare_statement { $$ = Stmt\Declare_[$3, $5]; } | T_TRY '{' inner_statement_list '}' catches optional_finally { $$ = Stmt\TryCatch[$3, $5, $6]; $this->checkTryCatch($$); } - | T_THROW expr semi { $$ = Stmt\Throw_[$2]; } - | T_GOTO T_STRING semi { $$ = Stmt\Goto_[$2]; } - | T_STRING ':' { $$ = Stmt\Label[$1]; } + | T_GOTO identifier_not_reserved semi { $$ = Stmt\Goto_[$2]; } + | identifier_not_reserved ':' { $$ = Stmt\Label[$1]; } | error { $$ = array(); /* means: no statement */ } ; statement: non_empty_statement { $$ = $1; } | ';' - { makeNop($$, $this->startAttributeStack[#1]); + { makeNop($$, $this->startAttributeStack[#1], $this->endAttributes); if ($$ === null) $$ = array(); /* means: no statement */ } ; @@ -255,8 +312,8 @@ name_union: ; catch: - T_CATCH '(' name_union T_VARIABLE ')' '{' inner_statement_list '}' - { $$ = Stmt\Catch_[$3, parseVar($4), $7]; } + T_CATCH '(' name_union optional_plain_variable ')' '{' inner_statement_list '}' + { $$ = Stmt\Catch_[$3, $4, $7]; } ; optional_finally: @@ -265,7 +322,7 @@ optional_finally: ; variables_list: - non_empty_variables_list no_comma { $$ = $1; } + non_empty_variables_list optional_comma { $$ = $1; } ; non_empty_variables_list: @@ -275,7 +332,12 @@ non_empty_variables_list: optional_ref: /* empty */ { $$ = false; } - | '&' { $$ = true; } + | ampersand { $$ = true; } +; + +optional_arg_ref: + /* empty */ { $$ = false; } + | T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG { $$ = true; } ; optional_ellipsis: @@ -283,20 +345,39 @@ optional_ellipsis: | T_ELLIPSIS { $$ = true; } ; +block_or_error: + '{' inner_statement_list '}' { $$ = $2; } + | error { $$ = []; } +; + function_declaration_statement: - T_FUNCTION optional_ref T_STRING '(' parameter_list ')' optional_return_type '{' inner_statement_list '}' - { $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $9]]; } + T_FUNCTION optional_ref identifier_not_reserved '(' parameter_list ')' optional_return_type block_or_error + { $$ = Stmt\Function_[$3, ['byRef' => $2, 'params' => $5, 'returnType' => $7, 'stmts' => $8, 'attrGroups' => []]]; } + | attributes T_FUNCTION optional_ref identifier_not_reserved '(' parameter_list ')' optional_return_type block_or_error + { $$ = Stmt\Function_[$4, ['byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9, 'attrGroups' => $1]]; } ; class_declaration_statement: - class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}' - { $$ = Stmt\Class_[$2, ['type' => $1, 'extends' => $3, 'implements' => $4, 'stmts' => $6]]; - $this->checkClass($$, #2); } - | T_INTERFACE T_STRING interface_extends_list '{' class_statement_list '}' - { $$ = Stmt\Interface_[$2, ['extends' => $3, 'stmts' => $5]]; - $this->checkInterface($$, #2); } - | T_TRAIT T_STRING '{' class_statement_list '}' - { $$ = Stmt\Trait_[$2, ['stmts' => $4]]; } + optional_attributes class_entry_type identifier_not_reserved extends_from implements_list '{' class_statement_list '}' + { $$ = Stmt\Class_[$3, ['type' => $2, 'extends' => $4, 'implements' => $5, 'stmts' => $7, 'attrGroups' => $1]]; + $this->checkClass($$, #3); } + | optional_attributes T_INTERFACE identifier_not_reserved interface_extends_list '{' class_statement_list '}' + { $$ = Stmt\Interface_[$3, ['extends' => $4, 'stmts' => $6, 'attrGroups' => $1]]; + $this->checkInterface($$, #3); } + | optional_attributes T_TRAIT identifier_not_reserved '{' class_statement_list '}' + { $$ = Stmt\Trait_[$3, ['stmts' => $5, 'attrGroups' => $1]]; } + | optional_attributes T_ENUM identifier_not_reserved enum_scalar_type implements_list '{' class_statement_list '}' + { $$ = Stmt\Enum_[$3, ['scalarType' => $4, 'implements' => $5, 'stmts' => $7, 'attrGroups' => $1]]; + $this->checkEnum($$, #3); } +; + +enum_scalar_type: + /* empty */ { $$ = null; } + | ':' type { $$ = $2; } + +enum_case_expr: + /* empty */ { $$ = null; } + | '=' expr { $$ = $2; } ; class_entry_type: @@ -355,7 +436,7 @@ non_empty_declare_list: ; declare_list_element: - T_STRING '=' expr { $$ = Stmt\DeclareDeclare[$1, $3]; } + identifier_not_reserved '=' expr { $$ = Stmt\DeclareDeclare[$1, $3]; } ; switch_case_list: @@ -380,6 +461,25 @@ case_separator: | ';' ; +match: + T_MATCH '(' expr ')' '{' match_arm_list '}' { $$ = Expr\Match_[$3, $6]; } +; + +match_arm_list: + /* empty */ { $$ = []; } + | non_empty_match_arm_list optional_comma { $$ = $1; } +; + +non_empty_match_arm_list: + match_arm { init($1); } + | non_empty_match_arm_list ',' match_arm { push($1, $3); } +; + +match_arm: + expr_list_allow_comma T_DOUBLE_ARROW expr { $$ = Node\MatchArm[$1, $3]; } + | T_DEFAULT optional_comma T_DOUBLE_ARROW expr { $$ = Node\MatchArm[null, $4]; } +; + while_statement: statement { $$ = toArray($1); } | ':' inner_statement_list T_ENDWHILE ';' { $$ = $2; } @@ -415,13 +515,13 @@ new_else_single: foreach_variable: variable { $$ = array($1, false); } - | '&' variable { $$ = array($2, true); } + | ampersand variable { $$ = array($2, true); } | list_expr { $$ = array($1, false); } | array_short_syntax { $$ = array($1, false); } ; parameter_list: - non_empty_parameter_list no_comma { $$ = $1; } + non_empty_parameter_list optional_comma { $$ = $1; } | /* empty */ { $$ = array(); } ; @@ -430,37 +530,100 @@ non_empty_parameter_list: | non_empty_parameter_list ',' parameter { push($1, $3); } ; +optional_property_modifiers: + /* empty */ { $$ = 0; } + | optional_property_modifiers property_modifier + { $this->checkModifier($1, $2, #2); $$ = $1 | $2; } +; + +property_modifier: + T_PUBLIC { $$ = Stmt\Class_::MODIFIER_PUBLIC; } + | T_PROTECTED { $$ = Stmt\Class_::MODIFIER_PROTECTED; } + | T_PRIVATE { $$ = Stmt\Class_::MODIFIER_PRIVATE; } + | T_READONLY { $$ = Stmt\Class_::MODIFIER_READONLY; } +; + parameter: - optional_param_type optional_ref optional_ellipsis T_VARIABLE - { $$ = Node\Param[parseVar($4), null, $1, $2, $3]; $this->checkParam($$); } - | optional_param_type optional_ref optional_ellipsis T_VARIABLE '=' expr - { $$ = Node\Param[parseVar($4), $6, $1, $2, $3]; $this->checkParam($$); } + optional_attributes optional_property_modifiers optional_type_without_static + optional_arg_ref optional_ellipsis plain_variable + { $$ = new Node\Param($6, null, $3, $4, $5, attributes(), $2, $1); + $this->checkParam($$); } + | optional_attributes optional_property_modifiers optional_type_without_static + optional_arg_ref optional_ellipsis plain_variable '=' expr + { $$ = new Node\Param($6, $8, $3, $4, $5, attributes(), $2, $1); + $this->checkParam($$); } + | optional_attributes optional_property_modifiers optional_type_without_static + optional_arg_ref optional_ellipsis error + { $$ = new Node\Param(Expr\Error[], null, $3, $4, $5, attributes(), $2, $1); } ; type_expr: type { $$ = $1; } | '?' type { $$ = Node\NullableType[$2]; } + | union_type { $$ = Node\UnionType[$1]; } + | intersection_type { $$ = Node\IntersectionType[$1]; } ; type: - name { $$ = $this->handleBuiltinTypes($1); } - | T_ARRAY { $$ = 'array'; } - | T_CALLABLE { $$ = 'callable'; } + type_without_static { $$ = $1; } + | T_STATIC { $$ = Node\Name['static']; } ; -optional_param_type: +type_without_static: + name { $$ = $this->handleBuiltinTypes($1); } + | T_ARRAY { $$ = Node\Identifier['array']; } + | T_CALLABLE { $$ = Node\Identifier['callable']; } +; + +union_type: + type '|' type { init($1, $3); } + | union_type '|' type { push($1, $3); } +; + +union_type_without_static: + type_without_static '|' type_without_static { init($1, $3); } + | union_type_without_static '|' type_without_static { push($1, $3); } +; + +intersection_type: + type T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG type { init($1, $3); } + | intersection_type T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG type + { push($1, $3); } +; + +intersection_type_without_static: + type_without_static T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG type_without_static + { init($1, $3); } + | intersection_type_without_static T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG type_without_static + { push($1, $3); } +; + +type_expr_without_static: + type_without_static { $$ = $1; } + | '?' type_without_static { $$ = Node\NullableType[$2]; } + | union_type_without_static { $$ = Node\UnionType[$1]; } + | intersection_type_without_static { $$ = Node\IntersectionType[$1]; } +; + +optional_type_without_static: /* empty */ { $$ = null; } - | type_expr { $$ = $1; } + | type_expr_without_static { $$ = $1; } ; optional_return_type: /* empty */ { $$ = null; } | ':' type_expr { $$ = $2; } + | ':' error { $$ = null; } ; argument_list: '(' ')' { $$ = array(); } - | '(' non_empty_argument_list no_comma ')' { $$ = $2; } + | '(' non_empty_argument_list optional_comma ')' { $$ = $2; } + | '(' variadic_placeholder ')' { init($2); } +; + +variadic_placeholder: + T_ELLIPSIS { $$ = Node\VariadicPlaceholder[]; } ; non_empty_argument_list: @@ -470,8 +633,10 @@ non_empty_argument_list: argument: expr { $$ = Node\Arg[$1, false, false]; } - | '&' variable { $$ = Node\Arg[$2, true, false]; } + | ampersand variable { $$ = Node\Arg[$2, true, false]; } | T_ELLIPSIS expr { $$ = Node\Arg[$2, false, true]; } + | identifier_maybe_reserved ':' expr + { $$ = new Node\Arg($3, false, false, attributes(), $1); } ; global_var_list: @@ -484,7 +649,7 @@ non_empty_global_var_list: ; global_var: - simple_variable { $$ = Expr\Variable[$1]; } + simple_variable { $$ = $1; } ; static_var_list: @@ -497,24 +662,36 @@ non_empty_static_var_list: ; static_var: - T_VARIABLE { $$ = Stmt\StaticVar[parseVar($1), null]; } - | T_VARIABLE '=' expr { $$ = Stmt\StaticVar[parseVar($1), $3]; } + plain_variable { $$ = Stmt\StaticVar[$1, null]; } + | plain_variable '=' expr { $$ = Stmt\StaticVar[$1, $3]; } ; -class_statement_list: - class_statement_list class_statement { push($1, $2); } +class_statement_list_ex: + class_statement_list_ex class_statement { if ($2 !== null) { push($1, $2); } } | /* empty */ { init(); } ; +class_statement_list: + class_statement_list_ex + { makeZeroLengthNop($nop, $this->lookaheadStartAttributes); + if ($nop !== null) { $1[] = $nop; } $$ = $1; } +; + class_statement: - variable_modifiers property_declaration_list ';' - { $$ = Stmt\Property[$1, $2]; $this->checkProperty($$, #1); } - | method_modifiers T_CONST class_const_list ';' - { $$ = Stmt\ClassConst[$3, $1]; $this->checkClassConst($$, #1); } - | method_modifiers T_FUNCTION optional_ref identifier '(' parameter_list ')' optional_return_type method_body - { $$ = Stmt\ClassMethod[$4, ['type' => $1, 'byRef' => $3, 'params' => $6, 'returnType' => $8, 'stmts' => $9]]; - $this->checkClassMethod($$, #1); } + optional_attributes variable_modifiers optional_type_without_static property_declaration_list semi + { $$ = new Stmt\Property($2, $4, attributes(), $3, $1); + $this->checkProperty($$, #2); } + | optional_attributes method_modifiers T_CONST class_const_list semi + { $$ = new Stmt\ClassConst($4, $2, attributes(), $1); + $this->checkClassConst($$, #2); } + | optional_attributes method_modifiers T_FUNCTION optional_ref identifier_maybe_reserved '(' parameter_list ')' + optional_return_type method_body + { $$ = Stmt\ClassMethod[$5, ['type' => $2, 'byRef' => $4, 'params' => $7, 'returnType' => $9, 'stmts' => $10, 'attrGroups' => $1]]; + $this->checkClassMethod($$, #2); } | T_USE class_name_list trait_adaptations { $$ = Stmt\TraitUse[$2, $3]; } + | optional_attributes T_CASE identifier_maybe_reserved enum_case_expr semi + { $$ = Stmt\EnumCase[$3, $4, $1]; } + | error { $$ = null; /* will be skipped */ } ; trait_adaptations: @@ -530,27 +707,27 @@ trait_adaptation_list: trait_adaptation: trait_method_reference_fully_qualified T_INSTEADOF class_name_list ';' { $$ = Stmt\TraitUseAdaptation\Precedence[$1[0], $1[1], $3]; } - | trait_method_reference T_AS member_modifier identifier ';' + | trait_method_reference T_AS member_modifier identifier_maybe_reserved ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, $4]; } | trait_method_reference T_AS member_modifier ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; } - | trait_method_reference T_AS T_STRING ';' + | trait_method_reference T_AS identifier_not_reserved ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } - | trait_method_reference T_AS reserved_non_modifiers ';' + | trait_method_reference T_AS reserved_non_modifiers_identifier ';' { $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; } ; trait_method_reference_fully_qualified: - name T_PAAMAYIM_NEKUDOTAYIM identifier { $$ = array($1, $3); } + name T_PAAMAYIM_NEKUDOTAYIM identifier_maybe_reserved { $$ = array($1, $3); } ; trait_method_reference: trait_method_reference_fully_qualified { $$ = $1; } - | identifier { $$ = array(null, $1); } + | identifier_maybe_reserved { $$ = array(null, $1); } ; method_body: ';' /* abstract method */ { $$ = null; } - | '{' inner_statement_list '}' { $$ = $2; } + | block_or_error { $$ = $1; } ; variable_modifiers: @@ -575,6 +752,7 @@ member_modifier: | T_STATIC { $$ = Stmt\Class_::MODIFIER_STATIC; } | T_ABSTRACT { $$ = Stmt\Class_::MODIFIER_ABSTRACT; } | T_FINAL { $$ = Stmt\Class_::MODIFIER_FINAL; } + | T_READONLY { $$ = Stmt\Class_::MODIFIER_READONLY; } ; property_declaration_list: @@ -587,15 +765,23 @@ non_empty_property_declaration_list: { push($1, $3); } ; -property_declaration: - T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; } - | T_VARIABLE '=' expr { $$ = Stmt\PropertyProperty[parseVar($1), $3]; } +property_decl_name: + T_VARIABLE { $$ = Node\VarLikeIdentifier[parseVar($1)]; } ; -expr_list: +property_declaration: + property_decl_name { $$ = Stmt\PropertyProperty[$1, null]; } + | property_decl_name '=' expr { $$ = Stmt\PropertyProperty[$1, $3]; } +; + +expr_list_forbid_comma: non_empty_expr_list no_comma { $$ = $1; } ; +expr_list_allow_comma: + non_empty_expr_list optional_comma { $$ = $1; } +; + non_empty_expr_list: non_empty_expr_list ',' expr { push($1, $3); } | expr { init($1); } @@ -603,7 +789,7 @@ non_empty_expr_list: for_expr: /* empty */ { $$ = array(); } - | expr_list { $$ = $1; } + | expr_list_forbid_comma { $$ = $1; } ; expr: @@ -611,8 +797,9 @@ expr: | list_expr '=' expr { $$ = Expr\Assign[$1, $3]; } | array_short_syntax '=' expr { $$ = Expr\Assign[$1, $3]; } | variable '=' expr { $$ = Expr\Assign[$1, $3]; } - | variable '=' '&' variable { $$ = Expr\AssignRef[$1, $4]; } + | variable '=' ampersand variable { $$ = Expr\AssignRef[$1, $4]; } | new_expr { $$ = $1; } + | match { $$ = $1; } | T_CLONE expr { $$ = Expr\Clone_[$2]; } | variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; } | variable T_MINUS_EQUAL expr { $$ = Expr\AssignOp\Minus [$1, $3]; } @@ -626,6 +813,7 @@ expr: | variable T_SL_EQUAL expr { $$ = Expr\AssignOp\ShiftLeft [$1, $3]; } | variable T_SR_EQUAL expr { $$ = Expr\AssignOp\ShiftRight[$1, $3]; } | variable T_POW_EQUAL expr { $$ = Expr\AssignOp\Pow [$1, $3]; } + | variable T_COALESCE_EQUAL expr { $$ = Expr\AssignOp\Coalesce [$1, $3]; } | variable T_INC { $$ = Expr\PostInc[$1]; } | T_INC variable { $$ = Expr\PreInc [$2]; } | variable T_DEC { $$ = Expr\PostDec[$1]; } @@ -636,7 +824,8 @@ expr: | expr T_LOGICAL_AND expr { $$ = Expr\BinaryOp\LogicalAnd[$1, $3]; } | expr T_LOGICAL_XOR expr { $$ = Expr\BinaryOp\LogicalXor[$1, $3]; } | expr '|' expr { $$ = Expr\BinaryOp\BitwiseOr [$1, $3]; } - | expr '&' expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | expr T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } + | expr T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG expr { $$ = Expr\BinaryOp\BitwiseAnd[$1, $3]; } | expr '^' expr { $$ = Expr\BinaryOp\BitwiseXor[$1, $3]; } | expr '.' expr { $$ = Expr\BinaryOp\Concat [$1, $3]; } | expr '+' expr { $$ = Expr\BinaryOp\Plus [$1, $3]; } @@ -665,7 +854,7 @@ expr: | expr '?' expr ':' expr { $$ = Expr\Ternary[$1, $3, $5]; } | expr '?' ':' expr { $$ = Expr\Ternary[$1, null, $4]; } | expr T_COALESCE expr { $$ = Expr\BinaryOp\Coalesce[$1, $3]; } - | T_ISSET '(' variables_list ')' { $$ = Expr\Isset_[$3]; } + | T_ISSET '(' expr_list_allow_comma ')' { $$ = Expr\Isset_[$3]; } | T_EMPTY '(' expr ')' { $$ = Expr\Empty_[$3]; } | T_INCLUDE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE]; } | T_INCLUDE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_INCLUDE_ONCE]; } @@ -673,7 +862,10 @@ expr: | T_REQUIRE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE]; } | T_REQUIRE_ONCE expr { $$ = Expr\Include_[$2, Expr\Include_::TYPE_REQUIRE_ONCE]; } | T_INT_CAST expr { $$ = Expr\Cast\Int_ [$2]; } - | T_DOUBLE_CAST expr { $$ = Expr\Cast\Double [$2]; } + | T_DOUBLE_CAST expr + { $attrs = attributes(); + $attrs['kind'] = $this->getFloatCastKind($1); + $$ = new Expr\Cast\Double($2, $attrs); } | T_STRING_CAST expr { $$ = Expr\Cast\String_ [$2]; } | T_ARRAY_CAST expr { $$ = Expr\Cast\Array_ [$2]; } | T_OBJECT_CAST expr { $$ = Expr\Cast\Object_ [$2]; } @@ -691,18 +883,32 @@ expr: | T_YIELD expr { $$ = Expr\Yield_[$2, null]; } | T_YIELD expr T_DOUBLE_ARROW expr { $$ = Expr\Yield_[$4, $2]; } | T_YIELD_FROM expr { $$ = Expr\YieldFrom[$2]; } - | T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type - '{' inner_statement_list '}' - { $$ = Expr\Closure[['static' => false, 'byRef' => $2, 'params' => $4, 'uses' => $6, 'returnType' => $7, 'stmts' => $9]]; } - | T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type - '{' inner_statement_list '}' - { $$ = Expr\Closure[['static' => true, 'byRef' => $3, 'params' => $5, 'uses' => $7, 'returnType' => $8, 'stmts' => $10]]; } + | T_THROW expr { $$ = Expr\Throw_[$2]; } + + | T_FN optional_ref '(' parameter_list ')' optional_return_type T_DOUBLE_ARROW expr %prec T_THROW + { $$ = Expr\ArrowFunction[['static' => false, 'byRef' => $2, 'params' => $4, 'returnType' => $6, 'expr' => $8, 'attrGroups' => []]]; } + | T_STATIC T_FN optional_ref '(' parameter_list ')' optional_return_type T_DOUBLE_ARROW expr %prec T_THROW + { $$ = Expr\ArrowFunction[['static' => true, 'byRef' => $3, 'params' => $5, 'returnType' => $7, 'expr' => $9, 'attrGroups' => []]]; } + | T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type block_or_error + { $$ = Expr\Closure[['static' => false, 'byRef' => $2, 'params' => $4, 'uses' => $6, 'returnType' => $7, 'stmts' => $8, 'attrGroups' => []]]; } + | T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type block_or_error + { $$ = Expr\Closure[['static' => true, 'byRef' => $3, 'params' => $5, 'uses' => $7, 'returnType' => $8, 'stmts' => $9, 'attrGroups' => []]]; } + + | attributes T_FN optional_ref '(' parameter_list ')' optional_return_type T_DOUBLE_ARROW expr %prec T_THROW + { $$ = Expr\ArrowFunction[['static' => false, 'byRef' => $3, 'params' => $5, 'returnType' => $7, 'expr' => $9, 'attrGroups' => $1]]; } + | attributes T_STATIC T_FN optional_ref '(' parameter_list ')' optional_return_type T_DOUBLE_ARROW expr %prec T_THROW + { $$ = Expr\ArrowFunction[['static' => true, 'byRef' => $4, 'params' => $6, 'returnType' => $8, 'expr' => $10, 'attrGroups' => $1]]; } + | attributes T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type block_or_error + { $$ = Expr\Closure[['static' => false, 'byRef' => $3, 'params' => $5, 'uses' => $7, 'returnType' => $8, 'stmts' => $9, 'attrGroups' => $1]]; } + | attributes T_STATIC T_FUNCTION optional_ref '(' parameter_list ')' lexical_vars optional_return_type block_or_error + { $$ = Expr\Closure[['static' => true, 'byRef' => $4, 'params' => $6, 'uses' => $8, 'returnType' => $9, 'stmts' => $10, 'attrGroups' => $1]]; } ; anonymous_class: - T_CLASS ctor_arguments extends_from implements_list '{' class_statement_list '}' - { $$ = array(Stmt\Class_[null, ['type' => 0, 'extends' => $3, 'implements' => $4, 'stmts' => $6]], $2); + optional_attributes T_CLASS ctor_arguments extends_from implements_list '{' class_statement_list '}' + { $$ = array(Stmt\Class_[null, ['type' => 0, 'extends' => $4, 'implements' => $5, 'stmts' => $7, 'attrGroups' => $1]], $3); $this->checkClass($$[0], -1); } +; new_expr: T_NEW class_name_reference ctor_arguments { $$ = Expr\New_[$2, $3]; } @@ -716,7 +922,7 @@ lexical_vars: ; lexical_var_list: - non_empty_lexical_var_list no_comma { $$ = $1; } + non_empty_lexical_var_list optional_comma { $$ = $1; } ; non_empty_lexical_var_list: @@ -725,7 +931,7 @@ non_empty_lexical_var_list: ; lexical_var: - optional_ref T_VARIABLE { $$ = Expr\ClosureUse[parseVar($2), $1]; } + optional_ref plain_variable { $$ = Expr\ClosureUse[$2, $1]; } ; function_call: @@ -741,20 +947,22 @@ class_name: ; name: - namespace_name_parts { $$ = Name[$1]; } - | T_NS_SEPARATOR namespace_name_parts { $$ = Name\FullyQualified[$2]; } - | T_NAMESPACE T_NS_SEPARATOR namespace_name_parts { $$ = Name\Relative[$3]; } + T_STRING { $$ = Name[$1]; } + | T_NAME_QUALIFIED { $$ = Name[$1]; } + | T_NAME_FULLY_QUALIFIED { $$ = Name\FullyQualified[substr($1, 1)]; } + | T_NAME_RELATIVE { $$ = Name\Relative[substr($1, 10)]; } ; class_name_reference: class_name { $$ = $1; } | new_variable { $$ = $1; } + | '(' expr ')' { $$ = $2; } | error { $$ = Expr\Error[]; $this->errorState = 2; } ; class_name_or_var: class_name { $$ = $1; } - | dereferencable { $$ = $1; } + | fully_dereferencable { $$ = $1; } ; exit_expr: @@ -776,9 +984,20 @@ ctor_arguments: constant: name { $$ = Expr\ConstFetch[$1]; } - | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier + | T_LINE { $$ = Scalar\MagicConst\Line[]; } + | T_FILE { $$ = Scalar\MagicConst\File[]; } + | T_DIR { $$ = Scalar\MagicConst\Dir[]; } + | T_CLASS_C { $$ = Scalar\MagicConst\Class_[]; } + | T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; } + | T_METHOD_C { $$ = Scalar\MagicConst\Method[]; } + | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; } + | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; } +; + +class_constant: + class_name_or_var T_PAAMAYIM_NEKUDOTAYIM identifier_maybe_reserved { $$ = Expr\ClassConstFetch[$1, $3]; } - /* We interpret and isolated FOO:: as an unfinished class constant fetch. It could also be + /* We interpret an isolated FOO:: as an unfinished class constant fetch. It could also be an unfinished static property fetch or unfinished scoped call. */ | class_name_or_var T_PAAMAYIM_NEKUDOTAYIM error { $$ = Expr\ClassConstFetch[$1, new Expr\Error(stackAttributes(#3))]; $this->errorState = 2; } @@ -798,33 +1017,23 @@ dereferencable_scalar: | T_CONSTANT_ENCAPSED_STRING { $attrs = attributes(); $attrs['kind'] = strKind($1); $$ = new Scalar\String_(Scalar\String_::parse($1), $attrs); } + | '"' encaps_list '"' + { $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); } ; scalar: T_LNUMBER { $$ = $this->parseLNumber($1, attributes()); } | T_DNUMBER { $$ = Scalar\DNumber[Scalar\DNumber::parse($1)]; } - | T_LINE { $$ = Scalar\MagicConst\Line[]; } - | T_FILE { $$ = Scalar\MagicConst\File[]; } - | T_DIR { $$ = Scalar\MagicConst\Dir[]; } - | T_CLASS_C { $$ = Scalar\MagicConst\Class_[]; } - | T_TRAIT_C { $$ = Scalar\MagicConst\Trait_[]; } - | T_METHOD_C { $$ = Scalar\MagicConst\Method[]; } - | T_FUNC_C { $$ = Scalar\MagicConst\Function_[]; } - | T_NS_C { $$ = Scalar\MagicConst\Namespace_[]; } | dereferencable_scalar { $$ = $1; } | constant { $$ = $1; } + | class_constant { $$ = $1; } | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC - { $attrs = attributes(); setDocStringAttrs($attrs, $1); - $$ = new Scalar\String_(Scalar\String_::parseDocString($1, $2), $attrs); } + { $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), true); } | T_START_HEREDOC T_END_HEREDOC - { $attrs = attributes(); setDocStringAttrs($attrs, $1); - $$ = new Scalar\String_('', $attrs); } - | '"' encaps_list '"' - { $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; - parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); } + { $$ = $this->parseDocString($1, '', $2, attributes(), stackAttributes(#2), true); } | T_START_HEREDOC encaps_list T_END_HEREDOC - { $attrs = attributes(); setDocStringAttrs($attrs, $1); - parseEncapsedDoc($2, true); $$ = new Scalar\Encapsed($2, $attrs); } + { $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), true); } ; optional_expr: @@ -832,10 +1041,16 @@ optional_expr: | expr { $$ = $1; } ; -dereferencable: +fully_dereferencable: variable { $$ = $1; } | '(' expr ')' { $$ = $2; } | dereferencable_scalar { $$ = $1; } + | class_constant { $$ = $1; } +; + +array_object_dereferencable: + fully_dereferencable { $$ = $1; } + | constant { $$ = $1; } ; callable_expr: @@ -845,87 +1060,100 @@ callable_expr: ; callable_variable: - simple_variable { $$ = Expr\Variable[$1]; } - | dereferencable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | constant '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | dereferencable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } + simple_variable { $$ = $1; } + | array_object_dereferencable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | array_object_dereferencable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } | function_call { $$ = $1; } - | dereferencable T_OBJECT_OPERATOR property_name argument_list + | array_object_dereferencable T_OBJECT_OPERATOR property_name argument_list { $$ = Expr\MethodCall[$1, $3, $4]; } + | array_object_dereferencable T_NULLSAFE_OBJECT_OPERATOR property_name argument_list + { $$ = Expr\NullsafeMethodCall[$1, $3, $4]; } +; + +optional_plain_variable: + /* empty */ { $$ = null; } + | plain_variable { $$ = $1; } ; variable: callable_variable { $$ = $1; } | static_member { $$ = $1; } - | dereferencable T_OBJECT_OPERATOR property_name { $$ = Expr\PropertyFetch[$1, $3]; } + | array_object_dereferencable T_OBJECT_OPERATOR property_name + { $$ = Expr\PropertyFetch[$1, $3]; } + | array_object_dereferencable T_NULLSAFE_OBJECT_OPERATOR property_name + { $$ = Expr\NullsafePropertyFetch[$1, $3]; } ; simple_variable: - T_VARIABLE { $$ = parseVar($1); } - | '$' '{' expr '}' { $$ = $3; } + plain_variable { $$ = $1; } + | '$' '{' expr '}' { $$ = Expr\Variable[$3]; } | '$' simple_variable { $$ = Expr\Variable[$2]; } - | '$' error { $$ = Expr\Error[]; $this->errorState = 2; } + | '$' error { $$ = Expr\Variable[Expr\Error[]]; $this->errorState = 2; } +; + +static_member_prop_name: + simple_variable + { $var = $1->name; $$ = \is_string($var) ? Node\VarLikeIdentifier[$var] : $var; } ; static_member: - class_name_or_var T_PAAMAYIM_NEKUDOTAYIM simple_variable + class_name_or_var T_PAAMAYIM_NEKUDOTAYIM static_member_prop_name { $$ = Expr\StaticPropertyFetch[$1, $3]; } ; new_variable: - simple_variable { $$ = Expr\Variable[$1]; } + simple_variable { $$ = $1; } | new_variable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } | new_variable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; } | new_variable T_OBJECT_OPERATOR property_name { $$ = Expr\PropertyFetch[$1, $3]; } - | class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable { $$ = Expr\StaticPropertyFetch[$1, $3]; } - | new_variable T_PAAMAYIM_NEKUDOTAYIM simple_variable { $$ = Expr\StaticPropertyFetch[$1, $3]; } + | new_variable T_NULLSAFE_OBJECT_OPERATOR property_name { $$ = Expr\NullsafePropertyFetch[$1, $3]; } + | class_name T_PAAMAYIM_NEKUDOTAYIM static_member_prop_name + { $$ = Expr\StaticPropertyFetch[$1, $3]; } + | new_variable T_PAAMAYIM_NEKUDOTAYIM static_member_prop_name + { $$ = Expr\StaticPropertyFetch[$1, $3]; } ; member_name: - identifier { $$ = $1; } - | '{' expr '}' { $$ = $2; } - | simple_variable { $$ = Expr\Variable[$1]; } + identifier_maybe_reserved { $$ = $1; } + | '{' expr '}' { $$ = $2; } + | simple_variable { $$ = $1; } ; property_name: - T_STRING { $$ = $1; } - | '{' expr '}' { $$ = $2; } - | simple_variable { $$ = Expr\Variable[$1]; } + identifier_not_reserved { $$ = $1; } + | '{' expr '}' { $$ = $2; } + | simple_variable { $$ = $1; } | error { $$ = Expr\Error[]; $this->errorState = 2; } ; list_expr: - T_LIST '(' list_expr_elements ')' { $$ = Expr\List_[$3]; } -; - -list_expr_elements: - list_expr_elements ',' list_expr_element { push($1, $3); } - | list_expr_element { init($1); } -; - -list_expr_element: - variable { $$ = Expr\ArrayItem[$1, null, false]; } - | list_expr { $$ = Expr\ArrayItem[$1, null, false]; } - | expr T_DOUBLE_ARROW variable { $$ = Expr\ArrayItem[$3, $1, false]; } - | expr T_DOUBLE_ARROW list_expr { $$ = Expr\ArrayItem[$3, $1, false]; } - | /* empty */ { $$ = null; } + T_LIST '(' inner_array_pair_list ')' { $$ = Expr\List_[$3]; } ; array_pair_list: inner_array_pair_list - { $$ = $1; $end = count($$)-1; if ($$[$end] === null) unset($$[$end]); } + { $$ = $1; $end = count($$)-1; if ($$[$end] === null) array_pop($$); } +; + +comma_or_error: + ',' + | error + { /* do nothing -- prevent default action of $$=$1. See #551. */ } ; inner_array_pair_list: - inner_array_pair_list ',' array_pair { push($1, $3); } + inner_array_pair_list comma_or_error array_pair { push($1, $3); } | array_pair { init($1); } ; array_pair: - expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; } - | expr { $$ = Expr\ArrayItem[$1, null, false]; } - | expr T_DOUBLE_ARROW '&' variable { $$ = Expr\ArrayItem[$4, $1, true]; } - | '&' variable { $$ = Expr\ArrayItem[$2, null, true]; } + expr { $$ = Expr\ArrayItem[$1, null, false]; } + | ampersand variable { $$ = Expr\ArrayItem[$2, null, true]; } + | list_expr { $$ = Expr\ArrayItem[$1, null, false]; } + | expr T_DOUBLE_ARROW expr { $$ = Expr\ArrayItem[$3, $1, false]; } + | expr T_DOUBLE_ARROW ampersand variable { $$ = Expr\ArrayItem[$4, $1, true]; } + | expr T_DOUBLE_ARROW list_expr { $$ = Expr\ArrayItem[$3, $1, false]; } + | T_ELLIPSIS expr { $$ = Expr\ArrayItem[$2, null, false, attributes(), true]; } | /* empty */ { $$ = null; } ; @@ -940,18 +1168,21 @@ encaps_string_part: T_ENCAPSED_AND_WHITESPACE { $$ = Scalar\EncapsedStringPart[$1]; } ; -encaps_base_var: - T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } +encaps_str_varname: + T_STRING_VARNAME { $$ = Expr\Variable[$1]; } ; encaps_var: - encaps_base_var { $$ = $1; } - | encaps_base_var '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } - | encaps_base_var T_OBJECT_OPERATOR T_STRING { $$ = Expr\PropertyFetch[$1, $3]; } + plain_variable { $$ = $1; } + | plain_variable '[' encaps_var_offset ']' { $$ = Expr\ArrayDimFetch[$1, $3]; } + | plain_variable T_OBJECT_OPERATOR identifier_not_reserved + { $$ = Expr\PropertyFetch[$1, $3]; } + | plain_variable T_NULLSAFE_OBJECT_OPERATOR identifier_not_reserved + { $$ = Expr\NullsafePropertyFetch[$1, $3]; } | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { $$ = Expr\Variable[$2]; } | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' { $$ = Expr\Variable[$2]; } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' - { $$ = Expr\ArrayDimFetch[Expr\Variable[$2], $4]; } + | T_DOLLAR_OPEN_CURLY_BRACES encaps_str_varname '[' expr ']' '}' + { $$ = Expr\ArrayDimFetch[$2, $4]; } | T_CURLY_OPEN variable '}' { $$ = $2; } ; @@ -959,7 +1190,7 @@ encaps_var_offset: T_STRING { $$ = Scalar\String_[$1]; } | T_NUM_STRING { $$ = $this->parseNumString($1, attributes()); } | '-' T_NUM_STRING { $$ = $this->parseNumString('-' . $2, attributes()); } - | T_VARIABLE { $$ = Expr\Variable[parseVar($1)]; } + | plain_variable { $$ = $1; } ; %% diff --git a/lib/nikic/php-parser/grammar/phpyLang.php b/lib/nikic/php-parser/grammar/phpyLang.php new file mode 100644 index 000000000..1a9808dcf --- /dev/null +++ b/lib/nikic/php-parser/grammar/phpyLang.php @@ -0,0 +1,192 @@ +\'[^\\\\\']*+(?:\\\\.[^\\\\\']*+)*+\') + (?"[^\\\\"]*+(?:\\\\.[^\\\\"]*+)*+") + (?(?&singleQuotedString)|(?&doubleQuotedString)) + (?/\*[^*]*+(?:\*(?!/)[^*]*+)*+\*/) + (?\{[^\'"/{}]*+(?:(?:(?&string)|(?&comment)|(?&code)|/)[^\'"/{}]*+)*+}) +)'; + +const PARAMS = '\[(?[^[\]]*+(?:\[(?¶ms)\][^[\]]*+)*+)\]'; +const ARGS = '\((?[^()]*+(?:\((?&args)\)[^()]*+)*+)\)'; + +/////////////////////////////// +/// Preprocessing functions /// +/////////////////////////////// + +function preprocessGrammar($code) { + $code = resolveNodes($code); + $code = resolveMacros($code); + $code = resolveStackAccess($code); + + return $code; +} + +function resolveNodes($code) { + return preg_replace_callback( + '~\b(?[A-Z][a-zA-Z_\\\\]++)\s*' . PARAMS . '~', + function($matches) { + // recurse + $matches['params'] = resolveNodes($matches['params']); + + $params = magicSplit( + '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', + $matches['params'] + ); + + $paramCode = ''; + foreach ($params as $param) { + $paramCode .= $param . ', '; + } + + return 'new ' . $matches['name'] . '(' . $paramCode . 'attributes())'; + }, + $code + ); +} + +function resolveMacros($code) { + return preg_replace_callback( + '~\b(?)(?!array\()(?[a-z][A-Za-z]++)' . ARGS . '~', + function($matches) { + // recurse + $matches['args'] = resolveMacros($matches['args']); + + $name = $matches['name']; + $args = magicSplit( + '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', + $matches['args'] + ); + + if ('attributes' === $name) { + assertArgs(0, $args, $name); + return '$this->startAttributeStack[#1] + $this->endAttributes'; + } + + if ('stackAttributes' === $name) { + assertArgs(1, $args, $name); + return '$this->startAttributeStack[' . $args[0] . ']' + . ' + $this->endAttributeStack[' . $args[0] . ']'; + } + + if ('init' === $name) { + return '$$ = array(' . implode(', ', $args) . ')'; + } + + if ('push' === $name) { + assertArgs(2, $args, $name); + + return $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0]; + } + + if ('pushNormalizing' === $name) { + assertArgs(2, $args, $name); + + return 'if (is_array(' . $args[1] . ')) { $$ = array_merge(' . $args[0] . ', ' . $args[1] . '); }' + . ' else { ' . $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0] . '; }'; + } + + if ('toArray' == $name) { + assertArgs(1, $args, $name); + + return 'is_array(' . $args[0] . ') ? ' . $args[0] . ' : array(' . $args[0] . ')'; + } + + if ('parseVar' === $name) { + assertArgs(1, $args, $name); + + return 'substr(' . $args[0] . ', 1)'; + } + + if ('parseEncapsed' === $name) { + assertArgs(3, $args, $name); + + return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {' + . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }'; + } + + if ('makeNop' === $name) { + assertArgs(3, $args, $name); + + return '$startAttributes = ' . $args[1] . ';' + . ' if (isset($startAttributes[\'comments\']))' + . ' { ' . $args[0] . ' = new Stmt\Nop($startAttributes + ' . $args[2] . '); }' + . ' else { ' . $args[0] . ' = null; }'; + } + + if ('makeZeroLengthNop' == $name) { + assertArgs(2, $args, $name); + + return '$startAttributes = ' . $args[1] . ';' + . ' if (isset($startAttributes[\'comments\']))' + . ' { ' . $args[0] . ' = new Stmt\Nop($this->createCommentNopAttributes($startAttributes[\'comments\'])); }' + . ' else { ' . $args[0] . ' = null; }'; + } + + if ('strKind' === $name) { + assertArgs(1, $args, $name); + + return '(' . $args[0] . '[0] === "\'" || (' . $args[0] . '[1] === "\'" && ' + . '(' . $args[0] . '[0] === \'b\' || ' . $args[0] . '[0] === \'B\')) ' + . '? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED)'; + } + + if ('prependLeadingComments' === $name) { + assertArgs(1, $args, $name); + + return '$attrs = $this->startAttributeStack[#1]; $stmts = ' . $args[0] . '; ' + . 'if (!empty($attrs[\'comments\'])) {' + . '$stmts[0]->setAttribute(\'comments\', ' + . 'array_merge($attrs[\'comments\'], $stmts[0]->getAttribute(\'comments\', []))); }'; + } + + return $matches[0]; + }, + $code + ); +} + +function assertArgs($num, $args, $name) { + if ($num != count($args)) { + die('Wrong argument count for ' . $name . '().'); + } +} + +function resolveStackAccess($code) { + $code = preg_replace('/\$\d+/', '$this->semStack[$0]', $code); + $code = preg_replace('/#(\d+)/', '$$1', $code); + return $code; +} + +function removeTrailingWhitespace($code) { + $lines = explode("\n", $code); + $lines = array_map('rtrim', $lines); + return implode("\n", $lines); +} + +////////////////////////////// +/// Regex helper functions /// +////////////////////////////// + +function regex($regex) { + return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~'; +} + +function magicSplit($regex, $string) { + $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string); + + foreach ($pieces as &$piece) { + $piece = trim($piece); + } + + if ($pieces === ['']) { + return []; + } + + return $pieces; +} diff --git a/lib/nikic/php-parser/grammar/rebuildParsers.php b/lib/nikic/php-parser/grammar/rebuildParsers.php index 340b0eacd..2d0c6b14d 100644 --- a/lib/nikic/php-parser/grammar/rebuildParsers.php +++ b/lib/nikic/php-parser/grammar/rebuildParsers.php @@ -1,5 +1,7 @@ 'Php5', __DIR__ . '/php7.y' => 'Php7', @@ -13,31 +15,16 @@ $tmpResultFile = __DIR__ . '/tmp_parser.php'; $resultDir = __DIR__ . '/../lib/PhpParser/Parser'; $tokensResultsFile = $resultDir . '/Tokens.php'; -// check for kmyacc.exe binary in this directory, otherwise fall back to global name -$kmyacc = __DIR__ . '/kmyacc.exe'; -if (!file_exists($kmyacc)) { - $kmyacc = 'kmyacc'; +$kmyacc = getenv('KMYACC'); +if (!$kmyacc) { + // Use phpyacc from dev dependencies by default. + $kmyacc = __DIR__ . '/../vendor/bin/phpyacc'; } $options = array_flip($argv); $optionDebug = isset($options['--debug']); $optionKeepTmpGrammar = isset($options['--keep-tmp-grammar']); -/////////////////////////////// -/// Utility regex constants /// -/////////////////////////////// - -const LIB = '(?(DEFINE) - (?\'[^\\\\\']*+(?:\\\\.[^\\\\\']*+)*+\') - (?"[^\\\\"]*+(?:\\\\.[^\\\\"]*+)*+") - (?(?&singleQuotedString)|(?&doubleQuotedString)) - (?/\*[^*]*+(?:\*(?!/)[^*]*+)*+\*/) - (?\{[^\'"/{}]*+(?:(?:(?&string)|(?&comment)|(?&code)|/)[^\'"/{}]*+)*+}) -)'; - -const PARAMS = '\[(?[^[\]]*+(?:\[(?¶ms)\][^[\]]*+)*+)\]'; -const ARGS = '\((?[^()]*+(?:\((?&args)\)[^()]*+)*+)\)'; - /////////////////// /// Main script /// /////////////////// @@ -49,18 +36,14 @@ foreach ($grammarFileToName as $grammarFile => $name) { $grammarCode = file_get_contents($grammarFile); $grammarCode = str_replace('%tokens', $tokens, $grammarCode); - - $grammarCode = resolveNodes($grammarCode); - $grammarCode = resolveMacros($grammarCode); - $grammarCode = resolveStackAccess($grammarCode); + $grammarCode = preprocessGrammar($grammarCode); file_put_contents($tmpGrammarFile, $grammarCode); $additionalArgs = $optionDebug ? '-t -v' : ''; echo "Building $name parser.\n"; - $output = trim(shell_exec("$kmyacc $additionalArgs -l -m $skeletonFile -p $name $tmpGrammarFile 2>&1")); - echo "Output: \"$output\"\n"; + $output = execCmd("$kmyacc $additionalArgs -m $skeletonFile -p $name $tmpGrammarFile"); $resultCode = file_get_contents($tmpResultFile); $resultCode = removeTrailingWhitespace($resultCode); @@ -70,8 +53,7 @@ foreach ($grammarFileToName as $grammarFile => $name) { unlink($tmpResultFile); echo "Building token definition.\n"; - $output = trim(shell_exec("$kmyacc -l -m $tokensTemplate $tmpGrammarFile 2>&1")); - assert($output === ''); + $output = execCmd("$kmyacc -m $tokensTemplate $tmpGrammarFile"); rename($tmpResultFile, $tokensResultsFile); if (!$optionKeepTmpGrammar) { @@ -79,160 +61,9 @@ foreach ($grammarFileToName as $grammarFile => $name) { } } -/////////////////////////////// -/// Preprocessing functions /// -/////////////////////////////// - -function resolveNodes($code) { - return preg_replace_callback( - '~\b(?[A-Z][a-zA-Z_\\\\]++)\s*' . PARAMS . '~', - function($matches) { - // recurse - $matches['params'] = resolveNodes($matches['params']); - - $params = magicSplit( - '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', - $matches['params'] - ); - - $paramCode = ''; - foreach ($params as $param) { - $paramCode .= $param . ', '; - } - - return 'new ' . $matches['name'] . '(' . $paramCode . 'attributes())'; - }, - $code - ); -} - -function resolveMacros($code) { - return preg_replace_callback( - '~\b(?)(?!array\()(?[a-z][A-Za-z]++)' . ARGS . '~', - function($matches) { - // recurse - $matches['args'] = resolveMacros($matches['args']); - - $name = $matches['name']; - $args = magicSplit( - '(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,', - $matches['args'] - ); - - if ('attributes' == $name) { - assertArgs(0, $args, $name); - return '$this->startAttributeStack[#1] + $this->endAttributes'; - } - - if ('stackAttributes' == $name) { - assertArgs(1, $args, $name); - return '$this->startAttributeStack[' . $args[0] . ']' - . ' + $this->endAttributeStack[' . $args[0] . ']'; - } - - if ('init' == $name) { - return '$$ = array(' . implode(', ', $args) . ')'; - } - - if ('push' == $name) { - assertArgs(2, $args, $name); - - return $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0]; - } - - if ('pushNormalizing' == $name) { - assertArgs(2, $args, $name); - - return 'if (is_array(' . $args[1] . ')) { $$ = array_merge(' . $args[0] . ', ' . $args[1] . '); }' - . ' else { ' . $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0] . '; }'; - } - - if ('toArray' == $name) { - assertArgs(1, $args, $name); - - return 'is_array(' . $args[0] . ') ? ' . $args[0] . ' : array(' . $args[0] . ')'; - } - - if ('parseVar' == $name) { - assertArgs(1, $args, $name); - - return 'substr(' . $args[0] . ', 1)'; - } - - if ('parseEncapsed' == $name) { - assertArgs(3, $args, $name); - - return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {' - . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }'; - } - - if ('parseEncapsedDoc' == $name) { - assertArgs(2, $args, $name); - - return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {' - . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, ' . $args[1] . '); } }' - . ' $s->value = preg_replace(\'~(\r\n|\n|\r)\z~\', \'\', $s->value);' - . ' if (\'\' === $s->value) array_pop(' . $args[0] . ');'; - } - - if ('makeNop' == $name) { - assertArgs(2, $args, $name); - - return '$startAttributes = ' . $args[1] . ';' - . ' if (isset($startAttributes[\'comments\']))' - . ' { ' . $args[0] . ' = new Stmt\Nop([\'comments\' => $startAttributes[\'comments\']]); }' - . ' else { ' . $args[0] . ' = null; }'; - } - - if ('strKind' == $name) { - assertArgs(1, $args, $name); - - return '(' . $args[0] . '[0] === "\'" || (' . $args[0] . '[1] === "\'" && ' - . '(' . $args[0] . '[0] === \'b\' || ' . $args[0] . '[0] === \'B\')) ' - . '? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED)'; - } - - if ('setDocStringAttrs' == $name) { - assertArgs(2, $args, $name); - - return $args[0] . '[\'kind\'] = strpos(' . $args[1] . ', "\'") === false ' - . '? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; ' - . 'preg_match(\'/\A[bB]?<<<[ \t]*[\\\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\\\'"]?(?:\r\n|\n|\r)\z/\', ' . $args[1] . ', $matches); ' - . $args[0] . '[\'docLabel\'] = $matches[1];'; - } - - if ('prependLeadingComments' == $name) { - assertArgs(1, $args, $name); - - return '$attrs = $this->startAttributeStack[#1]; $stmts = ' . $args[0] . '; ' - . 'if (!empty($attrs[\'comments\'])) {' - . '$stmts[0]->setAttribute(\'comments\', ' - . 'array_merge($attrs[\'comments\'], $stmts[0]->getAttribute(\'comments\', []))); }'; - } - - return $matches[0]; - }, - $code - ); -} - -function assertArgs($num, $args, $name) { - if ($num != count($args)) { - die('Wrong argument count for ' . $name . '().'); - } -} - -function resolveStackAccess($code) { - $code = preg_replace('/\$\d+/', '$this->semStack[$0]', $code); - $code = preg_replace('/#(\d+)/', '$$1', $code); - return $code; -} - -function removeTrailingWhitespace($code) { - $lines = explode("\n", $code); - $lines = array_map('rtrim', $lines); - return implode("\n", $lines); -} +//////////////////////////////// +/// Utility helper functions /// +//////////////////////////////// function ensureDirExists($dir) { if (!is_dir($dir)) { @@ -240,24 +71,11 @@ function ensureDirExists($dir) { } } -////////////////////////////// -/// Regex helper functions /// -////////////////////////////// - -function regex($regex) { - return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~'; -} - -function magicSplit($regex, $string) { - $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string); - - foreach ($pieces as &$piece) { - $piece = trim($piece); +function execCmd($cmd) { + $output = trim(shell_exec("$cmd 2>&1")); + if ($output !== "") { + echo "> " . $cmd . "\n"; + echo $output; } - - if ($pieces === ['']) { - return []; - } - - return $pieces; + return $output; } diff --git a/lib/nikic/php-parser/grammar/tokens.y b/lib/nikic/php-parser/grammar/tokens.y index 2b54f80b4..8f0b21725 100644 --- a/lib/nikic/php-parser/grammar/tokens.y +++ b/lib/nikic/php-parser/grammar/tokens.y @@ -1,6 +1,7 @@ /* We currently rely on the token ID mapping to be the same between PHP 5 and PHP 7 - so the same lexer can be used for * both. This is enforced by sharing this token file. */ +%right T_THROW %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE %left ',' %left T_LOGICAL_OR @@ -10,14 +11,14 @@ %right T_YIELD %right T_DOUBLE_ARROW %right T_YIELD_FROM -%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL +%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL T_XOR_EQUAL T_SL_EQUAL T_SR_EQUAL T_POW_EQUAL T_COALESCE_EQUAL %left '?' ':' %right T_COALESCE %left T_BOOLEAN_OR %left T_BOOLEAN_AND %left '|' %left '^' -%left '&' +%left T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG %nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP %nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL %left T_SL T_SR @@ -41,8 +42,6 @@ %token T_VARIABLE %token T_NUM_STRING %token T_INLINE_HTML -%token T_CHARACTER -%token T_BAD_CHARACTER %token T_ENCAPSED_AND_WHITESPACE %token T_CONSTANT_ENCAPSED_STRING %token T_ECHO @@ -57,6 +56,7 @@ %token T_ENDDECLARE %token T_AS %token T_SWITCH +%token T_MATCH %token T_ENDSWITCH %token T_CASE %token T_DEFAULT @@ -64,6 +64,7 @@ %token T_CONTINUE %token T_GOTO %token T_FUNCTION +%token T_FN %token T_CONST %token T_RETURN %token T_TRY @@ -73,7 +74,7 @@ %token T_USE %token T_INSTEADOF %token T_GLOBAL -%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC +%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC T_READONLY %token T_VAR %token T_UNSET %token T_ISSET @@ -82,9 +83,11 @@ %token T_CLASS %token T_TRAIT %token T_INTERFACE +%token T_ENUM %token T_EXTENDS %token T_IMPLEMENTS %token T_OBJECT_OPERATOR +%token T_NULLSAFE_OBJECT_OPERATOR %token T_DOUBLE_ARROW %token T_LIST %token T_ARRAY @@ -95,12 +98,6 @@ %token T_FUNC_C %token T_LINE %token T_FILE -%token T_COMMENT -%token T_DOC_COMMENT -%token T_OPEN_TAG -%token T_OPEN_TAG_WITH_ECHO -%token T_CLOSE_TAG -%token T_WHITESPACE %token T_START_HEREDOC %token T_END_HEREDOC %token T_DOLLAR_OPEN_CURLY_BRACES @@ -111,3 +108,8 @@ %token T_DIR %token T_NS_SEPARATOR %token T_ELLIPSIS +%token T_NAME_FULLY_QUALIFIED +%token T_NAME_QUALIFIED +%token T_NAME_RELATIVE +%token T_ATTRIBUTE +%token T_ENUM diff --git a/lib/nikic/php-parser/lib/PhpParser/Autoloader.php b/lib/nikic/php-parser/lib/PhpParser/Autoloader.php deleted file mode 100644 index 809a06ed8..000000000 --- a/lib/nikic/php-parser/lib/PhpParser/Autoloader.php +++ /dev/null @@ -1,40 +0,0 @@ -constants = [new Const_($name, BuilderHelpers::normalizeValue($value))]; + } + + /** + * Add another constant to const group + * + * @param string|Identifier $name Name + * @param Node\Expr|bool|null|int|float|string|array $value Value + * + * @return $this The builder instance (for fluid interface) + */ + public function addConst($name, $value) { + $this->constants[] = new Const_($name, BuilderHelpers::normalizeValue($value)); + + return $this; + } + + /** + * Makes the constant public. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePublic() { + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC); + + return $this; + } + + /** + * Makes the constant protected. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtected() { + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED); + + return $this; + } + + /** + * Makes the constant private. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivate() { + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE); + + return $this; + } + + /** + * Makes the constant final. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeFinal() { + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL); + + return $this; + } + + /** + * Sets doc comment for the constant. + * + * @param PhpParser\Comment\Doc|string $docComment Doc comment to set + * + * @return $this The builder instance (for fluid interface) + */ + public function setDocComment($docComment) { + $this->attributes = [ + 'comments' => [BuilderHelpers::normalizeDocComment($docComment)] + ]; + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built class node. + * + * @return Stmt\ClassConst The built constant node + */ + public function getNode(): PhpParser\Node { + return new Stmt\ClassConst( + $this->constants, + $this->flags, + $this->attributes, + $this->attributeGroups + ); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Class_.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Class_.php index f91f6a847..87e2901a9 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Class_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Class_.php @@ -1,8 +1,10 @@ -name = $name; } @@ -36,7 +41,7 @@ class Class_ extends Declaration * @return $this The builder instance (for fluid interface) */ public function extend($class) { - $this->extends = $this->normalizeName($class); + $this->extends = BuilderHelpers::normalizeName($class); return $this; } @@ -48,9 +53,9 @@ class Class_ extends Declaration * * @return $this The builder instance (for fluid interface) */ - public function implement() { - foreach (func_get_args() as $interface) { - $this->implements[] = $this->normalizeName($interface); + public function implement(...$interfaces) { + foreach ($interfaces as $interface) { + $this->implements[] = BuilderHelpers::normalizeName($interface); } return $this; @@ -62,7 +67,7 @@ class Class_ extends Declaration * @return $this The builder instance (for fluid interface) */ public function makeAbstract() { - $this->setModifier(Stmt\Class_::MODIFIER_ABSTRACT); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT); return $this; } @@ -73,7 +78,7 @@ class Class_ extends Declaration * @return $this The builder instance (for fluid interface) */ public function makeFinal() { - $this->setModifier(Stmt\Class_::MODIFIER_FINAL); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL); return $this; } @@ -86,21 +91,34 @@ class Class_ extends Declaration * @return $this The builder instance (for fluid interface) */ public function addStmt($stmt) { - $stmt = $this->normalizeNode($stmt); + $stmt = BuilderHelpers::normalizeNode($stmt); - $targets = array( - 'Stmt_TraitUse' => &$this->uses, - 'Stmt_ClassConst' => &$this->constants, - 'Stmt_Property' => &$this->properties, - 'Stmt_ClassMethod' => &$this->methods, - ); + $targets = [ + Stmt\TraitUse::class => &$this->uses, + Stmt\ClassConst::class => &$this->constants, + Stmt\Property::class => &$this->properties, + Stmt\ClassMethod::class => &$this->methods, + ]; - $type = $stmt->getType(); - if (!isset($targets[$type])) { - throw new \LogicException(sprintf('Unexpected node of type "%s"', $type)); + $class = \get_class($stmt); + if (!isset($targets[$class])) { + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); } - $targets[$type][] = $stmt; + $targets[$class][] = $stmt; + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); return $this; } @@ -110,12 +128,13 @@ class Class_ extends Declaration * * @return Stmt\Class_ The built class node */ - public function getNode() { - return new Stmt\Class_($this->name, array( + public function getNode() : PhpParser\Node { + return new Stmt\Class_($this->name, [ 'flags' => $this->flags, 'extends' => $this->extends, 'implements' => $this->implements, 'stmts' => array_merge($this->uses, $this->constants, $this->properties, $this->methods), - ), $this->attributes); + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); } -} \ No newline at end of file +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Declaration.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Declaration.php index 30a1937f9..830949928 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Declaration.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Declaration.php @@ -1,12 +1,13 @@ -attributes['comments'] = array( - $this->normalizeDocComment($docComment) - ); + $this->attributes['comments'] = [ + BuilderHelpers::normalizeDocComment($docComment) + ]; return $this; } -} \ No newline at end of file +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php b/lib/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php new file mode 100644 index 000000000..02fa83e62 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php @@ -0,0 +1,85 @@ +name = $name; + } + + /** + * Sets the value. + * + * @param Node\Expr|string|int $value + * + * @return $this + */ + public function setValue($value) { + $this->value = BuilderHelpers::normalizeValue($value); + + return $this; + } + + /** + * Sets doc comment for the constant. + * + * @param PhpParser\Comment\Doc|string $docComment Doc comment to set + * + * @return $this The builder instance (for fluid interface) + */ + public function setDocComment($docComment) { + $this->attributes = [ + 'comments' => [BuilderHelpers::normalizeDocComment($docComment)] + ]; + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built enum case node. + * + * @return Stmt\EnumCase The built constant node + */ + public function getNode(): PhpParser\Node { + return new Stmt\EnumCase( + $this->name, + $this->value, + $this->attributes, + $this->attributeGroups + ); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Enum_.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Enum_.php new file mode 100644 index 000000000..be7eef95f --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Enum_.php @@ -0,0 +1,117 @@ +name = $name; + } + + /** + * Sets the scalar type. + * + * @param string|Identifier $type + * + * @return $this + */ + public function setScalarType($scalarType) { + $this->scalarType = BuilderHelpers::normalizeType($scalarType); + + return $this; + } + + /** + * Implements one or more interfaces. + * + * @param Name|string ...$interfaces Names of interfaces to implement + * + * @return $this The builder instance (for fluid interface) + */ + public function implement(...$interfaces) { + foreach ($interfaces as $interface) { + $this->implements[] = BuilderHelpers::normalizeName($interface); + } + + return $this; + } + + /** + * Adds a statement. + * + * @param Stmt|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + $stmt = BuilderHelpers::normalizeNode($stmt); + + $targets = [ + Stmt\TraitUse::class => &$this->uses, + Stmt\EnumCase::class => &$this->enumCases, + Stmt\ClassConst::class => &$this->constants, + Stmt\ClassMethod::class => &$this->methods, + ]; + + $class = \get_class($stmt); + if (!isset($targets[$class])) { + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); + } + + $targets[$class][] = $stmt; + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built class node. + * + * @return Stmt\Enum_ The built enum node + */ + public function getNode() : PhpParser\Node { + return new Stmt\Enum_($this->name, [ + 'scalarType' => $this->scalarType, + 'implements' => $this->implements, + 'stmts' => array_merge($this->uses, $this->enumCases, $this->constants, $this->methods), + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php b/lib/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php index 28a2ea618..98ea9d336 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php @@ -1,14 +1,14 @@ -normalizeNode($param); + $param = BuilderHelpers::normalizeNode($param); if (!$param instanceof Node\Param) { throw new \LogicException(sprintf('Expected parameter node, got "%s"', $param->getType())); @@ -61,14 +61,12 @@ abstract class FunctionLike extends Declaration /** * Sets the return type for PHP 7. * - * @param string|Node\Name|Node\NullableType $type One of array, callable, string, int, float, bool, iterable, - * or a class/interface name. + * @param string|Node\Name|Node\Identifier|Node\ComplexType $type * * @return $this The builder instance (for fluid interface) */ - public function setReturnType($type) - { - $this->returnType = $this->normalizeType($type); + public function setReturnType($type) { + $this->returnType = BuilderHelpers::normalizeType($type); return $this; } diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Function_.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Function_.php index 228bdfaa2..1cd73c0d3 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Function_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Function_.php @@ -1,22 +1,26 @@ -name = $name; } @@ -28,7 +32,20 @@ class Function_ extends FunctionLike * @return $this The builder instance (for fluid interface) */ public function addStmt($stmt) { - $this->stmts[] = $this->normalizeNode($stmt); + $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); return $this; } @@ -38,12 +55,13 @@ class Function_ extends FunctionLike * * @return Stmt\Function_ The built function node */ - public function getNode() { - return new Stmt\Function_($this->name, array( + public function getNode() : Node { + return new Stmt\Function_($this->name, [ 'byRef' => $this->returnByRef, 'params' => $this->params, 'returnType' => $this->returnType, 'stmts' => $this->stmts, - ), $this->attributes); + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Interface_.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Interface_.php index 8ebb292a5..7806e85fc 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Interface_.php @@ -1,24 +1,29 @@ -name = $name; } @@ -29,9 +34,9 @@ class Interface_ extends Declaration * * @return $this The builder instance (for fluid interface) */ - public function extend() { - foreach (func_get_args() as $interface) { - $this->extends[] = $this->normalizeName($interface); + public function extend(...$interfaces) { + foreach ($interfaces as $interface) { + $this->extends[] = BuilderHelpers::normalizeName($interface); } return $this; @@ -45,36 +50,44 @@ class Interface_ extends Declaration * @return $this The builder instance (for fluid interface) */ public function addStmt($stmt) { - $stmt = $this->normalizeNode($stmt); + $stmt = BuilderHelpers::normalizeNode($stmt); - $type = $stmt->getType(); - switch ($type) { - case 'Stmt_ClassConst': - $this->constants[] = $stmt; - break; - - case 'Stmt_ClassMethod': - // we erase all statements in the body of an interface method - $stmt->stmts = null; - $this->methods[] = $stmt; - break; - - default: - throw new \LogicException(sprintf('Unexpected node of type "%s"', $type)); + if ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassMethod) { + // we erase all statements in the body of an interface method + $stmt->stmts = null; + $this->methods[] = $stmt; + } else { + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); } return $this; } + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + /** * Returns the built interface node. * * @return Stmt\Interface_ The built interface node */ - public function getNode() { - return new Stmt\Interface_($this->name, array( + public function getNode() : PhpParser\Node { + return new Stmt\Interface_($this->name, [ 'extends' => $this->extends, 'stmts' => array_merge($this->constants, $this->methods), - ), $this->attributes); + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); } -} \ No newline at end of file +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Method.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Method.php index 1ed75eeda..232d7cb87 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Method.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Method.php @@ -1,8 +1,9 @@ -name = $name; } @@ -29,7 +33,7 @@ class Method extends FunctionLike * @return $this The builder instance (for fluid interface) */ public function makePublic() { - $this->setModifier(Stmt\Class_::MODIFIER_PUBLIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC); return $this; } @@ -40,7 +44,7 @@ class Method extends FunctionLike * @return $this The builder instance (for fluid interface) */ public function makeProtected() { - $this->setModifier(Stmt\Class_::MODIFIER_PROTECTED); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED); return $this; } @@ -51,7 +55,7 @@ class Method extends FunctionLike * @return $this The builder instance (for fluid interface) */ public function makePrivate() { - $this->setModifier(Stmt\Class_::MODIFIER_PRIVATE); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE); return $this; } @@ -62,7 +66,7 @@ class Method extends FunctionLike * @return $this The builder instance (for fluid interface) */ public function makeStatic() { - $this->setModifier(Stmt\Class_::MODIFIER_STATIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC); return $this; } @@ -77,7 +81,7 @@ class Method extends FunctionLike throw new \LogicException('Cannot make method with statements abstract'); } - $this->setModifier(Stmt\Class_::MODIFIER_ABSTRACT); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT); $this->stmts = null; // abstract methods don't have statements return $this; @@ -89,7 +93,7 @@ class Method extends FunctionLike * @return $this The builder instance (for fluid interface) */ public function makeFinal() { - $this->setModifier(Stmt\Class_::MODIFIER_FINAL); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL); return $this; } @@ -106,7 +110,20 @@ class Method extends FunctionLike throw new \LogicException('Cannot add statements to an abstract method'); } - $this->stmts[] = $this->normalizeNode($stmt); + $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); return $this; } @@ -116,13 +133,14 @@ class Method extends FunctionLike * * @return Stmt\ClassMethod The built method node */ - public function getNode() { - return new Stmt\ClassMethod($this->name, array( + public function getNode() : Node { + return new Stmt\ClassMethod($this->name, [ 'flags' => $this->flags, 'byRef' => $this->returnByRef, 'params' => $this->params, 'returnType' => $this->returnType, 'stmts' => $this->stmts, - ), $this->attributes); + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php index fe636c4ff..1c751e163 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php @@ -1,15 +1,16 @@ -name = null !== $name ? $this->normalizeName($name) : null; + $this->name = null !== $name ? BuilderHelpers::normalizeName($name) : null; } /** @@ -28,7 +29,7 @@ class Namespace_ extends Declaration * @return $this The builder instance (for fluid interface) */ public function addStmt($stmt) { - $this->stmts[] = $this->normalizeNode($stmt); + $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); return $this; } @@ -36,9 +37,9 @@ class Namespace_ extends Declaration /** * Returns the built node. * - * @return Node The built node + * @return Stmt\Namespace_ The built node */ - public function getNode() { + public function getNode() : Node { return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Param.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Param.php index c029e748b..de9aae7e5 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Param.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Param.php @@ -1,29 +1,33 @@ -name = $name; } @@ -35,27 +39,40 @@ class Param extends PhpParser\BuilderAbstract * @return $this The builder instance (for fluid interface) */ public function setDefault($value) { - $this->default = $this->normalizeValue($value); + $this->default = BuilderHelpers::normalizeValue($value); return $this; } /** - * Sets type hint for the parameter. + * Sets type for the parameter. * - * @param string|Node\Name|Node\NullableType $type Type hint to use + * @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type * * @return $this The builder instance (for fluid interface) */ - public function setTypeHint($type) { - $this->type = $this->normalizeType($type); - if ($this->type === 'void') { + public function setType($type) { + $this->type = BuilderHelpers::normalizeType($type); + if ($this->type == 'void') { throw new \LogicException('Parameter type cannot be void'); } return $this; } + /** + * Sets type for the parameter. + * + * @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type + * + * @return $this The builder instance (for fluid interface) + * + * @deprecated Use setType() instead + */ + public function setTypeHint($type) { + return $this->setType($type); + } + /** * Make the parameter accept the value by reference. * @@ -78,14 +95,28 @@ class Param extends PhpParser\BuilderAbstract return $this; } + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + /** * Returns the built parameter node. * * @return Node\Param The built parameter node */ - public function getNode() { + public function getNode() : Node { return new Node\Param( - $this->name, $this->default, $this->type, $this->byRef, $this->variadic + new Node\Expr\Variable($this->name), + $this->default, $this->type, $this->byRef, $this->variadic, [], 0, $this->attributeGroups ); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Property.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Property.php index 053c851b9..68e318565 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Property.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Property.php @@ -1,24 +1,35 @@ -name = $name; } @@ -28,7 +39,7 @@ class Property extends PhpParser\BuilderAbstract * @return $this The builder instance (for fluid interface) */ public function makePublic() { - $this->setModifier(Stmt\Class_::MODIFIER_PUBLIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC); return $this; } @@ -39,7 +50,7 @@ class Property extends PhpParser\BuilderAbstract * @return $this The builder instance (for fluid interface) */ public function makeProtected() { - $this->setModifier(Stmt\Class_::MODIFIER_PROTECTED); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED); return $this; } @@ -50,7 +61,7 @@ class Property extends PhpParser\BuilderAbstract * @return $this The builder instance (for fluid interface) */ public function makePrivate() { - $this->setModifier(Stmt\Class_::MODIFIER_PRIVATE); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE); return $this; } @@ -61,7 +72,18 @@ class Property extends PhpParser\BuilderAbstract * @return $this The builder instance (for fluid interface) */ public function makeStatic() { - $this->setModifier(Stmt\Class_::MODIFIER_STATIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC); + + return $this; + } + + /** + * Makes the property readonly. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeReadonly() { + $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_READONLY); return $this; } @@ -74,7 +96,7 @@ class Property extends PhpParser\BuilderAbstract * @return $this The builder instance (for fluid interface) */ public function setDefault($value) { - $this->default = $this->normalizeValue($value); + $this->default = BuilderHelpers::normalizeValue($value); return $this; } @@ -87,9 +109,35 @@ class Property extends PhpParser\BuilderAbstract * @return $this The builder instance (for fluid interface) */ public function setDocComment($docComment) { - $this->attributes = array( - 'comments' => array($this->normalizeDocComment($docComment)) - ); + $this->attributes = [ + 'comments' => [BuilderHelpers::normalizeDocComment($docComment)] + ]; + + return $this; + } + + /** + * Sets the property type for PHP 7.4+. + * + * @param string|Name|Identifier|ComplexType $type + * + * @return $this + */ + public function setType($type) { + $this->type = BuilderHelpers::normalizeType($type); + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); return $this; } @@ -99,13 +147,15 @@ class Property extends PhpParser\BuilderAbstract * * @return Stmt\Property The built property node */ - public function getNode() { + public function getNode() : PhpParser\Node { return new Stmt\Property( $this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC, - array( + [ new Stmt\PropertyProperty($this->name, $this->default) - ), - $this->attributes + ], + $this->attributes, + $this->type, + $this->attributeGroups ); } -} \ No newline at end of file +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php b/lib/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php new file mode 100644 index 000000000..311e8cd7b --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php @@ -0,0 +1,64 @@ +and($trait); + } + } + + /** + * Adds used trait. + * + * @param Node\Name|string $trait Trait name + * + * @return $this The builder instance (for fluid interface) + */ + public function and($trait) { + $this->traits[] = BuilderHelpers::normalizeName($trait); + return $this; + } + + /** + * Adds trait adaptation. + * + * @param Stmt\TraitUseAdaptation|Builder\TraitUseAdaptation $adaptation Trait adaptation + * + * @return $this The builder instance (for fluid interface) + */ + public function with($adaptation) { + $adaptation = BuilderHelpers::normalizeNode($adaptation); + + if (!$adaptation instanceof Stmt\TraitUseAdaptation) { + throw new \LogicException('Adaptation must have type TraitUseAdaptation'); + } + + $this->adaptations[] = $adaptation; + return $this; + } + + /** + * Returns the built node. + * + * @return Node The built node + */ + public function getNode() : Node { + return new Stmt\TraitUse($this->traits, $this->adaptations); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php b/lib/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php new file mode 100644 index 000000000..eb6c0b622 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php @@ -0,0 +1,148 @@ +type = self::TYPE_UNDEFINED; + + $this->trait = is_null($trait)? null: BuilderHelpers::normalizeName($trait); + $this->method = BuilderHelpers::normalizeIdentifier($method); + } + + /** + * Sets alias of method. + * + * @param Node\Identifier|string $alias Alias for adaptated method + * + * @return $this The builder instance (for fluid interface) + */ + public function as($alias) { + if ($this->type === self::TYPE_UNDEFINED) { + $this->type = self::TYPE_ALIAS; + } + + if ($this->type !== self::TYPE_ALIAS) { + throw new \LogicException('Cannot set alias for not alias adaptation buider'); + } + + $this->alias = $alias; + return $this; + } + + /** + * Sets adaptated method public. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePublic() { + $this->setModifier(Stmt\Class_::MODIFIER_PUBLIC); + return $this; + } + + /** + * Sets adaptated method protected. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtected() { + $this->setModifier(Stmt\Class_::MODIFIER_PROTECTED); + return $this; + } + + /** + * Sets adaptated method private. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivate() { + $this->setModifier(Stmt\Class_::MODIFIER_PRIVATE); + return $this; + } + + /** + * Adds overwritten traits. + * + * @param Node\Name|string ...$traits Traits for overwrite + * + * @return $this The builder instance (for fluid interface) + */ + public function insteadof(...$traits) { + if ($this->type === self::TYPE_UNDEFINED) { + if (is_null($this->trait)) { + throw new \LogicException('Precedence adaptation must have trait'); + } + + $this->type = self::TYPE_PRECEDENCE; + } + + if ($this->type !== self::TYPE_PRECEDENCE) { + throw new \LogicException('Cannot add overwritten traits for not precedence adaptation buider'); + } + + foreach ($traits as $trait) { + $this->insteadof[] = BuilderHelpers::normalizeName($trait); + } + + return $this; + } + + protected function setModifier(int $modifier) { + if ($this->type === self::TYPE_UNDEFINED) { + $this->type = self::TYPE_ALIAS; + } + + if ($this->type !== self::TYPE_ALIAS) { + throw new \LogicException('Cannot set access modifier for not alias adaptation buider'); + } + + if (is_null($this->modifier)) { + $this->modifier = $modifier; + } else { + throw new \LogicException('Multiple access type modifiers are not allowed'); + } + } + + /** + * Returns the built node. + * + * @return Node The built node + */ + public function getNode() : Node { + switch ($this->type) { + case self::TYPE_ALIAS: + return new Stmt\TraitUseAdaptation\Alias($this->trait, $this->method, $this->modifier, $this->alias); + case self::TYPE_PRECEDENCE: + return new Stmt\TraitUseAdaptation\Precedence($this->trait, $this->method, $this->insteadof); + default: + throw new \LogicException('Type of adaptation is not defined'); + } + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Trait_.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Trait_.php index 7b004fa96..97f32f98d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Trait_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Trait_.php @@ -1,23 +1,28 @@ -name = $name; } @@ -29,13 +34,13 @@ class Trait_ extends Declaration * @return $this The builder instance (for fluid interface) */ public function addStmt($stmt) { - $stmt = $this->normalizeNode($stmt); + $stmt = BuilderHelpers::normalizeNode($stmt); if ($stmt instanceof Stmt\Property) { $this->properties[] = $stmt; - } else if ($stmt instanceof Stmt\ClassMethod) { + } elseif ($stmt instanceof Stmt\ClassMethod) { $this->methods[] = $stmt; - } else if ($stmt instanceof Stmt\TraitUse) { + } elseif ($stmt instanceof Stmt\TraitUse) { $this->uses[] = $stmt; } else { throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); @@ -44,16 +49,30 @@ class Trait_ extends Declaration return $this; } + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + /** * Returns the built trait node. * * @return Stmt\Trait_ The built interface node */ - public function getNode() { + public function getNode() : PhpParser\Node { return new Stmt\Trait_( - $this->name, array( - 'stmts' => array_merge($this->uses, $this->properties, $this->methods) - ), $this->attributes + $this->name, [ + 'stmts' => array_merge($this->uses, $this->properties, $this->methods), + 'attrGroups' => $this->attributeGroups, + ], $this->attributes ); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Builder/Use_.php b/lib/nikic/php-parser/lib/PhpParser/Builder/Use_.php index f6d3a856f..4bd3d12df 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Builder/Use_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Builder/Use_.php @@ -1,15 +1,14 @@ -name = $this->normalizeName($name); + public function __construct($name, int $type) { + $this->name = BuilderHelpers::normalizeName($name); $this->type = $type; } @@ -32,27 +31,19 @@ class Use_ extends BuilderAbstract { * * @return $this The builder instance (for fluid interface) */ - protected function as_($alias) { + public function as(string $alias) { $this->alias = $alias; return $this; } - public function __call($name, $args) { - if (method_exists($this, $name . '_')) { - return call_user_func_array(array($this, $name . '_'), $args); - } - - throw new \LogicException(sprintf('Method "%s" does not exist', $name)); - } /** * Returns the built node. * - * @return Node The built node + * @return Stmt\Use_ The built node */ - public function getNode() { - $alias = null !== $this->alias ? $this->alias : $this->name->getLast(); - return new Stmt\Use_(array( - new Stmt\UseUse($this->name, $alias) - ), $this->type); + public function getNode() : Node { + return new Stmt\Use_([ + new Stmt\UseUse($this->name, $this->alias) + ], $this->type); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/BuilderAbstract.php b/lib/nikic/php-parser/lib/PhpParser/BuilderAbstract.php deleted file mode 100644 index e353963e6..000000000 --- a/lib/nikic/php-parser/lib/PhpParser/BuilderAbstract.php +++ /dev/null @@ -1,175 +0,0 @@ -getNode(); - } elseif ($node instanceof Node) { - return $node; - } - - throw new \LogicException('Expected node or builder object'); - } - - /** - * Normalizes a name: Converts plain string names to PhpParser\Node\Name. - * - * @param Name|string $name The name to normalize - * - * @return Name The normalized name - */ - protected function normalizeName($name) { - if ($name instanceof Name) { - return $name; - } elseif (is_string($name)) { - if (!$name) { - throw new \LogicException('Name cannot be empty'); - } - - if ($name[0] == '\\') { - return new Name\FullyQualified(substr($name, 1)); - } elseif (0 === strpos($name, 'namespace\\')) { - return new Name\Relative(substr($name, strlen('namespace\\'))); - } else { - return new Name($name); - } - } - - throw new \LogicException('Name must be a string or an instance of PhpParser\Node\Name'); - } - - /** - * Normalizes a type: Converts plain-text type names into proper AST representation. - * - * In particular, builtin types are left as strings, custom types become Names and nullables - * are wrapped in NullableType nodes. - * - * @param Name|string|NullableType $type The type to normalize - * - * @return Name|string|NullableType The normalized type - */ - protected function normalizeType($type) { - if (!is_string($type)) { - if (!$type instanceof Name && !$type instanceof NullableType) { - throw new \LogicException( - 'Type must be a string, or an instance of Name or NullableType'); - } - return $type; - } - - $nullable = false; - if (strlen($type) > 0 && $type[0] === '?') { - $nullable = true; - $type = substr($type, 1); - } - - $builtinTypes = array( - 'array', 'callable', 'string', 'int', 'float', 'bool', 'iterable', 'void', 'object' - ); - - $lowerType = strtolower($type); - if (in_array($lowerType, $builtinTypes)) { - $type = $lowerType; - } else { - $type = $this->normalizeName($type); - } - - if ($nullable && $type === 'void') { - throw new \LogicException('void type cannot be nullable'); - } - - return $nullable ? new Node\NullableType($type) : $type; - } - - /** - * Normalizes a value: Converts nulls, booleans, integers, - * floats, strings and arrays into their respective nodes - * - * @param mixed $value The value to normalize - * - * @return Expr The normalized value - */ - protected function normalizeValue($value) { - if ($value instanceof Node) { - return $value; - } elseif (is_null($value)) { - return new Expr\ConstFetch( - new Name('null') - ); - } elseif (is_bool($value)) { - return new Expr\ConstFetch( - new Name($value ? 'true' : 'false') - ); - } elseif (is_int($value)) { - return new Scalar\LNumber($value); - } elseif (is_float($value)) { - return new Scalar\DNumber($value); - } elseif (is_string($value)) { - return new Scalar\String_($value); - } elseif (is_array($value)) { - $items = array(); - $lastKey = -1; - foreach ($value as $itemKey => $itemValue) { - // for consecutive, numeric keys don't generate keys - if (null !== $lastKey && ++$lastKey === $itemKey) { - $items[] = new Expr\ArrayItem( - $this->normalizeValue($itemValue) - ); - } else { - $lastKey = null; - $items[] = new Expr\ArrayItem( - $this->normalizeValue($itemValue), - $this->normalizeValue($itemKey) - ); - } - } - - return new Expr\Array_($items); - } else { - throw new \LogicException('Invalid value'); - } - } - - /** - * Normalizes a doc comment: Converts plain strings to PhpParser\Comment\Doc. - * - * @param Comment\Doc|string $docComment The doc comment to normalize - * - * @return Comment\Doc The normalized doc comment - */ - protected function normalizeDocComment($docComment) { - if ($docComment instanceof Comment\Doc) { - return $docComment; - } else if (is_string($docComment)) { - return new Comment\Doc($docComment); - } else { - throw new \LogicException('Doc comment must be a string or an instance of PhpParser\Comment\Doc'); - } - } - - /** - * Sets a modifier in the $this->type property. - * - * @param int $modifier Modifier to set - */ - protected function setModifier($modifier) { - Stmt\Class_::verifyModifier($this->flags, $modifier); - $this->flags |= $modifier; - } -} diff --git a/lib/nikic/php-parser/lib/PhpParser/BuilderFactory.php b/lib/nikic/php-parser/lib/PhpParser/BuilderFactory.php index 42c7f612c..fef2579b3 100644 --- a/lib/nikic/php-parser/lib/PhpParser/BuilderFactory.php +++ b/lib/nikic/php-parser/lib/PhpParser/BuilderFactory.php @@ -1,23 +1,32 @@ -args($args) + ); + } + /** * Creates a namespace builder. * @@ -25,7 +34,7 @@ class BuilderFactory * * @return Builder\Namespace_ The created namespace builder */ - protected function _namespace($name) { + public function namespace($name) : Builder\Namespace_ { return new Builder\Namespace_($name); } @@ -36,7 +45,7 @@ class BuilderFactory * * @return Builder\Class_ The created class builder */ - protected function _class($name) { + public function class(string $name) : Builder\Class_ { return new Builder\Class_($name); } @@ -47,7 +56,7 @@ class BuilderFactory * * @return Builder\Interface_ The created interface builder */ - protected function _interface($name) { + public function interface(string $name) : Builder\Interface_ { return new Builder\Interface_($name); } @@ -58,10 +67,49 @@ class BuilderFactory * * @return Builder\Trait_ The created trait builder */ - protected function _trait($name) { + public function trait(string $name) : Builder\Trait_ { return new Builder\Trait_($name); } + /** + * Creates an enum builder. + * + * @param string $name Name of the enum + * + * @return Builder\Enum_ The created enum builder + */ + public function enum(string $name) : Builder\Enum_ { + return new Builder\Enum_($name); + } + + /** + * Creates a trait use builder. + * + * @param Node\Name|string ...$traits Trait names + * + * @return Builder\TraitUse The create trait use builder + */ + public function useTrait(...$traits) : Builder\TraitUse { + return new Builder\TraitUse(...$traits); + } + + /** + * Creates a trait use adaptation builder. + * + * @param Node\Name|string|null $trait Trait name + * @param Node\Identifier|string $method Method name + * + * @return Builder\TraitUseAdaptation The create trait use adaptation builder + */ + public function traitUseAdaptation($trait, $method = null) : Builder\TraitUseAdaptation { + if ($method === null) { + $method = $trait; + $trait = null; + } + + return new Builder\TraitUseAdaptation($trait, $method); + } + /** * Creates a method builder. * @@ -69,7 +117,7 @@ class BuilderFactory * * @return Builder\Method The created method builder */ - public function method($name) { + public function method(string $name) : Builder\Method { return new Builder\Method($name); } @@ -80,7 +128,7 @@ class BuilderFactory * * @return Builder\Param The created parameter builder */ - public function param($name) { + public function param(string $name) : Builder\Param { return new Builder\Param($name); } @@ -91,7 +139,7 @@ class BuilderFactory * * @return Builder\Property The created property builder */ - public function property($name) { + public function property(string $name) : Builder\Property { return new Builder\Property($name); } @@ -102,26 +150,250 @@ class BuilderFactory * * @return Builder\Function_ The created function builder */ - protected function _function($name) { + public function function(string $name) : Builder\Function_ { return new Builder\Function_($name); } /** * Creates a namespace/class use builder. * - * @param string|Node\Name Name to alias + * @param Node\Name|string $name Name of the entity (namespace or class) to alias * - * @return Builder\Use_ The create use builder + * @return Builder\Use_ The created use builder */ - protected function _use($name) { + public function use($name) : Builder\Use_ { return new Builder\Use_($name, Use_::TYPE_NORMAL); } - public function __call($name, array $args) { - if (method_exists($this, '_' . $name)) { - return call_user_func_array(array($this, '_' . $name), $args); + /** + * Creates a function use builder. + * + * @param Node\Name|string $name Name of the function to alias + * + * @return Builder\Use_ The created use function builder + */ + public function useFunction($name) : Builder\Use_ { + return new Builder\Use_($name, Use_::TYPE_FUNCTION); + } + + /** + * Creates a constant use builder. + * + * @param Node\Name|string $name Name of the const to alias + * + * @return Builder\Use_ The created use const builder + */ + public function useConst($name) : Builder\Use_ { + return new Builder\Use_($name, Use_::TYPE_CONSTANT); + } + + /** + * Creates a class constant builder. + * + * @param string|Identifier $name Name + * @param Node\Expr|bool|null|int|float|string|array $value Value + * + * @return Builder\ClassConst The created use const builder + */ + public function classConst($name, $value) : Builder\ClassConst { + return new Builder\ClassConst($name, $value); + } + + /** + * Creates an enum case builder. + * + * @param string|Identifier $name Name + * + * @return Builder\EnumCase The created use const builder + */ + public function enumCase($name) : Builder\EnumCase { + return new Builder\EnumCase($name); + } + + /** + * Creates node a for a literal value. + * + * @param Expr|bool|null|int|float|string|array $value $value + * + * @return Expr + */ + public function val($value) : Expr { + return BuilderHelpers::normalizeValue($value); + } + + /** + * Creates variable node. + * + * @param string|Expr $name Name + * + * @return Expr\Variable + */ + public function var($name) : Expr\Variable { + if (!\is_string($name) && !$name instanceof Expr) { + throw new \LogicException('Variable name must be string or Expr'); } - throw new \LogicException(sprintf('Method "%s" does not exist', $name)); + return new Expr\Variable($name); + } + + /** + * Normalizes an argument list. + * + * Creates Arg nodes for all arguments and converts literal values to expressions. + * + * @param array $args List of arguments to normalize + * + * @return Arg[] + */ + public function args(array $args) : array { + $normalizedArgs = []; + foreach ($args as $key => $arg) { + if (!($arg instanceof Arg)) { + $arg = new Arg(BuilderHelpers::normalizeValue($arg)); + } + if (\is_string($key)) { + $arg->name = BuilderHelpers::normalizeIdentifier($key); + } + $normalizedArgs[] = $arg; + } + return $normalizedArgs; + } + + /** + * Creates a function call node. + * + * @param string|Name|Expr $name Function name + * @param array $args Function arguments + * + * @return Expr\FuncCall + */ + public function funcCall($name, array $args = []) : Expr\FuncCall { + return new Expr\FuncCall( + BuilderHelpers::normalizeNameOrExpr($name), + $this->args($args) + ); + } + + /** + * Creates a method call node. + * + * @param Expr $var Variable the method is called on + * @param string|Identifier|Expr $name Method name + * @param array $args Method arguments + * + * @return Expr\MethodCall + */ + public function methodCall(Expr $var, $name, array $args = []) : Expr\MethodCall { + return new Expr\MethodCall( + $var, + BuilderHelpers::normalizeIdentifierOrExpr($name), + $this->args($args) + ); + } + + /** + * Creates a static method call node. + * + * @param string|Name|Expr $class Class name + * @param string|Identifier|Expr $name Method name + * @param array $args Method arguments + * + * @return Expr\StaticCall + */ + public function staticCall($class, $name, array $args = []) : Expr\StaticCall { + return new Expr\StaticCall( + BuilderHelpers::normalizeNameOrExpr($class), + BuilderHelpers::normalizeIdentifierOrExpr($name), + $this->args($args) + ); + } + + /** + * Creates an object creation node. + * + * @param string|Name|Expr $class Class name + * @param array $args Constructor arguments + * + * @return Expr\New_ + */ + public function new($class, array $args = []) : Expr\New_ { + return new Expr\New_( + BuilderHelpers::normalizeNameOrExpr($class), + $this->args($args) + ); + } + + /** + * Creates a constant fetch node. + * + * @param string|Name $name Constant name + * + * @return Expr\ConstFetch + */ + public function constFetch($name) : Expr\ConstFetch { + return new Expr\ConstFetch(BuilderHelpers::normalizeName($name)); + } + + /** + * Creates a property fetch node. + * + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Property name + * + * @return Expr\PropertyFetch + */ + public function propertyFetch(Expr $var, $name) : Expr\PropertyFetch { + return new Expr\PropertyFetch($var, BuilderHelpers::normalizeIdentifierOrExpr($name)); + } + + /** + * Creates a class constant fetch node. + * + * @param string|Name|Expr $class Class name + * @param string|Identifier $name Constant name + * + * @return Expr\ClassConstFetch + */ + public function classConstFetch($class, $name): Expr\ClassConstFetch { + return new Expr\ClassConstFetch( + BuilderHelpers::normalizeNameOrExpr($class), + BuilderHelpers::normalizeIdentifier($name) + ); + } + + /** + * Creates nested Concat nodes from a list of expressions. + * + * @param Expr|string ...$exprs Expressions or literal strings + * + * @return Concat + */ + public function concat(...$exprs) : Concat { + $numExprs = count($exprs); + if ($numExprs < 2) { + throw new \LogicException('Expected at least two expressions'); + } + + $lastConcat = $this->normalizeStringExpr($exprs[0]); + for ($i = 1; $i < $numExprs; $i++) { + $lastConcat = new Concat($lastConcat, $this->normalizeStringExpr($exprs[$i])); + } + return $lastConcat; + } + + /** + * @param string|Expr $expr + * @return Expr + */ + private function normalizeStringExpr($expr) : Expr { + if ($expr instanceof Expr) { + return $expr; + } + + if (\is_string($expr)) { + return new String_($expr); + } + + throw new \LogicException('Expected string or Expr'); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/BuilderHelpers.php b/lib/nikic/php-parser/lib/PhpParser/BuilderHelpers.php new file mode 100644 index 000000000..2f0e91273 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/BuilderHelpers.php @@ -0,0 +1,313 @@ +getNode(); + } + + if ($node instanceof Node) { + return $node; + } + + throw new \LogicException('Expected node or builder object'); + } + + /** + * Normalizes a node to a statement. + * + * Expressions are wrapped in a Stmt\Expression node. + * + * @param Node|Builder $node The node to normalize + * + * @return Stmt The normalized statement node + */ + public static function normalizeStmt($node) : Stmt { + $node = self::normalizeNode($node); + if ($node instanceof Stmt) { + return $node; + } + + if ($node instanceof Expr) { + return new Stmt\Expression($node); + } + + throw new \LogicException('Expected statement or expression node'); + } + + /** + * Normalizes strings to Identifier. + * + * @param string|Identifier $name The identifier to normalize + * + * @return Identifier The normalized identifier + */ + public static function normalizeIdentifier($name) : Identifier { + if ($name instanceof Identifier) { + return $name; + } + + if (\is_string($name)) { + return new Identifier($name); + } + + throw new \LogicException('Expected string or instance of Node\Identifier'); + } + + /** + * Normalizes strings to Identifier, also allowing expressions. + * + * @param string|Identifier|Expr $name The identifier to normalize + * + * @return Identifier|Expr The normalized identifier or expression + */ + public static function normalizeIdentifierOrExpr($name) { + if ($name instanceof Identifier || $name instanceof Expr) { + return $name; + } + + if (\is_string($name)) { + return new Identifier($name); + } + + throw new \LogicException('Expected string or instance of Node\Identifier or Node\Expr'); + } + + /** + * Normalizes a name: Converts string names to Name nodes. + * + * @param Name|string $name The name to normalize + * + * @return Name The normalized name + */ + public static function normalizeName($name) : Name { + if ($name instanceof Name) { + return $name; + } + + if (is_string($name)) { + if (!$name) { + throw new \LogicException('Name cannot be empty'); + } + + if ($name[0] === '\\') { + return new Name\FullyQualified(substr($name, 1)); + } + + if (0 === strpos($name, 'namespace\\')) { + return new Name\Relative(substr($name, strlen('namespace\\'))); + } + + return new Name($name); + } + + throw new \LogicException('Name must be a string or an instance of Node\Name'); + } + + /** + * Normalizes a name: Converts string names to Name nodes, while also allowing expressions. + * + * @param Expr|Name|string $name The name to normalize + * + * @return Name|Expr The normalized name or expression + */ + public static function normalizeNameOrExpr($name) { + if ($name instanceof Expr) { + return $name; + } + + if (!is_string($name) && !($name instanceof Name)) { + throw new \LogicException( + 'Name must be a string or an instance of Node\Name or Node\Expr' + ); + } + + return self::normalizeName($name); + } + + /** + * Normalizes a type: Converts plain-text type names into proper AST representation. + * + * In particular, builtin types become Identifiers, custom types become Names and nullables + * are wrapped in NullableType nodes. + * + * @param string|Name|Identifier|ComplexType $type The type to normalize + * + * @return Name|Identifier|ComplexType The normalized type + */ + public static function normalizeType($type) { + if (!is_string($type)) { + if ( + !$type instanceof Name && !$type instanceof Identifier && + !$type instanceof ComplexType + ) { + throw new \LogicException( + 'Type must be a string, or an instance of Name, Identifier or ComplexType' + ); + } + return $type; + } + + $nullable = false; + if (strlen($type) > 0 && $type[0] === '?') { + $nullable = true; + $type = substr($type, 1); + } + + $builtinTypes = [ + 'array', 'callable', 'string', 'int', 'float', 'bool', 'iterable', 'void', 'object', 'mixed', 'never', + ]; + + $lowerType = strtolower($type); + if (in_array($lowerType, $builtinTypes)) { + $type = new Identifier($lowerType); + } else { + $type = self::normalizeName($type); + } + + $notNullableTypes = [ + 'void', 'mixed', 'never', + ]; + if ($nullable && in_array((string) $type, $notNullableTypes)) { + throw new \LogicException(sprintf('%s type cannot be nullable', $type)); + } + + return $nullable ? new NullableType($type) : $type; + } + + /** + * Normalizes a value: Converts nulls, booleans, integers, + * floats, strings and arrays into their respective nodes + * + * @param Node\Expr|bool|null|int|float|string|array $value The value to normalize + * + * @return Expr The normalized value + */ + public static function normalizeValue($value) : Expr { + if ($value instanceof Node\Expr) { + return $value; + } + + if (is_null($value)) { + return new Expr\ConstFetch( + new Name('null') + ); + } + + if (is_bool($value)) { + return new Expr\ConstFetch( + new Name($value ? 'true' : 'false') + ); + } + + if (is_int($value)) { + return new Scalar\LNumber($value); + } + + if (is_float($value)) { + return new Scalar\DNumber($value); + } + + if (is_string($value)) { + return new Scalar\String_($value); + } + + if (is_array($value)) { + $items = []; + $lastKey = -1; + foreach ($value as $itemKey => $itemValue) { + // for consecutive, numeric keys don't generate keys + if (null !== $lastKey && ++$lastKey === $itemKey) { + $items[] = new Expr\ArrayItem( + self::normalizeValue($itemValue) + ); + } else { + $lastKey = null; + $items[] = new Expr\ArrayItem( + self::normalizeValue($itemValue), + self::normalizeValue($itemKey) + ); + } + } + + return new Expr\Array_($items); + } + + throw new \LogicException('Invalid value'); + } + + /** + * Normalizes a doc comment: Converts plain strings to PhpParser\Comment\Doc. + * + * @param Comment\Doc|string $docComment The doc comment to normalize + * + * @return Comment\Doc The normalized doc comment + */ + public static function normalizeDocComment($docComment) : Comment\Doc { + if ($docComment instanceof Comment\Doc) { + return $docComment; + } + + if (is_string($docComment)) { + return new Comment\Doc($docComment); + } + + throw new \LogicException('Doc comment must be a string or an instance of PhpParser\Comment\Doc'); + } + + /** + * Normalizes a attribute: Converts attribute to the Attribute Group if needed. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return Node\AttributeGroup The Attribute Group + */ + public static function normalizeAttribute($attribute) : Node\AttributeGroup + { + if ($attribute instanceof Node\AttributeGroup) { + return $attribute; + } + + if (!($attribute instanceof Node\Attribute)) { + throw new \LogicException('Attribute must be an instance of PhpParser\Node\Attribute or PhpParser\Node\AttributeGroup'); + } + + return new Node\AttributeGroup([$attribute]); + } + + /** + * Adds a modifier and returns new modifier bitmask. + * + * @param int $modifiers Existing modifiers + * @param int $modifier Modifier to set + * + * @return int New modifiers + */ + public static function addModifier(int $modifiers, int $modifier) : int { + Stmt\Class_::verifyModifier($modifiers, $modifier); + return $modifiers | $modifier; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Comment.php b/lib/nikic/php-parser/lib/PhpParser/Comment.php index 4034cfa6b..61e98d3dc 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Comment.php +++ b/lib/nikic/php-parser/lib/PhpParser/Comment.php @@ -1,24 +1,37 @@ -text = $text; - $this->line = $startLine; - $this->filePos = $startFilePos; + $this->startLine = $startLine; + $this->startFilePos = $startFilePos; + $this->startTokenPos = $startTokenPos; + $this->endLine = $endLine; + $this->endFilePos = $endFilePos; + $this->endTokenPos = $endTokenPos; } /** @@ -26,26 +39,95 @@ class Comment implements \JsonSerializable * * @return string The comment text (including comment delimiters like /*) */ - public function getText() { + public function getText() : string { return $this->text; } /** * Gets the line number the comment started on. * - * @return int Line number + * @return int Line number (or -1 if not available) */ - public function getLine() { - return $this->line; + public function getStartLine() : int { + return $this->startLine; } /** * Gets the file offset the comment started on. * + * @return int File offset (or -1 if not available) + */ + public function getStartFilePos() : int { + return $this->startFilePos; + } + + /** + * Gets the token offset the comment started on. + * + * @return int Token offset (or -1 if not available) + */ + public function getStartTokenPos() : int { + return $this->startTokenPos; + } + + /** + * Gets the line number the comment ends on. + * + * @return int Line number (or -1 if not available) + */ + public function getEndLine() : int { + return $this->endLine; + } + + /** + * Gets the file offset the comment ends on. + * + * @return int File offset (or -1 if not available) + */ + public function getEndFilePos() : int { + return $this->endFilePos; + } + + /** + * Gets the token offset the comment ends on. + * + * @return int Token offset (or -1 if not available) + */ + public function getEndTokenPos() : int { + return $this->endTokenPos; + } + + /** + * Gets the line number the comment started on. + * + * @deprecated Use getStartLine() instead + * + * @return int Line number + */ + public function getLine() : int { + return $this->startLine; + } + + /** + * Gets the file offset the comment started on. + * + * @deprecated Use getStartFilePos() instead + * * @return int File offset */ - public function getFilePos() { - return $this->filePos; + public function getFilePos() : int { + return $this->startFilePos; + } + + /** + * Gets the token offset the comment started on. + * + * @deprecated Use getStartTokenPos() instead + * + * @return int Token offset + */ + public function getTokenPos() : int { + return $this->startTokenPos; } /** @@ -53,7 +135,7 @@ class Comment implements \JsonSerializable * * @return string The comment text (including comment delimiters like /*) */ - public function __toString() { + public function __toString() : string { return $this->text; } @@ -114,9 +196,17 @@ class Comment implements \JsonSerializable return $text; } - private function getShortestWhitespacePrefixLen($str) { + /** + * Get length of shortest whitespace prefix (at the start of a line). + * + * If there is a line with no prefix whitespace, 0 is a valid return value. + * + * @param string $str String to check + * @return int Length in characters. Tabs count as single characters. + */ + private function getShortestWhitespacePrefixLen(string $str) : int { $lines = explode("\n", $str); - $shortestPrefixLen = INF; + $shortestPrefixLen = \INF; foreach ($lines as $line) { preg_match('(^\s*)', $line, $matches); $prefixLen = strlen($matches[0]); @@ -127,14 +217,23 @@ class Comment implements \JsonSerializable return $shortestPrefixLen; } - public function jsonSerialize() { + /** + * @return array + * @psalm-return array{nodeType:string, text:mixed, line:mixed, filePos:mixed} + */ + public function jsonSerialize() : array { // Technically not a node, but we make it look like one anyway $type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment'; return [ 'nodeType' => $type, 'text' => $this->text, - 'line' => $this->line, - 'filePos' => $this->filePos, + // TODO: Rename these to include "start". + 'line' => $this->startLine, + 'filePos' => $this->startFilePos, + 'tokenPos' => $this->startTokenPos, + 'endLine' => $this->endLine, + 'endFilePos' => $this->endFilePos, + 'endTokenPos' => $this->endTokenPos, ]; } -} \ No newline at end of file +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Comment/Doc.php b/lib/nikic/php-parser/lib/PhpParser/Comment/Doc.php index 24fc6c9ec..a9db6128f 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Comment/Doc.php +++ b/lib/nikic/php-parser/lib/PhpParser/Comment/Doc.php @@ -1,7 +1,7 @@ -fallbackEvaluator = $fallbackEvaluator ?? function(Expr $expr) { + throw new ConstExprEvaluationException( + "Expression of type {$expr->getType()} cannot be evaluated" + ); + }; + } + + /** + * Silently evaluates a constant expression into a PHP value. + * + * Thrown Errors, warnings or notices will be converted into a ConstExprEvaluationException. + * The original source of the exception is available through getPrevious(). + * + * If some part of the expression cannot be evaluated, the fallback evaluator passed to the + * constructor will be invoked. By default, if no fallback is provided, an exception of type + * ConstExprEvaluationException is thrown. + * + * See class doc comment for caveats and limitations. + * + * @param Expr $expr Constant expression to evaluate + * @return mixed Result of evaluation + * + * @throws ConstExprEvaluationException if the expression cannot be evaluated or an error occurred + */ + public function evaluateSilently(Expr $expr) { + set_error_handler(function($num, $str, $file, $line) { + throw new \ErrorException($str, 0, $num, $file, $line); + }); + + try { + return $this->evaluate($expr); + } catch (\Throwable $e) { + if (!$e instanceof ConstExprEvaluationException) { + $e = new ConstExprEvaluationException( + "An error occurred during constant expression evaluation", 0, $e); + } + throw $e; + } finally { + restore_error_handler(); + } + } + + /** + * Directly evaluates a constant expression into a PHP value. + * + * May generate Error exceptions, warnings or notices. Use evaluateSilently() to convert these + * into a ConstExprEvaluationException. + * + * If some part of the expression cannot be evaluated, the fallback evaluator passed to the + * constructor will be invoked. By default, if no fallback is provided, an exception of type + * ConstExprEvaluationException is thrown. + * + * See class doc comment for caveats and limitations. + * + * @param Expr $expr Constant expression to evaluate + * @return mixed Result of evaluation + * + * @throws ConstExprEvaluationException if the expression cannot be evaluated + */ + public function evaluateDirectly(Expr $expr) { + return $this->evaluate($expr); + } + + private function evaluate(Expr $expr) { + if ($expr instanceof Scalar\LNumber + || $expr instanceof Scalar\DNumber + || $expr instanceof Scalar\String_ + ) { + return $expr->value; + } + + if ($expr instanceof Expr\Array_) { + return $this->evaluateArray($expr); + } + + // Unary operators + if ($expr instanceof Expr\UnaryPlus) { + return +$this->evaluate($expr->expr); + } + if ($expr instanceof Expr\UnaryMinus) { + return -$this->evaluate($expr->expr); + } + if ($expr instanceof Expr\BooleanNot) { + return !$this->evaluate($expr->expr); + } + if ($expr instanceof Expr\BitwiseNot) { + return ~$this->evaluate($expr->expr); + } + + if ($expr instanceof Expr\BinaryOp) { + return $this->evaluateBinaryOp($expr); + } + + if ($expr instanceof Expr\Ternary) { + return $this->evaluateTernary($expr); + } + + if ($expr instanceof Expr\ArrayDimFetch && null !== $expr->dim) { + return $this->evaluate($expr->var)[$this->evaluate($expr->dim)]; + } + + if ($expr instanceof Expr\ConstFetch) { + return $this->evaluateConstFetch($expr); + } + + return ($this->fallbackEvaluator)($expr); + } + + private function evaluateArray(Expr\Array_ $expr) { + $array = []; + foreach ($expr->items as $item) { + if (null !== $item->key) { + $array[$this->evaluate($item->key)] = $this->evaluate($item->value); + } elseif ($item->unpack) { + $array = array_merge($array, $this->evaluate($item->value)); + } else { + $array[] = $this->evaluate($item->value); + } + } + return $array; + } + + private function evaluateTernary(Expr\Ternary $expr) { + if (null === $expr->if) { + return $this->evaluate($expr->cond) ?: $this->evaluate($expr->else); + } + + return $this->evaluate($expr->cond) + ? $this->evaluate($expr->if) + : $this->evaluate($expr->else); + } + + private function evaluateBinaryOp(Expr\BinaryOp $expr) { + if ($expr instanceof Expr\BinaryOp\Coalesce + && $expr->left instanceof Expr\ArrayDimFetch + ) { + // This needs to be special cased to respect BP_VAR_IS fetch semantics + return $this->evaluate($expr->left->var)[$this->evaluate($expr->left->dim)] + ?? $this->evaluate($expr->right); + } + + // The evaluate() calls are repeated in each branch, because some of the operators are + // short-circuiting and evaluating the RHS in advance may be illegal in that case + $l = $expr->left; + $r = $expr->right; + switch ($expr->getOperatorSigil()) { + case '&': return $this->evaluate($l) & $this->evaluate($r); + case '|': return $this->evaluate($l) | $this->evaluate($r); + case '^': return $this->evaluate($l) ^ $this->evaluate($r); + case '&&': return $this->evaluate($l) && $this->evaluate($r); + case '||': return $this->evaluate($l) || $this->evaluate($r); + case '??': return $this->evaluate($l) ?? $this->evaluate($r); + case '.': return $this->evaluate($l) . $this->evaluate($r); + case '/': return $this->evaluate($l) / $this->evaluate($r); + case '==': return $this->evaluate($l) == $this->evaluate($r); + case '>': return $this->evaluate($l) > $this->evaluate($r); + case '>=': return $this->evaluate($l) >= $this->evaluate($r); + case '===': return $this->evaluate($l) === $this->evaluate($r); + case 'and': return $this->evaluate($l) and $this->evaluate($r); + case 'or': return $this->evaluate($l) or $this->evaluate($r); + case 'xor': return $this->evaluate($l) xor $this->evaluate($r); + case '-': return $this->evaluate($l) - $this->evaluate($r); + case '%': return $this->evaluate($l) % $this->evaluate($r); + case '*': return $this->evaluate($l) * $this->evaluate($r); + case '!=': return $this->evaluate($l) != $this->evaluate($r); + case '!==': return $this->evaluate($l) !== $this->evaluate($r); + case '+': return $this->evaluate($l) + $this->evaluate($r); + case '**': return $this->evaluate($l) ** $this->evaluate($r); + case '<<': return $this->evaluate($l) << $this->evaluate($r); + case '>>': return $this->evaluate($l) >> $this->evaluate($r); + case '<': return $this->evaluate($l) < $this->evaluate($r); + case '<=': return $this->evaluate($l) <= $this->evaluate($r); + case '<=>': return $this->evaluate($l) <=> $this->evaluate($r); + } + + throw new \Exception('Should not happen'); + } + + private function evaluateConstFetch(Expr\ConstFetch $expr) { + $name = $expr->name->toLowerString(); + switch ($name) { + case 'null': return null; + case 'false': return false; + case 'true': return true; + } + + return ($this->fallbackEvaluator)($expr); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Error.php b/lib/nikic/php-parser/lib/PhpParser/Error.php index 4a23294fe..d1fb959d1 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Error.php +++ b/lib/nikic/php-parser/lib/PhpParser/Error.php @@ -1,4 +1,4 @@ -rawMessage = (string) $message; + public function __construct(string $message, $attributes = []) { + $this->rawMessage = $message; if (is_array($attributes)) { $this->attributes = $attributes; } else { - $this->attributes = array('startLine' => $attributes); + $this->attributes = ['startLine' => $attributes]; } $this->updateMessage(); } @@ -29,7 +29,7 @@ class Error extends \RuntimeException * * @return string Error message */ - public function getRawMessage() { + public function getRawMessage() : string { return $this->rawMessage; } @@ -38,8 +38,8 @@ class Error extends \RuntimeException * * @return int Error start line */ - public function getStartLine() { - return isset($this->attributes['startLine']) ? $this->attributes['startLine'] : -1; + public function getStartLine() : int { + return $this->attributes['startLine'] ?? -1; } /** @@ -47,22 +47,21 @@ class Error extends \RuntimeException * * @return int Error end line */ - public function getEndLine() { - return isset($this->attributes['endLine']) ? $this->attributes['endLine'] : -1; + public function getEndLine() : int { + return $this->attributes['endLine'] ?? -1; } - /** * Gets the attributes of the node/token the error occurred at. * * @return array */ - public function getAttributes() { + public function getAttributes() : array { return $this->attributes; } /** - * Sets the attributes of the node/token the error occured at. + * Sets the attributes of the node/token the error occurred at. * * @param array $attributes */ @@ -76,8 +75,8 @@ class Error extends \RuntimeException * * @param string $message Error message */ - public function setRawMessage($message) { - $this->rawMessage = (string) $message; + public function setRawMessage(string $message) { + $this->rawMessage = $message; $this->updateMessage(); } @@ -86,8 +85,8 @@ class Error extends \RuntimeException * * @param int $line Error start line */ - public function setStartLine($line) { - $this->attributes['startLine'] = (int) $line; + public function setStartLine(int $line) { + $this->attributes['startLine'] = $line; $this->updateMessage(); } @@ -98,8 +97,8 @@ class Error extends \RuntimeException * * @return bool */ - public function hasColumnInfo() { - return isset($this->attributes['startFilePos']) && isset($this->attributes['endFilePos']); + public function hasColumnInfo() : bool { + return isset($this->attributes['startFilePos'], $this->attributes['endFilePos']); } /** @@ -108,7 +107,7 @@ class Error extends \RuntimeException * @param string $code Source code of the file * @return int */ - public function getStartColumn($code) { + public function getStartColumn(string $code) : int { if (!$this->hasColumnInfo()) { throw new \RuntimeException('Error does not have column information'); } @@ -122,7 +121,7 @@ class Error extends \RuntimeException * @param string $code Source code of the file * @return int */ - public function getEndColumn($code) { + public function getEndColumn(string $code) : int { if (!$this->hasColumnInfo()) { throw new \RuntimeException('Error does not have column information'); } @@ -130,7 +129,14 @@ class Error extends \RuntimeException return $this->toColumn($code, $this->attributes['endFilePos']); } - public function getMessageWithColumnInfo($code) { + /** + * Formats message including line and column information. + * + * @param string $code Source code associated with the error, for calculation of the columns + * + * @return string Formatted message + */ + public function getMessageWithColumnInfo(string $code) : string { return sprintf( '%s from %d:%d to %d:%d', $this->getRawMessage(), $this->getStartLine(), $this->getStartColumn($code), @@ -138,7 +144,15 @@ class Error extends \RuntimeException ); } - private function toColumn($code, $pos) { + /** + * Converts a file offset into a column. + * + * @param string $code Source code that $pos indexes into + * @param int $pos 0-based position in $code + * + * @return int 1-based column (relative to start of line) + */ + private function toColumn(string $code, int $pos) : int { if ($pos > strlen($code)) { throw new \RuntimeException('Invalid position information'); } diff --git a/lib/nikic/php-parser/lib/PhpParser/ErrorHandler.php b/lib/nikic/php-parser/lib/PhpParser/ErrorHandler.php index fa2c2f8ce..d620e7453 100644 --- a/lib/nikic/php-parser/lib/PhpParser/ErrorHandler.php +++ b/lib/nikic/php-parser/lib/PhpParser/ErrorHandler.php @@ -1,4 +1,4 @@ -errors; } @@ -33,7 +33,7 @@ class Collecting implements ErrorHandler * * @return bool */ - public function hasErrors() { + public function hasErrors() : bool { return !empty($this->errors); } @@ -43,4 +43,4 @@ class Collecting implements ErrorHandler public function clearErrors() { $this->errors = []; } -} \ No newline at end of file +} diff --git a/lib/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php b/lib/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php index c5a76dd0c..aeee989b1 100644 --- a/lib/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php +++ b/lib/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php @@ -1,4 +1,4 @@ -type = $type; + $this->old = $old; + $this->new = $new; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Internal/Differ.php b/lib/nikic/php-parser/lib/PhpParser/Internal/Differ.php new file mode 100644 index 000000000..7f218c74f --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Internal/Differ.php @@ -0,0 +1,164 @@ +isEqual = $isEqual; + } + + /** + * Calculate diff (edit script) from $old to $new. + * + * @param array $old Original array + * @param array $new New array + * + * @return DiffElem[] Diff (edit script) + */ + public function diff(array $old, array $new) { + list($trace, $x, $y) = $this->calculateTrace($old, $new); + return $this->extractDiff($trace, $x, $y, $old, $new); + } + + /** + * Calculate diff, including "replace" operations. + * + * If a sequence of remove operations is followed by the same number of add operations, these + * will be coalesced into replace operations. + * + * @param array $old Original array + * @param array $new New array + * + * @return DiffElem[] Diff (edit script), including replace operations + */ + public function diffWithReplacements(array $old, array $new) { + return $this->coalesceReplacements($this->diff($old, $new)); + } + + private function calculateTrace(array $a, array $b) { + $n = \count($a); + $m = \count($b); + $max = $n + $m; + $v = [1 => 0]; + $trace = []; + for ($d = 0; $d <= $max; $d++) { + $trace[] = $v; + for ($k = -$d; $k <= $d; $k += 2) { + if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) { + $x = $v[$k+1]; + } else { + $x = $v[$k-1] + 1; + } + + $y = $x - $k; + while ($x < $n && $y < $m && ($this->isEqual)($a[$x], $b[$y])) { + $x++; + $y++; + } + + $v[$k] = $x; + if ($x >= $n && $y >= $m) { + return [$trace, $x, $y]; + } + } + } + throw new \Exception('Should not happen'); + } + + private function extractDiff(array $trace, int $x, int $y, array $a, array $b) { + $result = []; + for ($d = \count($trace) - 1; $d >= 0; $d--) { + $v = $trace[$d]; + $k = $x - $y; + + if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) { + $prevK = $k + 1; + } else { + $prevK = $k - 1; + } + + $prevX = $v[$prevK]; + $prevY = $prevX - $prevK; + + while ($x > $prevX && $y > $prevY) { + $result[] = new DiffElem(DiffElem::TYPE_KEEP, $a[$x-1], $b[$y-1]); + $x--; + $y--; + } + + if ($d === 0) { + break; + } + + while ($x > $prevX) { + $result[] = new DiffElem(DiffElem::TYPE_REMOVE, $a[$x-1], null); + $x--; + } + + while ($y > $prevY) { + $result[] = new DiffElem(DiffElem::TYPE_ADD, null, $b[$y-1]); + $y--; + } + } + return array_reverse($result); + } + + /** + * Coalesce equal-length sequences of remove+add into a replace operation. + * + * @param DiffElem[] $diff + * @return DiffElem[] + */ + private function coalesceReplacements(array $diff) { + $newDiff = []; + $c = \count($diff); + for ($i = 0; $i < $c; $i++) { + $diffType = $diff[$i]->type; + if ($diffType !== DiffElem::TYPE_REMOVE) { + $newDiff[] = $diff[$i]; + continue; + } + + $j = $i; + while ($j < $c && $diff[$j]->type === DiffElem::TYPE_REMOVE) { + $j++; + } + + $k = $j; + while ($k < $c && $diff[$k]->type === DiffElem::TYPE_ADD) { + $k++; + } + + if ($j - $i === $k - $j) { + $len = $j - $i; + for ($n = 0; $n < $len; $n++) { + $newDiff[] = new DiffElem( + DiffElem::TYPE_REPLACE, $diff[$i + $n]->old, $diff[$j + $n]->new + ); + } + } else { + for (; $i < $k; $i++) { + $newDiff[] = $diff[$i]; + } + } + $i = $k - 1; + } + return $newDiff; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php b/lib/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php new file mode 100644 index 000000000..3eeac04a4 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php @@ -0,0 +1,61 @@ +attrGroups = $attrGroups; + $this->args = $args; + $this->extends = $extends; + $this->implements = $implements; + $this->stmts = $stmts; + } + + public static function fromNewNode(Expr\New_ $newNode) { + $class = $newNode->class; + assert($class instanceof Node\Stmt\Class_); + // We don't assert that $class->name is null here, to allow consumers to assign unique names + // to anonymous classes for their own purposes. We simplify ignore the name here. + return new self( + $class->attrGroups, $newNode->args, $class->extends, $class->implements, + $class->stmts, $newNode->getAttributes() + ); + } + + public function getType() : string { + return 'Expr_PrintableNewAnonClass'; + } + + public function getSubNodeNames() : array { + return ['attrGroups', 'args', 'extends', 'implements', 'stmts']; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php b/lib/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php new file mode 100644 index 000000000..84c0175ec --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php @@ -0,0 +1,281 @@ +tokens = $tokens; + $this->indentMap = $this->calcIndentMap(); + } + + /** + * Whether the given position is immediately surrounded by parenthesis. + * + * @param int $startPos Start position + * @param int $endPos End position + * + * @return bool + */ + public function haveParens(int $startPos, int $endPos) : bool { + return $this->haveTokenImmediatelyBefore($startPos, '(') + && $this->haveTokenImmediatelyAfter($endPos, ')'); + } + + /** + * Whether the given position is immediately surrounded by braces. + * + * @param int $startPos Start position + * @param int $endPos End position + * + * @return bool + */ + public function haveBraces(int $startPos, int $endPos) : bool { + return ($this->haveTokenImmediatelyBefore($startPos, '{') + || $this->haveTokenImmediatelyBefore($startPos, T_CURLY_OPEN)) + && $this->haveTokenImmediatelyAfter($endPos, '}'); + } + + /** + * Check whether the position is directly preceded by a certain token type. + * + * During this check whitespace and comments are skipped. + * + * @param int $pos Position before which the token should occur + * @param int|string $expectedTokenType Token to check for + * + * @return bool Whether the expected token was found + */ + public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType) : bool { + $tokens = $this->tokens; + $pos--; + for (; $pos >= 0; $pos--) { + $tokenType = $tokens[$pos][0]; + if ($tokenType === $expectedTokenType) { + return true; + } + if ($tokenType !== \T_WHITESPACE + && $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) { + break; + } + } + return false; + } + + /** + * Check whether the position is directly followed by a certain token type. + * + * During this check whitespace and comments are skipped. + * + * @param int $pos Position after which the token should occur + * @param int|string $expectedTokenType Token to check for + * + * @return bool Whether the expected token was found + */ + public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType) : bool { + $tokens = $this->tokens; + $pos++; + for (; $pos < \count($tokens); $pos++) { + $tokenType = $tokens[$pos][0]; + if ($tokenType === $expectedTokenType) { + return true; + } + if ($tokenType !== \T_WHITESPACE + && $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) { + break; + } + } + return false; + } + + public function skipLeft(int $pos, $skipTokenType) { + $tokens = $this->tokens; + + $pos = $this->skipLeftWhitespace($pos); + if ($skipTokenType === \T_WHITESPACE) { + return $pos; + } + + if ($tokens[$pos][0] !== $skipTokenType) { + // Shouldn't happen. The skip token MUST be there + throw new \Exception('Encountered unexpected token'); + } + $pos--; + + return $this->skipLeftWhitespace($pos); + } + + public function skipRight(int $pos, $skipTokenType) { + $tokens = $this->tokens; + + $pos = $this->skipRightWhitespace($pos); + if ($skipTokenType === \T_WHITESPACE) { + return $pos; + } + + if ($tokens[$pos][0] !== $skipTokenType) { + // Shouldn't happen. The skip token MUST be there + throw new \Exception('Encountered unexpected token'); + } + $pos++; + + return $this->skipRightWhitespace($pos); + } + + /** + * Return first non-whitespace token position smaller or equal to passed position. + * + * @param int $pos Token position + * @return int Non-whitespace token position + */ + public function skipLeftWhitespace(int $pos) { + $tokens = $this->tokens; + for (; $pos >= 0; $pos--) { + $type = $tokens[$pos][0]; + if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) { + break; + } + } + return $pos; + } + + /** + * Return first non-whitespace position greater or equal to passed position. + * + * @param int $pos Token position + * @return int Non-whitespace token position + */ + public function skipRightWhitespace(int $pos) { + $tokens = $this->tokens; + for ($count = \count($tokens); $pos < $count; $pos++) { + $type = $tokens[$pos][0]; + if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) { + break; + } + } + return $pos; + } + + public function findRight(int $pos, $findTokenType) { + $tokens = $this->tokens; + for ($count = \count($tokens); $pos < $count; $pos++) { + $type = $tokens[$pos][0]; + if ($type === $findTokenType) { + return $pos; + } + } + return -1; + } + + /** + * Whether the given position range contains a certain token type. + * + * @param int $startPos Starting position (inclusive) + * @param int $endPos Ending position (exclusive) + * @param int|string $tokenType Token type to look for + * @return bool Whether the token occurs in the given range + */ + public function haveTokenInRange(int $startPos, int $endPos, $tokenType) { + $tokens = $this->tokens; + for ($pos = $startPos; $pos < $endPos; $pos++) { + if ($tokens[$pos][0] === $tokenType) { + return true; + } + } + return false; + } + + public function haveBracesInRange(int $startPos, int $endPos) { + return $this->haveTokenInRange($startPos, $endPos, '{') + || $this->haveTokenInRange($startPos, $endPos, T_CURLY_OPEN) + || $this->haveTokenInRange($startPos, $endPos, '}'); + } + + /** + * Get indentation before token position. + * + * @param int $pos Token position + * + * @return int Indentation depth (in spaces) + */ + public function getIndentationBefore(int $pos) : int { + return $this->indentMap[$pos]; + } + + /** + * Get the code corresponding to a token offset range, optionally adjusted for indentation. + * + * @param int $from Token start position (inclusive) + * @param int $to Token end position (exclusive) + * @param int $indent By how much the code should be indented (can be negative as well) + * + * @return string Code corresponding to token range, adjusted for indentation + */ + public function getTokenCode(int $from, int $to, int $indent) : string { + $tokens = $this->tokens; + $result = ''; + for ($pos = $from; $pos < $to; $pos++) { + $token = $tokens[$pos]; + if (\is_array($token)) { + $type = $token[0]; + $content = $token[1]; + if ($type === \T_CONSTANT_ENCAPSED_STRING || $type === \T_ENCAPSED_AND_WHITESPACE) { + $result .= $content; + } else { + // TODO Handle non-space indentation + if ($indent < 0) { + $result .= str_replace("\n" . str_repeat(" ", -$indent), "\n", $content); + } elseif ($indent > 0) { + $result .= str_replace("\n", "\n" . str_repeat(" ", $indent), $content); + } else { + $result .= $content; + } + } + } else { + $result .= $token; + } + } + return $result; + } + + /** + * Precalculate the indentation at every token position. + * + * @return int[] Token position to indentation map + */ + private function calcIndentMap() { + $indentMap = []; + $indent = 0; + foreach ($this->tokens as $token) { + $indentMap[] = $indent; + + if ($token[0] === \T_WHITESPACE) { + $content = $token[1]; + $newlinePos = \strrpos($content, "\n"); + if (false !== $newlinePos) { + $indent = \strlen($content) - $newlinePos - 1; + } + } + } + + // Add a sentinel for one past end of the file + $indentMap[] = $indent; + + return $indentMap; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/JsonDecoder.php b/lib/nikic/php-parser/lib/PhpParser/JsonDecoder.php new file mode 100644 index 000000000..47d2003d4 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/JsonDecoder.php @@ -0,0 +1,103 @@ +decodeRecursive($value); + } + + private function decodeRecursive($value) { + if (\is_array($value)) { + if (isset($value['nodeType'])) { + if ($value['nodeType'] === 'Comment' || $value['nodeType'] === 'Comment_Doc') { + return $this->decodeComment($value); + } + return $this->decodeNode($value); + } + return $this->decodeArray($value); + } + return $value; + } + + private function decodeArray(array $array) : array { + $decodedArray = []; + foreach ($array as $key => $value) { + $decodedArray[$key] = $this->decodeRecursive($value); + } + return $decodedArray; + } + + private function decodeNode(array $value) : Node { + $nodeType = $value['nodeType']; + if (!\is_string($nodeType)) { + throw new \RuntimeException('Node type must be a string'); + } + + $reflectionClass = $this->reflectionClassFromNodeType($nodeType); + /** @var Node $node */ + $node = $reflectionClass->newInstanceWithoutConstructor(); + + if (isset($value['attributes'])) { + if (!\is_array($value['attributes'])) { + throw new \RuntimeException('Attributes must be an array'); + } + + $node->setAttributes($this->decodeArray($value['attributes'])); + } + + foreach ($value as $name => $subNode) { + if ($name === 'nodeType' || $name === 'attributes') { + continue; + } + + $node->$name = $this->decodeRecursive($subNode); + } + + return $node; + } + + private function decodeComment(array $value) : Comment { + $className = $value['nodeType'] === 'Comment' ? Comment::class : Comment\Doc::class; + if (!isset($value['text'])) { + throw new \RuntimeException('Comment must have text'); + } + + return new $className( + $value['text'], + $value['line'] ?? -1, $value['filePos'] ?? -1, $value['tokenPos'] ?? -1, + $value['endLine'] ?? -1, $value['endFilePos'] ?? -1, $value['endTokenPos'] ?? -1 + ); + } + + private function reflectionClassFromNodeType(string $nodeType) : \ReflectionClass { + if (!isset($this->reflectionClassCache[$nodeType])) { + $className = $this->classNameFromNodeType($nodeType); + $this->reflectionClassCache[$nodeType] = new \ReflectionClass($className); + } + return $this->reflectionClassCache[$nodeType]; + } + + private function classNameFromNodeType(string $nodeType) : string { + $className = 'PhpParser\\Node\\' . strtr($nodeType, '_', '\\'); + if (class_exists($className)) { + return $className; + } + + $className .= '_'; + if (class_exists($className)) { + return $className; + } + + throw new \RuntimeException("Unknown node type \"$nodeType\""); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer.php b/lib/nikic/php-parser/lib/PhpParser/Lexer.php index 75d3f35a3..e15dd0a5d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Lexer.php +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer.php @@ -1,4 +1,4 @@ -defineCompatibilityTokens(); $this->tokenMap = $this->createTokenMap(); + $this->identifierTokens = $this->createIdentifierTokenMap(); // map of tokens to drop while lexing (the map is only used for isset lookup, // that's why the value is simply set to 1; the value is never actually used.) $this->dropTokens = array_fill_keys( - array(T_WHITESPACE, T_OPEN_TAG, T_COMMENT, T_DOC_COMMENT), 1 + [\T_WHITESPACE, \T_OPEN_TAG, \T_COMMENT, \T_DOC_COMMENT, \T_BAD_CHARACTER], 1 ); - // the usedAttributes member is a map of the used attribute names to a dummy - // value (here "true") - $options += array( - 'usedAttributes' => array('comments', 'startLine', 'endLine'), - ); - $this->usedAttributes = array_fill_keys($options['usedAttributes'], true); + $defaultAttributes = ['comments', 'startLine', 'endLine']; + $usedAttributes = array_fill_keys($options['usedAttributes'] ?? $defaultAttributes, true); + + // Create individual boolean properties to make these checks faster. + $this->attributeStartLineUsed = isset($usedAttributes['startLine']); + $this->attributeEndLineUsed = isset($usedAttributes['endLine']); + $this->attributeStartTokenPosUsed = isset($usedAttributes['startTokenPos']); + $this->attributeEndTokenPosUsed = isset($usedAttributes['endTokenPos']); + $this->attributeStartFilePosUsed = isset($usedAttributes['startFilePos']); + $this->attributeEndFilePosUsed = isset($usedAttributes['endFilePos']); + $this->attributeCommentsUsed = isset($usedAttributes['comments']); } /** @@ -55,7 +69,7 @@ class Lexer * @param ErrorHandler|null $errorHandler Error handler to use for lexing errors. Defaults to * ErrorHandler\Throwing */ - public function startLexing($code, ErrorHandler $errorHandler = null) { + public function startLexing(string $code, ErrorHandler $errorHandler = null) { if (null === $errorHandler) { $errorHandler = new ErrorHandler\Throwing(); } @@ -71,34 +85,18 @@ class Lexer $scream = ini_set('xdebug.scream', '0'); - $this->resetErrors(); $this->tokens = @token_get_all($code); - $this->handleErrors($errorHandler); + $this->postprocessTokens($errorHandler); if (false !== $scream) { ini_set('xdebug.scream', $scream); } } - protected function resetErrors() { - if (function_exists('error_clear_last')) { - error_clear_last(); - } else { - // set error_get_last() to defined state by forcing an undefined variable error - set_error_handler(function() { return false; }, 0); - @$undefinedVariable; - restore_error_handler(); - } - } - private function handleInvalidCharacterRange($start, $end, $line, ErrorHandler $errorHandler) { + $tokens = []; for ($i = $start; $i < $end; $i++) { $chr = $this->code[$i]; - if ($chr === 'b' || $chr === 'B') { - // HHVM does not treat b" tokens correctly, so ignore these - continue; - } - if ($chr === "\0") { // PHP cuts error message after null byte, so need special case $errorMsg = 'Unexpected null byte'; @@ -108,6 +106,7 @@ class Lexer ); } + $tokens[] = [\T_BAD_CHARACTER, $chr, $line]; $errorHandler->handleError(new Error($errorMsg, [ 'startLine' => $line, 'endLine' => $line, @@ -115,48 +114,130 @@ class Lexer 'endFilePos' => $i, ])); } + return $tokens; } - private function isUnterminatedComment($token) { - return ($token[0] === T_COMMENT || $token[0] === T_DOC_COMMENT) + /** + * Check whether comment token is unterminated. + * + * @return bool + */ + private function isUnterminatedComment($token) : bool { + return ($token[0] === \T_COMMENT || $token[0] === \T_DOC_COMMENT) && substr($token[1], 0, 2) === '/*' && substr($token[1], -2) !== '*/'; } - private function errorMayHaveOccurred() { - if (defined('HHVM_VERSION')) { - // In HHVM token_get_all() does not throw warnings, so we need to conservatively - // assume that an error occurred - return true; - } - - $error = error_get_last(); - return null !== $error - && false === strpos($error['message'], 'Undefined variable'); - } - - protected function handleErrors(ErrorHandler $errorHandler) { - if (!$this->errorMayHaveOccurred()) { - return; - } - + protected function postprocessTokens(ErrorHandler $errorHandler) { // PHP's error handling for token_get_all() is rather bad, so if we want detailed // error information we need to compute it ourselves. Invalid character errors are // detected by finding "gaps" in the token array. Unterminated comments are detected // by checking if a trailing comment has a "*/" at the end. + // + // Additionally, we perform a number of canonicalizations here: + // * Use the PHP 8.0 comment format, which does not include trailing whitespace anymore. + // * Use PHP 8.0 T_NAME_* tokens. + // * Use PHP 8.1 T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG and + // T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG tokens used to disambiguate intersection types. $filePos = 0; $line = 1; - foreach ($this->tokens as $i => $token) { + $numTokens = \count($this->tokens); + for ($i = 0; $i < $numTokens; $i++) { + $token = $this->tokens[$i]; + + // Since PHP 7.4 invalid characters are represented by a T_BAD_CHARACTER token. + // In this case we only need to emit an error. + if ($token[0] === \T_BAD_CHARACTER) { + $this->handleInvalidCharacterRange($filePos, $filePos + 1, $line, $errorHandler); + } + + if ($token[0] === \T_COMMENT && substr($token[1], 0, 2) !== '/*' + && preg_match('/(\r\n|\n|\r)$/D', $token[1], $matches)) { + $trailingNewline = $matches[0]; + $token[1] = substr($token[1], 0, -strlen($trailingNewline)); + $this->tokens[$i] = $token; + if (isset($this->tokens[$i + 1]) && $this->tokens[$i + 1][0] === \T_WHITESPACE) { + // Move trailing newline into following T_WHITESPACE token, if it already exists. + $this->tokens[$i + 1][1] = $trailingNewline . $this->tokens[$i + 1][1]; + $this->tokens[$i + 1][2]--; + } else { + // Otherwise, we need to create a new T_WHITESPACE token. + array_splice($this->tokens, $i + 1, 0, [ + [\T_WHITESPACE, $trailingNewline, $line], + ]); + $numTokens++; + } + } + + // Emulate PHP 8 T_NAME_* tokens, by combining sequences of T_NS_SEPARATOR and T_STRING + // into a single token. + if (\is_array($token) + && ($token[0] === \T_NS_SEPARATOR || isset($this->identifierTokens[$token[0]]))) { + $lastWasSeparator = $token[0] === \T_NS_SEPARATOR; + $text = $token[1]; + for ($j = $i + 1; isset($this->tokens[$j]); $j++) { + if ($lastWasSeparator) { + if (!isset($this->identifierTokens[$this->tokens[$j][0]])) { + break; + } + $lastWasSeparator = false; + } else { + if ($this->tokens[$j][0] !== \T_NS_SEPARATOR) { + break; + } + $lastWasSeparator = true; + } + $text .= $this->tokens[$j][1]; + } + if ($lastWasSeparator) { + // Trailing separator is not part of the name. + $j--; + $text = substr($text, 0, -1); + } + if ($j > $i + 1) { + if ($token[0] === \T_NS_SEPARATOR) { + $type = \T_NAME_FULLY_QUALIFIED; + } else if ($token[0] === \T_NAMESPACE) { + $type = \T_NAME_RELATIVE; + } else { + $type = \T_NAME_QUALIFIED; + } + $token = [$type, $text, $line]; + array_splice($this->tokens, $i, $j - $i, [$token]); + $numTokens -= $j - $i - 1; + } + } + + if ($token === '&') { + $next = $i + 1; + while (isset($this->tokens[$next]) && $this->tokens[$next][0] === \T_WHITESPACE) { + $next++; + } + $followedByVarOrVarArg = isset($this->tokens[$next]) && + ($this->tokens[$next][0] === \T_VARIABLE || $this->tokens[$next][0] === \T_ELLIPSIS); + $this->tokens[$i] = $token = [ + $followedByVarOrVarArg + ? \T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG + : \T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG, + '&', + $line, + ]; + } + $tokenValue = \is_string($token) ? $token : $token[1]; $tokenLen = \strlen($tokenValue); if (substr($this->code, $filePos, $tokenLen) !== $tokenValue) { // Something is missing, must be an invalid character $nextFilePos = strpos($this->code, $tokenValue, $filePos); - $this->handleInvalidCharacterRange( + $badCharTokens = $this->handleInvalidCharacterRange( $filePos, $nextFilePos, $line, $errorHandler); - $filePos = $nextFilePos; + $filePos = (int) $nextFilePos; + + array_splice($this->tokens, $i, 0, $badCharTokens); + $numTokens += \count($badCharTokens); + $i += \count($badCharTokens); } $filePos += $tokenLen; @@ -176,11 +257,12 @@ class Lexer // Emulate the PHP behavior $isDocComment = isset($comment[3]) && $comment[3] === '*'; - $this->tokens[] = [$isDocComment ? T_DOC_COMMENT : T_COMMENT, $comment, $line]; + $this->tokens[] = [$isDocComment ? \T_DOC_COMMENT : \T_COMMENT, $comment, $line]; } else { // Invalid characters at the end of the input - $this->handleInvalidCharacterRange( + $badCharTokens = $this->handleInvalidCharacterRange( $filePos, \strlen($this->code), $line, $errorHandler); + $this->tokens = array_merge($this->tokens, $badCharTokens); } return; } @@ -221,9 +303,9 @@ class Lexer * * @return int Token id */ - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) { - $startAttributes = array(); - $endAttributes = array(); + public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) : int { + $startAttributes = []; + $endAttributes = []; while (1) { if (isset($this->tokens[++$this->pos])) { @@ -233,13 +315,13 @@ class Lexer $token = "\0"; } - if (isset($this->usedAttributes['startLine'])) { + if ($this->attributeStartLineUsed) { $startAttributes['startLine'] = $this->line; } - if (isset($this->usedAttributes['startTokenPos'])) { + if ($this->attributeStartTokenPosUsed) { $startAttributes['startTokenPos'] = $this->pos; } - if (isset($this->usedAttributes['startFilePos'])) { + if ($this->attributeStartFilePosUsed) { $startAttributes['startFilePos'] = $this->filePos; } @@ -256,36 +338,43 @@ class Lexer } elseif (!isset($this->dropTokens[$token[0]])) { $value = $token[1]; $id = $this->tokenMap[$token[0]]; - if (T_CLOSE_TAG === $token[0]) { - $this->prevCloseTagHasNewline = false !== strpos($token[1], "\n"); - } else if (T_INLINE_HTML === $token[0]) { + if (\T_CLOSE_TAG === $token[0]) { + $this->prevCloseTagHasNewline = false !== strpos($token[1], "\n") + || false !== strpos($token[1], "\r"); + } elseif (\T_INLINE_HTML === $token[0]) { $startAttributes['hasLeadingNewline'] = $this->prevCloseTagHasNewline; } $this->line += substr_count($value, "\n"); $this->filePos += \strlen($value); } else { - if (T_COMMENT === $token[0] || T_DOC_COMMENT === $token[0]) { - if (isset($this->usedAttributes['comments'])) { - $comment = T_DOC_COMMENT === $token[0] - ? new Comment\Doc($token[1], $this->line, $this->filePos) - : new Comment($token[1], $this->line, $this->filePos); + $origLine = $this->line; + $origFilePos = $this->filePos; + $this->line += substr_count($token[1], "\n"); + $this->filePos += \strlen($token[1]); + + if (\T_COMMENT === $token[0] || \T_DOC_COMMENT === $token[0]) { + if ($this->attributeCommentsUsed) { + $comment = \T_DOC_COMMENT === $token[0] + ? new Comment\Doc($token[1], + $origLine, $origFilePos, $this->pos, + $this->line, $this->filePos - 1, $this->pos) + : new Comment($token[1], + $origLine, $origFilePos, $this->pos, + $this->line, $this->filePos - 1, $this->pos); $startAttributes['comments'][] = $comment; } } - - $this->line += substr_count($token[1], "\n"); - $this->filePos += \strlen($token[1]); continue; } - if (isset($this->usedAttributes['endLine'])) { + if ($this->attributeEndLineUsed) { $endAttributes['endLine'] = $this->line; } - if (isset($this->usedAttributes['endTokenPos'])) { + if ($this->attributeEndTokenPosUsed) { $endAttributes['endTokenPos'] = $this->pos; } - if (isset($this->usedAttributes['endFilePos'])) { + if ($this->attributeEndFilePosUsed) { $endAttributes['endFilePos'] = $this->filePos - 1; } @@ -305,7 +394,7 @@ class Lexer * * @return array Array of tokens in token_get_all() format */ - public function getTokens() { + public function getTokens() : array { return $this->tokens; } @@ -314,7 +403,7 @@ class Lexer * * @return string Remaining text */ - public function handleHaltCompiler() { + public function handleHaltCompiler() : string { // text after T_HALT_COMPILER, still including (); $textAfter = substr($this->code, $this->filePos); @@ -329,7 +418,67 @@ class Lexer $this->pos = count($this->tokens); // return with (); removed - return (string) substr($textAfter, strlen($matches[0])); // (string) converts false to '' + return substr($textAfter, strlen($matches[0])); + } + + private function defineCompatibilityTokens() { + static $compatTokensDefined = false; + if ($compatTokensDefined) { + return; + } + + $compatTokens = [ + // PHP 7.4 + 'T_BAD_CHARACTER', + 'T_FN', + 'T_COALESCE_EQUAL', + // PHP 8.0 + 'T_NAME_QUALIFIED', + 'T_NAME_FULLY_QUALIFIED', + 'T_NAME_RELATIVE', + 'T_MATCH', + 'T_NULLSAFE_OBJECT_OPERATOR', + 'T_ATTRIBUTE', + // PHP 8.1 + 'T_ENUM', + 'T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG', + 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG', + 'T_READONLY', + ]; + + // PHP-Parser might be used together with another library that also emulates some or all + // of these tokens. Perform a sanity-check that all already defined tokens have been + // assigned a unique ID. + $usedTokenIds = []; + foreach ($compatTokens as $token) { + if (\defined($token)) { + $tokenId = \constant($token); + $clashingToken = $usedTokenIds[$tokenId] ?? null; + if ($clashingToken !== null) { + throw new \Error(sprintf( + 'Token %s has same ID as token %s, ' . + 'you may be using a library with broken token emulation', + $token, $clashingToken + )); + } + $usedTokenIds[$tokenId] = $token; + } + } + + // Now define any tokens that have not yet been emulated. Try to assign IDs from -1 + // downwards, but skip any IDs that may already be in use. + $newTokenId = -1; + foreach ($compatTokens as $token) { + if (!\defined($token)) { + while (isset($usedTokenIds[$newTokenId])) { + $newTokenId--; + } + \define($token, $newTokenId); + $newTokenId--; + } + } + + $compatTokensDefined = true; } /** @@ -341,26 +490,26 @@ class Lexer * * @return array The token map */ - protected function createTokenMap() { - $tokenMap = array(); + protected function createTokenMap() : array { + $tokenMap = []; // 256 is the minimum possible token number, as everything below // it is an ASCII value for ($i = 256; $i < 1000; ++$i) { - if (T_DOUBLE_COLON === $i) { + if (\T_DOUBLE_COLON === $i) { // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM $tokenMap[$i] = Tokens::T_PAAMAYIM_NEKUDOTAYIM; - } elseif(T_OPEN_TAG_WITH_ECHO === $i) { + } elseif(\T_OPEN_TAG_WITH_ECHO === $i) { // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO $tokenMap[$i] = Tokens::T_ECHO; - } elseif(T_CLOSE_TAG === $i) { + } elseif(\T_CLOSE_TAG === $i) { // T_CLOSE_TAG is equivalent to ';' $tokenMap[$i] = ord(';'); } elseif ('UNKNOWN' !== $name = token_name($i)) { if ('T_HASHBANG' === $name) { // HHVM uses a special token for #! hashbang lines $tokenMap[$i] = Tokens::T_INLINE_HTML; - } else if (defined($name = Tokens::class . '::' . $name)) { + } elseif (defined($name = Tokens::class . '::' . $name)) { // Other tokens can be mapped directly $tokenMap[$i] = constant($name); } @@ -369,13 +518,43 @@ class Lexer // HHVM uses a special token for numbers that overflow to double if (defined('T_ONUMBER')) { - $tokenMap[T_ONUMBER] = Tokens::T_DNUMBER; + $tokenMap[\T_ONUMBER] = Tokens::T_DNUMBER; } // HHVM also has a separate token for the __COMPILER_HALT_OFFSET__ constant if (defined('T_COMPILER_HALT_OFFSET')) { - $tokenMap[T_COMPILER_HALT_OFFSET] = Tokens::T_STRING; + $tokenMap[\T_COMPILER_HALT_OFFSET] = Tokens::T_STRING; } + // Assign tokens for which we define compatibility constants, as token_name() does not know them. + $tokenMap[\T_FN] = Tokens::T_FN; + $tokenMap[\T_COALESCE_EQUAL] = Tokens::T_COALESCE_EQUAL; + $tokenMap[\T_NAME_QUALIFIED] = Tokens::T_NAME_QUALIFIED; + $tokenMap[\T_NAME_FULLY_QUALIFIED] = Tokens::T_NAME_FULLY_QUALIFIED; + $tokenMap[\T_NAME_RELATIVE] = Tokens::T_NAME_RELATIVE; + $tokenMap[\T_MATCH] = Tokens::T_MATCH; + $tokenMap[\T_NULLSAFE_OBJECT_OPERATOR] = Tokens::T_NULLSAFE_OBJECT_OPERATOR; + $tokenMap[\T_ATTRIBUTE] = Tokens::T_ATTRIBUTE; + $tokenMap[\T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG] = Tokens::T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG; + $tokenMap[\T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG] = Tokens::T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG; + $tokenMap[\T_ENUM] = Tokens::T_ENUM; + $tokenMap[\T_READONLY] = Tokens::T_READONLY; + return $tokenMap; } + + private function createIdentifierTokenMap(): array { + // Based on semi_reserved production. + return array_fill_keys([ + \T_STRING, + \T_STATIC, \T_ABSTRACT, \T_FINAL, \T_PRIVATE, \T_PROTECTED, \T_PUBLIC, \T_READONLY, + \T_INCLUDE, \T_INCLUDE_ONCE, \T_EVAL, \T_REQUIRE, \T_REQUIRE_ONCE, \T_LOGICAL_OR, \T_LOGICAL_XOR, \T_LOGICAL_AND, + \T_INSTANCEOF, \T_NEW, \T_CLONE, \T_EXIT, \T_IF, \T_ELSEIF, \T_ELSE, \T_ENDIF, \T_ECHO, \T_DO, \T_WHILE, + \T_ENDWHILE, \T_FOR, \T_ENDFOR, \T_FOREACH, \T_ENDFOREACH, \T_DECLARE, \T_ENDDECLARE, \T_AS, \T_TRY, \T_CATCH, + \T_FINALLY, \T_THROW, \T_USE, \T_INSTEADOF, \T_GLOBAL, \T_VAR, \T_UNSET, \T_ISSET, \T_EMPTY, \T_CONTINUE, \T_GOTO, + \T_FUNCTION, \T_CONST, \T_RETURN, \T_PRINT, \T_YIELD, \T_LIST, \T_SWITCH, \T_ENDSWITCH, \T_CASE, \T_DEFAULT, + \T_BREAK, \T_ARRAY, \T_CALLABLE, \T_EXTENDS, \T_IMPLEMENTS, \T_NAMESPACE, \T_TRAIT, \T_INTERFACE, \T_CLASS, + \T_CLASS_C, \T_TRAIT_C, \T_FUNC_C, \T_METHOD_C, \T_LINE, \T_FILE, \T_DIR, \T_NS_C, \T_HALT_COMPILER, \T_FN, + \T_MATCH, + ], true); + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php index 739a328ab..5c56e026b 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php @@ -1,174 +1,248 @@ -targetPhpVersion = $options['phpVersion'] ?? Emulative::PHP_8_1; + unset($options['phpVersion']); - public function __construct(array $options = array()) { parent::__construct($options); - $newKeywordsPerVersion = array( - // No new keywords since PHP 5.5 - ); + $emulators = [ + new FlexibleDocStringEmulator(), + new FnTokenEmulator(), + new MatchTokenEmulator(), + new CoaleseEqualTokenEmulator(), + new NumericLiteralSeparatorEmulator(), + new NullsafeTokenEmulator(), + new AttributeEmulator(), + new EnumTokenEmulator(), + new ReadonlyTokenEmulator(), + new ExplicitOctalEmulator(), + ]; - $this->newKeywords = array(); - foreach ($newKeywordsPerVersion as $version => $newKeywords) { - if (version_compare(PHP_VERSION, $version, '>=')) { - break; + // Collect emulators that are relevant for the PHP version we're running + // and the PHP version we're targeting for emulation. + foreach ($emulators as $emulator) { + $emulatorPhpVersion = $emulator->getPhpVersion(); + if ($this->isForwardEmulationNeeded($emulatorPhpVersion)) { + $this->emulators[] = $emulator; + } else if ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { + $this->emulators[] = new ReverseEmulator($emulator); } - - $this->newKeywords += $newKeywords; } + } - if (version_compare(PHP_VERSION, self::PHP_7_0, '>=')) { + public function startLexing(string $code, ErrorHandler $errorHandler = null) { + $emulators = array_filter($this->emulators, function($emulator) use($code) { + return $emulator->isEmulationNeeded($code); + }); + + if (empty($emulators)) { + // Nothing to emulate, yay + parent::startLexing($code, $errorHandler); return; } - $this->tokenMap[self::T_COALESCE] = Tokens::T_COALESCE; - $this->tokenMap[self::T_SPACESHIP] = Tokens::T_SPACESHIP; - $this->tokenMap[self::T_YIELD_FROM] = Tokens::T_YIELD_FROM; - if (version_compare(PHP_VERSION, self::PHP_5_6, '>=')) { + $this->patches = []; + foreach ($emulators as $emulator) { + $code = $emulator->preprocessCode($code, $this->patches); + } + + $collector = new ErrorHandler\Collecting(); + parent::startLexing($code, $collector); + $this->sortPatches(); + $this->fixupTokens(); + + $errors = $collector->getErrors(); + if (!empty($errors)) { + $this->fixupErrors($errors); + foreach ($errors as $error) { + $errorHandler->handleError($error); + } + } + + foreach ($emulators as $emulator) { + $this->tokens = $emulator->emulate($code, $this->tokens); + } + } + + private function isForwardEmulationNeeded(string $emulatorPhpVersion): bool { + return version_compare(\PHP_VERSION, $emulatorPhpVersion, '<') + && version_compare($this->targetPhpVersion, $emulatorPhpVersion, '>='); + } + + private function isReverseEmulationNeeded(string $emulatorPhpVersion): bool { + return version_compare(\PHP_VERSION, $emulatorPhpVersion, '>=') + && version_compare($this->targetPhpVersion, $emulatorPhpVersion, '<'); + } + + private function sortPatches() + { + // Patches may be contributed by different emulators. + // Make sure they are sorted by increasing patch position. + usort($this->patches, function($p1, $p2) { + return $p1[0] <=> $p2[0]; + }); + } + + private function fixupTokens() + { + if (\count($this->patches) === 0) { return; } - $this->tokenMap[self::T_ELLIPSIS] = Tokens::T_ELLIPSIS; - $this->tokenMap[self::T_POW] = Tokens::T_POW; - $this->tokenMap[self::T_POW_EQUAL] = Tokens::T_POW_EQUAL; - } - public function startLexing($code, ErrorHandler $errorHandler = null) { - $this->inObjectAccess = false; + // Load first patch + $patchIdx = 0; - parent::startLexing($code, $errorHandler); - if ($this->requiresEmulation($code)) { - $this->emulateTokens(); + list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; + + // We use a manual loop over the tokens, because we modify the array on the fly + $pos = 0; + for ($i = 0, $c = \count($this->tokens); $i < $c; $i++) { + $token = $this->tokens[$i]; + if (\is_string($token)) { + if ($patchPos === $pos) { + // Only support replacement for string tokens. + assert($patchType === 'replace'); + $this->tokens[$i] = $patchText; + + // Fetch the next patch + $patchIdx++; + if ($patchIdx >= \count($this->patches)) { + // No more patches, we're done + return; + } + list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; + } + + $pos += \strlen($token); + continue; + } + + $len = \strlen($token[1]); + $posDelta = 0; + while ($patchPos >= $pos && $patchPos < $pos + $len) { + $patchTextLen = \strlen($patchText); + if ($patchType === 'remove') { + if ($patchPos === $pos && $patchTextLen === $len) { + // Remove token entirely + array_splice($this->tokens, $i, 1, []); + $i--; + $c--; + } else { + // Remove from token string + $this->tokens[$i][1] = substr_replace( + $token[1], '', $patchPos - $pos + $posDelta, $patchTextLen + ); + $posDelta -= $patchTextLen; + } + } elseif ($patchType === 'add') { + // Insert into the token string + $this->tokens[$i][1] = substr_replace( + $token[1], $patchText, $patchPos - $pos + $posDelta, 0 + ); + $posDelta += $patchTextLen; + } else if ($patchType === 'replace') { + // Replace inside the token string + $this->tokens[$i][1] = substr_replace( + $token[1], $patchText, $patchPos - $pos + $posDelta, $patchTextLen + ); + } else { + assert(false); + } + + // Fetch the next patch + $patchIdx++; + if ($patchIdx >= \count($this->patches)) { + // No more patches, we're done + return; + } + + list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; + + // Multiple patches may apply to the same token. Reload the current one to check + // If the new patch applies + $token = $this->tokens[$i]; + } + + $pos += $len; } + + // A patch did not apply + assert(false); } - /* - * Checks if the code is potentially using features that require emulation. + /** + * Fixup line and position information in errors. + * + * @param Error[] $errors */ - protected function requiresEmulation($code) { - if (version_compare(PHP_VERSION, self::PHP_7_0, '>=')) { - return false; - } + private function fixupErrors(array $errors) { + foreach ($errors as $error) { + $attrs = $error->getAttributes(); - if (preg_match('(\?\?|<=>|yield[ \n\r\t]+from)', $code)) { - return true; - } - - if (version_compare(PHP_VERSION, self::PHP_5_6, '>=')) { - return false; - } - - return preg_match('(\.\.\.|(?tokens); $i < $c; ++$i) { - $replace = null; - if (isset($this->tokens[$i + 1])) { - if ($this->tokens[$i] === '?' && $this->tokens[$i + 1] === '?') { - array_splice($this->tokens, $i, 2, array( - array(self::T_COALESCE, '??', $line) - )); - $c--; - continue; + $posDelta = 0; + $lineDelta = 0; + foreach ($this->patches as $patch) { + list($patchPos, $patchType, $patchText) = $patch; + if ($patchPos >= $attrs['startFilePos']) { + // No longer relevant + break; } - if ($this->tokens[$i][0] === T_IS_SMALLER_OR_EQUAL - && $this->tokens[$i + 1] === '>' - ) { - array_splice($this->tokens, $i, 2, array( - array(self::T_SPACESHIP, '<=>', $line) - )); - $c--; - continue; - } - if ($this->tokens[$i] === '*' && $this->tokens[$i + 1] === '*') { - array_splice($this->tokens, $i, 2, array( - array(self::T_POW, '**', $line) - )); - $c--; - continue; - } - if ($this->tokens[$i] === '*' && $this->tokens[$i + 1][0] === T_MUL_EQUAL) { - array_splice($this->tokens, $i, 2, array( - array(self::T_POW_EQUAL, '**=', $line) - )); - $c--; - continue; + + if ($patchType === 'add') { + $posDelta += strlen($patchText); + $lineDelta += substr_count($patchText, "\n"); + } else if ($patchType === 'remove') { + $posDelta -= strlen($patchText); + $lineDelta -= substr_count($patchText, "\n"); } } - if (isset($this->tokens[$i + 2])) { - if ($this->tokens[$i][0] === T_YIELD && $this->tokens[$i + 1][0] === T_WHITESPACE - && $this->tokens[$i + 2][0] === T_STRING - && !strcasecmp($this->tokens[$i + 2][1], 'from') - ) { - array_splice($this->tokens, $i, 3, array( - array( - self::T_YIELD_FROM, - $this->tokens[$i][1] . $this->tokens[$i + 1][1] . $this->tokens[$i + 2][1], - $line - ) - )); - $c -= 2; - $line += substr_count($this->tokens[$i][1], "\n"); - continue; - } - if ($this->tokens[$i] === '.' && $this->tokens[$i + 1] === '.' - && $this->tokens[$i + 2] === '.' - ) { - array_splice($this->tokens, $i, 3, array( - array(self::T_ELLIPSIS, '...', $line) - )); - $c -= 2; - continue; - } - } - - if (\is_array($this->tokens[$i])) { - $line += substr_count($this->tokens[$i][1], "\n"); - } + $attrs['startFilePos'] += $posDelta; + $attrs['endFilePos'] += $posDelta; + $attrs['startLine'] += $lineDelta; + $attrs['endLine'] += $lineDelta; + $error->setAttributes($attrs); } } - - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) { - $token = parent::getNextToken($value, $startAttributes, $endAttributes); - - // replace new keywords by their respective tokens. This is not done - // if we currently are in an object access (e.g. in $obj->namespace - // "namespace" stays a T_STRING tokens and isn't converted to T_NAMESPACE) - if (Tokens::T_STRING === $token && !$this->inObjectAccess) { - if (isset($this->newKeywords[strtolower($value)])) { - return $this->newKeywords[strtolower($value)]; - } - } else { - // keep track of whether we currently are in an object access (after ->) - $this->inObjectAccess = Tokens::T_OBJECT_OPERATOR === $token; - } - - return $token; - } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php new file mode 100644 index 000000000..6776a5197 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php @@ -0,0 +1,56 @@ +resolveIntegerOrFloatToken($tokens[$i + 1][1]); + array_splice($tokens, $i, 2, [ + [$tokenKind, '0' . $tokens[$i + 1][1], $tokens[$i][2]], + ]); + $c--; + } + } + return $tokens; + } + + private function resolveIntegerOrFloatToken(string $str): int + { + $str = substr($str, 1); + $str = str_replace('_', '', $str); + $num = octdec($str); + return is_float($num) ? \T_DNUMBER : \T_LNUMBER; + } + + public function reverseEmulate(string $code, array $tokens): array { + // Explicit octals were not legal code previously, don't bother. + return $tokens; + } +} \ No newline at end of file diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php new file mode 100644 index 000000000..c15d6271f --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php @@ -0,0 +1,76 @@ +\h*)\2(?![a-zA-Z0-9_\x80-\xff])(?(?:;?[\r\n])?)/x +REGEX; + + public function getPhpVersion(): string + { + return Emulative::PHP_7_3; + } + + public function isEmulationNeeded(string $code) : bool + { + return strpos($code, '<<<') !== false; + } + + public function emulate(string $code, array $tokens): array + { + // Handled by preprocessing + fixup. + return $tokens; + } + + public function reverseEmulate(string $code, array $tokens): array + { + // Not supported. + return $tokens; + } + + public function preprocessCode(string $code, array &$patches): string { + if (!preg_match_all(self::FLEXIBLE_DOC_STRING_REGEX, $code, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE)) { + // No heredoc/nowdoc found + return $code; + } + + // Keep track of how much we need to adjust string offsets due to the modifications we + // already made + $posDelta = 0; + foreach ($matches as $match) { + $indentation = $match['indentation'][0]; + $indentationStart = $match['indentation'][1]; + + $separator = $match['separator'][0]; + $separatorStart = $match['separator'][1]; + + if ($indentation === '' && $separator !== '') { + // Ordinary heredoc/nowdoc + continue; + } + + if ($indentation !== '') { + // Remove indentation + $indentationLen = strlen($indentation); + $code = substr_replace($code, '', $indentationStart + $posDelta, $indentationLen); + $patches[] = [$indentationStart + $posDelta, 'add', $indentation]; + $posDelta -= $indentationLen; + } + + if ($separator === '') { + // Insert newline as separator + $code = substr_replace($code, "\n", $separatorStart + $posDelta, 0); + $patches[] = [$separatorStart + $posDelta, 'remove', "\n"]; + $posDelta += 1; + } + } + + return $code; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php new file mode 100644 index 000000000..eb7e49634 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php @@ -0,0 +1,23 @@ +getKeywordString()) !== false; + } + + protected function isKeywordContext(array $tokens, int $pos): bool + { + $previousNonSpaceToken = $this->getPreviousNonSpaceToken($tokens, $pos); + return $previousNonSpaceToken === null || $previousNonSpaceToken[0] !== \T_OBJECT_OPERATOR; + } + + public function emulate(string $code, array $tokens): array + { + $keywordString = $this->getKeywordString(); + foreach ($tokens as $i => $token) { + if ($token[0] === T_STRING && strtolower($token[1]) === $keywordString + && $this->isKeywordContext($tokens, $i)) { + $tokens[$i][0] = $this->getKeywordToken(); + } + } + + return $tokens; + } + + /** + * @param mixed[] $tokens + * @return mixed[]|null + */ + private function getPreviousNonSpaceToken(array $tokens, int $start) + { + for ($i = $start - 1; $i >= 0; --$i) { + if ($tokens[$i][0] === T_WHITESPACE) { + continue; + } + + return $tokens[$i]; + } + + return null; + } + + public function reverseEmulate(string $code, array $tokens): array + { + $keywordToken = $this->getKeywordToken(); + foreach ($tokens as $i => $token) { + if ($token[0] === $keywordToken) { + $tokens[$i][0] = \T_STRING; + } + } + + return $tokens; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php new file mode 100644 index 000000000..902a46dfc --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php @@ -0,0 +1,23 @@ +') !== false; + } + + public function emulate(string $code, array $tokens): array + { + // We need to manually iterate and manage a count because we'll change + // the tokens array on the way + $line = 1; + for ($i = 0, $c = count($tokens); $i < $c; ++$i) { + if ($tokens[$i] === '?' && isset($tokens[$i + 1]) && $tokens[$i + 1][0] === \T_OBJECT_OPERATOR) { + array_splice($tokens, $i, 2, [ + [\T_NULLSAFE_OBJECT_OPERATOR, '?->', $line] + ]); + $c--; + continue; + } + + // Handle ?-> inside encapsed string. + if ($tokens[$i][0] === \T_ENCAPSED_AND_WHITESPACE && isset($tokens[$i - 1]) + && $tokens[$i - 1][0] === \T_VARIABLE + && preg_match('/^\?->([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/', $tokens[$i][1], $matches) + ) { + $replacement = [ + [\T_NULLSAFE_OBJECT_OPERATOR, '?->', $line], + [\T_STRING, $matches[1], $line], + ]; + if (\strlen($matches[0]) !== \strlen($tokens[$i][1])) { + $replacement[] = [ + \T_ENCAPSED_AND_WHITESPACE, + \substr($tokens[$i][1], \strlen($matches[0])), + $line + ]; + } + array_splice($tokens, $i, 1, $replacement); + $c += \count($replacement) - 1; + continue; + } + + if (\is_array($tokens[$i])) { + $line += substr_count($tokens[$i][1], "\n"); + } + } + + return $tokens; + } + + public function reverseEmulate(string $code, array $tokens): array + { + // ?-> was not valid code previously, don't bother. + return $tokens; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php new file mode 100644 index 000000000..cdf793e46 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php @@ -0,0 +1,105 @@ +resolveIntegerOrFloatToken($match); + $newTokens = [[$tokenKind, $match, $token[2]]]; + + $numTokens = 1; + $len = $tokenLen; + while ($matchLen > $len) { + $nextToken = $tokens[$i + $numTokens]; + $nextTokenText = \is_array($nextToken) ? $nextToken[1] : $nextToken; + $nextTokenLen = \strlen($nextTokenText); + + $numTokens++; + if ($matchLen < $len + $nextTokenLen) { + // Split trailing characters into a partial token. + assert(is_array($nextToken), "Partial token should be an array token"); + $partialText = substr($nextTokenText, $matchLen - $len); + $newTokens[] = [$nextToken[0], $partialText, $nextToken[2]]; + break; + } + + $len += $nextTokenLen; + } + + array_splice($tokens, $i, $numTokens, $newTokens); + $c -= $numTokens - \count($newTokens); + $codeOffset += $matchLen; + } + + return $tokens; + } + + private function resolveIntegerOrFloatToken(string $str): int + { + $str = str_replace('_', '', $str); + + if (stripos($str, '0b') === 0) { + $num = bindec($str); + } elseif (stripos($str, '0x') === 0) { + $num = hexdec($str); + } elseif (stripos($str, '0') === 0 && ctype_digit($str)) { + $num = octdec($str); + } else { + $num = +$str; + } + + return is_float($num) ? T_DNUMBER : T_LNUMBER; + } + + public function reverseEmulate(string $code, array $tokens): array + { + // Numeric separators were not legal code previously, don't bother. + return $tokens; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php new file mode 100644 index 000000000..b97f8d112 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php @@ -0,0 +1,23 @@ +emulator = $emulator; + } + + public function getPhpVersion(): string { + return $this->emulator->getPhpVersion(); + } + + public function isEmulationNeeded(string $code): bool { + return $this->emulator->isEmulationNeeded($code); + } + + public function emulate(string $code, array $tokens): array { + return $this->emulator->reverseEmulate($code, $tokens); + } + + public function reverseEmulate(string $code, array $tokens): array { + return $this->emulator->emulate($code, $tokens); + } + + public function preprocessCode(string $code, array &$patches): string { + return $code; + } +} \ No newline at end of file diff --git a/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php new file mode 100644 index 000000000..a020bc0ff --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php @@ -0,0 +1,25 @@ + [aliasName => originalName]] */ + protected $aliases = []; + + /** @var Name[][] Same as $aliases but preserving original case */ + protected $origAliases = []; + + /** @var ErrorHandler Error handler */ + protected $errorHandler; + + /** + * Create a name context. + * + * @param ErrorHandler $errorHandler Error handling used to report errors + */ + public function __construct(ErrorHandler $errorHandler) { + $this->errorHandler = $errorHandler; + } + + /** + * Start a new namespace. + * + * This also resets the alias table. + * + * @param Name|null $namespace Null is the global namespace + */ + public function startNamespace(Name $namespace = null) { + $this->namespace = $namespace; + $this->origAliases = $this->aliases = [ + Stmt\Use_::TYPE_NORMAL => [], + Stmt\Use_::TYPE_FUNCTION => [], + Stmt\Use_::TYPE_CONSTANT => [], + ]; + } + + /** + * Add an alias / import. + * + * @param Name $name Original name + * @param string $aliasName Aliased name + * @param int $type One of Stmt\Use_::TYPE_* + * @param array $errorAttrs Attributes to use to report an error + */ + public function addAlias(Name $name, string $aliasName, int $type, array $errorAttrs = []) { + // Constant names are case sensitive, everything else case insensitive + if ($type === Stmt\Use_::TYPE_CONSTANT) { + $aliasLookupName = $aliasName; + } else { + $aliasLookupName = strtolower($aliasName); + } + + if (isset($this->aliases[$type][$aliasLookupName])) { + $typeStringMap = [ + Stmt\Use_::TYPE_NORMAL => '', + Stmt\Use_::TYPE_FUNCTION => 'function ', + Stmt\Use_::TYPE_CONSTANT => 'const ', + ]; + + $this->errorHandler->handleError(new Error( + sprintf( + 'Cannot use %s%s as %s because the name is already in use', + $typeStringMap[$type], $name, $aliasName + ), + $errorAttrs + )); + return; + } + + $this->aliases[$type][$aliasLookupName] = $name; + $this->origAliases[$type][$aliasName] = $name; + } + + /** + * Get current namespace. + * + * @return null|Name Namespace (or null if global namespace) + */ + public function getNamespace() { + return $this->namespace; + } + + /** + * Get resolved name. + * + * @param Name $name Name to resolve + * @param int $type One of Stmt\Use_::TYPE_{FUNCTION|CONSTANT} + * + * @return null|Name Resolved name, or null if static resolution is not possible + */ + public function getResolvedName(Name $name, int $type) { + // don't resolve special class names + if ($type === Stmt\Use_::TYPE_NORMAL && $name->isSpecialClassName()) { + if (!$name->isUnqualified()) { + $this->errorHandler->handleError(new Error( + sprintf("'\\%s' is an invalid class name", $name->toString()), + $name->getAttributes() + )); + } + return $name; + } + + // fully qualified names are already resolved + if ($name->isFullyQualified()) { + return $name; + } + + // Try to resolve aliases + if (null !== $resolvedName = $this->resolveAlias($name, $type)) { + return $resolvedName; + } + + if ($type !== Stmt\Use_::TYPE_NORMAL && $name->isUnqualified()) { + if (null === $this->namespace) { + // outside of a namespace unaliased unqualified is same as fully qualified + return new FullyQualified($name, $name->getAttributes()); + } + + // Cannot resolve statically + return null; + } + + // if no alias exists prepend current namespace + return FullyQualified::concat($this->namespace, $name, $name->getAttributes()); + } + + /** + * Get resolved class name. + * + * @param Name $name Class ame to resolve + * + * @return Name Resolved name + */ + public function getResolvedClassName(Name $name) : Name { + return $this->getResolvedName($name, Stmt\Use_::TYPE_NORMAL); + } + + /** + * Get possible ways of writing a fully qualified name (e.g., by making use of aliases). + * + * @param string $name Fully-qualified name (without leading namespace separator) + * @param int $type One of Stmt\Use_::TYPE_* + * + * @return Name[] Possible representations of the name + */ + public function getPossibleNames(string $name, int $type) : array { + $lcName = strtolower($name); + + if ($type === Stmt\Use_::TYPE_NORMAL) { + // self, parent and static must always be unqualified + if ($lcName === "self" || $lcName === "parent" || $lcName === "static") { + return [new Name($name)]; + } + } + + // Collect possible ways to write this name, starting with the fully-qualified name + $possibleNames = [new FullyQualified($name)]; + + if (null !== $nsRelativeName = $this->getNamespaceRelativeName($name, $lcName, $type)) { + // Make sure there is no alias that makes the normally namespace-relative name + // into something else + if (null === $this->resolveAlias($nsRelativeName, $type)) { + $possibleNames[] = $nsRelativeName; + } + } + + // Check for relevant namespace use statements + foreach ($this->origAliases[Stmt\Use_::TYPE_NORMAL] as $alias => $orig) { + $lcOrig = $orig->toLowerString(); + if (0 === strpos($lcName, $lcOrig . '\\')) { + $possibleNames[] = new Name($alias . substr($name, strlen($lcOrig))); + } + } + + // Check for relevant type-specific use statements + foreach ($this->origAliases[$type] as $alias => $orig) { + if ($type === Stmt\Use_::TYPE_CONSTANT) { + // Constants are are complicated-sensitive + $normalizedOrig = $this->normalizeConstName($orig->toString()); + if ($normalizedOrig === $this->normalizeConstName($name)) { + $possibleNames[] = new Name($alias); + } + } else { + // Everything else is case-insensitive + if ($orig->toLowerString() === $lcName) { + $possibleNames[] = new Name($alias); + } + } + } + + return $possibleNames; + } + + /** + * Get shortest representation of this fully-qualified name. + * + * @param string $name Fully-qualified name (without leading namespace separator) + * @param int $type One of Stmt\Use_::TYPE_* + * + * @return Name Shortest representation + */ + public function getShortName(string $name, int $type) : Name { + $possibleNames = $this->getPossibleNames($name, $type); + + // Find shortest name + $shortestName = null; + $shortestLength = \INF; + foreach ($possibleNames as $possibleName) { + $length = strlen($possibleName->toCodeString()); + if ($length < $shortestLength) { + $shortestName = $possibleName; + $shortestLength = $length; + } + } + + return $shortestName; + } + + private function resolveAlias(Name $name, $type) { + $firstPart = $name->getFirst(); + + if ($name->isQualified()) { + // resolve aliases for qualified names, always against class alias table + $checkName = strtolower($firstPart); + if (isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$checkName])) { + $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$checkName]; + return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes()); + } + } elseif ($name->isUnqualified()) { + // constant aliases are case-sensitive, function aliases case-insensitive + $checkName = $type === Stmt\Use_::TYPE_CONSTANT ? $firstPart : strtolower($firstPart); + if (isset($this->aliases[$type][$checkName])) { + // resolve unqualified aliases + return new FullyQualified($this->aliases[$type][$checkName], $name->getAttributes()); + } + } + + // No applicable aliases + return null; + } + + private function getNamespaceRelativeName(string $name, string $lcName, int $type) { + if (null === $this->namespace) { + return new Name($name); + } + + if ($type === Stmt\Use_::TYPE_CONSTANT) { + // The constants true/false/null always resolve to the global symbols, even inside a + // namespace, so they may be used without qualification + if ($lcName === "true" || $lcName === "false" || $lcName === "null") { + return new Name($name); + } + } + + $namespacePrefix = strtolower($this->namespace . '\\'); + if (0 === strpos($lcName, $namespacePrefix)) { + return new Name(substr($name, strlen($namespacePrefix))); + } + + return null; + } + + private function normalizeConstName(string $name) { + $nsSep = strrpos($name, '\\'); + if (false === $nsSep) { + return $name; + } + + // Constants have case-insensitive namespace and case-sensitive short-name + $ns = substr($name, 0, $nsSep); + $shortName = substr($name, $nsSep + 1); + return strtolower($ns) . '\\' . $shortName; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node.php b/lib/nikic/php-parser/lib/PhpParser/Node.php index 6925fd726..befb25650 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node.php @@ -1,4 +1,4 @@ -attributes = $attributes; + $this->name = $name; $this->value = $value; $this->byRef = $byRef; $this->unpack = $unpack; } - public function getSubNodeNames() { - return array('value', 'byRef', 'unpack'); + public function getSubNodeNames() : array { + return ['name', 'value', 'byRef', 'unpack']; + } + + public function getType() : string { + return 'Arg'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Attribute.php b/lib/nikic/php-parser/lib/PhpParser/Node/Attribute.php new file mode 100644 index 000000000..c96f66e51 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Attribute.php @@ -0,0 +1,34 @@ +attributes = $attributes; + $this->name = $name; + $this->args = $args; + } + + public function getSubNodeNames() : array { + return ['name', 'args']; + } + + public function getType() : string { + return 'Attribute'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php b/lib/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php new file mode 100644 index 000000000..613bfc413 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php @@ -0,0 +1,29 @@ +attributes = $attributes; + $this->attrs = $attrs; + } + + public function getSubNodeNames() : array { + return ['attrs']; + } + + public function getType() : string { + return 'AttributeGroup'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/ComplexType.php b/lib/nikic/php-parser/lib/PhpParser/Node/ComplexType.php new file mode 100644 index 000000000..9505532ae --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/ComplexType.php @@ -0,0 +1,14 @@ +name = $name; + public function __construct($name, Expr $value, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Identifier($name) : $name; $this->value = $value; } - public function getSubNodeNames() { - return array('name', 'value'); + public function getSubNodeNames() : array { + return ['name', 'value']; + } + + public function getType() : string { + return 'Const'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr.php index 2dae5bfcd..6cf4df223 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; $this->dim = $dim; } - public function getSubNodeNames() { - return array('var', 'dim'); + public function getSubNodeNames() : array { + return ['var', 'dim']; + } + + public function getType() : string { + return 'Expr_ArrayDimFetch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php index de73ef467..1b078f821 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->key = $key; $this->value = $value; $this->byRef = $byRef; + $this->unpack = $unpack; } - public function getSubNodeNames() { - return array('key', 'value', 'byRef'); + public function getSubNodeNames() : array { + return ['key', 'value', 'byRef', 'unpack']; + } + + public function getType() : string { + return 'Expr_ArrayItem'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php index 9151f27d8..e6eaa2834 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->items = $items; } - public function getSubNodeNames() { - return array('items'); + public function getSubNodeNames() : array { + return ['items']; + } + + public function getType() : string { + return 'Expr_Array'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php new file mode 100644 index 000000000..c273fb7ee --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php @@ -0,0 +1,79 @@ + false : Whether the closure is static + * 'byRef' => false : Whether to return by reference + * 'params' => array() : Parameters + * 'returnType' => null : Return type + * 'expr' => Expr : Expression body + * 'attrGroups' => array() : PHP attribute groups + * @param array $attributes Additional attributes + */ + public function __construct(array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->static = $subNodes['static'] ?? false; + $this->byRef = $subNodes['byRef'] ?? false; + $this->params = $subNodes['params'] ?? []; + $returnType = $subNodes['returnType'] ?? null; + $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->expr = $subNodes['expr']; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames() : array { + return ['attrGroups', 'static', 'byRef', 'params', 'returnType', 'expr']; + } + + public function returnsByRef() : bool { + return $this->byRef; + } + + public function getParams() : array { + return $this->params; + } + + public function getReturnType() { + return $this->returnType; + } + + public function getAttrGroups() : array { + return $this->attrGroups; + } + + /** + * @return Node\Stmt\Return_[] + */ + public function getStmts() : array { + return [new Node\Stmt\Return_($this->expr)]; + } + + public function getType() : string { + return 'Expr_ArrowFunction'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php index 1f280ff0c..cf9e6e82b 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; $this->expr = $expr; } - public function getSubNodeNames() { - return array('var', 'expr'); + public function getSubNodeNames() : array { + return ['var', 'expr']; + } + + public function getType() : string { + return 'Expr_Assign'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php index 83540a072..bce8604f1 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; $this->expr = $expr; } - public function getSubNodeNames() { - return array('var', 'expr'); + public function getSubNodeNames() : array { + return ['var', 'expr']; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php index 9e3ed8226..420284cdc 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; $this->expr = $expr; } - public function getSubNodeNames() { - return array('var', 'expr'); + public function getSubNodeNames() : array { + return ['var', 'expr']; + } + + public function getType() : string { + return 'Expr_AssignRef'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php index 6f87e2350..d9c582b0d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->left = $left; $this->right = $right; } - public function getSubNodeNames() { - return array('left', 'right'); + public function getSubNodeNames() : array { + return ['left', 'right']; } + + /** + * Get the operator sigil for this binary operation. + * + * In the case there are multiple possible sigils for an operator, this method does not + * necessarily return the one used in the parsed code. + * + * @return string + */ + abstract public function getOperatorSigil() : string; } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php index bd6c5c1fb..d907393bf 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php @@ -1,4 +1,4 @@ -'; + } + + public function getType() : string { + return 'Expr_BinaryOp_Greater'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php index 9bd93a152..d677502cf 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php @@ -1,4 +1,4 @@ -='; + } + + public function getType() : string { + return 'Expr_BinaryOp_GreaterOrEqual'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php index 9562680e7..3d96285c6 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php @@ -1,4 +1,4 @@ ->'; + } + + public function getType() : string { + return 'Expr_BinaryOp_ShiftRight'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php index ba2c28b8b..3cb8e7e0d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php @@ -1,4 +1,4 @@ -'; + } + + public function getType() : string { + return 'Expr_BinaryOp_Spaceship'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php index 1d9226410..ed44984be 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_BitwiseNot'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php index 8f543b822..bf27e9f65 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_BooleanNot'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php new file mode 100644 index 000000000..78e1cf349 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php @@ -0,0 +1,39 @@ + + */ + abstract public function getRawArgs(): array; + + /** + * Returns whether this call expression is actually a first class callable. + */ + public function isFirstClassCallable(): bool { + foreach ($this->getRawArgs() as $arg) { + if ($arg instanceof VariadicPlaceholder) { + return true; + } + } + return false; + } + + /** + * Assert that this is not a first-class callable and return only ordinary Args. + * + * @return Arg[] + */ + public function getArgs(): array { + assert(!$this->isFirstClassCallable()); + return $this->getRawArgs(); + } +} \ No newline at end of file diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php index bf850dc52..36769d4fc 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php index 08b3a384c..57cc473b6 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->class = $class; - $this->name = $name; + $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() { - return array('class', 'name'); + public function getSubNodeNames() : array { + return ['class', 'name']; + } + + public function getType() : string { + return 'Expr_ClassConstFetch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php index 198ec4d89..db216b8f8 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_Clone'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php index 5d3765508..56ddea6aa 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php @@ -1,4 +1,4 @@ - array(): use()s * 'returnType' => null : Return type * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attributes groups * @param array $attributes Additional attributes */ - public function __construct(array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); - $this->static = isset($subNodes['static']) ? $subNodes['static'] : false; - $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; - $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); - $this->uses = isset($subNodes['uses']) ? $subNodes['uses'] : array(); - $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null; - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + public function __construct(array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->static = $subNodes['static'] ?? false; + $this->byRef = $subNodes['byRef'] ?? false; + $this->params = $subNodes['params'] ?? []; + $this->uses = $subNodes['uses'] ?? []; + $returnType = $subNodes['returnType'] ?? null; + $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() { - return array('static', 'byRef', 'params', 'uses', 'returnType', 'stmts'); + public function getSubNodeNames() : array { + return ['attrGroups', 'static', 'byRef', 'params', 'uses', 'returnType', 'stmts']; } - public function returnsByRef() { + public function returnsByRef() : bool { return $this->byRef; } - public function getParams() { + public function getParams() : array { return $this->params; } @@ -59,7 +64,16 @@ class Closure extends Expr implements FunctionLike return $this->returnType; } - public function getStmts() { + /** @return Node\Stmt[] */ + public function getStmts() : array { return $this->stmts; } + + public function getAttrGroups() : array { + return $this->attrGroups; + } + + public function getType() : string { + return 'Expr_Closure'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php index f4d02023e..2b8a09666 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; $this->byRef = $byRef; } - public function getSubNodeNames() { - return array('var', 'byRef'); + public function getSubNodeNames() : array { + return ['var', 'byRef']; + } + + public function getType() : string { + return 'Expr_ClosureUse'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php index 98e51d527..14ebd16bd 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->name = $name; } - public function getSubNodeNames() { - return array('name'); + public function getSubNodeNames() : array { + return ['name']; + } + + public function getType() : string { + return 'Expr_ConstFetch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php index 0c0509efb..4042ec93c 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_Empty'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php index 5ab8fd445..1637f3aea 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php @@ -1,4 +1,4 @@ -attributes = $attributes; } - public function getSubNodeNames() { - return array(); + public function getSubNodeNames() : array { + return []; + } + + public function getType() : string { + return 'Expr_Error'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php index 750c814c7..c44ff6f93 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_ErrorSuppress'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php index eadffd008..856854743 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_Eval'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php index b0b94cf7b..b88a8f7e6 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_Exit'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php index 60d00507d..2de4d0dd5 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php @@ -1,31 +1,39 @@ - Arguments */ public $args; /** * Constructs a function call node. * - * @param Node\Name|Expr $name Function name - * @param Node\Arg[] $args Arguments - * @param array $attributes Additional attributes + * @param Node\Name|Expr $name Function name + * @param array $args Arguments + * @param array $attributes Additional attributes */ - public function __construct($name, array $args = array(), array $attributes = array()) { - parent::__construct($attributes); + public function __construct($name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; $this->name = $name; $this->args = $args; } - public function getSubNodeNames() { - return array('name', 'args'); + public function getSubNodeNames() : array { + return ['name', 'args']; + } + + public function getType() : string { + return 'Expr_FuncCall'; + } + + public function getRawArgs(): array { + return $this->args; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php index b27f3af18..07ce5968e 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; $this->type = $type; } - public function getSubNodeNames() { - return array('expr', 'type'); + public function getSubNodeNames() : array { + return ['expr', 'type']; + } + + public function getType() : string { + return 'Expr_Include'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php index 69573d865..9000d47bb 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; $this->class = $class; } - public function getSubNodeNames() { - return array('expr', 'class'); + public function getSubNodeNames() : array { + return ['expr', 'class']; + } + + public function getType() : string { + return 'Expr_Instanceof'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php index 4ec1d025a..76b738758 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() { - return array('vars'); + public function getSubNodeNames() : array { + return ['vars']; + } + + public function getType() : string { + return 'Expr_Isset'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php index 30f3dc165..c27a27b95 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->items = $items; } - public function getSubNodeNames() { - return array('items'); + public function getSubNodeNames() : array { + return ['items']; + } + + public function getType() : string { + return 'Expr_List'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php new file mode 100644 index 000000000..2455a3026 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php @@ -0,0 +1,31 @@ +attributes = $attributes; + $this->cond = $cond; + $this->arms = $arms; + } + + public function getSubNodeNames() : array { + return ['cond', 'arms']; + } + + public function getType() : string { + return 'Expr_Match'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php index a6cdd07c1..49ca48356 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php @@ -1,35 +1,45 @@ - Arguments */ public $args; /** * Constructs a function call node. * - * @param Expr $var Variable holding object - * @param string|Expr $name Method name - * @param Arg[] $args Arguments - * @param array $attributes Additional attributes + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Method name + * @param array $args Arguments + * @param array $attributes Additional attributes */ - public function __construct(Expr $var, $name, array $args = array(), array $attributes = array()) { - parent::__construct($attributes); + public function __construct(Expr $var, $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; $this->var = $var; - $this->name = $name; + $this->name = \is_string($name) ? new Identifier($name) : $name; $this->args = $args; } - public function getSubNodeNames() { - return array('var', 'name', 'args'); + public function getSubNodeNames() : array { + return ['var', 'name', 'args']; + } + + public function getType() : string { + return 'Expr_MethodCall'; + } + + public function getRawArgs(): array { + return $this->args; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php index a8c87794d..e2bb64928 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php @@ -1,31 +1,41 @@ - Arguments */ public $args; /** * Constructs a function call node. * * @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes) - * @param Node\Arg[] $args Arguments + * @param array $args Arguments * @param array $attributes Additional attributes */ - public function __construct($class, array $args = array(), array $attributes = array()) { - parent::__construct($attributes); + public function __construct($class, array $args = [], array $attributes = []) { + $this->attributes = $attributes; $this->class = $class; $this->args = $args; } - public function getSubNodeNames() { - return array('class', 'args'); + public function getSubNodeNames() : array { + return ['class', 'args']; + } + + public function getType() : string { + return 'Expr_New'; + } + + public function getRawArgs(): array { + return $this->args; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php new file mode 100644 index 000000000..07a571fd8 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php @@ -0,0 +1,45 @@ + Arguments */ + public $args; + + /** + * Constructs a nullsafe method call node. + * + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Method name + * @param array $args Arguments + * @param array $attributes Additional attributes + */ + public function __construct(Expr $var, $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->name = \is_string($name) ? new Identifier($name) : $name; + $this->args = $args; + } + + public function getSubNodeNames() : array { + return ['var', 'name', 'args']; + } + + public function getType() : string { + return 'Expr_NullsafeMethodCall'; + } + + public function getRawArgs(): array { + return $this->args; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php new file mode 100644 index 000000000..9317eb3b9 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php @@ -0,0 +1,35 @@ +attributes = $attributes; + $this->var = $var; + $this->name = \is_string($name) ? new Identifier($name) : $name; + } + + public function getSubNodeNames() : array { + return ['var', 'name']; + } + + public function getType() : string { + return 'Expr_NullsafePropertyFetch'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php index 06ce5470e..94d6c296d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() { - return array('var'); + public function getSubNodeNames() : array { + return ['var']; + } + + public function getType() : string { + return 'Expr_PostDec'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php index 54865ba12..005c443a2 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() { - return array('var'); + public function getSubNodeNames() : array { + return ['var']; + } + + public function getType() : string { + return 'Expr_PostInc'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php index db30f5102..a5ca685a8 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() { - return array('var'); + public function getSubNodeNames() : array { + return ['var']; + } + + public function getType() : string { + return 'Expr_PreDec'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php index 06356028c..0986c4474 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->var = $var; } - public function getSubNodeNames() { - return array('var'); + public function getSubNodeNames() : array { + return ['var']; + } + + public function getType() : string { + return 'Expr_PreInc'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php index 0666ab84d..2d43c2ac8 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_Print'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php index adcf21ce1..4281f31cc 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php @@ -1,30 +1,35 @@ -attributes = $attributes; $this->var = $var; - $this->name = $name; + $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() { - return array('var', 'name'); + public function getSubNodeNames() : array { + return ['var', 'name']; + } + + public function getType() : string { + return 'Expr_PropertyFetch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php index 9516a32f4..537a7cc80 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->parts = $parts; } - public function getSubNodeNames() { - return array('parts'); + public function getSubNodeNames() : array { + return ['parts']; + } + + public function getType() : string { + return 'Expr_ShellExec'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php index 5118f34a7..d0d099c47 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php @@ -1,35 +1,46 @@ - Arguments */ public $args; /** * Constructs a static method call node. * - * @param Node\Name|Expr $class Class name - * @param string|Expr $name Method name - * @param Node\Arg[] $args Arguments - * @param array $attributes Additional attributes + * @param Node\Name|Expr $class Class name + * @param string|Identifier|Expr $name Method name + * @param array $args Arguments + * @param array $attributes Additional attributes */ - public function __construct($class, $name, array $args = array(), array $attributes = array()) { - parent::__construct($attributes); + public function __construct($class, $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; $this->class = $class; - $this->name = $name; + $this->name = \is_string($name) ? new Identifier($name) : $name; $this->args = $args; } - public function getSubNodeNames() { - return array('class', 'name', 'args'); + public function getSubNodeNames() : array { + return ['class', 'name', 'args']; + } + + public function getType() : string { + return 'Expr_StaticCall'; + } + + public function getRawArgs(): array { + return $this->args; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php index 477a69ddb..1ee1a25e5 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php @@ -1,31 +1,36 @@ -attributes = $attributes; $this->class = $class; - $this->name = $name; + $this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name; } - public function getSubNodeNames() { - return array('class', 'name'); + public function getSubNodeNames() : array { + return ['class', 'name']; + } + + public function getType() : string { + return 'Expr_StaticPropertyFetch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php index 57301390f..9316f47d4 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->cond = $cond; $this->if = $if; $this->else = $else; } - public function getSubNodeNames() { - return array('cond', 'if', 'else'); + public function getSubNodeNames() : array { + return ['cond', 'if', 'else']; + } + + public function getType() : string { + return 'Expr_Ternary'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php new file mode 100644 index 000000000..5c97f0e2b --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php @@ -0,0 +1,30 @@ +attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_Throw'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php index 94635d638..ce8808bc6 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_UnaryMinus'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php index 651412003..d23047e54 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_UnaryPlus'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php index 3ae3ecd9b..b47d38e93 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->name = $name; } - public function getSubNodeNames() { - return array('name'); + public function getSubNodeNames() : array { + return ['name']; + } + + public function getType() : string { + return 'Expr_Variable'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php index 993c82c20..a3efce618 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Expr_YieldFrom'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php index f3ca88e05..aef8fc333 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->key = $key; $this->value = $value; } - public function getSubNodeNames() { - return array('key', 'value'); + public function getSubNodeNames() : array { + return ['key', 'value']; + } + + public function getType() : string { + return 'Expr_Yield'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php b/lib/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php index 82569450c..5a825e731 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php @@ -1,4 +1,4 @@ - true, + 'parent' => true, + 'static' => true, + ]; + + /** + * Constructs an identifier node. + * + * @param string $name Identifier as string + * @param array $attributes Additional attributes + */ + public function __construct(string $name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = $name; + } + + public function getSubNodeNames() : array { + return ['name']; + } + + /** + * Get identifier as string. + * + * @return string Identifier as string. + */ + public function toString() : string { + return $this->name; + } + + /** + * Get lowercased identifier as string. + * + * @return string Lowercased identifier as string + */ + public function toLowerString() : string { + return strtolower($this->name); + } + + /** + * Checks whether the identifier is a special class name (self, parent or static). + * + * @return bool Whether identifier is a special class name + */ + public function isSpecialClassName() : bool { + return isset(self::$specialClassNames[strtolower($this->name)]); + } + + /** + * Get identifier as string. + * + * @return string Identifier as string + */ + public function __toString() : string { + return $this->name; + } + + public function getType() : string { + return 'Identifier'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php b/lib/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php new file mode 100644 index 000000000..9208e1392 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php @@ -0,0 +1,30 @@ +attributes = $attributes; + $this->types = $types; + } + + public function getSubNodeNames() : array { + return ['types']; + } + + public function getType() : string { + return 'IntersectionType'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/MatchArm.php b/lib/nikic/php-parser/lib/PhpParser/Node/MatchArm.php new file mode 100644 index 000000000..2ae1c86b8 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/MatchArm.php @@ -0,0 +1,31 @@ +conds = $conds; + $this->body = $body; + $this->attributes = $attributes; + } + + public function getSubNodeNames() : array { + return ['conds', 'body']; + } + + public function getType() : string { + return 'MatchArm'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Name.php b/lib/nikic/php-parser/lib/PhpParser/Node/Name.php index 7b8c8e232..6b1cc9f8e 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Name.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Name.php @@ -1,4 +1,4 @@ - true, + 'parent' => true, + 'static' => true, + ]; + /** * Constructs a name node. * - * @param string|array|self $name Name as string, part array or Name instance (copy ctor) - * @param array $attributes Additional attributes + * @param string|string[]|self $name Name as string, part array or Name instance (copy ctor) + * @param array $attributes Additional attributes */ - public function __construct($name, array $attributes = array()) { - parent::__construct($attributes); + public function __construct($name, array $attributes = []) { + $this->attributes = $attributes; $this->parts = self::prepareName($name); } - public function getSubNodeNames() { - return array('parts'); + public function getSubNodeNames() : array { + return ['parts']; } /** @@ -31,7 +35,7 @@ class Name extends NodeAbstract * * @return string First part of the name */ - public function getFirst() { + public function getFirst() : string { return $this->parts[0]; } @@ -40,7 +44,7 @@ class Name extends NodeAbstract * * @return string Last part of the name */ - public function getLast() { + public function getLast() : string { return $this->parts[count($this->parts) - 1]; } @@ -49,8 +53,8 @@ class Name extends NodeAbstract * * @return bool Whether the name is unqualified */ - public function isUnqualified() { - return 1 == count($this->parts); + public function isUnqualified() : bool { + return 1 === count($this->parts); } /** @@ -58,7 +62,7 @@ class Name extends NodeAbstract * * @return bool Whether the name is qualified */ - public function isQualified() { + public function isQualified() : bool { return 1 < count($this->parts); } @@ -67,7 +71,7 @@ class Name extends NodeAbstract * * @return bool Whether the name is fully qualified */ - public function isFullyQualified() { + public function isFullyQualified() : bool { return false; } @@ -76,27 +80,57 @@ class Name extends NodeAbstract * * @return bool Whether the name is relative */ - public function isRelative() { + public function isRelative() : bool { return false; } /** - * Returns a string representation of the name by imploding the namespace parts with the - * namespace separator. + * Returns a string representation of the name itself, without taking the name type into + * account (e.g., not including a leading backslash for fully qualified names). * * @return string String representation */ - public function toString() { + public function toString() : string { return implode('\\', $this->parts); } + /** + * Returns a string representation of the name as it would occur in code (e.g., including + * leading backslash for fully qualified names. + * + * @return string String representation + */ + public function toCodeString() : string { + return $this->toString(); + } + + /** + * Returns lowercased string representation of the name, without taking the name type into + * account (e.g., no leading backslash for fully qualified names). + * + * @return string Lowercased string representation + */ + public function toLowerString() : string { + return strtolower(implode('\\', $this->parts)); + } + + /** + * Checks whether the identifier is a special class name (self, parent or static). + * + * @return bool Whether identifier is a special class name + */ + public function isSpecialClassName() : bool { + return count($this->parts) === 1 + && isset(self::$specialClassNames[strtolower($this->parts[0])]); + } + /** * Returns a string representation of the name by imploding the namespace parts with the * namespace separator. * * @return string String representation */ - public function __toString() { + public function __toString() : string { return implode('\\', $this->parts); } @@ -116,7 +150,7 @@ class Name extends NodeAbstract * * @return static|null Sliced name */ - public function slice($offset, $length = null) { + public function slice(int $offset, int $length = null) { $numParts = count($this->parts); $realOffset = $offset < 0 ? $offset + $numParts : $offset; @@ -152,9 +186,9 @@ class Name extends NodeAbstract * Name::concat($namespace, $shortName) * where $namespace is a Name node or null will work as expected. * - * @param string|array|self|null $name1 The first name - * @param string|array|self|null $name2 The second name - * @param array $attributes Attributes to assign to concatenated name + * @param string|string[]|self|null $name1 The first name + * @param string|string[]|self|null $name2 The second name + * @param array $attributes Attributes to assign to concatenated name * * @return static|null Concatenated name */ @@ -163,7 +197,7 @@ class Name extends NodeAbstract return null; } elseif (null === $name1) { return new static(self::prepareName($name2), $attributes); - } else if (null === $name2) { + } elseif (null === $name2) { return new static(self::prepareName($name1), $attributes); } else { return new static( @@ -176,14 +210,22 @@ class Name extends NodeAbstract * Prepares a (string, array or Name node) name for use in name changing methods by converting * it to an array. * - * @param string|array|self $name Name to prepare + * @param string|string[]|self $name Name to prepare * - * @return array Prepared name + * @return string[] Prepared name */ - private static function prepareName($name) { + private static function prepareName($name) : array { if (\is_string($name)) { + if ('' === $name) { + throw new \InvalidArgumentException('Name cannot be empty'); + } + return explode('\\', $name); } elseif (\is_array($name)) { + if (empty($name)) { + throw new \InvalidArgumentException('Name cannot be empty'); + } + return $name; } elseif ($name instanceof self) { return $name->parts; @@ -193,4 +235,8 @@ class Name extends NodeAbstract 'Expected string, array of parts or Name instance' ); } + + public function getType() : string { + return 'Name'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php b/lib/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php index 97cc1113d..1df93a56b 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php @@ -1,4 +1,4 @@ -toString(); + } + + public function getType() : string { + return 'Name_FullyQualified'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php b/lib/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php index 25676ce69..57bf7af2b 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php @@ -1,4 +1,4 @@ -toString(); + } + + public function getType() : string { + return 'Name_Relative'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/NullableType.php b/lib/nikic/php-parser/lib/PhpParser/Node/NullableType.php index d887b321a..d68e26a38 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/NullableType.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/NullableType.php @@ -1,26 +1,28 @@ -type = $type; + public function __construct($type, array $attributes = []) { + $this->attributes = $attributes; + $this->type = \is_string($type) ? new Identifier($type) : $type; } - public function getSubNodeNames() { - return array('type'); + public function getSubNodeNames() : array { + return ['type']; + } + + public function getType() : string { + return 'NullableType'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Param.php b/lib/nikic/php-parser/lib/PhpParser/Node/Param.php index b35ee4ef0..1e90b7944 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Param.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Param.php @@ -1,4 +1,4 @@ -type = $type; + public function __construct( + $var, Expr $default = null, $type = null, + bool $byRef = false, bool $variadic = false, + array $attributes = [], + int $flags = 0, + array $attrGroups = [] + ) { + $this->attributes = $attributes; + $this->type = \is_string($type) ? new Identifier($type) : $type; $this->byRef = $byRef; $this->variadic = $variadic; - $this->name = $name; + $this->var = $var; $this->default = $default; + $this->flags = $flags; + $this->attrGroups = $attrGroups; } - public function getSubNodeNames() { - return array('type', 'byRef', 'variadic', 'name', 'default'); + public function getSubNodeNames() : array { + return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default']; + } + + public function getType() : string { + return 'Param'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar.php b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar.php index 01177532c..8117909b6 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar.php @@ -1,7 +1,7 @@ -attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() { - return array('value'); + public function getSubNodeNames() : array { + return ['value']; } /** @@ -33,7 +33,9 @@ class DNumber extends Scalar * * @return float The parsed number */ - public static function parse($str) { + public static function parse(string $str) : float { + $str = str_replace('_', '', $str); + // if string contains any of .eE just cast it to float if (false !== strpbrk($str, '.eE')) { return (float) $str; @@ -61,4 +63,8 @@ class DNumber extends Scalar // dec return (float) $str; } + + public function getType() : string { + return 'Scalar_DNumber'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php index 4f9b433c2..fa5d2e268 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->parts = $parts; } - public function getSubNodeNames() { - return array('parts'); + public function getSubNodeNames() : array { + return ['parts']; + } + + public function getType() : string { + return 'Scalar_Encapsed'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php index 50cb1afe6..bb3194c1d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() { - return array('value'); + public function getSubNodeNames() : array { + return ['value']; + } + + public function getType() : string { + return 'Scalar_EncapsedStringPart'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php index 3559b982c..f17dd1f8a 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() { - return array('value'); + public function getSubNodeNames() : array { + return ['value']; } /** @@ -40,7 +40,9 @@ class LNumber extends Scalar * * @return LNumber The constructed LNumber, including kind attribute */ - public static function fromString($str, array $attributes = array(), $allowInvalidOctal = false) { + public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false) : LNumber { + $str = str_replace('_', '', $str); + if ('0' !== $str[0] || '0' === $str) { $attributes['kind'] = LNumber::KIND_DEC; return new LNumber((int) $str, $attributes); @@ -60,8 +62,17 @@ class LNumber extends Scalar throw new Error('Invalid numeric literal', $attributes); } + // Strip optional explicit octal prefix. + if ('o' === $str[1] || 'O' === $str[1]) { + $str = substr($str, 2); + } + // use intval instead of octdec to get proper cutting behavior with malformed numbers $attributes['kind'] = LNumber::KIND_OCT; return new LNumber(intval($str, 8), $attributes); } + + public function getType() : string { + return 'Scalar_LNumber'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php index a50d68f3d..941f0c762 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php @@ -1,4 +1,4 @@ -attributes = $attributes; } - public function getSubNodeNames() { - return array(); + public function getSubNodeNames() : array { + return []; } /** @@ -24,5 +24,5 @@ abstract class MagicConst extends Scalar * * @return string Name of magic constant */ - abstract public function getName(); + abstract public function getName() : string; } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php index 3466b21a1..244328476 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php @@ -1,4 +1,4 @@ - '\\', '$' => '$', 'n' => "\n", @@ -25,7 +25,7 @@ class String_ extends Scalar 'f' => "\f", 'v' => "\v", 'e' => "\x1B", - ); + ]; /** * Constructs a string scalar node. @@ -33,13 +33,13 @@ class String_ extends Scalar * @param string $value Value of the string * @param array $attributes Additional attributes */ - public function __construct($value, array $attributes = array()) { - parent::__construct($attributes); + public function __construct(string $value, array $attributes = []) { + $this->attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() { - return array('value'); + public function getSubNodeNames() : array { + return ['value']; } /** @@ -52,7 +52,7 @@ class String_ extends Scalar * * @return string The parsed string */ - public static function parse($str, $parseUnicodeEscape = true) { + public static function parse(string $str, bool $parseUnicodeEscape = true) : string { $bLength = 0; if ('b' === $str[0] || 'B' === $str[0]) { $bLength = 1; @@ -60,8 +60,8 @@ class String_ extends Scalar if ('\'' === $str[$bLength]) { return str_replace( - array('\\\\', '\\\''), - array( '\\', '\''), + ['\\\\', '\\\''], + ['\\', '\''], substr($str, $bLength + 1, -1) ); } else { @@ -82,7 +82,7 @@ class String_ extends Scalar * * @return string String with escape sequences parsed */ - public static function parseEscapeSequences($str, $quote, $parseUnicodeEscape = true) { + public static function parseEscapeSequences(string $str, $quote, bool $parseUnicodeEscape = true) : string { if (null !== $quote) { $str = str_replace('\\' . $quote, $quote, $str); } @@ -100,7 +100,7 @@ class String_ extends Scalar if (isset(self::$replacements[$str])) { return self::$replacements[$str]; } elseif ('x' === $str[0] || 'X' === $str[0]) { - return chr(hexdec($str)); + return chr(hexdec(substr($str, 1))); } elseif ('u' === $str[0]) { return self::codePointToUtf8(hexdec($matches[2])); } else { @@ -111,7 +111,14 @@ class String_ extends Scalar ); } - private static function codePointToUtf8($num) { + /** + * Converts a Unicode code point to its UTF-8 encoded representation. + * + * @param int $num Code point + * + * @return string UTF-8 representation of code point + */ + private static function codePointToUtf8(int $num) : string { if ($num <= 0x7F) { return chr($num); } @@ -128,26 +135,7 @@ class String_ extends Scalar throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); } - /** - * @internal - * - * Parses a constant doc string. - * - * @param string $startToken Doc string start token content (<<attributes = $attributes; $this->num = $num; } - public function getSubNodeNames() { - return array('num'); + public function getSubNodeNames() : array { + return ['num']; + } + + public function getType() : string { + return 'Stmt_Break'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php index 03f892c7c..2bf044c90 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('cond', 'stmts'); + public function getSubNodeNames() : array { + return ['cond', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Case'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php index 58337ad9b..9b9c09478 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php @@ -1,34 +1,41 @@ -attributes = $attributes; $this->types = $types; $this->var = $var; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('types', 'var', 'stmts'); + public function getSubNodeNames() : array { + return ['types', 'var', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Catch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php index 0d41094ff..1fc7f3362 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->flags = $flags; $this->consts = $consts; + $this->attrGroups = $attrGroups; } - public function getSubNodeNames() { - return array('flags', 'consts'); + public function getSubNodeNames() : array { + return ['attrGroups', 'flags', 'consts']; } - public function isPublic() { + /** + * Whether constant is explicitly or implicitly public. + * + * @return bool + */ + public function isPublic() : bool { return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; } - public function isProtected() { + /** + * Whether constant is protected. + * + * @return bool + */ + public function isProtected() : bool { return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); } - public function isPrivate() { + /** + * Whether constant is private. + * + * @return bool + */ + public function isPrivate() : bool { return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); } - public function isStatic() { - return (bool) ($this->flags & Class_::MODIFIER_STATIC); + /** + * Whether constant is final. + * + * @return bool + */ + public function isFinal() : bool { + return (bool) ($this->flags & Class_::MODIFIER_FINAL); + } + + public function getType() : string { + return 'Stmt_ClassConst'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php index f90533553..6c3369172 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php @@ -1,22 +1,87 @@ -stmts as $stmt) { + if ($stmt instanceof TraitUse) { + $traitUses[] = $stmt; + } + } + return $traitUses; + } + + /** + * @return ClassConst[] + */ + public function getConstants() : array { + $constants = []; + foreach ($this->stmts as $stmt) { + if ($stmt instanceof ClassConst) { + $constants[] = $stmt; + } + } + return $constants; + } + + /** + * @return Property[] + */ + public function getProperties() : array { + $properties = []; + foreach ($this->stmts as $stmt) { + if ($stmt instanceof Property) { + $properties[] = $stmt; + } + } + return $properties; + } + + /** + * Gets property with the given name defined directly in this class/interface/trait. + * + * @param string $name Name of the property + * + * @return Property|null Property node or null if the property does not exist + */ + public function getProperty(string $name) { + foreach ($this->stmts as $stmt) { + if ($stmt instanceof Property) { + foreach ($stmt->props as $prop) { + if ($prop instanceof PropertyProperty && $name === $prop->name->toString()) { + return $stmt; + } + } + } + } + return null; + } /** * Gets all methods defined directly in this class/interface/trait * * @return ClassMethod[] */ - public function getMethods() { - $methods = array(); + public function getMethods() : array { + $methods = []; foreach ($this->stmts as $stmt) { if ($stmt instanceof ClassMethod) { $methods[] = $stmt; @@ -32,10 +97,10 @@ abstract class ClassLike extends Node\Stmt { * * @return ClassMethod|null Method node or null if the method does not exist */ - public function getMethod($name) { + public function getMethod(string $name) { $lowerName = strtolower($name); foreach ($this->stmts as $stmt) { - if ($stmt instanceof ClassMethod && $lowerName === strtolower($stmt->name)) { + if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) { return $stmt; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php index de05390ad..09b877a92 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php @@ -1,4 +1,4 @@ - true, + '__destruct' => true, + '__call' => true, + '__callstatic' => true, + '__get' => true, + '__set' => true, + '__isset' => true, + '__unset' => true, + '__sleep' => true, + '__wakeup' => true, + '__tostring' => true, + '__set_state' => true, + '__clone' => true, + '__invoke' => true, + '__debuginfo' => true, + ]; /** * Constructs a class method node. * - * @param string $name Name - * @param array $subNodes Array of the following optional subnodes: - * 'flags => MODIFIER_PUBLIC: Flags - * 'byRef' => false : Whether to return by reference - * 'params' => array() : Parameters - * 'returnType' => null : Return type - * 'stmts' => array() : Statements - * @param array $attributes Additional attributes + * @param string|Node\Identifier $name Name + * @param array $subNodes Array of the following optional subnodes: + * 'flags => MODIFIER_PUBLIC: Flags + * 'byRef' => false : Whether to return by reference + * 'params' => array() : Parameters + * 'returnType' => null : Return type + * 'stmts' => array() : Statements + * 'attrGroups' => array() : PHP attribute groups + * @param array $attributes Additional attributes */ - public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); - $this->flags = isset($subNodes['flags']) ? $subNodes['flags'] - : (isset($subNodes['type']) ? $subNodes['type'] : 0); - $this->type = $this->flags; - $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; - $this->name = $name; - $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); - $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null; - $this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : array(); + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0; + $this->byRef = $subNodes['byRef'] ?? false; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->params = $subNodes['params'] ?? []; + $returnType = $subNodes['returnType'] ?? null; + $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() { - return array('flags', 'byRef', 'name', 'params', 'returnType', 'stmts'); + public function getSubNodeNames() : array { + return ['attrGroups', 'flags', 'byRef', 'name', 'params', 'returnType', 'stmts']; } - public function returnsByRef() { + public function returnsByRef() : bool { return $this->byRef; } - public function getParams() { + public function getParams() : array { return $this->params; } @@ -67,28 +85,75 @@ class ClassMethod extends Node\Stmt implements FunctionLike return $this->stmts; } - public function isPublic() { + public function getAttrGroups() : array { + return $this->attrGroups; + } + + /** + * Whether the method is explicitly or implicitly public. + * + * @return bool + */ + public function isPublic() : bool { return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; } - public function isProtected() { + /** + * Whether the method is protected. + * + * @return bool + */ + public function isProtected() : bool { return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); } - public function isPrivate() { + /** + * Whether the method is private. + * + * @return bool + */ + public function isPrivate() : bool { return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); } - public function isAbstract() { + /** + * Whether the method is abstract. + * + * @return bool + */ + public function isAbstract() : bool { return (bool) ($this->flags & Class_::MODIFIER_ABSTRACT); } - public function isFinal() { + /** + * Whether the method is final. + * + * @return bool + */ + public function isFinal() : bool { return (bool) ($this->flags & Class_::MODIFIER_FINAL); } - public function isStatic() { + /** + * Whether the method is static. + * + * @return bool + */ + public function isStatic() : bool { return (bool) ($this->flags & Class_::MODIFIER_STATIC); } + + /** + * Whether the method is magic. + * + * @return bool + */ + public function isMagic() : bool { + return isset(self::$magicNames[$this->name->toLowerString()]); + } + + public function getType() : string { + return 'Stmt_ClassMethod'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php index 0a65e3740..b290aaf6d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php @@ -1,4 +1,4 @@ - true, - 'parent' => true, - 'static' => true, - ); - /** * Constructs a class node. * - * @param string|null $name Name + * @param string|Node\Identifier|null $name Name * @param array $subNodes Array of the following optional subnodes: - * 'flags' => 0 : Flags - * 'extends' => null : Name of extended class - * 'implements' => array(): Names of implemented interfaces - * 'stmts' => array(): Statements + * 'flags' => 0 : Flags + * 'extends' => null : Name of extended class + * 'implements' => array(): Names of implemented interfaces + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups * @param array $attributes Additional attributes */ - public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); - $this->flags = isset($subNodes['flags']) ? $subNodes['flags'] - : (isset($subNodes['type']) ? $subNodes['type'] : 0); - $this->type = $this->flags; - $this->name = $name; - $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : null; - $this->implements = isset($subNodes['implements']) ? $subNodes['implements'] : array(); - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->extends = $subNodes['extends'] ?? null; + $this->implements = $subNodes['implements'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() { - return array('flags', 'name', 'extends', 'implements', 'stmts'); + public function getSubNodeNames() : array { + return ['attrGroups', 'flags', 'name', 'extends', 'implements', 'stmts']; } - public function isAbstract() { + /** + * Whether the class is explicitly abstract. + * + * @return bool + */ + public function isAbstract() : bool { return (bool) ($this->flags & self::MODIFIER_ABSTRACT); } - public function isFinal() { + /** + * Whether the class is final. + * + * @return bool + */ + public function isFinal() : bool { return (bool) ($this->flags & self::MODIFIER_FINAL); } - public function isAnonymous() { + /** + * Whether the class is anonymous. + * + * @return bool + */ + public function isAnonymous() : bool { return null === $this->name; } @@ -92,8 +97,16 @@ class Class_ extends ClassLike throw new Error('Multiple final modifiers are not allowed'); } + if ($a & self::MODIFIER_READONLY && $b & self::MODIFIER_READONLY) { + throw new Error('Multiple readonly modifiers are not allowed'); + } + if ($a & 48 && $b & 48) { throw new Error('Cannot use the final modifier on an abstract class member'); } } + + public function getType() : string { + return 'Stmt_Class'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php index 8b2eecd51..e6316345e 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->consts = $consts; } - public function getSubNodeNames() { - return array('consts'); + public function getSubNodeNames() : array { + return ['consts']; + } + + public function getType() : string { + return 'Stmt_Const'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php index f78e19a2a..24882683b 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->num = $num; } - public function getSubNodeNames() { - return array('num'); + public function getSubNodeNames() : array { + return ['num']; + } + + public function getType() : string { + return 'Stmt_Continue'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php index 829dbaf25..ac07f30c7 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php @@ -1,4 +1,4 @@ -value pair node. * - * @param string $key Key - * @param Node\Expr $value Value - * @param array $attributes Additional attributes + * @param string|Node\Identifier $key Key + * @param Node\Expr $value Value + * @param array $attributes Additional attributes */ - public function __construct($key, Node\Expr $value, array $attributes = array()) { - parent::__construct($attributes); - $this->key = $key; + public function __construct($key, Node\Expr $value, array $attributes = []) { + $this->attributes = $attributes; + $this->key = \is_string($key) ? new Node\Identifier($key) : $key; $this->value = $value; } - public function getSubNodeNames() { - return array('key', 'value'); + public function getSubNodeNames() : array { + return ['key', 'value']; + } + + public function getType() : string { + return 'Stmt_DeclareDeclare'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php index 32739f35f..f46ff0baf 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->declares = $declares; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('declares', 'stmts'); + public function getSubNodeNames() : array { + return ['declares', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Declare'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php index dd4c6c843..78e90da03 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('cond', 'stmts'); + public function getSubNodeNames() : array { + return ['stmts', 'cond']; + } + + public function getType() : string { + return 'Stmt_Do'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php index 11e107072..7cc50d5d6 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->exprs = $exprs; } - public function getSubNodeNames() { - return array('exprs'); + public function getSubNodeNames() : array { + return ['exprs']; + } + + public function getType() : string { + return 'Stmt_Echo'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php index 608878f65..eef1ece32 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('cond', 'stmts'); + public function getSubNodeNames() : array { + return ['cond', 'stmts']; + } + + public function getType() : string { + return 'Stmt_ElseIf'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php index c91a1484f..0e61778e2 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('stmts'); + public function getSubNodeNames() : array { + return ['stmts']; + } + + public function getType() : string { + return 'Stmt_Else'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php new file mode 100644 index 000000000..5beff8b39 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php @@ -0,0 +1,37 @@ +name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->expr = $expr; + $this->attrGroups = $attrGroups; + } + + public function getSubNodeNames() : array { + return ['attrGroups', 'name', 'expr']; + } + + public function getType() : string { + return 'Stmt_EnumCase'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php new file mode 100644 index 000000000..3a50c225d --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php @@ -0,0 +1,40 @@ + null : Scalar type + * 'implements' => array() : Names of implemented interfaces + * 'stmts' => array() : Statements + * 'attrGroups' => array() : PHP attribute groups + * @param array $attributes Additional attributes + */ + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->scalarType = $subNodes['scalarType'] ?? null; + $this->implements = $subNodes['implements'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + + parent::__construct($attributes); + } + + public function getSubNodeNames() : array { + return ['attrGroups', 'name', 'scalarType', 'implements', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Enum'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php new file mode 100644 index 000000000..99d1687de --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php @@ -0,0 +1,33 @@ +attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Stmt_Expression'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php index 0e3eabbe1..d55b8b687 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('stmts'); + public function getSubNodeNames() : array { + return ['stmts']; + } + + public function getType() : string { + return 'Stmt_Finally'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php index 2ca88a332..1323d37cf 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php @@ -1,4 +1,4 @@ - array(): Statements * @param array $attributes Additional attributes */ - public function __construct(array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); - $this->init = isset($subNodes['init']) ? $subNodes['init'] : array(); - $this->cond = isset($subNodes['cond']) ? $subNodes['cond'] : array(); - $this->loop = isset($subNodes['loop']) ? $subNodes['loop'] : array(); - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + public function __construct(array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->init = $subNodes['init'] ?? []; + $this->cond = $subNodes['cond'] ?? []; + $this->loop = $subNodes['loop'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; } - public function getSubNodeNames() { - return array('init', 'cond', 'loop', 'stmts'); + public function getSubNodeNames() : array { + return ['init', 'cond', 'loop', 'stmts']; + } + + public function getType() : string { + return 'Stmt_For'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php index d2c643205..0556a7ce5 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php @@ -1,4 +1,4 @@ - array(): Statements * @param array $attributes Additional attributes */ - public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); + public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; $this->expr = $expr; - $this->keyVar = isset($subNodes['keyVar']) ? $subNodes['keyVar'] : null; - $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; + $this->keyVar = $subNodes['keyVar'] ?? null; + $this->byRef = $subNodes['byRef'] ?? false; $this->valueVar = $valueVar; - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + $this->stmts = $subNodes['stmts'] ?? []; } - public function getSubNodeNames() { - return array('expr', 'keyVar', 'byRef', 'valueVar', 'stmts'); + public function getSubNodeNames() : array { + return ['expr', 'keyVar', 'byRef', 'valueVar', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Foreach'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php index 4c1f48d84..abb7ee5c8 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php @@ -1,4 +1,4 @@ - false : Whether to return by reference * 'params' => array(): Parameters * 'returnType' => null : Return type * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups * @param array $attributes Additional attributes */ - public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); - $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; - $this->name = $name; - $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); - $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null; - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->byRef = $subNodes['byRef'] ?? false; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->params = $subNodes['params'] ?? []; + $returnType = $subNodes['returnType'] ?? null; + $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() { - return array('byRef', 'name', 'params', 'returnType', 'stmts'); + public function getSubNodeNames() : array { + return ['attrGroups', 'byRef', 'name', 'params', 'returnType', 'stmts']; } - public function returnsByRef() { + public function returnsByRef() : bool { return $this->byRef; } - public function getParams() { + public function getParams() : array { return $this->params; } @@ -54,7 +62,16 @@ class Function_ extends Node\Stmt implements FunctionLike return $this->returnType; } - public function getStmts() { + public function getAttrGroups() : array { + return $this->attrGroups; + } + + /** @return Node\Stmt[] */ + public function getStmts() : array { return $this->stmts; } + + public function getType() : string { + return 'Stmt_Function'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php index 29fbc488e..a0022ad93 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() { - return array('vars'); + public function getSubNodeNames() : array { + return ['vars']; + } + + public function getType() : string { + return 'Stmt_Global'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php index b087fe02b..24a57f780 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php @@ -1,26 +1,31 @@ -name = $name; + public function __construct($name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() { - return array('name'); + public function getSubNodeNames() : array { + return ['name']; + } + + public function getType() : string { + return 'Stmt_Goto'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php index 30837dd6b..24520d223 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->type = $type; $this->prefix = $prefix; $this->uses = $uses; } - public function getSubNodeNames() { - return array('type', 'prefix', 'uses'); + public function getSubNodeNames() : array { + return ['type', 'prefix', 'uses']; + } + + public function getType() : string { + return 'Stmt_GroupUse'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php index c33ec9f1d..8e624e0f1 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->remaining = $remaining; } - public function getSubNodeNames() { - return array('remaining'); + public function getSubNodeNames() : array { + return ['remaining']; + } + + public function getType() : string { + return 'Stmt_HaltCompiler'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php index 98bda356f..a1bae4bf8 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php @@ -1,4 +1,4 @@ - null : Else clause * @param array $attributes Additional attributes */ - public function __construct(Node\Expr $cond, array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); + public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; $this->cond = $cond; - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); - $this->elseifs = isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array(); - $this->else = isset($subNodes['else']) ? $subNodes['else'] : null; + $this->stmts = $subNodes['stmts'] ?? []; + $this->elseifs = $subNodes['elseifs'] ?? []; + $this->else = $subNodes['else'] ?? null; } - public function getSubNodeNames() { - return array('cond', 'stmts', 'elseifs', 'else'); + public function getSubNodeNames() : array { + return ['cond', 'stmts', 'elseifs', 'else']; + } + + public function getType() : string { + return 'Stmt_If'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php index accebe61e..0711d2842 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->value = $value; } - public function getSubNodeNames() { - return array('value'); + public function getSubNodeNames() : array { + return ['value']; + } + + public function getType() : string { + return 'Stmt_InlineHTML'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php index efb5891fc..4d587dd48 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php @@ -1,4 +1,4 @@ - array(): Name of extended interfaces - * 'stmts' => array(): Statements + * 'extends' => array(): Name of extended interfaces + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups * @param array $attributes Additional attributes */ - public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); - $this->name = $name; - $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : array(); - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->extends = $subNodes['extends'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() { - return array('name', 'extends', 'stmts'); + public function getSubNodeNames() : array { + return ['attrGroups', 'name', 'extends', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Interface'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php index edd0ee9a5..3edcb3be7 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php @@ -1,26 +1,31 @@ -name = $name; + public function __construct($name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Identifier($name) : $name; } - public function getSubNodeNames() { - return array('name'); + public function getSubNodeNames() : array { + return ['name']; + } + + public function getType() : string { + return 'Stmt_Label'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php index 444855c39..c63204577 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->name = $name; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('name', 'stmts'); + public function getSubNodeNames() : array { + return ['name', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Namespace'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php index 270dd0995..f86f8df7d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->flags = $flags; - $this->type = $flags; $this->props = $props; + $this->type = \is_string($type) ? new Identifier($type) : $type; + $this->attrGroups = $attrGroups; } - public function getSubNodeNames() { - return array('flags', 'props'); + public function getSubNodeNames() : array { + return ['attrGroups', 'flags', 'type', 'props']; } - public function isPublic() { + /** + * Whether the property is explicitly or implicitly public. + * + * @return bool + */ + public function isPublic() : bool { return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; } - public function isProtected() { + /** + * Whether the property is protected. + * + * @return bool + */ + public function isProtected() : bool { return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); } - public function isPrivate() { + /** + * Whether the property is private. + * + * @return bool + */ + public function isPrivate() : bool { return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); } - public function isStatic() { + /** + * Whether the property is static. + * + * @return bool + */ + public function isStatic() : bool { return (bool) ($this->flags & Class_::MODIFIER_STATIC); } + + /** + * Whether the property is readonly. + * + * @return bool + */ + public function isReadonly() : bool { + return (bool) ($this->flags & Class_::MODIFIER_READONLY); + } + + public function getType() : string { + return 'Stmt_Property'; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php index b2d29dc77..205731e20 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php @@ -1,4 +1,4 @@ -name = $name; + public function __construct($name, Node\Expr $default = null, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; $this->default = $default; } - public function getSubNodeNames() { - return array('name', 'default'); + public function getSubNodeNames() : array { + return ['name', 'default']; + } + + public function getType() : string { + return 'Stmt_PropertyProperty'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php index b64284114..efc578c58 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Stmt_Return'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php index 4bc5dd25c..29584560d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php @@ -1,30 +1,37 @@ -name = $name; + public function __construct( + Expr\Variable $var, Node\Expr $default = null, array $attributes = [] + ) { + $this->attributes = $attributes; + $this->var = $var; $this->default = $default; } - public function getSubNodeNames() { - return array('name', 'default'); + public function getSubNodeNames() : array { + return ['var', 'default']; + } + + public function getType() : string { + return 'Stmt_StaticVar'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php index 37cc0b36f..464898ffa 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() { - return array('vars'); + public function getSubNodeNames() : array { + return ['vars']; + } + + public function getType() : string { + return 'Stmt_Static'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php index 72d667b1e..2c8dae022 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->cond = $cond; $this->cases = $cases; } - public function getSubNodeNames() { - return array('cond', 'cases'); + public function getSubNodeNames() : array { + return ['cond', 'cases']; + } + + public function getType() : string { + return 'Stmt_Switch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php index f8ff6aa38..a34e2b362 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->expr = $expr; } - public function getSubNodeNames() { - return array('expr'); + public function getSubNodeNames() : array { + return ['expr']; + } + + public function getType() : string { + return 'Stmt_Throw'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php index a29874bea..9e97053b4 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php @@ -1,10 +1,9 @@ -attributes = $attributes; $this->traits = $traits; $this->adaptations = $adaptations; } - public function getSubNodeNames() { - return array('traits', 'adaptations'); + public function getSubNodeNames() : array { + return ['traits', 'adaptations']; + } + + public function getType() : string { + return 'Stmt_TraitUse'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php index c6038c8ca..8bdd2c041 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->trait = $trait; - $this->method = $method; + $this->method = \is_string($method) ? new Node\Identifier($method) : $method; $this->newModifier = $newModifier; - $this->newName = $newName; + $this->newName = \is_string($newName) ? new Node\Identifier($newName) : $newName; } - public function getSubNodeNames() { - return array('trait', 'method', 'newModifier', 'newName'); + public function getSubNodeNames() : array { + return ['trait', 'method', 'newModifier', 'newName']; + } + + public function getType() : string { + return 'Stmt_TraitUseAdaptation_Alias'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php index 1f6bc1f98..80385f64e 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->trait = $trait; - $this->method = $method; + $this->method = \is_string($method) ? new Node\Identifier($method) : $method; $this->insteadof = $insteadof; } - public function getSubNodeNames() { - return array('trait', 'method', 'insteadof'); + public function getSubNodeNames() : array { + return ['trait', 'method', 'insteadof']; + } + + public function getType() : string { + return 'Stmt_TraitUseAdaptation_Precedence'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php index eed5844ae..0cec203ac 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php @@ -1,4 +1,4 @@ - array(): Statements + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups * @param array $attributes Additional attributes */ - public function __construct($name, array $subNodes = array(), array $attributes = array()) { - parent::__construct($attributes); - $this->name = $name; - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; } - public function getSubNodeNames() { - return array('name', 'stmts'); + public function getSubNodeNames() : array { + return ['attrGroups', 'name', 'stmts']; + } + + public function getType() : string { + return 'Stmt_Trait'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php index 0ff36cc77..7fc158c57 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->stmts = $stmts; $this->catches = $catches; $this->finally = $finally; } - public function getSubNodeNames() { - return array('stmts', 'catches', 'finally'); + public function getSubNodeNames() : array { + return ['stmts', 'catches', 'finally']; + } + + public function getType() : string { + return 'Stmt_TryCatch'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php index 0f00fe941..310e427aa 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->vars = $vars; } - public function getSubNodeNames() { - return array('vars'); + public function getSubNodeNames() : array { + return ['vars']; + } + + public function getType() : string { + return 'Stmt_Unset'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php index 2de8432d7..32bd7847d 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php @@ -1,8 +1,9 @@ -getLast(); - } - - parent::__construct($attributes); + public function __construct(Node\Name $name, $alias = null, int $type = Use_::TYPE_UNKNOWN, array $attributes = []) { + $this->attributes = $attributes; $this->type = $type; $this->name = $name; - $this->alias = $alias; + $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; } - public function getSubNodeNames() { - return array('type', 'name', 'alias'); + public function getSubNodeNames() : array { + return ['type', 'name', 'alias']; + } + + /** + * Get alias. If not explicitly given this is the last component of the used name. + * + * @return Identifier + */ + public function getAlias() : Identifier { + if (null !== $this->alias) { + return $this->alias; + } + + return new Identifier($this->name->getLast()); + } + + public function getType() : string { + return 'Stmt_UseUse'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php index 6c89ebb1b..8753da313 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->type = $type; $this->uses = $uses; } - public function getSubNodeNames() { - return array('type', 'uses'); + public function getSubNodeNames() : array { + return ['type', 'uses']; + } + + public function getType() : string { + return 'Stmt_Use'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php index afad1b259..f41034f8c 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +++ b/lib/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php @@ -1,4 +1,4 @@ -attributes = $attributes; $this->cond = $cond; $this->stmts = $stmts; } - public function getSubNodeNames() { - return array('cond', 'stmts'); + public function getSubNodeNames() : array { + return ['cond', 'stmts']; + } + + public function getType() : string { + return 'Stmt_While'; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/UnionType.php b/lib/nikic/php-parser/lib/PhpParser/Node/UnionType.php new file mode 100644 index 000000000..61c2d8106 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/UnionType.php @@ -0,0 +1,28 @@ +attributes = $attributes; + $this->types = $types; + } + + public function getSubNodeNames() : array { + return ['types']; + } + + public function getType() : string { + return 'UnionType'; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php b/lib/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php new file mode 100644 index 000000000..a30807a6d --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php @@ -0,0 +1,17 @@ +attributes = $attributes; + } + + public function getType(): string { + return 'VariadicPlaceholder'; + } + + public function getSubNodeNames(): array { + return []; + } +} \ No newline at end of file diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeAbstract.php b/lib/nikic/php-parser/lib/PhpParser/NodeAbstract.php index 1b757c7bc..04514da11 100644 --- a/lib/nikic/php-parser/lib/PhpParser/NodeAbstract.php +++ b/lib/nikic/php-parser/lib/PhpParser/NodeAbstract.php @@ -1,9 +1,7 @@ -attributes = $attributes; } /** - * Gets the type of the node. + * Gets line the node started in (alias of getStartLine). * - * @return string Type of the node + * @return int Start line (or -1 if not available) */ - public function getType() { - $className = rtrim(get_class($this), '_'); - return strtr( - substr($className, strlen(Node::class) + 1), - '\\', - '_' - ); + public function getLine() : int { + return $this->attributes['startLine'] ?? -1; } /** * Gets line the node started in. * - * @return int Line + * Requires the 'startLine' attribute to be enabled in the lexer (enabled by default). + * + * @return int Start line (or -1 if not available) */ - public function getLine() { - return $this->getAttribute('startLine', -1); + public function getStartLine() : int { + return $this->attributes['startLine'] ?? -1; } /** - * Sets line the node started in. + * Gets the line the node ended in. * - * @param int $line Line + * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default). * - * @deprecated + * @return int End line (or -1 if not available) */ - public function setLine($line) { - $this->setAttribute('startLine', (int) $line); + public function getEndLine() : int { + return $this->attributes['endLine'] ?? -1; + } + + /** + * Gets the token offset of the first token that is part of this node. + * + * The offset is an index into the array returned by Lexer::getTokens(). + * + * Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int Token start position (or -1 if not available) + */ + public function getStartTokenPos() : int { + return $this->attributes['startTokenPos'] ?? -1; + } + + /** + * Gets the token offset of the last token that is part of this node. + * + * The offset is an index into the array returned by Lexer::getTokens(). + * + * Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int Token end position (or -1 if not available) + */ + public function getEndTokenPos() : int { + return $this->attributes['endTokenPos'] ?? -1; + } + + /** + * Gets the file offset of the first character that is part of this node. + * + * Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int File start position (or -1 if not available) + */ + public function getStartFilePos() : int { + return $this->attributes['startFilePos'] ?? -1; + } + + /** + * Gets the file offset of the last character that is part of this node. + * + * Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int File end position (or -1 if not available) + */ + public function getEndFilePos() : int { + return $this->attributes['endFilePos'] ?? -1; + } + + /** + * Gets all comments directly preceding this node. + * + * The comments are also available through the "comments" attribute. + * + * @return Comment[] + */ + public function getComments() : array { + return $this->attributes['comments'] ?? []; } /** * Gets the doc comment of the node. * - * The doc comment has to be the last comment associated with the node. - * * @return null|Comment\Doc Doc comment object or null */ public function getDocComment() { - $comments = $this->getAttribute('comments'); - if (!$comments) { - return null; + $comments = $this->getComments(); + for ($i = count($comments) - 1; $i >= 0; $i--) { + $comment = $comments[$i]; + if ($comment instanceof Comment\Doc) { + return $comment; + } } - $lastComment = $comments[count($comments) - 1]; - if (!$lastComment instanceof Comment\Doc) { - return null; - } - - return $lastComment; + return null; } /** @@ -80,41 +130,49 @@ abstract class NodeAbstract implements Node, \JsonSerializable * @param Comment\Doc $docComment Doc comment to set */ public function setDocComment(Comment\Doc $docComment) { - $comments = $this->getAttribute('comments', []); - - $numComments = count($comments); - if ($numComments > 0 && $comments[$numComments - 1] instanceof Comment\Doc) { - // Replace existing doc comment - $comments[$numComments - 1] = $docComment; - } else { - // Append new comment - $comments[] = $docComment; + $comments = $this->getComments(); + for ($i = count($comments) - 1; $i >= 0; $i--) { + if ($comments[$i] instanceof Comment\Doc) { + // Replace existing doc comment. + $comments[$i] = $docComment; + $this->setAttribute('comments', $comments); + return; + } } + // Append new doc comment. + $comments[] = $docComment; $this->setAttribute('comments', $comments); } - public function setAttribute($key, $value) { + public function setAttribute(string $key, $value) { $this->attributes[$key] = $value; } - public function hasAttribute($key) { + public function hasAttribute(string $key) : bool { return array_key_exists($key, $this->attributes); } - public function &getAttribute($key, $default = null) { - if (!array_key_exists($key, $this->attributes)) { - return $default; - } else { + public function getAttribute(string $key, $default = null) { + if (array_key_exists($key, $this->attributes)) { return $this->attributes[$key]; } + + return $default; } - public function getAttributes() { + public function getAttributes() : array { return $this->attributes; } - public function jsonSerialize() { + public function setAttributes(array $attributes) { + $this->attributes = $attributes; + } + + /** + * @return array + */ + public function jsonSerialize() : array { return ['nodeType' => $this->getType()] + get_object_vars($this); } } diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeDumper.php b/lib/nikic/php-parser/lib/PhpParser/NodeDumper.php index 9946eb853..ba622efd1 100644 --- a/lib/nikic/php-parser/lib/PhpParser/NodeDumper.php +++ b/lib/nikic/php-parser/lib/PhpParser/NodeDumper.php @@ -1,4 +1,4 @@ -code = $code; return $this->dumpRecursive($node); } @@ -65,9 +65,9 @@ class NodeDumper } elseif (is_scalar($value)) { if ('flags' === $key || 'newModifier' === $key) { $r .= $this->dumpFlags($value); - } else if ('type' === $key && $node instanceof Include_) { + } elseif ('type' === $key && $node instanceof Include_) { $r .= $this->dumpIncludeType($value); - } else if ('type' === $key + } elseif ('type' === $key && ($node instanceof Use_ || $node instanceof UseUse || $node instanceof GroupUse)) { $r .= $this->dumpUseType($value); } else { @@ -78,7 +78,7 @@ class NodeDumper } } - if ($this->dumpComments && $comments = $node->getAttribute('comments')) { + if ($this->dumpComments && $comments = $node->getComments()) { $r .= "\n comments: " . str_replace("\n", "\n ", $this->dumpRecursive($comments)); } } elseif (is_array($node)) { @@ -128,6 +128,9 @@ class NodeDumper if ($flags & Class_::MODIFIER_FINAL) { $strs[] = 'MODIFIER_FINAL'; } + if ($flags & Class_::MODIFIER_READONLY) { + $strs[] = 'MODIFIER_READONLY'; + } if ($strs) { return implode(' | ', $strs) . ' (' . $flags . ')'; @@ -141,7 +144,7 @@ class NodeDumper Include_::TYPE_INCLUDE => 'TYPE_INCLUDE', Include_::TYPE_INCLUDE_ONCE => 'TYPE_INCLUDE_ONCE', Include_::TYPE_REQUIRE => 'TYPE_REQUIRE', - Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQURE_ONCE', + Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQUIRE_ONCE', ]; if (!isset($map[$type])) { @@ -164,18 +167,25 @@ class NodeDumper return $map[$type] . ' (' . $type . ')'; } + /** + * Dump node position, if possible. + * + * @param Node $node Node for which to dump position + * + * @return string|null Dump of position, or null if position information not available + */ protected function dumpPosition(Node $node) { if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) { return null; } - $start = $node->getAttribute('startLine'); - $end = $node->getAttribute('endLine'); + $start = $node->getStartLine(); + $end = $node->getEndLine(); if ($node->hasAttribute('startFilePos') && $node->hasAttribute('endFilePos') && null !== $this->code ) { - $start .= ':' . $this->toColumn($this->code, $node->getAttribute('startFilePos')); - $end .= ':' . $this->toColumn($this->code, $node->getAttribute('endFilePos')); + $start .= ':' . $this->toColumn($this->code, $node->getStartFilePos()); + $end .= ':' . $this->toColumn($this->code, $node->getEndFilePos()); } return "[$start - $end]"; } diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeFinder.php b/lib/nikic/php-parser/lib/PhpParser/NodeFinder.php new file mode 100644 index 000000000..2e7cfdad4 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/NodeFinder.php @@ -0,0 +1,81 @@ +addVisitor($visitor); + $traverser->traverse($nodes); + + return $visitor->getFoundNodes(); + } + + /** + * Find all nodes that are instances of a certain class. + * + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param string $class Class name + * + * @return Node[] Found nodes (all instances of $class) + */ + public function findInstanceOf($nodes, string $class) : array { + return $this->find($nodes, function ($node) use ($class) { + return $node instanceof $class; + }); + } + + /** + * Find first node satisfying a filter callback. + * + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param callable $filter Filter callback: function(Node $node) : bool + * + * @return null|Node Found node (or null if none found) + */ + public function findFirst($nodes, callable $filter) { + if (!is_array($nodes)) { + $nodes = [$nodes]; + } + + $visitor = new FirstFindingVisitor($filter); + + $traverser = new NodeTraverser; + $traverser->addVisitor($visitor); + $traverser->traverse($nodes); + + return $visitor->getFoundNode(); + } + + /** + * Find first node that is an instance of a certain class. + * + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param string $class Class name + * + * @return null|Node Found node, which is an instance of $class (or null if none found) + */ + public function findFirstInstanceOf($nodes, string $class) { + return $this->findFirst($nodes, function ($node) use ($class) { + return $node instanceof $class; + }); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeTraverser.php b/lib/nikic/php-parser/lib/PhpParser/NodeTraverser.php index cce43d926..97d45bdaa 100644 --- a/lib/nikic/php-parser/lib/PhpParser/NodeTraverser.php +++ b/lib/nikic/php-parser/lib/PhpParser/NodeTraverser.php @@ -1,4 +1,4 @@ -visitors = array(); + // for BC } /** @@ -73,7 +79,7 @@ class NodeTraverser implements NodeTraverserInterface * * @return Node[] Traversed array of nodes */ - public function traverse(array $nodes) { + public function traverse(array $nodes) : array { $this->stopTraversal = false; foreach ($this->visitors as $visitor) { @@ -93,26 +99,46 @@ class NodeTraverser implements NodeTraverserInterface return $nodes; } - protected function traverseNode(Node $node) { + /** + * Recursively traverse a node. + * + * @param Node $node Node to traverse. + * + * @return Node Result of traversal (may be original node or new one) + */ + protected function traverseNode(Node $node) : Node { foreach ($node->getSubNodeNames() as $name) { $subNode =& $node->$name; - if (is_array($subNode)) { + if (\is_array($subNode)) { $subNode = $this->traverseArray($subNode); if ($this->stopTraversal) { break; } } elseif ($subNode instanceof Node) { $traverseChildren = true; - foreach ($this->visitors as $visitor) { + $breakVisitorIndex = null; + + foreach ($this->visitors as $visitorIndex => $visitor) { $return = $visitor->enterNode($subNode); - if (self::DONT_TRAVERSE_CHILDREN === $return) { - $traverseChildren = false; - } else if (self::STOP_TRAVERSAL === $return) { - $this->stopTraversal = true; - break 2; - } else if (null !== $return) { - $subNode = $return; + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($subNode, $return); + $subNode = $return; + } elseif (self::DONT_TRAVERSE_CHILDREN === $return) { + $traverseChildren = false; + } elseif (self::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { + $traverseChildren = false; + $breakVisitorIndex = $visitorIndex; + break; + } elseif (self::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } else { + throw new \LogicException( + 'enterNode() returned invalid value of type ' . gettype($return) + ); + } } } @@ -123,19 +149,30 @@ class NodeTraverser implements NodeTraverserInterface } } - foreach ($this->visitors as $visitor) { + foreach ($this->visitors as $visitorIndex => $visitor) { $return = $visitor->leaveNode($subNode); - if (self::STOP_TRAVERSAL === $return) { - $this->stopTraversal = true; - break 2; - } else if (null !== $return) { - if (is_array($return)) { + + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($subNode, $return); + $subNode = $return; + } elseif (self::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } elseif (\is_array($return)) { throw new \LogicException( 'leaveNode() may only return an array ' . 'if the parent structure is an array' ); + } else { + throw new \LogicException( + 'leaveNode() returned invalid value of type ' . gettype($return) + ); } - $subNode = $return; + } + + if ($breakVisitorIndex === $visitorIndex) { + break; } } } @@ -144,26 +181,41 @@ class NodeTraverser implements NodeTraverserInterface return $node; } - protected function traverseArray(array $nodes) { - $doNodes = array(); + /** + * Recursively traverse array (usually of nodes). + * + * @param array $nodes Array to traverse + * + * @return array Result of traversal (may be original array or changed one) + */ + protected function traverseArray(array $nodes) : array { + $doNodes = []; foreach ($nodes as $i => &$node) { - if (is_array($node)) { - $node = $this->traverseArray($node); - if ($this->stopTraversal) { - break; - } - } elseif ($node instanceof Node) { + if ($node instanceof Node) { $traverseChildren = true; - foreach ($this->visitors as $visitor) { + $breakVisitorIndex = null; + + foreach ($this->visitors as $visitorIndex => $visitor) { $return = $visitor->enterNode($node); - if (self::DONT_TRAVERSE_CHILDREN === $return) { - $traverseChildren = false; - } else if (self::STOP_TRAVERSAL === $return) { - $this->stopTraversal = true; - break 2; - } else if (null !== $return) { - $node = $return; + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($node, $return); + $node = $return; + } elseif (self::DONT_TRAVERSE_CHILDREN === $return) { + $traverseChildren = false; + } elseif (self::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { + $traverseChildren = false; + $breakVisitorIndex = $visitorIndex; + break; + } elseif (self::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } else { + throw new \LogicException( + 'enterNode() returned invalid value of type ' . gettype($return) + ); + } } } @@ -174,22 +226,40 @@ class NodeTraverser implements NodeTraverserInterface } } - foreach ($this->visitors as $visitor) { + foreach ($this->visitors as $visitorIndex => $visitor) { $return = $visitor->leaveNode($node); - if (self::REMOVE_NODE === $return) { - $doNodes[] = array($i, array()); + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($node, $return); + $node = $return; + } elseif (\is_array($return)) { + $doNodes[] = [$i, $return]; + break; + } elseif (self::REMOVE_NODE === $return) { + $doNodes[] = [$i, []]; + break; + } elseif (self::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } elseif (false === $return) { + throw new \LogicException( + 'bool(false) return from leaveNode() no longer supported. ' . + 'Return NodeTraverser::REMOVE_NODE instead' + ); + } else { + throw new \LogicException( + 'leaveNode() returned invalid value of type ' . gettype($return) + ); + } + } + + if ($breakVisitorIndex === $visitorIndex) { break; - } else if (self::STOP_TRAVERSAL === $return) { - $this->stopTraversal = true; - break 2; - } elseif (is_array($return)) { - $doNodes[] = array($i, $return); - break; - } elseif (null !== $return) { - $node = $return; } } + } elseif (\is_array($node)) { + throw new \LogicException('Invalid node structure: Contains nested arrays'); } } @@ -201,4 +271,21 @@ class NodeTraverser implements NodeTraverserInterface return $nodes; } + + private function ensureReplacementReasonable($old, $new) { + if ($old instanceof Node\Stmt && $new instanceof Node\Expr) { + throw new \LogicException( + "Trying to replace statement ({$old->getType()}) " . + "with expression ({$new->getType()}). Are you missing a " . + "Stmt_Expression wrapper?" + ); + } + + if ($old instanceof Node\Expr && $new instanceof Node\Stmt) { + throw new \LogicException( + "Trying to replace expression ({$old->getType()}) " . + "with statement ({$new->getType()})" + ); + } + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php b/lib/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php index 0f88e4671..77ff3d27f 100644 --- a/lib/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php +++ b/lib/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php @@ -1,4 +1,4 @@ -setAttribute('origNode', $origNode); + return $node; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php new file mode 100644 index 000000000..9531edbce --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php @@ -0,0 +1,48 @@ +filterCallback = $filterCallback; + } + + /** + * Get found nodes satisfying the filter callback. + * + * Nodes are returned in pre-order. + * + * @return Node[] Found nodes + */ + public function getFoundNodes() : array { + return $this->foundNodes; + } + + public function beforeTraverse(array $nodes) { + $this->foundNodes = []; + + return null; + } + + public function enterNode(Node $node) { + $filterCallback = $this->filterCallback; + if ($filterCallback($node)) { + $this->foundNodes[] = $node; + } + + return null; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php new file mode 100644 index 000000000..596a7d7fd --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php @@ -0,0 +1,50 @@ +filterCallback = $filterCallback; + } + + /** + * Get found node satisfying the filter callback. + * + * Returns null if no node satisfies the filter callback. + * + * @return null|Node Found node (or null if not found) + */ + public function getFoundNode() { + return $this->foundNode; + } + + public function beforeTraverse(array $nodes) { + $this->foundNode = null; + + return null; + } + + public function enterNode(Node $node) { + $filterCallback = $this->filterCallback; + if ($filterCallback($node)) { + $this->foundNode = $node; + return NodeTraverser::STOP_TRAVERSAL; + } + + return null; + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php index d56812bcc..8e259c57b 100644 --- a/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +++ b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php @@ -1,9 +1,9 @@ - [aliasName => originalName]] */ - protected $aliases; - - /** @var ErrorHandler Error handler */ - protected $errorHandler; + /** @var NameContext Naming context */ + protected $nameContext; /** @var bool Whether to preserve original names */ protected $preserveOriginalNames; + /** @var bool Whether to replace resolved nodes in place, or to add resolvedNode attributes */ + protected $replaceNodes; + /** * Constructs a name resolution visitor. * - * Options: If "preserveOriginalNames" is enabled, an "originalName" attribute will be added to - * all name nodes that underwent resolution. + * Options: + * * preserveOriginalNames (default false): An "originalName" attribute will be added to + * all name nodes that underwent resolution. + * * replaceNodes (default true): Resolved names are replaced in-place. Otherwise, a + * resolvedName attribute is added. (Names that cannot be statically resolved receive a + * namespacedName attribute, as usual.) * * @param ErrorHandler|null $errorHandler Error handler * @param array $options Options */ public function __construct(ErrorHandler $errorHandler = null, array $options = []) { - $this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing; - $this->preserveOriginalNames = !empty($options['preserveOriginalNames']); + $this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing); + $this->preserveOriginalNames = $options['preserveOriginalNames'] ?? false; + $this->replaceNodes = $options['replaceNodes'] ?? true; + } + + /** + * Get name resolution context. + * + * @return NameContext + */ + public function getNameContext() : NameContext { + return $this->nameContext; } public function beforeTraverse(array $nodes) { - $this->resetState(); + $this->nameContext->startNamespace(); + return null; } public function enterNode(Node $node) { if ($node instanceof Stmt\Namespace_) { - $this->resetState($node->name); + $this->nameContext->startNamespace($node->name); } elseif ($node instanceof Stmt\Use_) { foreach ($node->uses as $use) { $this->addAlias($use, $node->type, null); @@ -63,6 +75,7 @@ class NameResolver extends NodeVisitorAbstract $interface = $this->resolveClassName($interface); } + $this->resolveAttrGroups($node); if (null !== $node->name) { $this->addNamespacedName($node); } @@ -71,20 +84,43 @@ class NameResolver extends NodeVisitorAbstract $interface = $this->resolveClassName($interface); } + $this->resolveAttrGroups($node); $this->addNamespacedName($node); + } elseif ($node instanceof Stmt\Enum_) { + foreach ($node->implements as &$interface) { + $interface = $this->resolveClassName($interface); + } + + $this->resolveAttrGroups($node); + if (null !== $node->name) { + $this->addNamespacedName($node); + } } elseif ($node instanceof Stmt\Trait_) { + $this->resolveAttrGroups($node); $this->addNamespacedName($node); } elseif ($node instanceof Stmt\Function_) { - $this->addNamespacedName($node); $this->resolveSignature($node); + $this->resolveAttrGroups($node); + $this->addNamespacedName($node); } elseif ($node instanceof Stmt\ClassMethod || $node instanceof Expr\Closure + || $node instanceof Expr\ArrowFunction ) { $this->resolveSignature($node); + $this->resolveAttrGroups($node); + } elseif ($node instanceof Stmt\Property) { + if (null !== $node->type) { + $node->type = $this->resolveType($node->type); + } + $this->resolveAttrGroups($node); } elseif ($node instanceof Stmt\Const_) { foreach ($node->consts as $const) { $this->addNamespacedName($const); } + } else if ($node instanceof Stmt\ClassConst) { + $this->resolveAttrGroups($node); + } else if ($node instanceof Stmt\EnumCase) { + $this->resolveAttrGroups($node); } elseif ($node instanceof Expr\StaticCall || $node instanceof Expr\StaticPropertyFetch || $node instanceof Expr\ClassConstFetch @@ -100,10 +136,10 @@ class NameResolver extends NodeVisitorAbstract } } elseif ($node instanceof Expr\FuncCall) { if ($node->name instanceof Name) { - $node->name = $this->resolveOtherName($node->name, Stmt\Use_::TYPE_FUNCTION); + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_FUNCTION); } } elseif ($node instanceof Expr\ConstFetch) { - $node->name = $this->resolveOtherName($node->name, Stmt\Use_::TYPE_CONSTANT); + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_CONSTANT); } elseif ($node instanceof Stmt\TraitUse) { foreach ($node->traits as &$trait) { $trait = $this->resolveClassName($trait); @@ -121,70 +157,67 @@ class NameResolver extends NodeVisitorAbstract } } } + + return null; } - protected function resetState(Name $namespace = null) { - $this->namespace = $namespace; - $this->aliases = array( - Stmt\Use_::TYPE_NORMAL => array(), - Stmt\Use_::TYPE_FUNCTION => array(), - Stmt\Use_::TYPE_CONSTANT => array(), - ); - } - - protected function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) { + private function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) { // Add prefix for group uses $name = $prefix ? Name::concat($prefix, $use->name) : $use->name; // Type is determined either by individual element or whole use declaration $type |= $use->type; - // Constant names are case sensitive, everything else case insensitive - if ($type === Stmt\Use_::TYPE_CONSTANT) { - $aliasName = $use->alias; - } else { - $aliasName = strtolower($use->alias); - } - - if (isset($this->aliases[$type][$aliasName])) { - $typeStringMap = array( - Stmt\Use_::TYPE_NORMAL => '', - Stmt\Use_::TYPE_FUNCTION => 'function ', - Stmt\Use_::TYPE_CONSTANT => 'const ', - ); - - $this->errorHandler->handleError(new Error( - sprintf( - 'Cannot use %s%s as %s because the name is already in use', - $typeStringMap[$type], $name, $use->alias - ), - $use->getAttributes() - )); - return; - } - - $this->aliases[$type][$aliasName] = $name; + $this->nameContext->addAlias( + $name, (string) $use->getAlias(), $type, $use->getAttributes() + ); } /** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure $node */ private function resolveSignature($node) { foreach ($node->params as $param) { $param->type = $this->resolveType($param->type); + $this->resolveAttrGroups($param); } $node->returnType = $this->resolveType($node->returnType); } private function resolveType($node) { + if ($node instanceof Name) { + return $this->resolveClassName($node); + } if ($node instanceof Node\NullableType) { $node->type = $this->resolveType($node->type); return $node; } - if ($node instanceof Name) { - return $this->resolveClassName($node); + if ($node instanceof Node\UnionType || $node instanceof Node\IntersectionType) { + foreach ($node->types as &$type) { + $type = $this->resolveType($type); + } + return $node; } return $node; } - protected function resolveClassName(Name $name) { + /** + * Resolve name, according to name resolver options. + * + * @param Name $name Function or constant name to resolve + * @param int $type One of Stmt\Use_::TYPE_* + * + * @return Name Resolved name, or original name with attribute + */ + protected function resolveName(Name $name, int $type) : Name { + if (!$this->replaceNodes) { + $resolvedName = $this->nameContext->getResolvedName($name, $type); + if (null !== $resolvedName) { + $name->setAttribute('resolvedName', $resolvedName); + } else { + $name->setAttribute('namespacedName', FullyQualified::concat( + $this->nameContext->getNamespace(), $name, $name->getAttributes())); + } + return $name; + } + if ($this->preserveOriginalNames) { // Save the original name $originalName = $name; @@ -192,81 +225,33 @@ class NameResolver extends NodeVisitorAbstract $name->setAttribute('originalName', $originalName); } - // don't resolve special class names - if (in_array(strtolower($name->toString()), array('self', 'parent', 'static'))) { - if (!$name->isUnqualified()) { - $this->errorHandler->handleError(new Error( - sprintf("'\\%s' is an invalid class name", $name->toString()), - $name->getAttributes() - )); - } - return $name; + $resolvedName = $this->nameContext->getResolvedName($name, $type); + if (null !== $resolvedName) { + return $resolvedName; } - // fully qualified names are already resolved - if ($name->isFullyQualified()) { - return $name; - } - - $aliasName = strtolower($name->getFirst()); - if (!$name->isRelative() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) { - // resolve aliases (for non-relative names) - $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName]; - return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes()); - } - - // if no alias exists prepend current namespace - return FullyQualified::concat($this->namespace, $name, $name->getAttributes()); + // unqualified names inside a namespace cannot be resolved at compile-time + // add the namespaced version of the name as an attribute + $name->setAttribute('namespacedName', FullyQualified::concat( + $this->nameContext->getNamespace(), $name, $name->getAttributes())); + return $name; } - protected function resolveOtherName(Name $name, $type) { - if ($this->preserveOriginalNames) { - // Save the original name - $originalName = $name; - $name = clone $originalName; - $name->setAttribute('originalName', $originalName); - } - - // fully qualified names are already resolved - if ($name->isFullyQualified()) { - return $name; - } - - // resolve aliases for qualified names - $aliasName = strtolower($name->getFirst()); - if ($name->isQualified() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) { - $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName]; - return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes()); - } - - if ($name->isUnqualified()) { - if ($type === Stmt\Use_::TYPE_CONSTANT) { - // constant aliases are case-sensitive, function aliases case-insensitive - $aliasName = $name->getFirst(); - } - - if (isset($this->aliases[$type][$aliasName])) { - // resolve unqualified aliases - return new FullyQualified($this->aliases[$type][$aliasName], $name->getAttributes()); - } - - if (null === $this->namespace) { - // outside of a namespace unaliased unqualified is same as fully qualified - return new FullyQualified($name, $name->getAttributes()); - } - - // unqualified names inside a namespace cannot be resolved at compile-time - // add the namespaced version of the name as an attribute - $name->setAttribute('namespacedName', - FullyQualified::concat($this->namespace, $name, $name->getAttributes())); - return $name; - } - - // if no alias exists prepend current namespace - return FullyQualified::concat($this->namespace, $name, $name->getAttributes()); + protected function resolveClassName(Name $name) { + return $this->resolveName($name, Stmt\Use_::TYPE_NORMAL); } protected function addNamespacedName(Node $node) { - $node->namespacedName = Name::concat($this->namespace, $node->name); + $node->namespacedName = Name::concat( + $this->nameContext->getNamespace(), (string) $node->name); + } + + protected function resolveAttrGroups(Node $node) + { + foreach ($node->attrGroups as $attrGroup) { + foreach ($attrGroup->attrs as $attr) { + $attr->name = $this->resolveClassName($attr->name); + } + } } } diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php new file mode 100644 index 000000000..ea372e5b9 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php @@ -0,0 +1,52 @@ +$node->getAttribute('parent'), the previous + * node can be accessed through $node->getAttribute('previous'), + * and the next node can be accessed through $node->getAttribute('next'). + */ +final class NodeConnectingVisitor extends NodeVisitorAbstract +{ + /** + * @var Node[] + */ + private $stack = []; + + /** + * @var ?Node + */ + private $previous; + + public function beforeTraverse(array $nodes) { + $this->stack = []; + $this->previous = null; + } + + public function enterNode(Node $node) { + if (!empty($this->stack)) { + $node->setAttribute('parent', $this->stack[count($this->stack) - 1]); + } + + if ($this->previous !== null && $this->previous->getAttribute('parent') === $node->getAttribute('parent')) { + $node->setAttribute('previous', $this->previous); + $this->previous->setAttribute('next', $node); + } + + $this->stack[] = $node; + } + + public function leaveNode(Node $node) { + $this->previous = $node; + + array_pop($this->stack); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php new file mode 100644 index 000000000..b98d2bfa6 --- /dev/null +++ b/lib/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php @@ -0,0 +1,41 @@ +$node->getAttribute('parent'). + */ +final class ParentConnectingVisitor extends NodeVisitorAbstract +{ + /** + * @var Node[] + */ + private $stack = []; + + public function beforeTraverse(array $nodes) + { + $this->stack = []; + } + + public function enterNode(Node $node) + { + if (!empty($this->stack)) { + $node->setAttribute('parent', $this->stack[count($this->stack) - 1]); + } + + $this->stack[] = $node; + } + + public function leaveNode(Node $node) + { + array_pop($this->stack); + } +} diff --git a/lib/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php b/lib/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php index 3e1743a74..d378d6709 100644 --- a/lib/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php +++ b/lib/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php @@ -1,4 +1,4 @@ -parsers = $parsers; } - public function parse($code, ErrorHandler $errorHandler = null) { + public function parse(string $code, ErrorHandler $errorHandler = null) { if (null === $errorHandler) { $errorHandler = new ErrorHandler\Throwing; } diff --git a/lib/nikic/php-parser/lib/PhpParser/Parser/Php5.php b/lib/nikic/php-parser/lib/PhpParser/Parser/Php5.php index 4fbddaa70..c62adfd2c 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Parser/Php5.php +++ b/lib/nikic/php-parser/lib/PhpParser/Parser/Php5.php @@ -17,21 +17,22 @@ use PhpParser\Node\Stmt; */ class Php5 extends \PhpParser\ParserAbstract { - protected $tokenToSymbolMapSize = 392; - protected $actionTableSize = 1077; - protected $gotoTableSize = 591; + protected $tokenToSymbolMapSize = 396; + protected $actionTableSize = 1093; + protected $gotoTableSize = 643; - protected $invalidSymbol = 157; + protected $invalidSymbol = 168; protected $errorSymbol = 1; protected $defaultAction = -32766; protected $unexpectedTokenRule = 32767; - protected $YY2TBLSTATE = 407; - protected $YYNLSTATES = 669; + protected $YY2TBLSTATE = 415; + protected $numNonLeafStates = 662; protected $symbolToName = array( "EOF", "error", + "T_THROW", "T_INCLUDE", "T_INCLUDE_ONCE", "T_EVAL", @@ -58,6 +59,7 @@ class Php5 extends \PhpParser\ParserAbstract "T_SL_EQUAL", "T_SR_EQUAL", "T_POW_EQUAL", + "T_COALESCE_EQUAL", "'?'", "':'", "T_COALESCE", @@ -65,7 +67,8 @@ class Php5 extends \PhpParser\ParserAbstract "T_BOOLEAN_AND", "'|'", "'^'", - "'&'", + "T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG", + "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG", "T_IS_EQUAL", "T_IS_NOT_EQUAL", "T_IS_IDENTICAL", @@ -126,6 +129,7 @@ class Php5 extends \PhpParser\ParserAbstract "T_ENDDECLARE", "T_AS", "T_SWITCH", + "T_MATCH", "T_ENDSWITCH", "T_CASE", "T_DEFAULT", @@ -133,12 +137,12 @@ class Php5 extends \PhpParser\ParserAbstract "T_CONTINUE", "T_GOTO", "T_FUNCTION", + "T_FN", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH", "T_FINALLY", - "T_THROW", "T_USE", "T_INSTEADOF", "T_GLOBAL", @@ -178,6 +182,9 @@ class Php5 extends \PhpParser\ParserAbstract "T_DIR", "T_NS_SEPARATOR", "T_ELLIPSIS", + "T_NAME_FULLY_QUALIFIED", + "T_NAME_QUALIFIED", + "T_NAME_RELATIVE", "';'", "'{'", "'}'", @@ -186,671 +193,693 @@ class Php5 extends \PhpParser\ParserAbstract "'$'", "'`'", "']'", - "'\"'" + "'\"'", + "T_READONLY", + "T_ENUM", + "T_NULLSAFE_OBJECT_OPERATOR", + "T_ATTRIBUTE" ); protected $tokenToSymbol = array( - 0, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 53, 156, 157, 153, 52, 35, 157, - 151, 152, 50, 47, 7, 48, 49, 51, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 29, 148, - 41, 15, 43, 28, 65, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 67, 157, 155, 34, 157, 154, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 149, 33, 150, 55, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 1, 2, 3, 4, - 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, + 0, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 56, 163, 168, 160, 55, 168, 168, + 158, 159, 53, 50, 8, 51, 52, 54, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 31, 155, + 44, 16, 46, 30, 68, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 70, 168, 162, 36, 168, 161, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 156, 35, 157, 58, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 1, 2, 3, 4, + 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 30, 31, 32, 36, 37, 38, 39, 40, 42, - 44, 45, 46, 54, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 66, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 157, 157, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, + 41, 42, 43, 45, 47, 48, 49, 57, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 164, + 122, 123, 124, 125, 126, 127, 128, 129, 165, 130, + 131, 132, 166, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 167 + ); + + protected $action = array( + 699, 669, 670, 671, 672, 673, 286, 674, 675, 676, + 712, 713, 223, 224, 225, 226, 227, 228, 229, 230, + 231, 232, 0, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244,-32766,-32766,-32766,-32766,-32766, + -32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767, 245, 246, + 242, 243, 244,-32766,-32766, 677,-32766, 750,-32766,-32766, + -32766,-32766,-32766,-32766,-32766, 1224, 245, 246, 1225, 678, + 679, 680, 681, 682, 683, 684,-32766, 48, 746,-32766, + -32766,-32766,-32766,-32766,-32766, 685, 686, 687, 688, 689, + 690, 691, 692, 693, 694, 695, 715, 738, 716, 717, + 718, 719, 707, 708, 709, 737, 710, 711, 696, 697, + 698, 700, 701, 702, 740, 741, 742, 743, 744, 745, + 703, 704, 705, 706, 736, 727, 725, 726, 722, 723, + 751, 714, 720, 721, 728, 729, 731, 730, 732, 733, + 55, 56, 425, 57, 58, 724, 735, 734, 1073, 59, + 60, -224, 61,-32766,-32766,-32766,-32766,-32766,-32766,-32766, + -32766,-32766,-32766, 121,-32767,-32767,-32767,-32767, 29, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 1043, 766, 1071, 767, 580, 62, 63,-32766, + -32766,-32766,-32766, 64, 516, 65, 294, 295, 66, 67, + 68, 69, 70, 71, 72, 73, 822, 25, 302, 74, + 418, 981, 983, 1043, 1181, 1095, 1096, 1073, 748, 754, + 1075, 1074, 1076, 469,-32766,-32766,-32766, 337, 823, 54, + -32767,-32767,-32767,-32767, 98, 99, 100, 101, 102, 220, + 221, 222, 78, 361, 1107,-32766, 341,-32766,-32766,-32766, + -32766,-32766, 1107, 492, 949, 950, 951, 948, 947, 946, + 207, 477, 478, 949, 950, 951, 948, 947, 946, 1043, + 479, 480, 52, 1101, 1102, 1103, 1104, 1098, 1099, 319, + 872, 668, 667, 27, -511, 1105, 1100,-32766, 130, 1075, + 1074, 1076, 345, 668, 667, 41, 126, 341, 334, 369, + 336, 426, -128, -128, -128, 896, 897, 468, 220, 221, + 222, 811, 1195, 619, 40, 21, 427, -128, 470, -128, + 471, -128, 472, -128, 802, 428, -4, 823, 54, 207, + 33, 34, 429, 360, 317, 28, 35, 473,-32766,-32766, + -32766, 211, 356, 357, 474, 475,-32766,-32766,-32766, 754, + 476, 49, 313, 794, 843, 430, 431, 289, 125,-32766, + 813,-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767, + -32767,-32767,-32767,-32766,-32766,-32766, 769, 103, 104, 105, + 327, 307, 825, 633, -128, 1075, 1074, 1076, 221, 222, + 927, 748, 1146, 106,-32766, 129,-32766,-32766,-32766,-32766, + 426, 823, 54, 902, 873, 302, 468, 75, 207, 359, + 811, 668, 667, 40, 21, 427, 754, 470, 754, 471, + 423, 472, 1043, 127, 428, 435, 1043, 341, 1043, 33, + 34, 429, 360, 1181, 415, 35, 473, 122, 10, 315, + 128, 356, 357, 474, 475,-32766,-32766,-32766, 768, 476, + 668, 667, 758, 843, 430, 431, 754, 1043, 1147,-32766, + -32766,-32766, 754, 419, 342, 1215,-32766, 131,-32766,-32766, + -32766, 341, 363, 346, 426, 823, 54, 100, 101, 102, + 468, 825, 633, -4, 811, 442, 903, 40, 21, 427, + 754, 470, 435, 471, 341, 472, 341, 766, 428, 767, + -209, -209, -209, 33, 34, 429, 360, 479, 1196, 35, + 473, 345,-32766,-32766,-32766, 356, 357, 474, 475, 220, + 221, 222, 421, 476, 32, 297, 794, 843, 430, 431, + 754, 754, 435,-32766, 341,-32766,-32766, 9, 300, 51, + 207, 249, 324, 753, 120, 220, 221, 222, 426, 30, + 247, 941, 422, 424, 468, 825, 633, -209, 811, 1043, + 1061, 40, 21, 427, 129, 470, 207, 471, 341, 472, + 804, 20, 428, 124, -208, -208, -208, 33, 34, 429, + 360, 479, 212, 35, 473, 923, -259, 823, 54, 356, + 357, 474, 475,-32766,-32766,-32766, 1043, 476, 213, 806, + 794, 843, 430, 431,-32766,-32766, 435, 435, 341, 341, + 443, 79, 80, 81,-32766, 668, 667, 636, 344, 808, + 668, 667, 239, 240, 241, 123, 214, 538, 250, 825, + 633, -208, 36, 251, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 252, 307, + 426, 220, 221, 222, 823, 54, 468,-32766, 222, 765, + 811, 106, 134, 40, 21, 427, 571, 470, 207, 471, + 445, 472, 207,-32766, 428, 896, 897, 207, 307, 33, + 34, 429, 245, 246, 637, 35, 473, 452, 22, 809, + 922, 356, 357, 457, 588, 135, 374, 595, 596, 476, + -228, 759, 639, 938, 653, 926, 661, -86, 823, 54, + 314, 644, 647, 821, 133, 836, 43, 106, 603, 44, + 45, 46, 47, 748, 50, 53, 132, 426, 302,-32766, + 520, 825, 633, 468, -84, 607, 577, 811, 641, 362, + 40, 21, 427, -278, 470, 754, 471, 954, 472, 441, + 627, 428, 823, 54, 574, 844, 33, 34, 429, 11, + 615, 845, 35, 473, 444, 461, 285, -511, 356, 357, + 592, -419, 593, 1106, 1153, -410, 476, 368, 838, 38, + 658, 426, 645, 795, 1052, 0, 325, 468, 0,-32766, + 0, 811, 0, 0, 40, 21, 427, 0, 470, 0, + 471, 0, 472, 0, 322, 428, 823, 54, 825, 633, + 33, 34, 429, 0, 326, 0, 35, 473, 323, 0, + 316, 318, 356, 357, -512, 426, 0, 753, 531, 0, + 476, 468, 6, 0, 0, 811, 650, 7, 40, 21, + 427, 12, 470, 14, 471, 373, 472, -420, 562, 428, + 823, 54, 78, -225, 33, 34, 429, 39, 656, 657, + 35, 473, 859, 633, 764, 812, 356, 357, 820, 799, + 814, 875, 866, 867, 476, 797, 860, 857, 855, 426, + 933, 934, 931, 819, 803, 468, 805, 807, 810, 811, + 930, 762, 40, 21, 427, 763, 470, 932, 471, 335, + 472, 358, 634, 428, 638, 640, 825, 633, 33, 34, + 429, 642, 643, 646, 35, 473, 648, 649, 651, 652, + 356, 357, 635, 426, 1221, 1223, 761, 842, 476, 468, + 248, 760, 841, 811, 1222, 840, 40, 21, 427, 1057, + 470, 830, 471, 1045, 472, 839, 1046, 428, 828, 215, + 216, 939, 33, 34, 429, 217, 864, 218, 35, 473, + 825, 633, 24, 865, 356, 357, 456, 1220, 1189, 209, + 1187, 1172, 476, 1185, 215, 216, 1086, 1095, 1096, 914, + 217, 1193, 218, 1183, -224, 1097, 26, 31, 37, 42, + 76, 77, 210, 288, 209, 292, 293, 308, 309, 310, + 311, 339, 1095, 1096, 825, 633, 355, 291, 416, 1152, + 1097, 16, 17, 18, 393, 453, 460, 462, 466, 552, + 624, 1048, 1051, 904, 1111, 1047, 1023, 563, 1022, 1088, + 0, 0, -429, 558, 1041, 1101, 1102, 1103, 1104, 1098, + 1099, 398, 1054, 1053, 1056, 1055, 1070, 1105, 1100, 1186, + 1171, 1167, 1184, 1085, 1218, 1112, 1166, 219, 558, 599, + 1101, 1102, 1103, 1104, 1098, 1099, 398, 0, 0, 0, + 0, 0, 1105, 1100, 0, 0, 0, 0, 0, 0, + 0, 0, 219 + ); + + protected $actionCheck = array( + 2, 3, 4, 5, 6, 7, 14, 9, 10, 11, + 12, 13, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 0, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 9, 10, 11, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 69, 70, + 53, 54, 55, 9, 10, 57, 30, 80, 32, 33, + 34, 35, 36, 37, 38, 80, 69, 70, 83, 71, + 72, 73, 74, 75, 76, 77, 9, 70, 80, 33, + 34, 35, 36, 37, 38, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 157, 157, 157, 157, - 157, 157, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147 - ); - - protected $action = array( - 674, 675, 676, 677, 678,-32766, 679, 680, 681, 717, - 718, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 0, 227, 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238,-32766,-32766,-32766,-32766,-32766,-32766,-32766, - -32766,-32767,-32767,-32767,-32767, 442, 239, 240,-32766,-32766, - -32766,-32766, 682,-32766, 308,-32766,-32766,-32766,-32766,-32766, - -32766,-32767,-32767,-32767,-32767,-32767, 683, 684, 685, 686, - 687, 688, 689, 1174, 462, 749,-32766,-32766,-32766,-32766, - -32766, 25, 690, 691, 692, 693, 694, 695, 696, 697, - 698, 699, 700, 720, 721, 722, 723, 724, 712, 713, - 714, 715, 716, 701, 702, 703, 704, 705, 706, 707, - 743, 744, 745, 746, 747, 748, 708, 709, 710, 711, - 741, 732, 730, 731, 727, 728, 520, 719, 725, 726, - 733, 734, 736, 735, 737, 738, 54, 55, 422, 56, - 57, 729, 740, 739, 421, 58, 59, 341, 60,-32766, - -32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766, 9,-32767, - -32767,-32767,-32767, 52, 327,-32766, 331, 947, 948, 949, - 946, 945, 944, 939, 1215, 29, 1217, 1216, 765, 766, - 823, 61, 62, 1101, -269, 1180, 764, 63, 1174, 64, - 293, 294, 65, 66, 67, 68, 69, 70, 71, 72, - 129, 26, 301, 73, 415,-32766,-32766,-32766,-32766, 1089, - 1090, 751, 635, 1180,-32766, 920, 206, 466,-32766,-32766, - -32766, 824, 409,-32766, 313,-32766, 902,-32766,-32766,-32766, - -32766,-32766,-32766, 215, 216, 217, 430,-32766,-32766,-32766, - -32766,-32766,-32766,-32766,-32766, 122, 493, 947, 948, 949, - 946, 945, 944, 202, 475, 476, 284, 625, 127, 336, - 895, 896, 341, 479, 480, 1187, 1095, 1096, 1097, 1098, - 1092, 1093, 309, 494, 10, 443, 427, 494, 1099, 1094, - 427, 587, -220, 1212, 123, 41, 449, 336, 323, 1056, - 324, 423, -122, -122, -122, -4, 824, 465, 101, 102, - 103, 813, 303, 282, 40, 21, 424, -122, 467, -122, - 468, -122, 469, -122, 104, 425, 215, 216, 217, 30, - 31, 470, 426, 626, 32, 471, 427, 814, 74, 871, - 925, 351, 352, 472, 473, 358, 202, 243, 1101, 474, - 414, 1184, 795, 842, 477, 478, 300, 236, 237, 238, - 35, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 239, 240, 1038, 423, 350, 826, 640, - -122, 824, 465, 215, 216, 217, 813, 1140, 241, 40, - 21, 424, 48, 467, 440, 468, 334, 469, 297, 1038, - 425, 977, 979, 202, 30, 31, 470, 426, 416, 32, - 471, 1188, 1038, 74, 322, 1038, 351, 352, 472, 473, - -32766,-32766,-32766, 128, 474, 921, 811, 757, 842, 477, - 478,-32767,-32767,-32767,-32767, 96, 97, 98, 99, 100, - -32766, 20,-32766,-32766,-32766,-32766, 895, 896, 335, 1038, - 479, 423, -216, 826, 640, -4, 824, 465, 872, 494, - 1207, 813, 427, 1206, 40, 21, 424, 299, 467, 121, - 468, 1038, 469, -497, 118, 425, -201, -201, -201, 30, - 31, 470, 426, 297, 32, 471, 810, 911, 74, 216, - 217, 351, 352, 472, 473,-32766,-32766,-32766, 36, 474, - 51, 340, 795, 842, 477, 478, 207, 751, 202, 1180, - 126,-32766,-32766,-32766, 441,-32766, 417,-32766,-32766,-32766, - 49, 33, 296,-32766,-32766,-32766, 423, 208, 826, 640, - -201,-32766, 465,-32766,-32766, 807, 813, 379, 117, 40, - 21, 424, 1066, 467,-32766, 468, 217, 469, 805, 245, - 425, -200, -200, -200, 30, 31, 470, 426, 1038, 32, - 471, 286, 548, 74, 202, 824, 351, 352, 472, 473, - -32766,-32766,-32766, 494, 474, 125, 427, 795, 842, 477, - 478, 431, 120, 336, 1038, 803, 78, 79, 80, 494, - -32766, 436, 427, 646, 642, 126,-32766,-32766,-32766, 244, - 901, 246, 119, 826, 640, -200, 34, 298, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 209, 303, 202, 824, 423, 822, 1038, 215, 216, - 217, 465, 131, 130, 104, 813, 578, 1038, 40, 21, - 424, 650, 467, 835, 468, 647, 469, 315, 202, 425, - 285, 104, 643, 30, 31, 470, 824,-32766, 32, 471, - 295, 303, 74,-32766,-32766, 351, 352, 215, 216, 217, - -32766,-32766, 50, 474, 98, 99, 100, 233, 234, 235, - 239, 240, 456, 593, 644, 451, 22, 202, 132, 359, - 765, 766, 601, 602, 423, 758, 645, 924, 668, 301, - 465, 47, 858, 640, 813, 936, 656, 40, 21, 424, - 43, 467, 46, 468, 45, 469, 44, 53, 425, 751, - 607, 514, 30, 31, 470, 824, 423, 32, 471, 778, - 752, 74, 465, 437, 351, 352, 813, 535, 519, 40, - 21, 424, 474, 467, 536, 468, 1210, 469, 515, 435, - 425, 439, 518, 648, 30, 31, 470, 824, 624, 32, - 471, 614, 604, 74, 1059, 581, 351, 352,-32766, 526, - 634, 826, 640, 611, 474, 1139, 460, 434, 281, 621, - 328, 844, 314, 539, 14, 653, -80, 597, 837, 584, - 330, 843, 325, -398, 395, 423, 1146, 0, 0, 0, - 0, 465, 1100, 826, 640, 813, 598, 0, 40, 21, - 424, 0, 467, 0, 468, 0, 469, 0, 372, 425, - 0, 326, 0, 30, 31, 470, 824, 423, 32, 471, - 312, -498, 74, 465, -497, 351, 352, 813, 479, 0, - 40, 21, 424, 474, 467, 374, 468, 5, 469, 6, - 11, 425, -407, 13, -406, 30, 31, 470, 1036, 386, - 32, 471, 411, 410, 74, 387, 528, 351, 352, 436, - 856, 1213, 826, 640, 866, 474, 865, 874, 815, 800, - 821, 809, 763, 661, 660, 39, 38, 854, 931, 932, - 929, 859, 930, 820, 808, 761, 423, 928, 806, 804, - 798, 812, 465, 762, 826, 640, 813, 649, 77, 40, - 21, 424, 651, 467, 652, 468, 242, 469, 654, 655, - 425, 658, 663, 664, 30, 31, 470, 665, 124, 32, - 471, 332, 333, 74, 210, 211, 351, 352, 407, 641, - 212, 408, 213, 768, 474, 767, 864, 455, 1211, 1181, - 1179, 1165, 1177, 1080, 204, 913, 1185, 1175, 838, 210, - 211, 1040, 1089, 1090, 1041, 212,-32766, 213, 829, 863, - 1091, 1052, 759, 826, 640, 306, 839, 840, 760, 204, - 1214, 796, 662, 841, 770, 769, 937, 1089, 1090, 831, - 1042,-32766, 305, 304, 24, 1091, 27, 292, 291, 283, - 307, 338, 413, 419, 28, 205, 37, 42, 76, 75, - -32766, 0, 1018, 1017, 1082, 571, -216, 567, 1105, 1095, - 1096, 1097, 1098, 1092, 1093, 385, 903, 1046, 1043, 631, - 561, 1099, 1094, 463, 459, 457, 452, 380, 214, 0, - -32766, 18, 567, -217, 1095, 1096, 1097, 1098, 1092, 1093, - 385, 17, 16, 605, 0, -416, 1099, 1094, 1160, 1159, - 1106, 1209, 1079, 214, 1176,-32766, 1047, 0, 1164, 1178, - 1065, 1050, 1051, 1048, 1049, 0, 1145 - ); - - protected $actionCheck = array( - 2, 3, 4, 5, 6, 8, 8, 9, 10, 11, - 12, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 0, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 8, 9, 10, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 7, 66, 67, 31, 32, - 33, 34, 54, 28, 7, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 68, 69, 70, 71, - 72, 73, 74, 79, 7, 77, 31, 32, 33, 34, - 35, 7, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 82, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 2, 3, 4, 5, - 6, 143, 144, 145, 7, 11, 12, 153, 14, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 103, 41, - 42, 43, 44, 67, 109, 79, 7, 112, 113, 114, - 115, 116, 117, 118, 77, 7, 79, 80, 102, 103, - 1, 47, 48, 139, 79, 79, 148, 53, 79, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 67, 67, 68, 69, 70, 8, 9, 10, 103, 75, - 76, 77, 77, 79, 109, 148, 7, 83, 8, 9, - 10, 1, 146, 118, 128, 28, 152, 30, 31, 32, - 33, 34, 35, 8, 9, 10, 102, 151, 28, 153, - 30, 31, 32, 33, 34, 149, 112, 112, 113, 114, - 115, 116, 117, 28, 120, 121, 7, 77, 149, 153, - 130, 131, 153, 129, 130, 1, 132, 133, 134, 135, - 136, 137, 138, 143, 7, 7, 146, 143, 144, 145, - 146, 82, 152, 150, 7, 151, 7, 153, 154, 152, - 156, 71, 72, 73, 74, 0, 1, 77, 50, 51, - 52, 81, 54, 13, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 66, 95, 8, 9, 10, 99, - 100, 101, 102, 143, 104, 105, 146, 148, 108, 29, - 150, 111, 112, 113, 114, 7, 28, 29, 139, 119, - 7, 77, 122, 123, 124, 125, 35, 50, 51, 52, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 66, 67, 12, 71, 7, 148, 149, - 150, 1, 77, 8, 9, 10, 81, 152, 13, 84, - 85, 86, 67, 88, 29, 90, 7, 92, 35, 12, - 95, 56, 57, 28, 99, 100, 101, 102, 103, 104, - 105, 152, 12, 108, 109, 12, 111, 112, 113, 114, - 8, 9, 10, 149, 119, 148, 148, 122, 123, 124, - 125, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 28, 152, 30, 31, 32, 33, 130, 131, 143, 12, - 129, 71, 152, 148, 149, 150, 1, 77, 148, 143, - 79, 81, 146, 82, 84, 85, 86, 7, 88, 13, - 90, 12, 92, 128, 149, 95, 96, 97, 98, 99, - 100, 101, 102, 35, 104, 105, 148, 79, 108, 9, - 10, 111, 112, 113, 114, 8, 9, 10, 13, 119, - 67, 67, 122, 123, 124, 125, 15, 77, 28, 79, - 147, 8, 9, 10, 149, 28, 123, 30, 31, 32, - 67, 140, 141, 8, 9, 10, 71, 15, 148, 149, - 150, 28, 77, 30, 31, 148, 81, 78, 15, 84, - 85, 86, 112, 88, 151, 90, 10, 92, 148, 15, - 95, 96, 97, 98, 99, 100, 101, 102, 12, 104, - 105, 153, 128, 108, 28, 1, 111, 112, 113, 114, - 8, 9, 10, 143, 119, 29, 146, 122, 123, 124, - 125, 151, 149, 153, 12, 148, 8, 9, 10, 143, - 28, 146, 146, 29, 149, 147, 31, 32, 33, 15, - 152, 15, 149, 148, 149, 150, 28, 35, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 15, 54, 28, 1, 71, 29, 12, 8, 9, - 10, 77, 149, 29, 66, 81, 153, 12, 84, 85, - 86, 29, 88, 35, 90, 29, 92, 29, 28, 95, - 35, 66, 29, 99, 100, 101, 1, 31, 104, 105, - 35, 54, 108, 31, 32, 111, 112, 8, 9, 10, - 8, 9, 67, 119, 47, 48, 49, 47, 48, 49, - 66, 67, 72, 73, 29, 72, 73, 28, 97, 98, - 102, 103, 106, 107, 71, 148, 149, 148, 149, 68, - 77, 67, 148, 149, 81, 148, 149, 84, 85, 86, - 67, 88, 67, 90, 67, 92, 67, 67, 95, 77, - 74, 77, 99, 100, 101, 1, 71, 104, 105, 77, - 77, 108, 77, 77, 111, 112, 81, 77, 77, 84, - 85, 86, 119, 88, 77, 90, 77, 92, 77, 77, - 95, 86, 79, 29, 99, 100, 101, 1, 79, 104, - 105, 79, 79, 108, 79, 87, 111, 112, 82, 82, - 89, 148, 149, 93, 119, 155, 102, 102, 94, 91, - 110, 123, 128, 94, 94, 29, 94, 96, 147, 96, - 126, 123, 126, 142, 146, 71, 139, -1, -1, -1, - -1, 77, 139, 148, 149, 81, 109, -1, 84, 85, - 86, -1, 88, -1, 90, -1, 92, -1, 142, 95, - -1, 127, -1, 99, 100, 101, 1, 71, 104, 105, - 128, 128, 108, 77, 128, 111, 112, 81, 129, -1, - 84, 85, 86, 119, 88, 146, 90, 142, 92, 142, - 142, 95, 142, 142, 142, 99, 100, 101, 154, 146, - 104, 105, 146, 146, 108, 146, 146, 111, 112, 146, - 148, 150, 148, 149, 148, 119, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 71, 148, 148, 148, - 148, 148, 77, 148, 148, 149, 81, 149, 149, 84, - 85, 86, 149, 88, 149, 90, 29, 92, 149, 149, - 95, 149, 149, 149, 99, 100, 101, 149, 149, 104, - 105, 149, 149, 108, 47, 48, 111, 112, 149, 149, - 53, 149, 55, 150, 119, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 67, 150, 150, 150, 150, 47, - 48, 150, 75, 76, 150, 53, 79, 55, 150, 150, - 83, 150, 150, 148, 149, 151, 150, 150, 150, 67, - 150, 150, 150, 150, 150, 150, 150, 75, 76, 150, - 152, 79, 151, 151, 151, 83, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, -1, 152, 152, 152, 152, 152, 130, 152, 132, - 133, 134, 135, 136, 137, 138, 152, 152, 152, 152, - 152, 144, 145, 152, 152, 152, 152, 152, 151, -1, - 153, 152, 130, 152, 132, 133, 134, 135, 136, 137, - 138, 152, 152, 155, -1, 154, 144, 145, 155, 155, - 155, 155, 155, 151, 155, 153, 155, -1, 155, 155, - 155, 155, 155, 155, 155, -1, 156 + 153, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 3, 4, 5, 6, 7, 147, 148, 149, 80, 12, + 13, 159, 15, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 156, 44, 45, 46, 47, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 13, 106, 116, 108, 85, 50, 51, 33, + 34, 35, 36, 56, 85, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 1, 70, 71, 72, + 73, 59, 60, 13, 82, 78, 79, 80, 80, 82, + 152, 153, 154, 86, 9, 10, 11, 8, 1, 2, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 9, + 10, 11, 156, 106, 143, 30, 160, 32, 33, 34, + 35, 36, 143, 116, 116, 117, 118, 119, 120, 121, + 30, 124, 125, 116, 117, 118, 119, 120, 121, 13, + 133, 134, 70, 136, 137, 138, 139, 140, 141, 142, + 31, 37, 38, 8, 132, 148, 149, 116, 156, 152, + 153, 154, 160, 37, 38, 158, 8, 160, 161, 8, + 163, 74, 75, 76, 77, 134, 135, 80, 9, 10, + 11, 84, 1, 80, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 155, 98, 0, 1, 2, 30, + 103, 104, 105, 106, 132, 8, 109, 110, 9, 10, + 11, 8, 115, 116, 117, 118, 9, 10, 11, 82, + 123, 70, 8, 126, 127, 128, 129, 8, 156, 30, + 155, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 9, 10, 11, 157, 53, 54, 55, + 8, 57, 155, 156, 157, 152, 153, 154, 10, 11, + 157, 80, 162, 69, 30, 151, 32, 33, 34, 35, + 74, 1, 2, 159, 155, 71, 80, 151, 30, 8, + 84, 37, 38, 87, 88, 89, 82, 91, 82, 93, + 8, 95, 13, 156, 98, 158, 13, 160, 13, 103, + 104, 105, 106, 82, 108, 109, 110, 156, 8, 113, + 31, 115, 116, 117, 118, 9, 10, 11, 157, 123, + 37, 38, 126, 127, 128, 129, 82, 13, 159, 33, + 34, 35, 82, 127, 8, 85, 30, 156, 32, 33, + 34, 160, 8, 147, 74, 1, 2, 50, 51, 52, + 80, 155, 156, 157, 84, 31, 159, 87, 88, 89, + 82, 91, 158, 93, 160, 95, 160, 106, 98, 108, + 100, 101, 102, 103, 104, 105, 106, 133, 159, 109, + 110, 160, 9, 10, 11, 115, 116, 117, 118, 9, + 10, 11, 8, 123, 144, 145, 126, 127, 128, 129, + 82, 82, 158, 30, 160, 32, 33, 108, 8, 70, + 30, 31, 113, 152, 16, 9, 10, 11, 74, 14, + 14, 122, 8, 8, 80, 155, 156, 157, 84, 13, + 159, 87, 88, 89, 151, 91, 30, 93, 160, 95, + 155, 159, 98, 14, 100, 101, 102, 103, 104, 105, + 106, 133, 16, 109, 110, 155, 157, 1, 2, 115, + 116, 117, 118, 9, 10, 11, 13, 123, 16, 155, + 126, 127, 128, 129, 33, 34, 158, 158, 160, 160, + 156, 9, 10, 11, 30, 37, 38, 31, 70, 155, + 37, 38, 50, 51, 52, 156, 16, 81, 16, 155, + 156, 157, 30, 16, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 16, 57, + 74, 9, 10, 11, 1, 2, 80, 116, 11, 155, + 84, 69, 156, 87, 88, 89, 160, 91, 30, 93, + 132, 95, 30, 33, 98, 134, 135, 30, 57, 103, + 104, 105, 69, 70, 31, 109, 110, 75, 76, 155, + 155, 115, 116, 75, 76, 101, 102, 111, 112, 123, + 159, 155, 156, 155, 156, 155, 156, 31, 1, 2, + 31, 31, 31, 31, 31, 38, 70, 69, 77, 70, + 70, 70, 70, 80, 70, 70, 70, 74, 71, 85, + 85, 155, 156, 80, 97, 96, 100, 84, 31, 106, + 87, 88, 89, 82, 91, 82, 93, 82, 95, 89, + 92, 98, 1, 2, 90, 127, 103, 104, 105, 97, + 94, 127, 109, 110, 97, 97, 97, 132, 115, 116, + 100, 146, 113, 143, 143, 146, 123, 106, 151, 155, + 157, 74, 31, 157, 162, -1, 114, 80, -1, 116, + -1, 84, -1, -1, 87, 88, 89, -1, 91, -1, + 93, -1, 95, -1, 130, 98, 1, 2, 155, 156, + 103, 104, 105, -1, 130, -1, 109, 110, 131, -1, + 132, 132, 115, 116, 132, 74, -1, 152, 150, -1, + 123, 80, 146, -1, -1, 84, 31, 146, 87, 88, + 89, 146, 91, 146, 93, 146, 95, 146, 150, 98, + 1, 2, 156, 159, 103, 104, 105, 155, 155, 155, + 109, 110, 155, 156, 155, 155, 115, 116, 155, 155, + 155, 155, 155, 155, 123, 155, 155, 155, 155, 74, + 155, 155, 155, 155, 155, 80, 155, 155, 155, 84, + 155, 155, 87, 88, 89, 155, 91, 155, 93, 156, + 95, 156, 156, 98, 156, 156, 155, 156, 103, 104, + 105, 156, 156, 156, 109, 110, 156, 156, 156, 156, + 115, 116, 156, 74, 157, 157, 157, 157, 123, 80, + 31, 157, 157, 84, 157, 157, 87, 88, 89, 157, + 91, 157, 93, 157, 95, 157, 157, 98, 157, 50, + 51, 157, 103, 104, 105, 56, 157, 58, 109, 110, + 155, 156, 158, 157, 115, 116, 157, 157, 157, 70, + 157, 157, 123, 157, 50, 51, 157, 78, 79, 157, + 56, 157, 58, 157, 159, 86, 158, 158, 158, 158, + 158, 158, 158, 158, 70, 158, 158, 158, 158, 158, + 158, 158, 78, 79, 155, 156, 158, 160, 158, 163, + 86, 159, 159, 159, 159, 159, 159, 159, 159, 159, + 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, + -1, -1, 161, 134, 161, 136, 137, 138, 139, 140, + 141, 142, 162, 162, 162, 162, 162, 148, 149, 162, + 162, 162, 162, 162, 162, 162, 162, 158, 134, 162, + 136, 137, 138, 139, 140, 141, 142, -1, -1, -1, + -1, -1, 148, 149, -1, -1, -1, -1, -1, -1, + -1, -1, 158 ); protected $actionBase = array( - 0, 220, 295, 370, 445, 109, 109, 180, 744, -2, - -2, -2, -2, -2, 135, 655, 724, 756, 724, 623, - 554, 825, 825, 825, 438, 353, 625, 625, 862, 625, - 427, 390, 377, 449, 536, 615, 562, 393, 393, 393, - 393, 134, 134, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, - 393, 393, 393, 300, 179, 446, 475, 751, 750, 746, - 745, 838, 684, 860, 798, 799, 604, 800, 801, 802, - 803, 805, 797, 806, 898, 807, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 568, 568, -3, 365, 225, - 308, 620, 662, 659, 659, 659, 659, 659, 659, 659, - 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, - 505, 505, 505, 505, 505, 505, 505, 470, 552, 552, - 552, 526, 887, 595, 912, 912, 912, 912, 912, 912, - 912, 912, 912, 912, 912, 912, 912, 912, 912, 912, - 912, 912, 912, 912, 912, 912, 912, 912, 912, 912, - 912, 912, 912, 912, 912, 912, 912, 912, 912, 912, - 912, 912, 912, 912, 912, 912, 912, 493, -20, -20, - 477, 626, 402, 632, 210, 555, 197, 25, 25, 25, - 25, 25, 17, 45, 5, 5, 5, 5, 335, 380, - 380, 380, 380, 118, 118, 118, 118, 833, 827, 826, - 821, 311, 311, 709, 709, 631, 779, 627, 627, 630, - 630, 420, 420, 420, 420, 420, 420, 420, 420, 420, - 420, 383, 105, 859, 130, 130, 130, 130, 306, 44, - 657, 920, 264, 264, 264, 306, 248, 248, 248, 297, - 297, 297, 76, 687, 371, 86, 86, 86, 86, 371, - 86, 86, 588, 588, 588, 435, 759, 686, 436, 443, - 97, 483, 693, 819, 691, 796, 549, 710, 96, 717, - 716, 398, 675, 613, 610, 586, 651, 355, 398, 300, - 557, 423, 607, 753, 667, 38, 747, 328, 268, 424, - 547, 315, -6, 279, 782, 755, 863, 861, 249, 133, - 703, 607, 607, 607, 74, 199, 783, 789, 315, 290, - 614, 614, 614, 614, 835, 792, 614, 614, 614, 614, - 834, 795, 267, 67, 793, 137, 749, 642, 642, 642, - 642, 642, 642, 608, 642, 853, 671, 843, 843, 660, - 683, 608, 856, 856, 856, 856, 608, 642, 843, 843, - 608, 631, 843, 168, 608, 666, 642, 664, 664, 856, - 736, 735, 671, 673, 694, 843, 843, 843, 694, 660, - 608, 856, 697, 641, 209, 843, 856, 618, 618, 697, - 608, 618, 683, 618, 20, 597, 643, 855, 858, 852, - 644, 790, 668, 658, 847, 846, 857, 661, 672, 848, - 845, 720, 734, 733, 656, 513, 649, 647, 645, 634, - 705, 605, 702, 675, 723, 585, 585, 585, 706, 707, - 706, 585, 585, 585, 585, 585, 585, 585, 585, 911, - 712, 676, 654, 665, 732, 481, 699, 689, 502, 772, - 663, 720, 720, 831, 876, 885, 901, 704, 653, 842, - 878, 706, 919, 738, 277, 606, 841, 832, 713, 652, - 719, 706, 824, 706, 773, 706, 875, 830, 669, 720, - 828, 585, 874, 918, 917, 916, 915, 914, 913, 903, - 909, 650, 907, 731, 678, 884, 47, 854, 651, 708, - 648, 730, 159, 906, 822, 706, 706, 774, 759, 706, - 778, 729, 737, 900, 728, 883, 905, 663, 882, 706, - 674, 904, 159, 616, 646, 891, 680, 726, 851, 682, - 866, 850, 758, 574, 524, 721, 612, 752, 899, 889, - 864, 743, 763, 765, 576, 688, 685, 679, 839, 769, - 849, 722, 808, 811, 877, 692, 723, 711, 670, 690, - 681, 770, 814, 881, 739, 740, 741, 818, 742, 836, + 0, 227, 326, 400, 474, 233, 132, 132, 752, -2, + -2, 138, -2, -2, -2, 663, 761, 815, 761, 586, + 717, 859, 859, 859, 244, 256, 256, 256, 413, 583, + 583, 880, 546, 169, 415, 444, 409, 200, 200, 200, + 200, 137, 137, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 249, 205, 738, 559, + 535, 739, 741, 742, 876, 679, 877, 820, 821, 693, + 823, 824, 826, 829, 832, 819, 834, 907, 836, 602, + 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, + 602, 67, 536, 299, 510, 230, 44, 652, 652, 652, + 652, 652, 652, 652, 337, 337, 337, 337, 337, 337, + 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + 337, 337, 378, 584, 584, 584, 657, 909, 648, 934, + 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, + 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, + 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, + 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, + 934, 934, 934, 503, -21, -21, 436, 650, 364, 571, + 215, 426, 156, 26, 26, 329, 329, 329, 329, 329, + 46, 46, 5, 5, 5, 5, 152, 186, 186, 186, + 186, 120, 120, 120, 120, 374, 374, 429, 448, 448, + 334, 267, 449, 449, 449, 449, 449, 449, 449, 449, + 449, 449, 336, 427, 427, 572, 572, 408, 551, 551, + 551, 551, 671, 171, 171, 391, 311, 311, 311, 109, + 641, 856, 68, 68, 68, 68, 68, 68, 324, 324, + 324, -3, -3, -3, 655, 77, 380, 77, 380, 683, + 685, 86, 685, 654, -15, 516, 776, 281, 646, 809, + 680, 816, 560, 711, 202, 578, 857, 643, -23, 578, + 578, 578, 578, 857, 622, 628, 596, -23, 578, -23, + 639, 454, 849, 351, 249, 558, 469, 631, 743, 514, + 688, 746, 464, 544, 548, 556, 7, 412, 708, 750, + 878, 879, 349, 702, 631, 631, 631, 327, 101, 7, + -8, 623, 623, 623, 623, 219, 623, 623, 623, 623, + 291, 430, 545, 401, 745, 653, 653, 675, 839, 814, + 814, 653, 673, 653, 675, 841, 841, 841, 841, 653, + 653, 653, 653, 814, 814, 667, 814, 275, 684, 694, + 694, 841, 713, 714, 653, 653, 697, 814, 814, 814, + 697, 687, 841, 669, 637, 333, 814, 841, 689, 673, + 689, 653, 669, 689, 673, 673, 689, 22, 686, 656, + 840, 842, 860, 756, 638, 644, 847, 848, 843, 845, + 838, 692, 719, 720, 528, 659, 660, 661, 662, 696, + 664, 698, 643, 658, 658, 658, 645, 701, 645, 658, + 658, 658, 658, 658, 658, 658, 658, 632, 635, 709, + 699, 670, 723, 566, 582, 758, 640, 636, 872, 865, + 881, 883, 849, 870, 645, 890, 634, 288, 610, 850, + 633, 753, 645, 851, 645, 759, 645, 873, 777, 666, + 778, 779, 658, 874, 891, 892, 893, 894, 897, 898, + 899, 900, 665, 901, 724, 674, 866, 344, 844, 639, + 705, 677, 755, 725, 780, 372, 902, 784, 645, 645, + 765, 706, 645, 766, 726, 712, 862, 727, 867, 903, + 640, 678, 868, 645, 681, 785, 904, 372, 690, 651, + 704, 649, 728, 858, 875, 853, 767, 612, 617, 787, + 788, 792, 691, 730, 863, 864, 835, 731, 770, 642, + 771, 676, 794, 772, 852, 732, 796, 798, 871, 647, + 707, 682, 672, 668, 773, 799, 869, 733, 735, 736, + 801, 737, 804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 137, 137, 137, 137, -2, -2, -2, + -2, 0, 0, -2, 0, 0, 0, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 0, 0, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 602, 602, + 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, + 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, + 602, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 602, -21, -21, -21, -21, 602, -21, + -21, -21, -21, -21, -21, -21, 602, 602, 602, 602, + 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, + 602, 602, 602, 602, -21, 602, 602, 602, -21, 68, + -21, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 602, 0, 0, 602, -21, + 602, -21, 602, -21, -21, 602, 602, 602, 602, 602, + 602, 602, -21, -21, -21, -21, -21, -21, 0, 324, + 324, 324, 324, -21, -21, -21, -21, 68, 68, 147, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 324, 324, -3, -3, 68, + 68, 68, 68, 68, 147, 68, 68, -23, 673, 673, + 673, 380, 380, 380, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 380, -23, 0, -23, + 0, 68, -23, 673, -23, 380, 673, 673, -23, 814, + 604, 604, 604, 604, 372, 7, 0, 0, 673, 673, + 0, 0, 0, 0, 0, 673, 0, 0, 0, 0, + 0, 0, 814, 0, 653, 0, 0, 0, 0, 658, + 288, 0, 677, 456, 0, 0, 0, 0, 0, 0, + 677, 456, 530, 530, 0, 665, 658, 658, 658, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 134, 134, 134, 134, -2, -2, -2, -2, 0, 0, - 0, 0, 0, -2, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 0, 0, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 568, 568, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 568, -20, -20, -20, - -20, 568, -20, -20, -20, -20, -20, -20, -20, 568, - 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 568, -20, 568, 568, 568, - -20, 420, -20, 420, 420, 420, 420, 420, 420, 420, - 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, - 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, - 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, - 420, 420, 420, 420, 420, 420, 568, 0, 0, 568, - -20, 568, -20, 568, -20, 568, 568, 568, 568, 568, - 568, -20, -20, -20, -20, -20, -20, 0, 248, 248, - 248, 248, -20, -20, -20, -20, 55, 55, 55, 55, - 420, 420, 420, 420, 420, 420, 248, 248, 297, 297, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 420, 55, 420, 642, 642, 642, 642, 642, 371, 371, - 371, 106, 106, 106, 642, 0, 0, 0, 0, 0, - 0, 642, 371, 0, 420, 420, 420, 420, 0, 420, - 420, 642, 642, 642, 642, 106, 371, 642, 843, 0, - 106, 591, 591, 591, 591, 159, 315, 0, 642, 642, - 0, 673, 0, 0, 0, 843, 0, 0, 0, 0, - 0, 585, 277, 842, 0, 360, 0, 0, 0, 0, - 0, 0, 0, 653, 360, 450, 450, 0, 0, 650, - 585, 585, 585, 0, 0, 653, 653, 0, 0, 0, - 0, 0, 0, 379, 653, 0, 0, 0, 0, 379, - 333, 0, 0, 333, 0, 159 + 0, 0, 0, 0, 0, 0, 372 ); protected $actionDefault = array( 3,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767, 525, 525,32767, 481, - 32767,32767,32767,32767,32767,32767,32767, 287, 287, 287, - 32767,32767,32767, 513, 513, 513, 513, 513, 513, 513, - 513, 513, 513, 513,32767,32767,32767,32767,32767, 369, + 32767,32767,32767,32767,32767, 540, 540, 495,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 297, 297, 297, + 32767,32767,32767, 528, 528, 528, 528, 528, 528, 528, + 528, 528, 528, 528,32767,32767,32767,32767,32767,32767, + 381,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 375, 530,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767, 350, 351, 353, 354, - 286, 514, 237, 376, 529, 285, 239, 314, 485,32767, - 32767,32767, 316, 116, 248, 193, 484, 119, 284, 224, - 368, 370, 315, 291, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, 306, 307, 290, 441, 347, 346, - 345, 443,32767, 442, 478, 478, 481,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 387, + 545,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 362, + 363, 365, 366, 296, 548, 529, 245, 388, 544, 295, + 247, 325, 499,32767,32767,32767, 327, 122, 256, 201, + 498, 125, 294, 232, 380, 382, 326, 301, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 300, 454, 359, 358, 357, 456,32767, 455, 492, + 492, 495,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767, 312, 469, 468, - 313, 439, 317, 440, 319, 444, 318, 335, 336, 333, - 334, 337, 446, 445, 462, 463, 460, 461, 289, 338, - 339, 340, 341, 464, 465, 466, 467, 271, 271, 271, - 271,32767,32767, 524, 524,32767,32767, 326, 327, 453, - 454,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767, 272,32767, 228, 228, 228, 228, 228,32767, - 32767,32767,32767,32767,32767,32767, 321, 322, 320, 448, - 449, 447,32767, 415,32767,32767,32767,32767,32767, 417, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 486, - 32767,32767,32767,32767,32767,32767,32767, 499, 404,32767, - 32767,32767, 397, 212, 214, 161, 472,32767,32767,32767, - 32767, 504, 331,32767,32767,32767,32767,32767,32767, 539, - 32767, 499,32767,32767,32767,32767,32767,32767,32767,32767, - 344, 323, 324, 325,32767,32767,32767,32767, 503, 497, - 456, 457, 458, 459,32767,32767, 450, 451, 452, 455, + 32767,32767,32767, 323, 483, 482, 324, 452, 328, 453, + 331, 457, 460, 329, 330, 347, 348, 345, 346, 349, + 458, 459, 476, 477, 474, 475, 299, 350, 351, 352, + 353, 478, 479, 480, 481,32767,32767, 280, 539, 539, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767, 165,32767, 412,32767, 418, 418,32767, - 32767, 165,32767,32767,32767,32767, 165,32767, 502, 501, - 165,32767, 398, 480, 165, 178,32767, 176, 176,32767, - 198, 198,32767,32767, 180, 473, 492,32767, 180,32767, - 165,32767, 386, 167, 480,32767,32767, 230, 230, 386, - 165, 230,32767, 230,32767, 82, 422,32767,32767,32767, + 32767,32767,32767, 338, 339, 467, 468,32767, 236, 236, + 236, 236, 281, 236,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 333, 334, + 332, 462, 463, 461, 428,32767,32767,32767, 430,32767, + 32767,32767,32767,32767,32767,32767,32767, 500,32767,32767, + 32767,32767,32767, 513, 417, 171,32767, 409,32767, 171, + 171, 171, 171,32767, 220, 222, 167,32767, 171,32767, + 486,32767,32767,32767,32767,32767, 518, 343,32767,32767, + 116,32767,32767,32767, 555,32767, 513,32767, 116,32767, + 32767,32767,32767, 356, 335, 336, 337,32767,32767, 517, + 511, 470, 471, 472, 473,32767, 464, 465, 466, 469, + 32767,32767,32767,32767,32767,32767,32767,32767, 425, 431, + 431,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 516, 515,32767, 410, 494, 186, 184, + 184,32767, 206, 206,32767,32767, 188, 487, 506,32767, + 188, 173,32767, 398, 175, 494,32767,32767, 238,32767, + 238,32767, 398, 238,32767,32767, 238,32767, 411, 435, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767, 399,32767,32767,32767,32767, 365, 366, 475, 488, - 32767, 489,32767, 397,32767, 329, 330, 332, 309,32767, - 311, 355, 356, 357, 358, 359, 360, 361, 363,32767, - 402,32767, 405,32767,32767,32767, 84, 108, 247,32767, - 537, 84, 400,32767,32767, 294, 537,32767,32767,32767, - 32767, 532,32767,32767, 288,32767,32767,32767, 84,32767, - 84, 243,32767, 163,32767, 522,32767, 497,32767, 401, - 32767, 328,32767,32767,32767,32767,32767,32767,32767,32767, - 32767, 498,32767,32767,32767,32767, 219,32767, 435,32767, - 84,32767, 179,32767,32767, 292, 238,32767,32767, 531, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 164, - 32767,32767, 181,32767,32767, 497,32767,32767,32767,32767, - 32767,32767,32767,32767, 283,32767,32767,32767,32767,32767, - 497,32767,32767,32767, 223,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 82, 60,32767, 265,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 121, 121, 3, 121, 121, 3, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 206, 250, 209, - 198, 198, 158, 250, 250, 250, 121, 121, 257 + 32767,32767,32767,32767,32767, 377, 378, 489, 502,32767, + 503,32767, 409, 341, 342, 344, 320,32767, 322, 367, + 368, 369, 370, 371, 372, 373, 375,32767, 415,32767, + 418,32767,32767,32767, 255,32767, 553,32767,32767, 304, + 553,32767,32767,32767, 547,32767,32767, 298,32767,32767, + 32767,32767, 251,32767, 169,32767, 537,32767, 554,32767, + 511,32767, 340,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 512,32767,32767,32767,32767, 227,32767, 448, + 32767, 116,32767,32767,32767, 187,32767,32767, 302, 246, + 32767,32767, 546,32767,32767,32767,32767,32767,32767,32767, + 32767, 114,32767, 170,32767,32767,32767, 189,32767,32767, + 511,32767,32767,32767,32767,32767,32767,32767, 293,32767, + 32767,32767,32767,32767,32767,32767, 511,32767,32767, 231, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 411, + 32767, 274,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 127, 127, 3, 127, 127, 258, 3, + 258, 127, 258, 258, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 214, 217, 206, 206, 164, 127, + 127, 266 ); protected $goto = array( - 162, 162, 136, 136, 141, 136, 137, 138, 139, 144, - 146, 183, 164, 160, 160, 160, 160, 141, 141, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 156, 157, 158, 159, 180, 135, 181, 495, 496, 362, - 497, 501, 502, 503, 504, 505, 506, 507, 508, 964, - 140, 142, 143, 145, 167, 172, 182, 198, 247, 250, - 252, 254, 256, 257, 258, 259, 260, 261, 269, 270, - 271, 272, 287, 288, 316, 317, 318, 381, 382, 383, - 551, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 147, 148, 149, 163, 150, 165, - 151, 199, 166, 152, 153, 154, 200, 155, 133, 627, - 569, 786, 569, 569, 569, 569, 569, 569, 569, 569, - 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, - 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, - 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, - 569, 569, 569, 569, 569, 1102, 636, 1102, 1102, 1102, - 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, - 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, - 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, - 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, - 525, 817, 499, 499, 499, 499, 499, 499, 1171, 510, - 1171, 510, 499, 499, 499, 499, 499, 499, 499, 499, - 499, 499, 511, 552, 511, 582, 608, 524, 887, 887, - 1192, 1192, 755, 851, 851, 851, 851, 170, 846, 852, - 524, 524, 173, 174, 175, 390, 391, 392, 393, 169, - 197, 201, 203, 251, 253, 255, 262, 263, 264, 265, - 266, 267, 273, 274, 275, 276, 289, 290, 319, 320, - 321, 396, 397, 398, 399, 171, 176, 248, 249, 177, - 178, 179, 389, 610, 545, 545, 575, 541, 8, 343, - 1078, 1077, 543, 543, 498, 500, 531, 547, 576, 579, - 589, 595, 550, 756, 568, 574, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 568, 568, 568, 568, 568, 568, 516, - 445, 447, 935, 638, 329, 311, 1103, 620, 933, 521, - 521, 521, 521, 779, 553, 554, 555, 556, 557, 558, - 559, 560, 562, 591, 857, 613, 540, 521, 619, 512, - 360, 512, 905, 432, 432, 432, 432, 432, 432, 546, - 779, 779, 1196, 432, 432, 432, 432, 432, 432, 432, - 432, 432, 432, 1067, 1163, 1067, 894, 894, 894, 894, - 894, 1170, 363, 1170, 585, 588, 633, 894, 371, 371, - 371, 1060, 1186, 1186, 1186, 3, 4, 1067, 1067, 1067, - 1067, 600, 1067, 1067, 521, 521, 538, 570, 521, 521, - 617, 521, 371, 1151, 962, 609, 1169, 388, 772, 772, - 780, 780, 780, 782, 522, 771, 1189, 1202, 1202, 537, - 377, 659, 564, 549, 596, 884, 615, 618, 880, 622, - 623, 630, 632, 637, 639, 900, 1202, 1203, 1203, 364, - 592, 346, 406, 529, 1205, 754, 891, 542, 278, 279, - 280, 1011, 349, 1063, 1064, 400, 1203, 1060, 873, 855, - 853, 855, 657, 453, 513, 882, 877, 1083, 344, 345, - 1061, 1162, 1061, 12, 1021, 19, 15, 357, 775, 773, - 1062, 370, 375, 909, 404, 666, 1053, 448, 1058, 783, - 580, 563, 861, 914, 1148, 461, 951, 0, 0, 0, - 0, 0, 0, 23, 0, 0, 0, 0, 606, 0, + 166, 140, 140, 140, 166, 187, 168, 144, 147, 141, + 142, 143, 149, 163, 163, 163, 163, 144, 144, 165, + 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, + 138, 159, 160, 161, 162, 184, 139, 185, 493, 494, + 377, 495, 499, 500, 501, 502, 503, 504, 505, 506, + 967, 164, 145, 146, 148, 171, 176, 186, 203, 253, + 256, 258, 260, 263, 264, 265, 266, 267, 268, 269, + 277, 278, 279, 280, 303, 304, 328, 329, 330, 394, + 395, 396, 542, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 150, 151, 152, + 167, 153, 169, 154, 204, 170, 155, 156, 157, 205, + 158, 136, 620, 560, 756, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, + 560, 560, 560, 560, 560, 560, 560, 560, 560, 1108, + 628, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, + 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, + 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, + 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, + 1108, 1108, 1108, 1108, 1108, 757, 888, 888, 508, 1200, + 1200, 400, 606, 508, 536, 536, 568, 532, 534, 534, + 496, 498, 524, 540, 569, 572, 583, 590, 852, 852, + 852, 852, 847, 853, 174, 585, 519, 600, 601, 177, + 178, 179, 401, 402, 403, 404, 173, 202, 206, 208, + 257, 259, 261, 262, 270, 271, 272, 273, 274, 275, + 281, 282, 283, 284, 305, 306, 331, 332, 333, 406, + 407, 408, 409, 175, 180, 254, 255, 181, 182, 183, + 497, 497, 785, 497, 497, 497, 497, 497, 497, 497, + 497, 497, 497, 497, 497, 497, 497, 509, 578, 582, + 626, 749, 509, 544, 545, 546, 547, 548, 549, 550, + 551, 553, 586, 338, 559, 321, 559, 559, 559, 559, + 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, + 530, 349, 655, 555, 587, 352, 414, 591, 575, 604, + 885, 611, 612, 881, 616, 617, 623, 625, 630, 632, + 298, 296, 296, 296, 298, 290, 299, 944, 610, 816, + 1170, 613, 436, 436, 375, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 1072, + 1084, 1083, 945, 1065, 1072, 895, 895, 895, 895, 1178, + 895, 895, 1212, 1212, 1178, 388, 858, 561, 755, 1072, + 1072, 1072, 1072, 1072, 1072, 3, 4, 384, 384, 384, + 1212, 874, 856, 854, 856, 654, 465, 511, 883, 878, + 1089, 541, 384, 537, 384, 567, 384, 1026, 19, 15, + 371, 384, 1226, 510, 1204, 1192, 1192, 1192, 510, 906, + 372, 522, 533, 554, 912, 514, 1068, 1069, 13, 1065, + 378, 912, 1158, 594, 23, 965, 386, 386, 386, 602, + 1066, 1169, 1066, 937, 447, 449, 631, 752, 1177, 1067, + 1109, 614, 935, 1177, 605, 1197, 391, 1211, 1211, 543, + 892, 386, 1194, 1194, 1194, 399, 518, 1016, 901, 389, + 771, 529, 752, 340, 752, 1211, 518, 518, 385, 781, + 1214, 770, 772, 1063, 910, 774, 1058, 1176, 659, 953, + 514, 782, 862, 915, 450, 573, 1155, 0, 463, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 513, 528, 0, 0, 0, 0, + 513, 0, 528, 0, 350, 351, 0, 609, 512, 515, + 438, 439, 1064, 618, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 779, 1219, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 943, 0, 0, 0, + 777, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 530 + 523, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 301, 301 ); protected $gotoCheck = array( - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 53, - 63, 25, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 119, 5, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 94, 46, 110, 110, 110, 110, 110, 110, 111, 63, - 111, 63, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 40, 110, 36, 36, 40, 71, 71, - 71, 71, 11, 63, 63, 63, 63, 23, 63, 63, - 40, 40, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 47, 47, 47, 47, 47, 47, 91, 66, - 117, 117, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 2, 12, 53, 2, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 8, - 7, 7, 7, 7, 118, 118, 7, 7, 7, 8, - 8, 8, 8, 19, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 103, 29, 57, 8, 8, 57, 115, - 57, 115, 78, 53, 53, 53, 53, 53, 53, 102, - 19, 19, 132, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 76, 53, 53, 53, 53, 53, - 53, 112, 43, 112, 56, 56, 56, 53, 116, 116, - 116, 76, 112, 112, 112, 26, 26, 53, 53, 53, - 53, 120, 53, 53, 8, 8, 8, 8, 8, 8, - 53, 8, 116, 124, 94, 45, 112, 116, 19, 19, - 19, 19, 19, 19, 8, 19, 130, 133, 133, 28, - 44, 28, 28, 8, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 75, 133, 134, 134, 54, - 64, 64, 64, 54, 133, 10, 73, 54, 61, 61, - 61, 95, 14, 76, 76, 18, 134, 76, 10, 10, - 10, 10, 10, 54, 10, 10, 10, 30, 66, 66, - 76, 76, 76, 54, 30, 30, 30, 30, 21, 20, - 76, 9, 13, 79, 17, 68, 106, 59, 108, 22, - 60, 30, 65, 80, 123, 101, 93, -1, -1, -1, - -1, -1, -1, 30, -1, -1, -1, -1, 30, -1, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 57, 68, 15, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 126, + 9, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 16, 76, 76, 68, 76, + 76, 51, 51, 68, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 68, 68, + 68, 68, 68, 68, 27, 66, 101, 66, 66, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 117, 117, 29, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 61, 61, + 61, 6, 117, 110, 110, 110, 110, 110, 110, 110, + 110, 110, 110, 125, 57, 125, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 32, 71, 32, 32, 69, 69, 69, 32, 40, 40, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 5, 5, 5, 5, 5, 5, 5, 97, 62, 50, + 81, 62, 57, 57, 62, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 124, 124, 97, 81, 57, 57, 57, 57, 57, 118, + 57, 57, 142, 142, 118, 12, 33, 12, 14, 57, + 57, 57, 57, 57, 57, 30, 30, 13, 13, 13, + 142, 14, 14, 14, 14, 14, 57, 14, 14, 14, + 34, 2, 13, 109, 13, 2, 13, 34, 34, 34, + 34, 13, 13, 122, 140, 9, 9, 9, 122, 83, + 58, 58, 58, 34, 13, 13, 81, 81, 58, 81, + 46, 13, 131, 127, 34, 101, 123, 123, 123, 34, + 81, 81, 81, 8, 8, 8, 8, 11, 119, 81, + 8, 8, 8, 119, 49, 138, 48, 141, 141, 47, + 78, 123, 119, 119, 119, 123, 47, 102, 80, 17, + 23, 9, 11, 18, 11, 141, 47, 47, 11, 23, + 141, 23, 24, 115, 84, 25, 113, 119, 73, 99, + 13, 26, 70, 85, 64, 65, 130, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 9, 9, -1, -1, -1, -1, + 9, -1, 9, -1, 71, 71, -1, 13, 9, 9, + 9, 9, 13, 13, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 9, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 91, -1, -1, -1, + 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 94 + 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 5 ); protected $gotoBase = array( - 0, 0, -340, 0, 0, 142, 0, 345, 27, 186, - 483, 230, 301, 173, 170, 0, 0, 116, 162, 41, - 169, 184, 87, 35, 0, 101, -241, 0, -182, 354, - 92, 0, 0, 0, 0, 0, 187, 0, 0, -24, - 199, 0, 0, 372, 168, 163, 183, 1, 0, 0, - 0, 0, 0, 102, 53, 0, 109, -83, 0, 89, - 82, -175, 0, -92, 154, 83, -152, 0, 166, 0, - 0, -53, 0, 178, 0, 160, 65, 0, 357, 165, - 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 274, 0, 74, 159, 188, 0, 0, 0, 0, - 0, 76, 362, 320, 0, 0, 108, 0, 107, 0, - -79, -93, 110, 0, 0, 78, 106, -23, 31, -47, - 226, 0, 0, 80, 237, 0, 0, 0, 0, 0, - 172, 0, 363, 147, 167, 0, 0 + 0, 0, -184, 0, 0, 356, 290, 0, 488, 149, + 0, 182, 85, 118, 426, 112, 203, 179, 208, 0, + 0, 0, 0, 162, 190, 198, 120, 27, 0, 272, + -224, 0, -274, 406, 32, 0, 0, 0, 0, 0, + 330, 0, 0, -24, 0, 0, 440, 485, 213, 218, + 371, -74, 0, 0, 0, 0, 0, 107, 110, 0, + 0, -11, -72, 0, 104, 95, -405, 0, -94, 41, + 119, -82, 0, 164, 0, 0, -79, 0, 197, 0, + 204, 43, 0, 441, 171, 121, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 100, 0, 115, + 0, 195, 210, 0, 0, 0, 0, 0, 86, 427, + 259, 0, 0, 116, 0, 174, 0, -5, 117, 196, + 0, 0, 161, 170, 93, -21, -48, 273, 0, 0, + 91, 271, 0, 0, 0, 0, 0, 0, 216, 0, + 437, 187, 102, 0, 0 ); protected $gotoDefault = array( - -32768, 464, 670, 2, 671, 742, 750, 603, 481, 517, - 792, 793, 794, 366, 412, 482, 365, 401, 394, 781, - 774, 776, 784, 168, 402, 787, 1, 789, 523, 825, - 1012, 353, 797, 354, 594, 799, 533, 801, 802, 134, - 483, 367, 368, 534, 376, 583, 816, 268, 373, 818, - 355, 819, 828, 356, 616, 599, 565, 612, 484, 444, - 577, 277, 544, 1075, 572, 860, 342, 868, 667, 876, - 879, 485, 566, 890, 450, 898, 1088, 384, 904, 910, - 915, 918, 420, 403, 590, 922, 923, 7, 927, 628, - 629, 942, 302, 950, 963, 418, 1031, 1033, 486, 487, - 527, 458, 509, 532, 488, 1054, 438, 405, 1057, 489, - 490, 428, 429, 1072, 348, 1156, 347, 446, 310, 1143, - 586, 1107, 454, 1195, 1152, 339, 491, 492, 361, 378, - 1190, 433, 1197, 1204, 337, 369, 573 + -32768, 467, 663, 2, 664, 834, 739, 747, 597, 481, + 629, 581, 380, 1188, 791, 792, 793, 381, 367, 482, + 379, 410, 405, 780, 773, 775, 783, 172, 411, 786, + 1, 788, 517, 824, 1017, 364, 796, 365, 589, 798, + 526, 800, 801, 137, 382, 383, 527, 483, 390, 576, + 815, 276, 387, 817, 366, 818, 827, 370, 464, 454, + 459, 556, 608, 432, 446, 570, 564, 535, 1081, 565, + 861, 348, 869, 660, 877, 880, 484, 557, 891, 451, + 899, 1094, 397, 905, 911, 916, 287, 919, 417, 412, + 584, 924, 925, 5, 929, 621, 622, 8, 312, 952, + 598, 966, 420, 1036, 1038, 485, 486, 521, 458, 507, + 525, 487, 1059, 440, 413, 1062, 488, 489, 433, 434, + 1078, 354, 1163, 353, 448, 320, 1150, 579, 1113, 455, + 1203, 1159, 347, 490, 491, 376, 1182, 392, 1198, 437, + 1205, 1213, 343, 539, 566 ); protected $ruleToNonTerminal = array( - 0, 1, 3, 3, 2, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 8, 8, 9, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 14, 14, 15, 15, - 15, 15, 17, 17, 13, 13, 18, 18, 19, 19, - 20, 20, 21, 21, 16, 16, 22, 24, 24, 25, - 26, 26, 28, 27, 27, 27, 27, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 10, 10, 50, 50, - 52, 51, 51, 44, 44, 54, 54, 55, 55, 11, - 12, 12, 12, 58, 58, 58, 59, 59, 62, 62, - 60, 60, 64, 64, 37, 37, 46, 46, 49, 49, - 49, 48, 48, 65, 38, 38, 38, 38, 66, 66, - 67, 67, 68, 68, 35, 35, 31, 31, 69, 33, - 33, 70, 32, 32, 34, 34, 45, 45, 45, 56, - 56, 72, 72, 73, 73, 75, 75, 75, 74, 74, - 57, 57, 76, 76, 76, 77, 77, 78, 78, 78, - 41, 41, 79, 79, 79, 42, 42, 80, 80, 61, - 61, 81, 81, 81, 81, 86, 86, 87, 87, 88, - 88, 88, 88, 88, 89, 90, 90, 85, 85, 82, - 82, 84, 84, 92, 92, 91, 91, 91, 91, 91, - 91, 83, 83, 93, 93, 43, 43, 36, 36, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 30, 30, 40, 40, 98, 98, 99, - 99, 99, 99, 105, 94, 94, 101, 101, 107, 107, - 108, 109, 109, 109, 109, 109, 109, 63, 63, 53, - 53, 53, 95, 95, 113, 113, 110, 110, 114, 114, - 114, 114, 96, 96, 96, 100, 100, 100, 106, 106, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 23, 23, 23, 23, 23, 23, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, - 121, 121, 104, 104, 97, 97, 97, 97, 120, 120, - 123, 123, 122, 122, 124, 124, 47, 47, 47, 47, - 126, 126, 125, 125, 125, 125, 125, 127, 127, 112, - 112, 115, 115, 111, 111, 128, 128, 128, 128, 116, - 116, 116, 116, 103, 103, 117, 117, 117, 117, 71, - 129, 129, 130, 130, 130, 102, 102, 131, 131, 132, - 132, 132, 132, 118, 118, 118, 118, 134, 135, 133, - 133, 133, 133, 133, 133, 133, 136, 136, 136 + 0, 1, 3, 3, 2, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 7, 7, 7, 8, 8, 9, 10, 11, 11, + 12, 12, 13, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 18, 18, 19, 19, 21, 21, + 17, 17, 22, 22, 23, 23, 24, 24, 25, 25, + 20, 20, 26, 28, 28, 29, 30, 30, 32, 31, + 31, 31, 31, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 14, 14, 54, 54, 56, 55, 55, 48, + 48, 58, 58, 59, 59, 60, 60, 15, 16, 16, + 16, 63, 63, 63, 64, 64, 67, 67, 65, 65, + 69, 69, 41, 41, 50, 50, 53, 53, 53, 52, + 52, 70, 42, 42, 42, 42, 71, 71, 72, 72, + 73, 73, 39, 39, 35, 35, 74, 37, 37, 75, + 36, 36, 38, 38, 49, 49, 49, 61, 61, 77, + 77, 78, 78, 80, 80, 80, 79, 79, 62, 62, + 81, 81, 81, 82, 82, 83, 83, 83, 44, 44, + 84, 84, 84, 45, 45, 85, 85, 86, 86, 66, + 87, 87, 87, 87, 92, 92, 93, 93, 94, 94, + 94, 94, 94, 95, 96, 96, 91, 91, 88, 88, + 90, 90, 98, 98, 97, 97, 97, 97, 97, 97, + 89, 89, 100, 99, 99, 46, 46, 40, 40, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 34, 34, 47, 47, 105, + 105, 106, 106, 106, 106, 112, 101, 101, 108, 108, + 114, 114, 115, 116, 116, 116, 116, 116, 116, 68, + 68, 57, 57, 57, 57, 102, 102, 120, 120, 117, + 117, 121, 121, 121, 121, 103, 103, 103, 107, 107, + 107, 113, 113, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 27, 27, 27, 27, + 27, 27, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 111, 111, 104, 104, + 104, 104, 127, 127, 130, 130, 129, 129, 131, 131, + 51, 51, 51, 51, 133, 133, 132, 132, 132, 132, + 132, 134, 134, 119, 119, 122, 122, 118, 118, 136, + 135, 135, 135, 135, 123, 123, 123, 123, 110, 110, + 124, 124, 124, 124, 76, 137, 137, 138, 138, 138, + 109, 109, 139, 139, 140, 140, 140, 140, 140, 125, + 125, 125, 125, 142, 143, 141, 141, 141, 141, 141, + 141, 141, 144, 144, 144 ); protected $ruleToLength = array( @@ -862,2292 +891,1784 @@ class Php5 extends \PhpParser\ParserAbstract 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, - 5, 4, 3, 4, 2, 3, 1, 1, 7, 8, - 6, 7, 3, 1, 3, 1, 3, 1, 1, 3, - 1, 2, 1, 2, 3, 1, 3, 3, 1, 3, - 2, 0, 1, 1, 1, 1, 1, 3, 5, 8, - 3, 5, 9, 3, 2, 3, 2, 3, 2, 3, - 2, 3, 3, 3, 1, 2, 5, 7, 9, 5, - 6, 3, 3, 2, 2, 1, 1, 1, 0, 2, - 8, 0, 4, 1, 3, 0, 1, 0, 1, 10, - 7, 6, 5, 1, 2, 2, 0, 2, 0, 2, - 0, 2, 1, 3, 1, 4, 1, 4, 1, 1, - 4, 1, 3, 3, 3, 4, 4, 5, 0, 2, - 4, 3, 1, 1, 1, 4, 0, 2, 3, 0, - 2, 4, 0, 2, 0, 3, 1, 2, 1, 1, - 0, 1, 3, 4, 6, 1, 1, 1, 0, 1, - 0, 2, 2, 3, 3, 1, 3, 1, 2, 2, - 3, 1, 1, 2, 4, 3, 1, 1, 3, 2, - 0, 3, 3, 9, 3, 1, 3, 0, 2, 4, - 5, 4, 4, 4, 3, 1, 1, 1, 3, 1, - 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 3, 1, 3, 3, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 5, 4, + 3, 4, 2, 3, 1, 1, 7, 6, 3, 1, + 3, 1, 3, 1, 1, 3, 1, 3, 1, 2, + 3, 1, 3, 3, 1, 3, 2, 0, 1, 1, + 1, 1, 1, 3, 5, 8, 3, 5, 9, 3, + 2, 3, 2, 3, 2, 3, 3, 3, 3, 1, + 2, 2, 5, 7, 9, 5, 6, 3, 3, 2, + 2, 1, 1, 1, 0, 2, 8, 0, 4, 1, + 3, 0, 1, 0, 1, 0, 1, 10, 7, 6, + 5, 1, 2, 2, 0, 2, 0, 2, 0, 2, + 1, 3, 1, 4, 1, 4, 1, 1, 4, 1, + 3, 3, 3, 4, 4, 5, 0, 2, 4, 3, + 1, 1, 1, 4, 0, 2, 3, 0, 2, 4, + 0, 2, 0, 3, 1, 2, 1, 1, 0, 1, + 3, 4, 6, 1, 1, 1, 0, 1, 0, 2, + 2, 3, 3, 1, 3, 1, 2, 2, 3, 1, + 1, 2, 4, 3, 1, 1, 3, 2, 0, 1, + 3, 3, 9, 3, 1, 3, 0, 2, 4, 5, + 4, 4, 4, 3, 1, 1, 1, 3, 1, 1, + 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 1, 3, 3, 1, 0, 1, 1, 3, 3, 4, 4, 1, 2, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, - 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 1, 3, 5, 4, 3, 4, 4, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 1, 1, 1, 3, 2, 1, - 2, 10, 11, 3, 3, 2, 4, 4, 3, 4, - 4, 4, 4, 7, 3, 2, 0, 4, 1, 3, - 2, 2, 4, 6, 2, 2, 4, 1, 1, 1, - 2, 3, 1, 1, 1, 1, 1, 1, 3, 3, - 4, 4, 0, 2, 1, 0, 1, 1, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 2, 1, 3, 1, 4, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, - 4, 3, 1, 3, 1, 1, 3, 3, 0, 2, - 0, 1, 3, 1, 3, 1, 1, 1, 1, 1, - 6, 4, 3, 4, 2, 4, 4, 1, 3, 1, - 2, 1, 1, 4, 1, 3, 6, 4, 4, 4, - 4, 1, 4, 0, 1, 1, 3, 1, 1, 4, - 3, 1, 1, 1, 0, 0, 2, 3, 1, 3, - 1, 4, 2, 2, 2, 1, 2, 1, 1, 1, - 4, 3, 3, 3, 6, 3, 1, 1, 1 + 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 1, 3, 5, 4, 3, + 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 1, 1, 3, + 2, 1, 2, 10, 11, 3, 3, 2, 4, 4, + 3, 4, 4, 4, 4, 7, 3, 2, 0, 4, + 1, 3, 2, 2, 4, 6, 2, 2, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 4, 4, 0, 2, 1, 0, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 2, 1, 3, 1, 4, + 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 5, 4, 4, 3, 1, 3, 1, 1, + 3, 3, 0, 2, 0, 1, 3, 1, 3, 1, + 1, 1, 1, 1, 6, 4, 3, 4, 2, 4, + 4, 1, 3, 1, 2, 1, 1, 4, 1, 1, + 3, 6, 4, 4, 4, 4, 1, 4, 0, 1, + 1, 3, 1, 1, 4, 3, 1, 1, 1, 0, + 0, 2, 3, 1, 3, 1, 4, 2, 2, 2, + 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, + 6, 3, 1, 1, 1 ); - protected function reduceRule0() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule1() { - $this->semValue = $this->handleNamespaces($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule2() { - if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; - } - - protected function reduceRule3() { - $this->semValue = array(); - } - - protected function reduceRule4() { - $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; - if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule5() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule6() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule7() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule8() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule9() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule10() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule11() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule12() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule13() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule14() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule15() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule16() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule17() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule18() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule19() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule20() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule21() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule22() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule23() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule24() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule25() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule26() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule27() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule28() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule29() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule30() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule31() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule32() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule33() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule34() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule35() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule36() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule37() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule38() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule39() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule40() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule41() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule42() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule43() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule44() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule45() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule46() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule47() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule48() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule49() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule50() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule51() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule52() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule53() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule54() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule55() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule56() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule57() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule58() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule59() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule60() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule61() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule62() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule63() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule64() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule65() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule66() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule67() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule68() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule69() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule70() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule71() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule72() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule73() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule74() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule75() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule76() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule77() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule78() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule79() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule80() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule81() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule82() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule83() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule84() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule85() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule86() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule87() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule88() { - $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule89() { - $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(3-2)], null, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + protected function initReduceCallbacks() { + $this->reduceCallbacks = [ + 0 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 1 => function ($stackPos) { + $this->semValue = $this->handleNamespaces($this->semStack[$stackPos-(1-1)]); + }, + 2 => function ($stackPos) { + if (is_array($this->semStack[$stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); } else { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }; + }, + 3 => function ($stackPos) { + $this->semValue = array(); + }, + 4 => function ($stackPos) { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 5 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 6 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 7 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 8 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 9 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 10 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 11 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 12 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 13 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 14 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 15 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 16 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 17 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 18 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 19 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 20 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 21 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 22 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 23 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 24 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 25 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 26 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 27 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 28 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 29 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 30 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 31 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 32 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 33 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 34 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 35 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 36 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 37 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 38 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 39 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 40 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 41 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 42 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 43 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 44 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 45 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 46 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 47 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 48 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 49 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 50 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 51 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 52 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 53 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 54 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 55 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 56 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 57 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 58 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 59 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 60 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 61 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 62 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 63 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 64 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 65 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 66 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 67 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 68 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 69 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 70 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 71 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 72 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 73 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 74 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 75 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 76 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 77 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 78 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 79 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 80 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 81 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 82 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 83 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 84 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 85 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 86 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 87 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 88 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 89 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 90 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 91 => function ($stackPos) { + $this->semValue = new Name(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 92 => function ($stackPos) { + $this->semValue = new Expr\Variable(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 93 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 94 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 95 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 96 => function ($stackPos) { + $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 97 => function ($stackPos) { + $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos-(3-2)], null, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); $this->checkNamespace($this->semValue); - } - - protected function reduceRule90() { - $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + }, + 98 => function ($stackPos) { + $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos-(5-2)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); $this->checkNamespace($this->semValue); - } - - protected function reduceRule91() { - $this->semValue = new Stmt\Namespace_(null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + }, + 99 => function ($stackPos) { + $this->semValue = new Stmt\Namespace_(null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); $this->checkNamespace($this->semValue); - } + }, + 100 => function ($stackPos) { + $this->semValue = new Stmt\Use_($this->semStack[$stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 101 => function ($stackPos) { + $this->semValue = new Stmt\Use_($this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 102 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 103 => function ($stackPos) { + $this->semValue = new Stmt\Const_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 104 => function ($stackPos) { + $this->semValue = Stmt\Use_::TYPE_FUNCTION; + }, + 105 => function ($stackPos) { + $this->semValue = Stmt\Use_::TYPE_CONSTANT; + }, + 106 => function ($stackPos) { + $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-6)], $this->semStack[$stackPos-(7-2)], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 107 => function ($stackPos) { + $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 108 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 109 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 110 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 111 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 112 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 113 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 114 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(1-1)); + }, + 115 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(3-3)); + }, + 116 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(1-1)); + }, + 117 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(3-3)); + }, + 118 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL; + }, + 119 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; $this->semValue->type = $this->semStack[$stackPos-(2-1)]; + }, + 120 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 121 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 122 => function ($stackPos) { + $this->semValue = new Node\Const_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 123 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 124 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 125 => function ($stackPos) { + $this->semValue = new Node\Const_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 126 => function ($stackPos) { + if (is_array($this->semStack[$stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); } else { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }; + }, + 127 => function ($stackPos) { + $this->semValue = array(); + }, + 128 => function ($stackPos) { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 129 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 130 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 131 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 132 => function ($stackPos) { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 133 => function ($stackPos) { - protected function reduceRule92() { - $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule93() { - $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule94() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule95() { - $this->semValue = new Stmt\Const_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule96() { - $this->semValue = Stmt\Use_::TYPE_FUNCTION; - } - - protected function reduceRule97() { - $this->semValue = Stmt\Use_::TYPE_CONSTANT; - } - - protected function reduceRule98() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], $this->semStack[$this->stackPos-(7-2)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule99() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(8-4)], $this->startAttributeStack[$this->stackPos-(8-4)] + $this->endAttributeStack[$this->stackPos-(8-4)]), $this->semStack[$this->stackPos-(8-7)], $this->semStack[$this->stackPos-(8-2)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); - } - - protected function reduceRule100() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-2)] + $this->endAttributeStack[$this->stackPos-(6-2)]), $this->semStack[$this->stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule101() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule102() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule103() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule104() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule105() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule106() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule107() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule108() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(1-1)); - } - - protected function reduceRule109() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(3-3)); - } - - protected function reduceRule110() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule111() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule112() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL; - } - - protected function reduceRule113() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; $this->semValue->type = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule114() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule115() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule116() { - $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule117() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule118() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule119() { - $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule120() { - if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; - } - - protected function reduceRule121() { - $this->semValue = array(); - } - - protected function reduceRule122() { - $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; - if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule123() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule124() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule125() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule126() { - throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule127() { - - if ($this->semStack[$this->stackPos-(3-2)]) { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; $attrs = $this->startAttributeStack[$this->stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); }; + if ($this->semStack[$stackPos-(3-2)]) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; $attrs = $this->startAttributeStack[$stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); }; } else { - $startAttributes = $this->startAttributeStack[$this->stackPos-(3-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; }; + $startAttributes = $this->startAttributeStack[$stackPos-(3-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); } else { $this->semValue = null; }; if (null === $this->semValue) { $this->semValue = array(); } } - } - - protected function reduceRule128() { - $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(5-2)], ['stmts' => is_array($this->semStack[$this->stackPos-(5-3)]) ? $this->semStack[$this->stackPos-(5-3)] : array($this->semStack[$this->stackPos-(5-3)]), 'elseifs' => $this->semStack[$this->stackPos-(5-4)], 'else' => $this->semStack[$this->stackPos-(5-5)]], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule129() { - $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(8-2)], ['stmts' => $this->semStack[$this->stackPos-(8-4)], 'elseifs' => $this->semStack[$this->stackPos-(8-5)], 'else' => $this->semStack[$this->stackPos-(8-6)]], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); - } - - protected function reduceRule130() { - $this->semValue = new Stmt\While_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule131() { - $this->semValue = new Stmt\Do_($this->semStack[$this->stackPos-(5-4)], is_array($this->semStack[$this->stackPos-(5-2)]) ? $this->semStack[$this->stackPos-(5-2)] : array($this->semStack[$this->stackPos-(5-2)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule132() { - $this->semValue = new Stmt\For_(['init' => $this->semStack[$this->stackPos-(9-3)], 'cond' => $this->semStack[$this->stackPos-(9-5)], 'loop' => $this->semStack[$this->stackPos-(9-7)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - } - - protected function reduceRule133() { - $this->semValue = new Stmt\Switch_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule134() { - $this->semValue = new Stmt\Break_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule135() { - $this->semValue = new Stmt\Break_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule136() { - $this->semValue = new Stmt\Continue_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule137() { - $this->semValue = new Stmt\Continue_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule138() { - $this->semValue = new Stmt\Return_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule139() { - $this->semValue = new Stmt\Return_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule140() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule141() { - $this->semValue = new Stmt\Global_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule142() { - $this->semValue = new Stmt\Static_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule143() { - $this->semValue = new Stmt\Echo_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule144() { - $this->semValue = new Stmt\InlineHTML($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule145() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule146() { - $this->semValue = new Stmt\Unset_($this->semStack[$this->stackPos-(5-3)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule147() { - $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(7-3)], $this->semStack[$this->stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$this->stackPos-(7-5)][1], 'stmts' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule148() { - $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(9-3)], $this->semStack[$this->stackPos-(9-7)][0], ['keyVar' => $this->semStack[$this->stackPos-(9-5)], 'byRef' => $this->semStack[$this->stackPos-(9-7)][1], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - } - - protected function reduceRule149() { - $this->semValue = new Stmt\Declare_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule150() { - $this->semValue = new Stmt\TryCatch($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-5)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkTryCatch($this->semValue); - } - - protected function reduceRule151() { - $this->semValue = new Stmt\Throw_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule152() { - $this->semValue = new Stmt\Goto_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule153() { - $this->semValue = new Stmt\Label($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule154() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule155() { - $this->semValue = array(); /* means: no statement */ - } - - protected function reduceRule156() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule157() { - $startAttributes = $this->startAttributeStack[$this->stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; }; + }, + 134 => function ($stackPos) { + $this->semValue = new Stmt\If_($this->semStack[$stackPos-(5-2)], ['stmts' => is_array($this->semStack[$stackPos-(5-3)]) ? $this->semStack[$stackPos-(5-3)] : array($this->semStack[$stackPos-(5-3)]), 'elseifs' => $this->semStack[$stackPos-(5-4)], 'else' => $this->semStack[$stackPos-(5-5)]], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 135 => function ($stackPos) { + $this->semValue = new Stmt\If_($this->semStack[$stackPos-(8-2)], ['stmts' => $this->semStack[$stackPos-(8-4)], 'elseifs' => $this->semStack[$stackPos-(8-5)], 'else' => $this->semStack[$stackPos-(8-6)]], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + }, + 136 => function ($stackPos) { + $this->semValue = new Stmt\While_($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 137 => function ($stackPos) { + $this->semValue = new Stmt\Do_($this->semStack[$stackPos-(5-4)], is_array($this->semStack[$stackPos-(5-2)]) ? $this->semStack[$stackPos-(5-2)] : array($this->semStack[$stackPos-(5-2)]), $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 138 => function ($stackPos) { + $this->semValue = new Stmt\For_(['init' => $this->semStack[$stackPos-(9-3)], 'cond' => $this->semStack[$stackPos-(9-5)], 'loop' => $this->semStack[$stackPos-(9-7)], 'stmts' => $this->semStack[$stackPos-(9-9)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 139 => function ($stackPos) { + $this->semValue = new Stmt\Switch_($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 140 => function ($stackPos) { + $this->semValue = new Stmt\Break_(null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 141 => function ($stackPos) { + $this->semValue = new Stmt\Break_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 142 => function ($stackPos) { + $this->semValue = new Stmt\Continue_(null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 143 => function ($stackPos) { + $this->semValue = new Stmt\Continue_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 144 => function ($stackPos) { + $this->semValue = new Stmt\Return_(null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 145 => function ($stackPos) { + $this->semValue = new Stmt\Return_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 146 => function ($stackPos) { + $this->semValue = new Stmt\Global_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 147 => function ($stackPos) { + $this->semValue = new Stmt\Static_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 148 => function ($stackPos) { + $this->semValue = new Stmt\Echo_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 149 => function ($stackPos) { + $this->semValue = new Stmt\InlineHTML($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 150 => function ($stackPos) { + $this->semValue = new Stmt\Expression($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 151 => function ($stackPos) { + $this->semValue = new Stmt\Expression($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 152 => function ($stackPos) { + $this->semValue = new Stmt\Unset_($this->semStack[$stackPos-(5-3)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 153 => function ($stackPos) { + $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$stackPos-(7-5)][1], 'stmts' => $this->semStack[$stackPos-(7-7)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 154 => function ($stackPos) { + $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos-(9-3)], $this->semStack[$stackPos-(9-7)][0], ['keyVar' => $this->semStack[$stackPos-(9-5)], 'byRef' => $this->semStack[$stackPos-(9-7)][1], 'stmts' => $this->semStack[$stackPos-(9-9)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 155 => function ($stackPos) { + $this->semValue = new Stmt\Declare_($this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 156 => function ($stackPos) { + $this->semValue = new Stmt\TryCatch($this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-5)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); $this->checkTryCatch($this->semValue); + }, + 157 => function ($stackPos) { + $this->semValue = new Stmt\Throw_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 158 => function ($stackPos) { + $this->semValue = new Stmt\Goto_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 159 => function ($stackPos) { + $this->semValue = new Stmt\Label($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 160 => function ($stackPos) { + $this->semValue = new Stmt\Expression($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 161 => function ($stackPos) { + $this->semValue = array(); /* means: no statement */ + }, + 162 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 163 => function ($stackPos) { + $startAttributes = $this->startAttributeStack[$stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); } else { $this->semValue = null; }; if ($this->semValue === null) $this->semValue = array(); /* means: no statement */ - } - - protected function reduceRule158() { - $this->semValue = array(); - } - - protected function reduceRule159() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule160() { - $this->semValue = new Stmt\Catch_(array($this->semStack[$this->stackPos-(8-3)]), substr($this->semStack[$this->stackPos-(8-4)], 1), $this->semStack[$this->stackPos-(8-7)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); - } - - protected function reduceRule161() { - $this->semValue = null; - } - - protected function reduceRule162() { - $this->semValue = new Stmt\Finally_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule163() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule164() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule165() { - $this->semValue = false; - } - - protected function reduceRule166() { - $this->semValue = true; - } - - protected function reduceRule167() { - $this->semValue = false; - } - - protected function reduceRule168() { - $this->semValue = true; - } - - protected function reduceRule169() { - $this->semValue = new Stmt\Function_($this->semStack[$this->stackPos-(10-3)], ['byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-5)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); - } - - protected function reduceRule170() { - $this->semValue = new Stmt\Class_($this->semStack[$this->stackPos-(7-2)], ['type' => $this->semStack[$this->stackPos-(7-1)], 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - $this->checkClass($this->semValue, $this->stackPos-(7-2)); - } - - protected function reduceRule171() { - $this->semValue = new Stmt\Interface_($this->semStack[$this->stackPos-(6-2)], ['extends' => $this->semStack[$this->stackPos-(6-3)], 'stmts' => $this->semStack[$this->stackPos-(6-5)]], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - $this->checkInterface($this->semValue, $this->stackPos-(6-2)); - } - - protected function reduceRule172() { - $this->semValue = new Stmt\Trait_($this->semStack[$this->stackPos-(5-2)], ['stmts' => $this->semStack[$this->stackPos-(5-4)]], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule173() { - $this->semValue = 0; - } - - protected function reduceRule174() { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - } - - protected function reduceRule175() { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - } - - protected function reduceRule176() { - $this->semValue = null; - } - - protected function reduceRule177() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule178() { - $this->semValue = array(); - } - - protected function reduceRule179() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule180() { - $this->semValue = array(); - } - - protected function reduceRule181() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule182() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule183() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule184() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule185() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule186() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule187() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule188() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule189() { - $this->semValue = null; - } - - protected function reduceRule190() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule191() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule192() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule193() { - $this->semValue = new Stmt\DeclareDeclare($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule194() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule195() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule196() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule197() { - $this->semValue = $this->semStack[$this->stackPos-(5-3)]; - } - - protected function reduceRule198() { - $this->semValue = array(); - } - - protected function reduceRule199() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule200() { - $this->semValue = new Stmt\Case_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule201() { - $this->semValue = new Stmt\Case_(null, $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule202() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule203() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule204() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule205() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule206() { - $this->semValue = array(); - } - - protected function reduceRule207() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule208() { - $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(3-2)], is_array($this->semStack[$this->stackPos-(3-3)]) ? $this->semStack[$this->stackPos-(3-3)] : array($this->semStack[$this->stackPos-(3-3)]), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule209() { - $this->semValue = array(); - } - - protected function reduceRule210() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule211() { - $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule212() { - $this->semValue = null; - } - - protected function reduceRule213() { - $this->semValue = new Stmt\Else_(is_array($this->semStack[$this->stackPos-(2-2)]) ? $this->semStack[$this->stackPos-(2-2)] : array($this->semStack[$this->stackPos-(2-2)]), $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule214() { - $this->semValue = null; - } - - protected function reduceRule215() { - $this->semValue = new Stmt\Else_($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule216() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); - } - - protected function reduceRule217() { - $this->semValue = array($this->semStack[$this->stackPos-(2-2)], true); - } - - protected function reduceRule218() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); - } - - protected function reduceRule219() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule220() { - $this->semValue = array(); - } - - protected function reduceRule221() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule222() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule223() { - $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(4-4)], 1), null, $this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); $this->checkParam($this->semValue); - } - - protected function reduceRule224() { - $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(6-4)], 1), $this->semStack[$this->stackPos-(6-6)], $this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-3)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkParam($this->semValue); - } - - protected function reduceRule225() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule226() { - $this->semValue = 'array'; - } - - protected function reduceRule227() { - $this->semValue = 'callable'; - } - - protected function reduceRule228() { - $this->semValue = null; - } - - protected function reduceRule229() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule230() { - $this->semValue = null; - } - - protected function reduceRule231() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule232() { - $this->semValue = array(); - } - - protected function reduceRule233() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule234() { - $this->semValue = array(new Node\Arg($this->semStack[$this->stackPos-(3-2)], false, false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes)); - } - - protected function reduceRule235() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule236() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule237() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(1-1)], false, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule238() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], true, false, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule239() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], false, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule240() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule241() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule242() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule243() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule244() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule245() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule246() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule247() { - $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule248() { - $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule249() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule250() { - $this->semValue = array(); - } - - protected function reduceRule251() { - $this->semValue = new Stmt\Property($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkProperty($this->semValue, $this->stackPos-(3-1)); - } - - protected function reduceRule252() { - $this->semValue = new Stmt\ClassConst($this->semStack[$this->stackPos-(3-2)], 0, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule253() { - $this->semValue = new Stmt\ClassMethod($this->semStack[$this->stackPos-(9-4)], ['type' => $this->semStack[$this->stackPos-(9-1)], 'byRef' => $this->semStack[$this->stackPos-(9-3)], 'params' => $this->semStack[$this->stackPos-(9-6)], 'returnType' => $this->semStack[$this->stackPos-(9-8)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - $this->checkClassMethod($this->semValue, $this->stackPos-(9-1)); - } - - protected function reduceRule254() { - $this->semValue = new Stmt\TraitUse($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule255() { - $this->semValue = array(); - } - - protected function reduceRule256() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule257() { - $this->semValue = array(); - } - - protected function reduceRule258() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule259() { - $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule260() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(5-1)][0], $this->semStack[$this->stackPos-(5-1)][1], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule261() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], null, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule262() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule263() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule264() { - $this->semValue = array($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)]); - } - - protected function reduceRule265() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule266() { - $this->semValue = array(null, $this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule267() { - $this->semValue = null; - } - - protected function reduceRule268() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule269() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule270() { - $this->semValue = 0; - } - - protected function reduceRule271() { - $this->semValue = 0; - } - - protected function reduceRule272() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule273() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule274() { - $this->checkModifier($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->stackPos-(2-2)); $this->semValue = $this->semStack[$this->stackPos-(2-1)] | $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule275() { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; - } - - protected function reduceRule276() { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; - } - - protected function reduceRule277() { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; - } - - protected function reduceRule278() { - $this->semValue = Stmt\Class_::MODIFIER_STATIC; - } - - protected function reduceRule279() { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - } - - protected function reduceRule280() { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - } - - protected function reduceRule281() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule282() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule283() { - $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule284() { - $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule285() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule286() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule287() { - $this->semValue = array(); - } - - protected function reduceRule288() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule289() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule290() { - $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule291() { - $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule292() { - $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule293() { - $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule294() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule295() { - $this->semValue = new Expr\Clone_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule296() { - $this->semValue = new Expr\AssignOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule297() { - $this->semValue = new Expr\AssignOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule298() { - $this->semValue = new Expr\AssignOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule299() { - $this->semValue = new Expr\AssignOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule300() { - $this->semValue = new Expr\AssignOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule301() { - $this->semValue = new Expr\AssignOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule302() { - $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule303() { - $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule304() { - $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule305() { - $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule306() { - $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule307() { - $this->semValue = new Expr\AssignOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule308() { - $this->semValue = new Expr\PostInc($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule309() { - $this->semValue = new Expr\PreInc($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule310() { - $this->semValue = new Expr\PostDec($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule311() { - $this->semValue = new Expr\PreDec($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule312() { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule313() { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule314() { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule315() { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule316() { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule317() { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule318() { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule319() { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule320() { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule321() { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule322() { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule323() { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule324() { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule325() { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule326() { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule327() { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule328() { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule329() { - $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule330() { - $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule331() { - $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule332() { - $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule333() { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule334() { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule335() { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule336() { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule337() { - $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule338() { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule339() { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule340() { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule341() { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule342() { - $this->semValue = new Expr\Instanceof_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule343() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule344() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule345() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule346() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule347() { - $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule348() { - $this->semValue = new Expr\Isset_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule349() { - $this->semValue = new Expr\Empty_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule350() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule351() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule352() { - $this->semValue = new Expr\Eval_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule353() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule354() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule355() { - $this->semValue = new Expr\Cast\Int_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule356() { - $this->semValue = new Expr\Cast\Double($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule357() { - $this->semValue = new Expr\Cast\String_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule358() { - $this->semValue = new Expr\Cast\Array_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule359() { - $this->semValue = new Expr\Cast\Object_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule360() { - $this->semValue = new Expr\Cast\Bool_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule361() { - $this->semValue = new Expr\Cast\Unset_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule362() { - $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; - $attrs['kind'] = strtolower($this->semStack[$this->stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; - $this->semValue = new Expr\Exit_($this->semStack[$this->stackPos-(2-2)], $attrs); - } - - protected function reduceRule363() { - $this->semValue = new Expr\ErrorSuppress($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule364() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule365() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule366() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule367() { - $this->semValue = new Expr\ShellExec($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule368() { - $this->semValue = new Expr\Print_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule369() { - $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule370() { - $this->semValue = new Expr\YieldFrom($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule371() { - $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-4)], 'uses' => $this->semStack[$this->stackPos-(10-6)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); - } - - protected function reduceRule372() { - $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$this->stackPos-(11-3)], 'params' => $this->semStack[$this->stackPos-(11-5)], 'uses' => $this->semStack[$this->stackPos-(11-7)], 'returnType' => $this->semStack[$this->stackPos-(11-8)], 'stmts' => $this->semStack[$this->stackPos-(11-10)]], $this->startAttributeStack[$this->stackPos-(11-1)] + $this->endAttributes); - } - - protected function reduceRule373() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule374() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule375() { - $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule376() { - $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule377() { - $attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $attrs); - } - - protected function reduceRule378() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $attrs); - } - - protected function reduceRule379() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule380() { - $attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(4-1)][0] === "'" || ($this->semStack[$this->stackPos-(4-1)][1] === "'" && ($this->semStack[$this->stackPos-(4-1)][0] === 'b' || $this->semStack[$this->stackPos-(4-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); - $this->semValue = new Expr\ArrayDimFetch(new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(4-1)]), $attrs), $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule381() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule382() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule383() { - $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-2)]); + }, + 164 => function ($stackPos) { + $this->semValue = array(); + }, + 165 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 166 => function ($stackPos) { + $this->semValue = new Stmt\Catch_(array($this->semStack[$stackPos-(8-3)]), $this->semStack[$stackPos-(8-4)], $this->semStack[$stackPos-(8-7)], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + }, + 167 => function ($stackPos) { + $this->semValue = null; + }, + 168 => function ($stackPos) { + $this->semValue = new Stmt\Finally_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 169 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 170 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 171 => function ($stackPos) { + $this->semValue = false; + }, + 172 => function ($stackPos) { + $this->semValue = true; + }, + 173 => function ($stackPos) { + $this->semValue = false; + }, + 174 => function ($stackPos) { + $this->semValue = true; + }, + 175 => function ($stackPos) { + $this->semValue = false; + }, + 176 => function ($stackPos) { + $this->semValue = true; + }, + 177 => function ($stackPos) { + $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(10-3)], ['byRef' => $this->semStack[$stackPos-(10-2)], 'params' => $this->semStack[$stackPos-(10-5)], 'returnType' => $this->semStack[$stackPos-(10-7)], 'stmts' => $this->semStack[$stackPos-(10-9)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + }, + 178 => function ($stackPos) { + $this->semValue = new Stmt\Class_($this->semStack[$stackPos-(7-2)], ['type' => $this->semStack[$stackPos-(7-1)], 'extends' => $this->semStack[$stackPos-(7-3)], 'implements' => $this->semStack[$stackPos-(7-4)], 'stmts' => $this->semStack[$stackPos-(7-6)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + $this->checkClass($this->semValue, $stackPos-(7-2)); + }, + 179 => function ($stackPos) { + $this->semValue = new Stmt\Interface_($this->semStack[$stackPos-(6-2)], ['extends' => $this->semStack[$stackPos-(6-3)], 'stmts' => $this->semStack[$stackPos-(6-5)]], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + $this->checkInterface($this->semValue, $stackPos-(6-2)); + }, + 180 => function ($stackPos) { + $this->semValue = new Stmt\Trait_($this->semStack[$stackPos-(5-2)], ['stmts' => $this->semStack[$stackPos-(5-4)]], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 181 => function ($stackPos) { + $this->semValue = 0; + }, + 182 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + }, + 183 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + }, + 184 => function ($stackPos) { + $this->semValue = null; + }, + 185 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 186 => function ($stackPos) { + $this->semValue = array(); + }, + 187 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 188 => function ($stackPos) { + $this->semValue = array(); + }, + 189 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 190 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 191 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 192 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 193 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 194 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 195 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 196 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 197 => function ($stackPos) { + $this->semValue = null; + }, + 198 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 199 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 200 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 201 => function ($stackPos) { + $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 202 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 203 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-3)]; + }, + 204 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 205 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(5-3)]; + }, + 206 => function ($stackPos) { + $this->semValue = array(); + }, + 207 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 208 => function ($stackPos) { + $this->semValue = new Stmt\Case_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 209 => function ($stackPos) { + $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 210 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 211 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 212 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 213 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 214 => function ($stackPos) { + $this->semValue = array(); + }, + 215 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 216 => function ($stackPos) { + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(3-2)], is_array($this->semStack[$stackPos-(3-3)]) ? $this->semStack[$stackPos-(3-3)] : array($this->semStack[$stackPos-(3-3)]), $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 217 => function ($stackPos) { + $this->semValue = array(); + }, + 218 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 219 => function ($stackPos) { + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 220 => function ($stackPos) { + $this->semValue = null; + }, + 221 => function ($stackPos) { + $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos-(2-2)]) ? $this->semStack[$stackPos-(2-2)] : array($this->semStack[$stackPos-(2-2)]), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 222 => function ($stackPos) { + $this->semValue = null; + }, + 223 => function ($stackPos) { + $this->semValue = new Stmt\Else_($this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 224 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + }, + 225 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(2-2)], true); + }, + 226 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + }, + 227 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 228 => function ($stackPos) { + $this->semValue = array(); + }, + 229 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 230 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 231 => function ($stackPos) { + $this->semValue = new Node\Param($this->semStack[$stackPos-(4-4)], null, $this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); $this->checkParam($this->semValue); + }, + 232 => function ($stackPos) { + $this->semValue = new Node\Param($this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-6)], $this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-3)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); $this->checkParam($this->semValue); + }, + 233 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 234 => function ($stackPos) { + $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 235 => function ($stackPos) { + $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 236 => function ($stackPos) { + $this->semValue = null; + }, + 237 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 238 => function ($stackPos) { + $this->semValue = null; + }, + 239 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 240 => function ($stackPos) { + $this->semValue = array(); + }, + 241 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 242 => function ($stackPos) { + $this->semValue = array(new Node\Arg($this->semStack[$stackPos-(3-2)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes)); + }, + 243 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 244 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 245 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(1-1)], false, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 246 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], true, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 247 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], false, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 248 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 249 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 250 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 251 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 252 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 253 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 254 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 255 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 256 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 257 => function ($stackPos) { + if ($this->semStack[$stackPos-(2-2)] !== null) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; } + }, + 258 => function ($stackPos) { + $this->semValue = array(); + }, + 259 => function ($stackPos) { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 260 => function ($stackPos) { + $this->semValue = new Stmt\Property($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->checkProperty($this->semValue, $stackPos-(3-1)); + }, + 261 => function ($stackPos) { + $this->semValue = new Stmt\ClassConst($this->semStack[$stackPos-(3-2)], 0, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 262 => function ($stackPos) { + $this->semValue = new Stmt\ClassMethod($this->semStack[$stackPos-(9-4)], ['type' => $this->semStack[$stackPos-(9-1)], 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-6)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + $this->checkClassMethod($this->semValue, $stackPos-(9-1)); + }, + 263 => function ($stackPos) { + $this->semValue = new Stmt\TraitUse($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 264 => function ($stackPos) { + $this->semValue = array(); + }, + 265 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 266 => function ($stackPos) { + $this->semValue = array(); + }, + 267 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 268 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 269 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(5-1)][0], $this->semStack[$stackPos-(5-1)][1], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 270 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], null, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 271 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 272 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 273 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + }, + 274 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 275 => function ($stackPos) { + $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); + }, + 276 => function ($stackPos) { + $this->semValue = null; + }, + 277 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 278 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 279 => function ($stackPos) { + $this->semValue = 0; + }, + 280 => function ($stackPos) { + $this->semValue = 0; + }, + 281 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 282 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 283 => function ($stackPos) { + $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + }, + 284 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + }, + 285 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + }, + 286 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + }, + 287 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_STATIC; + }, + 288 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + }, + 289 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + }, + 290 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 291 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 292 => function ($stackPos) { + $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 293 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 294 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 295 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 296 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 297 => function ($stackPos) { + $this->semValue = array(); + }, + 298 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 299 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 300 => function ($stackPos) { + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 301 => function ($stackPos) { + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 302 => function ($stackPos) { + $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 303 => function ($stackPos) { + $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 304 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 305 => function ($stackPos) { + $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 306 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 307 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 308 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 309 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 310 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 311 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 312 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 313 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 314 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 315 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 316 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 317 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 318 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 319 => function ($stackPos) { + $this->semValue = new Expr\PostInc($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 320 => function ($stackPos) { + $this->semValue = new Expr\PreInc($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 321 => function ($stackPos) { + $this->semValue = new Expr\PostDec($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 322 => function ($stackPos) { + $this->semValue = new Expr\PreDec($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 323 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 324 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 325 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 326 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 327 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 328 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 329 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 330 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 331 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 332 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 333 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 334 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 335 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 336 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 337 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 338 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 339 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 340 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 341 => function ($stackPos) { + $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 342 => function ($stackPos) { + $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 343 => function ($stackPos) { + $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 344 => function ($stackPos) { + $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 345 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 346 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 347 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 348 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 349 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 350 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 351 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 352 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 353 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 354 => function ($stackPos) { + $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 355 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 356 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 357 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 358 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 359 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 360 => function ($stackPos) { + $this->semValue = new Expr\Isset_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 361 => function ($stackPos) { + $this->semValue = new Expr\Empty_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 362 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 363 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 364 => function ($stackPos) { + $this->semValue = new Expr\Eval_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 365 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 366 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 367 => function ($stackPos) { + $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 368 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; + $attrs['kind'] = $this->getFloatCastKind($this->semStack[$stackPos-(2-1)]); + $this->semValue = new Expr\Cast\Double($this->semStack[$stackPos-(2-2)], $attrs); + }, + 369 => function ($stackPos) { + $this->semValue = new Expr\Cast\String_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 370 => function ($stackPos) { + $this->semValue = new Expr\Cast\Array_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 371 => function ($stackPos) { + $this->semValue = new Expr\Cast\Object_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 372 => function ($stackPos) { + $this->semValue = new Expr\Cast\Bool_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 373 => function ($stackPos) { + $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 374 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; + $attrs['kind'] = strtolower($this->semStack[$stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $this->semValue = new Expr\Exit_($this->semStack[$stackPos-(2-2)], $attrs); + }, + 375 => function ($stackPos) { + $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 376 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 377 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 378 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 379 => function ($stackPos) { + $this->semValue = new Expr\ShellExec($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 380 => function ($stackPos) { + $this->semValue = new Expr\Print_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 381 => function ($stackPos) { + $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 382 => function ($stackPos) { + $this->semValue = new Expr\YieldFrom($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 383 => function ($stackPos) { + $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$stackPos-(10-2)], 'params' => $this->semStack[$stackPos-(10-4)], 'uses' => $this->semStack[$stackPos-(10-6)], 'returnType' => $this->semStack[$stackPos-(10-7)], 'stmts' => $this->semStack[$stackPos-(10-9)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + }, + 384 => function ($stackPos) { + $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$stackPos-(11-3)], 'params' => $this->semStack[$stackPos-(11-5)], 'uses' => $this->semStack[$stackPos-(11-7)], 'returnType' => $this->semStack[$stackPos-(11-8)], 'stmts' => $this->semStack[$stackPos-(11-10)]], $this->startAttributeStack[$stackPos-(11-1)] + $this->endAttributes); + }, + 385 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 386 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 387 => function ($stackPos) { + $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(2-2)], null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 388 => function ($stackPos) { + $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 389 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(4-3)], $attrs); + }, + 390 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(3-2)], $attrs); + }, + 391 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 392 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$stackPos-(4-1)][0] === "'" || ($this->semStack[$stackPos-(4-1)][1] === "'" && ($this->semStack[$stackPos-(4-1)][0] === 'b' || $this->semStack[$stackPos-(4-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); + $this->semValue = new Expr\ArrayDimFetch(new Scalar\String_(Scalar\String_::parse($this->semStack[$stackPos-(4-1)]), $attrs), $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 393 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 394 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 395 => function ($stackPos) { + $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$stackPos-(7-3)], 'implements' => $this->semStack[$stackPos-(7-4)], 'stmts' => $this->semStack[$stackPos-(7-6)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes), $this->semStack[$stackPos-(7-2)]); $this->checkClass($this->semValue[0], -1); - } - - protected function reduceRule384() { - $this->semValue = new Expr\New_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule385() { - list($class, $ctorArgs) = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule386() { - $this->semValue = array(); - } - - protected function reduceRule387() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule388() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule389() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule390() { - $this->semValue = new Expr\ClosureUse(substr($this->semStack[$this->stackPos-(2-2)], 1), $this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule391() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule392() { - $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule393() { - $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-4)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule394() { - - if ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\StaticPropertyFetch) { - $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(2-1)]->class, new Expr\Variable($this->semStack[$this->stackPos-(2-1)]->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } elseif ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\ArrayDimFetch) { - $tmp = $this->semStack[$this->stackPos-(2-1)]; - while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { - $tmp = $tmp->var; - } - - $this->semValue = new Expr\StaticCall($tmp->var->class, $this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - $tmp->var = new Expr\Variable($tmp->var->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } else { - throw new \Exception; - } - - } - - protected function reduceRule395() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule396() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule397() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule398() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule399() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule400() { - $this->semValue = new Name\FullyQualified($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule401() { - $this->semValue = new Name\Relative($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule402() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule403() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule404() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule405() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule406() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule407() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule408() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule409() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule410() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule411() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule412() { - $this->semValue = null; - } - - protected function reduceRule413() { - $this->semValue = null; - } - - protected function reduceRule414() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule415() { - $this->semValue = array(); - } - - protected function reduceRule416() { - $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$this->stackPos-(1-1)], '`', false), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes)); - } - - protected function reduceRule417() { - foreach ($this->semStack[$this->stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', false); } }; $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule418() { - $this->semValue = array(); - } - - protected function reduceRule419() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule420() { - $this->semValue = $this->parseLNumber($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes, true); - } - - protected function reduceRule421() { - $this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule422() { - $attrs = $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(1-1)][0] === "'" || ($this->semStack[$this->stackPos-(1-1)][1] === "'" && ($this->semStack[$this->stackPos-(1-1)][0] === 'b' || $this->semStack[$this->stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); - $this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)], false), $attrs); - } - - protected function reduceRule423() { - $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule424() { - $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule425() { - $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule426() { - $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule427() { - $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule428() { - $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule429() { - $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule430() { - $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule431() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; - $this->semValue = new Scalar\String_(Scalar\String_::parseDocString($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], false), $attrs); - } - - protected function reduceRule432() { - $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(2-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(2-1)], $matches); $attrs['docLabel'] = $matches[1];; - $this->semValue = new Scalar\String_('', $attrs); - } - - protected function reduceRule433() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule434() { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule435() { - $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule436() { - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule437() { - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule438() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule439() { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule440() { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule441() { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule442() { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule443() { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule444() { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule445() { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule446() { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule447() { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule448() { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule449() { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule450() { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule451() { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule452() { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule453() { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule454() { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule455() { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule456() { - $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule457() { - $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule458() { - $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule459() { - $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule460() { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule461() { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule462() { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule463() { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule464() { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule465() { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule466() { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule467() { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule468() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule469() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule470() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule471() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule472() { - $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule473() { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule474() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule475() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule476() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; - foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); - } - - protected function reduceRule477() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; - foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); - } - - protected function reduceRule478() { - $this->semValue = array(); - } - - protected function reduceRule479() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule480() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule481() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule482() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule483() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule484() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule485() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule486() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule487() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule488() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule489() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule490() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule491() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule492() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule493() { - $this->semValue = new Expr\MethodCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule494() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule495() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule496() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule497() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule498() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule499() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule500() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule501() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule502() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule503() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule504() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule505() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], substr($this->semStack[$this->stackPos-(3-3)], 1), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule506() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule507() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule508() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule509() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule510() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule511() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule512() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule513() { - $this->semValue = null; - } - - protected function reduceRule514() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule515() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule516() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule517() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule518() { - $this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; - } - - protected function reduceRule519() { - $this->semValue = new Expr\List_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule520() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule521() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule522() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule523() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule524() { - $this->semValue = null; - } - - protected function reduceRule525() { - $this->semValue = array(); - } - - protected function reduceRule526() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule527() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule528() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule529() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule530() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule531() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-1)], true, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule532() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(2-2)], null, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule533() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule534() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule535() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule536() { - $this->semValue = array($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); - } - - protected function reduceRule537() { - $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule538() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule539() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule540() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule541() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule542() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule543() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule544() { - $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-4)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule545() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule546() { - $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule547() { - $this->semValue = $this->parseNumString($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule548() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + }, + 396 => function ($stackPos) { + $this->semValue = new Expr\New_($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 397 => function ($stackPos) { + list($class, $ctorArgs) = $this->semStack[$stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 398 => function ($stackPos) { + $this->semValue = array(); + }, + 399 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-3)]; + }, + 400 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 401 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 402 => function ($stackPos) { + $this->semValue = new Expr\ClosureUse($this->semStack[$stackPos-(2-2)], $this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 403 => function ($stackPos) { + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 404 => function ($stackPos) { + $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 405 => function ($stackPos) { + $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 406 => function ($stackPos) { + $this->semValue = $this->fixupPhp5StaticPropCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 407 => function ($stackPos) { + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 408 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 409 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 410 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 411 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 412 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 413 => function ($stackPos) { + $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 414 => function ($stackPos) { + $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 415 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 416 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 417 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 418 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 419 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 420 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 421 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 422 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 423 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 424 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 425 => function ($stackPos) { + $this->semValue = null; + }, + 426 => function ($stackPos) { + $this->semValue = null; + }, + 427 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 428 => function ($stackPos) { + $this->semValue = array(); + }, + 429 => function ($stackPos) { + $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`', false), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); + }, + 430 => function ($stackPos) { + foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', false); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 431 => function ($stackPos) { + $this->semValue = array(); + }, + 432 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 433 => function ($stackPos) { + $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, true); + }, + 434 => function ($stackPos) { + $this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$stackPos-(1-1)]), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 435 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$stackPos-(1-1)][0] === "'" || ($this->semStack[$stackPos-(1-1)][1] === "'" && ($this->semStack[$stackPos-(1-1)][0] === 'b' || $this->semStack[$stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); + $this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$stackPos-(1-1)], false), $attrs); + }, + 436 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 437 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 438 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 439 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 440 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 441 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 442 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 443 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 444 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], false); + }, + 445 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], false); + }, + 446 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 447 => function ($stackPos) { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 448 => function ($stackPos) { + $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 449 => function ($stackPos) { + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 450 => function ($stackPos) { + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 451 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 452 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 453 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 454 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 455 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 456 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 457 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 458 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 459 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 460 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 461 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 462 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 463 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 464 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 465 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 466 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 467 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 468 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 469 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 470 => function ($stackPos) { + $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 471 => function ($stackPos) { + $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 472 => function ($stackPos) { + $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 473 => function ($stackPos) { + $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 474 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 475 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 476 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 477 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 478 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 479 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 480 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 481 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 482 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 483 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 484 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 485 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 486 => function ($stackPos) { + $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 487 => function ($stackPos) { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 488 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 489 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 490 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs); + }, + 491 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); + }, + 492 => function ($stackPos) { + $this->semValue = array(); + }, + 493 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 494 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 495 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 496 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 497 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 498 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 499 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 500 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 501 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 502 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 503 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 504 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 505 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 506 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 507 => function ($stackPos) { + $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 508 => function ($stackPos) { + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 509 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 510 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 511 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 512 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 513 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 514 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 515 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 516 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 517 => function ($stackPos) { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 518 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 519 => function ($stackPos) { + $var = substr($this->semStack[$stackPos-(1-1)], 1); $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; + }, + 520 => function ($stackPos) { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 521 => function ($stackPos) { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(6-1)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 522 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 523 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 524 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 525 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 526 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 527 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 528 => function ($stackPos) { + $this->semValue = null; + }, + 529 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 530 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 531 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 532 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 533 => function ($stackPos) { + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; + }, + 534 => function ($stackPos) { + $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 535 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 536 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 537 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 538 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 539 => function ($stackPos) { + $this->semValue = null; + }, + 540 => function ($stackPos) { + $this->semValue = array(); + }, + 541 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 542 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 543 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 544 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 545 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 546 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 547 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 548 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 549 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 550 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 551 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 552 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); + }, + 553 => function ($stackPos) { + $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 554 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 555 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 556 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 557 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 558 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 559 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 560 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 561 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 562 => function ($stackPos) { + $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 563 => function ($stackPos) { + $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 564 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + ]; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Parser/Php7.php b/lib/nikic/php-parser/lib/PhpParser/Parser/Php7.php index 591bd61fc..7a0854b30 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Parser/Php7.php +++ b/lib/nikic/php-parser/lib/PhpParser/Parser/Php7.php @@ -17,21 +17,22 @@ use PhpParser\Node\Stmt; */ class Php7 extends \PhpParser\ParserAbstract { - protected $tokenToSymbolMapSize = 392; - protected $actionTableSize = 915; - protected $gotoTableSize = 429; + protected $tokenToSymbolMapSize = 396; + protected $actionTableSize = 1196; + protected $gotoTableSize = 545; - protected $invalidSymbol = 157; + protected $invalidSymbol = 168; protected $errorSymbol = 1; protected $defaultAction = -32766; protected $unexpectedTokenRule = 32767; - protected $YY2TBLSTATE = 330; - protected $YYNLSTATES = 578; + protected $YY2TBLSTATE = 420; + protected $numNonLeafStates = 710; protected $symbolToName = array( "EOF", "error", + "T_THROW", "T_INCLUDE", "T_INCLUDE_ONCE", "T_EVAL", @@ -58,6 +59,7 @@ class Php7 extends \PhpParser\ParserAbstract "T_SL_EQUAL", "T_SR_EQUAL", "T_POW_EQUAL", + "T_COALESCE_EQUAL", "'?'", "':'", "T_COALESCE", @@ -65,7 +67,8 @@ class Php7 extends \PhpParser\ParserAbstract "T_BOOLEAN_AND", "'|'", "'^'", - "'&'", + "T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG", + "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG", "T_IS_EQUAL", "T_IS_NOT_EQUAL", "T_IS_IDENTICAL", @@ -126,6 +129,7 @@ class Php7 extends \PhpParser\ParserAbstract "T_ENDDECLARE", "T_AS", "T_SWITCH", + "T_MATCH", "T_ENDSWITCH", "T_CASE", "T_DEFAULT", @@ -133,12 +137,12 @@ class Php7 extends \PhpParser\ParserAbstract "T_CONTINUE", "T_GOTO", "T_FUNCTION", + "T_FN", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH", "T_FINALLY", - "T_THROW", "T_USE", "T_INSTEADOF", "T_GLOBAL", @@ -148,6 +152,7 @@ class Php7 extends \PhpParser\ParserAbstract "T_PRIVATE", "T_PROTECTED", "T_PUBLIC", + "T_READONLY", "T_VAR", "T_UNSET", "T_ISSET", @@ -156,9 +161,11 @@ class Php7 extends \PhpParser\ParserAbstract "T_CLASS", "T_TRAIT", "T_INTERFACE", + "T_ENUM", "T_EXTENDS", "T_IMPLEMENTS", "T_OBJECT_OPERATOR", + "T_NULLSAFE_OBJECT_OPERATOR", "T_LIST", "T_ARRAY", "T_CALLABLE", @@ -178,585 +185,719 @@ class Php7 extends \PhpParser\ParserAbstract "T_DIR", "T_NS_SEPARATOR", "T_ELLIPSIS", + "T_NAME_FULLY_QUALIFIED", + "T_NAME_QUALIFIED", + "T_NAME_RELATIVE", + "T_ATTRIBUTE", "';'", + "']'", "'{'", "'}'", "'('", "')'", "'`'", - "']'", "'\"'", "'$'" ); protected $tokenToSymbol = array( - 0, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 53, 155, 157, 156, 52, 35, 157, - 151, 152, 50, 47, 7, 48, 49, 51, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 29, 148, - 41, 15, 43, 28, 65, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 67, 157, 154, 34, 157, 153, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 149, 33, 150, 55, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 1, 2, 3, 4, - 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, + 0, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 56, 166, 168, 167, 55, 168, 168, + 163, 164, 53, 50, 8, 51, 52, 54, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 31, 159, + 44, 16, 46, 30, 68, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 70, 168, 160, 36, 168, 165, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 161, 35, 162, 58, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 1, 2, 3, 4, + 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 30, 31, 32, 36, 37, 38, 39, 40, 42, - 44, 45, 46, 54, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 66, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 157, 157, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, + 41, 42, 43, 45, 47, 48, 49, 57, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158 + ); + + protected $action = array( + 132, 133, 134, 569, 135, 136, 0, 722, 723, 724, + 137, 37, 834, 911, 835, 469,-32766,-32766,-32766,-32767, + -32767,-32767,-32767, 101, 102, 103, 104, 105, 1068, 1069, + 1070, 1067, 1066, 1065, 1071, 716, 715,-32766,-32766,-32766, + -32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767, + -32767, 545, 546,-32766,-32766, 725,-32766,-32766,-32766, 998, + 999, 806, 922, 447, 448, 449, 370, 371, 2, 267, + 138, 396, 729, 730, 731, 732, 414,-32766, 420,-32766, + -32766,-32766,-32766,-32766, 990, 733, 734, 735, 736, 737, + 738, 739, 740, 741, 742, 743, 763, 570, 764, 765, + 766, 767, 755, 756, 336, 337, 758, 759, 744, 745, + 746, 748, 749, 750, 346, 790, 791, 792, 793, 794, + 795, 751, 752, 571, 572, 784, 775, 773, 774, 787, + 770, 771, 283, 420, 573, 574, 769, 575, 576, 577, + 578, 579, 580, 598, -575, 470, 14, 798, 772, 581, + 582, -575, 139,-32766,-32766,-32766, 132, 133, 134, 569, + 135, 136, 1017, 722, 723, 724, 137, 37, 1060,-32766, + -32766,-32766, 1303, 696,-32766, 1304,-32766,-32766,-32766,-32766, + -32766,-32766,-32766, 1068, 1069, 1070, 1067, 1066, 1065, 1071, + -32766, 716, 715, 372, 371, 1258,-32766,-32766,-32766, -572, + 106, 107, 108, 414, 270, 891, -572, 240, 1193, 1192, + 1194, 725,-32766,-32766,-32766, 1046, 109,-32766,-32766,-32766, + -32766, 986, 985, 984, 987, 267, 138, 396, 729, 730, + 731, 732, 12,-32766, 420,-32766,-32766,-32766,-32766, 998, + 999, 733, 734, 735, 736, 737, 738, 739, 740, 741, + 742, 743, 763, 570, 764, 765, 766, 767, 755, 756, + 336, 337, 758, 759, 744, 745, 746, 748, 749, 750, + 346, 790, 791, 792, 793, 794, 795, 751, 752, 571, + 572, 784, 775, 773, 774, 787, 770, 771, 881, 321, + 573, 574, 769, 575, 576, 577, 578, 579, 580,-32766, + 82, 83, 84, -575, 772, 581, 582, -575, 148, 747, + 717, 718, 719, 720, 721, 1278, 722, 723, 724, 760, + 761, 36, 1277, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 996, 270, 150, + -32766,-32766,-32766, 455, 456, 81, 34, -264, -572, 1016, + 109, 320, -572, 893, 725, 682, 803, 128, 998, 999, + 592,-32766, 1044,-32766,-32766,-32766, 809, 151, 726, 727, + 728, 729, 730, 731, 732, -88, 1198, 796, 278, -526, + 283,-32766,-32766,-32766, 733, 734, 735, 736, 737, 738, + 739, 740, 741, 742, 743, 763, 786, 764, 765, 766, + 767, 755, 756, 757, 785, 758, 759, 744, 745, 746, + 748, 749, 750, 789, 790, 791, 792, 793, 794, 795, + 751, 752, 753, 754, 784, 775, 773, 774, 787, 770, + 771, 144, 804, 762, 768, 769, 776, 777, 779, 778, + 780, 781, -314, -526, -526, -193, -192, 772, 783, 782, + 49, 50, 51, 500, 52, 53, 239, 807, -526, -86, + 54, 55, -111, 56, 996, 253,-32766, -111, 800, -111, + -526, 541, -532, -352, 300, -352, 304, -111, -111, -111, + -111, -111, -111, -111, -111, 998, 999, 998, 999, 153, + -32766,-32766,-32766, 1191, 807, 126, 306, 1293, 57, 58, + 103, 104, 105, -111, 59, 1218, 60, 246, 247, 61, + 62, 63, 64, 65, 66, 67, 68, -525, 27, 268, + 69, 436, 501, -328, 808, -86, 1224, 1225, 502, 1189, + 807, 1198, 1230, 293, 1222, 41, 24, 503, 74, 504, + 953, 505, 320, 506, 802, 154, 507, 508, 279, 684, + 280, 43, 44, 437, 367, 366, 891, 45, 509, 35, + 249, -16, -566, 358, 332, 318, -566, 1198, 1193, 1192, + 1194, -527, 510, 511, 512, 333, -524, 1274, 48, 716, + 715, -525, -525, 334, 513, 514, 807, 1212, 1213, 1214, + 1215, 1209, 1210, 292, 360, 284, -525, 285, -314, 1216, + 1211, -193, -192, 1193, 1192, 1194, 293, 891, -525, 364, + -531, 70, 807, 316, 317, 320, 31, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + -153, -153, -153, 638, 25, -527, -527, 687, 379, 881, + -524, -524, 296, 297, 891, -153, 432, -153, 807, -153, + -527, -153, 716, 715, 433, -524, 798, 363, -111, 1105, + 1107, 365, -527, 434, 891, 140, 435, -524, 954, 127, + -524, 320, -111, -111, 688, 813, 381, -529, 11, 834, + 155, 835, 867, -111, -111, -111, -111, 47, 293,-32766, + 881, 654, 655, 74, 689, 1191, 1045, 320, 708, 149, + 399, 157,-32766,-32766,-32766, 32,-32766, -79,-32766, 123, + -32766, 716, 715,-32766, 893, 891, 682, -153,-32766,-32766, + -32766, 716, 715, 891,-32766,-32766, 124, 881, 129, 74, + -32766, 411, 130, 320, -524, -524, 143, 141, -75,-32766, + 158, -529, -529, 320, 27, 691, 159, 881, 160, -524, + 161, 294, 295, 698, 368, 369, 807, -73,-32766, -72, + 1222, -524, 373, 374, 1191, 893, -71, 682, -529, 73, + -70,-32766,-32766,-32766, -69,-32766, -68,-32766, 125,-32766, + 630, 631,-32766, -67, -66, -47, -51,-32766,-32766,-32766, + -18, 147, 271,-32766,-32766, 277, 697, 700, 881,-32766, + 411, 890, 893, 146, 682, 282, 881, 907,-32766, 281, + 513, 514, 286, 1212, 1213, 1214, 1215, 1209, 1210, 326, + 131, 145, 939, 287, 682, 1216, 1211, 109, 270,-32766, + 798, 807,-32766, 662, 639, 1191, 657, 72, 675, 1075, + 317, 320,-32766,-32766,-32766, 1305,-32766, 301,-32766, 628, + -32766, 431, 543,-32766,-32766, 923, 555, 924,-32766,-32766, + -32766, 1229, 549,-32766,-32766,-32766, -4, 891, -490, 1191, + -32766, 411, 644, 893, 299, 682,-32766,-32766,-32766,-32766, + -32766, 893,-32766, 682,-32766, 13, 1231,-32766, 452, 480, + 645, 909,-32766,-32766,-32766,-32766, 658, -480,-32766,-32766, + 0, 1191, 0, 0,-32766, 411, 0, 298,-32766,-32766, + -32766, 305,-32766,-32766,-32766, 0,-32766, 0, 806,-32766, + 0, 0, 0, 475,-32766,-32766,-32766,-32766, 0, 7, + -32766,-32766, 16, 1191, 561, 596,-32766, 411, 1219, 891, + -32766,-32766,-32766, 362,-32766,-32766,-32766, 818,-32766, -267, + 881,-32766, 39, 293, 0, 0,-32766,-32766,-32766, 40, + 705, 706,-32766,-32766, 872, 963, 940, 947,-32766, 411, + 937, 948, 365, 870, 427, 891, 935,-32766, 1049, 291, + 1244, 1052, 1053, -111, -111, 1050, 1051, 1057, -560, 1262, + 1296, 633, 0, 826, -111, -111, -111, -111, 33, 315, + -32766, 361, 683, 686, 690, 692, 1191, 693, 694, 695, + 699, 685, 320,-32766,-32766,-32766, 9,-32766, 702,-32766, + 868,-32766, 881, 1300,-32766, 893, 1302, 682, -4,-32766, + -32766,-32766, 829, 828, 837,-32766,-32766, 916, -242, -242, + -242,-32766, 411, 955, 365, 27, 836, 1301, 915, 917, + -32766, 914, 1177, 900, 910, -111, -111, 807, 881, 898, + 945, 1222, 946, 1299, 1256, 867, -111, -111, -111, -111, + 1245, 1263, 1269, 1272, -241, -241, -241, -558, -532, -531, + 365, -530, 1, 28, 29, 38, 42, 46, 71, 0, + 75, -111, -111, 76, 77, 78, 79, 893, 80, 682, + -242, 867, -111, -111, -111, -111, 142, 152, 156, 245, + 322, 347, 514, 348, 1212, 1213, 1214, 1215, 1209, 1210, + 349, 350, 351, 352, 353, 354, 1216, 1211, 355, 356, + 357, 359, 428, 893, -265, 682, -241, -264, 72, 0, + 18, 317, 320, 19, 20, 21, 23, 398, 471, 472, + 479, 482, 483, 484, 485, 489, 490, 491, 498, 669, + 1202, 1145, 1220, 1019, 1018, 1181, -269, -103, 17, 22, + 26, 290, 397, 589, 593, 620, 674, 1149, 1197, 1146, + 1275, 0, -494, 1162, 0, 1223 + ); + + protected $actionCheck = array( + 2, 3, 4, 5, 6, 7, 0, 9, 10, 11, + 12, 13, 106, 1, 108, 31, 9, 10, 11, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 116, 117, + 118, 119, 120, 121, 122, 37, 38, 30, 116, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 117, 118, 9, 10, 57, 9, 10, 11, 137, + 138, 155, 128, 129, 130, 131, 106, 107, 8, 71, + 72, 73, 74, 75, 76, 77, 116, 30, 80, 32, + 33, 34, 35, 36, 1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 157, 157, 157, 157, - 157, 157, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147 - ); - - protected $action = array( - 583, 584, 585, 586, 587, 1037, 588, 589, 590, 626, - 627, 479, 29, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112,-32766,-32766,-32766, 97, 98, - 99, 0, 241, 387, -282,-32766,-32766,-32766,-32766, -487, - 1081, 544, 1084, 1082, 100,-32766, 664,-32766,-32766,-32766, - -32766,-32766, 591, 901, 903,-32766, 30,-32766,-32766,-32766, - -32766,-32766,-32766, 1034,-32766, 295, 592, 593, 594, 595, - 596, 597, 598,-32766, 274, 658, 869, 870, 871, 868, - 867, 866, 599, 600, 601, 602, 603, 604, 605, 606, - 607, 608, 609, 629, 630, 631, 632, 633, 621, 622, - 623, 624, 625, 610, 611, 612, 613, 614, 615, 616, - 652, 653, 654, 655, 656, 657, 617, 618, 619, 620, - 650, 641, 639, 640, 636, 637, -251, 628, 634, 635, - 642, 643, 645, 644, 646, 647, 74, 75, 76, 556, - 266, 638, 649, 648, 739, 44, 45, 392, 46, 47, - 375, 680, 681, 73, 48, 49, 28, 50, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 218, 241, 996, -487, -443, -487,-32766,-32766,-32766, - 51, 52, 116, 663, 100, 339, 53, 242, 54, 221, - 222, 55, 56, 57, 58, 59, 60, 61, 62, -173, - 24, 234, 63, 347, 393,-32766,-32766,-32766, 1001, 1002, - 394, 228, 1034, 217, 729,-32766, 1000, 34, 19, 395, - 1051, 396, 127, 397, 118, 398, -442, 24, 399, 984, - 43, 267, 36, 37, 400, 351, -443, 38, 401, 1034, - 248, 64, 289, 1000, 288, 290, 248,-32766, 741, 226, - -443, 1034, 404, 405, 406, 442, 291, -443, 371, -446, - 376, -251, 409, 410, 26, 1006, 1007, 1008, 1009, 1003, - 1004, 245, 977,-32766,-32766,-32766, 419, 1010, 1005, 349, - -488, 226, 549, 278, 65,-32766, 257, -442, 262, 266, - 410, 660, 467,-32766, 1073,-32766, 1048, 1072,-32766,-32766, - -32766, -442,-32766,-32766,-32766, 1078,-32766, 1034, -442,-32766, - -445, 67, 1014,-32766,-32766,-32766, 266,-32766,-32766,-32766, - -479, 123,-32766, 660, -172,-32766, 418,-32766, 266, 531, - -32766,-32766,-32766,-32766,-32766,-32766,-32766, 223,-32766, 560, - 977,-32766, 818, 819, -173,-32766,-32766,-32766, 818, 819, - -32766,-32766, -227, 561,-32766, 27, 224,-32766, 418,-32766, - -32766, 122, -441,-32766, -232,-32766, 824, 40, 124, 227, - -88, 791, 265,-32766, 984, 1052,-32766,-32766,-32766, 660, - 94, 95, 96,-32766, 266, 364,-32766,-32766,-32766, 42, - -32766, 553,-32766, 122,-32766,-32766,-32766,-32766,-32766,-32766, - -32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766, 363, 532, - -32766, 660, 554,-32766, 418,-32766, -477, 9,-32766,-32766, - -32766,-32766,-32766, -441,-32766, -488,-32766, -488, 249,-32766, - 248, 660, 121,-32766,-32766,-32766,-32766, -441,-32766,-32766, - 359, 555,-32766, 551, -441,-32766, 418, 517, 518, 115, - 250,-32766, 1034,-32766,-32767,-32767,-32767,-32767, 92, 93, - 94, 95, 96, 23, 308, -479, 504, 20, 344, -172, - 225, 117, 741, 126,-32766, 533, -441, 564, 349,-32766, - 660, 133, 847,-32766,-32766, 977, 120,-32766,-32766,-32766, - 792,-32766, 119,-32766, 114,-32766, 345, 419,-32766, 113, - 349, 130,-32766,-32766,-32766, 132,-32766,-32766,-32766, 738, - 741,-32766, 660, 241,-32766, 418,-32766, 244,-32766,-32766, - -32766,-32766,-32766,-32766, 128,-32766, 753,-32766, 527, 266, - -32766, 741, 818, 819,-32766,-32766,-32766, -441, 100,-32766, - -32766, 129, 313,-32766, 680, 681,-32766, 418, 41,-32766, - 660, -441,-32766, 453,-32766, 660, 321,-32766, -441,-32766, - 777, -477,-32766,-32766,-32766, 1083,-32766, 261,-32766, 441, - -32766, 385, 8,-32766, 437, 24, 360,-32766,-32766,-32766, - 497, 498,-32766,-32766,-32766, 501,-32766, 1034,-32766,-32766, - 418, 1000, 818, 819, 660, 846, 575,-32766,-32766, 358, - -4,-32766,-32766,-32766, 301,-32766, 1076,-32766, 661,-32766, - 455, 696,-32766, 858, 565, 513,-32766,-32766,-32766, 440, - 977,-32766,-32766, 973, 446,-32766, 505,-32766,-32766, 418, - -133, -133, -133,-32766,-32766,-32766,-32766, 409, 410, 451, - 542, 528, 509, 521, 510, -133, 12, -133, -80, -133, - 216, -133, 495,-32766, 458,-32766,-32766,-32766,-32766, 67, - 348, 356, 259, 258, 266, 1016,-32766,-32766,-32766,-32766, - 260, 402, 403, 869, 870, 871, 868, 867, 866, 861, - 715, 760, 407, 408, 977, 761, 762,-32766, 11,-32766, - -32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767,-32767, - 264, 229, 348, 337, 1013, 852, 741, 17, -133, 256, - -212, -212, -212, 402, 403, -400, 348, 5, 307, 775, - 758, 21, 672, 760, 407, 408, 329, 402, 403, -211, - -211, -211, 448, 24, 326, 348, 715, 760, 407, 408, - 341, 340, 318, 276, 325, 1034, 402, 403, 741, 1000, - -4,-32766,-32766,-32766, 359, 715, 760, 407, 408, 755, - 552, 33, 741, 573, -212, 574, 720, 842, 794, 778, - 32,-32766, 851,-32766,-32766, 854, 853, 850, 977, 773, - 785, 741, 718, -211, 786, 843, 741, 252, 334, 550, - 557, 558, 559, 562, 272, 409, 410, 273, 571, 570, - 568, 566, 563, 335, 0, 757, 965, 783, 859, 0, - 746, 964, 963, 756, 748, 683, 0, 67, 1079, 682, - 685, 784, 266, 567, 716, 1080, 675, 674, 684, 759, - 1049, 1046, 1041, 1077, 1035, 1028, 0, -444, -467, -446, - -445, 22, 25, 31, 35, 39, 66, 338, 336, 275, - 240, 239, 238, 237, 220, 219, 134, 131, 125, 72, - 71, 70, 69, 68, -469, 0, 310, 475, 941, 491, - 541, 944, 13, 969, 825, 998, 940, 988, -230, -88, - 538, 390, 383, 380, 377, 311, 18, 16, 15, 14, - -227, -228, 0, 957, -412, 0, 503, 0, 1040, 1075, - 1026, 1027, 997, 0, 1015 - ); - - protected $actionCheck = array( - 2, 3, 4, 5, 6, 1, 8, 9, 10, 11, - 12, 48, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 8, 9, 10, 50, 51, - 52, 0, 54, 7, 79, 8, 9, 10, 8, 7, - 77, 77, 79, 80, 66, 28, 1, 30, 31, 32, - 33, 34, 54, 56, 57, 28, 13, 30, 31, 32, - 33, 34, 35, 79, 109, 7, 68, 69, 70, 71, - 72, 73, 74, 118, 7, 77, 112, 113, 114, 115, - 116, 117, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 7, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 8, 9, 10, 29, - 156, 143, 144, 145, 1, 2, 3, 4, 5, 6, - 29, 102, 103, 149, 11, 12, 28, 14, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 13, 54, 1, 152, 67, 154, 8, 9, 10, - 47, 48, 13, 148, 66, 146, 53, 7, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 7, - 67, 68, 69, 70, 71, 8, 9, 10, 75, 76, - 77, 7, 79, 13, 81, 1, 83, 84, 85, 86, - 1, 88, 67, 90, 7, 92, 67, 67, 95, 1, - 7, 67, 99, 100, 101, 102, 128, 104, 105, 79, - 28, 108, 7, 83, 111, 112, 28, 1, 148, 35, - 142, 79, 119, 120, 121, 82, 7, 149, 7, 151, - 149, 152, 129, 130, 7, 132, 133, 134, 135, 136, - 137, 138, 112, 8, 9, 10, 143, 144, 145, 146, - 7, 35, 149, 33, 151, 71, 153, 128, 155, 156, - 130, 77, 128, 28, 79, 81, 77, 82, 84, 85, - 86, 142, 88, 1, 90, 150, 92, 79, 149, 95, - 151, 151, 139, 99, 100, 101, 156, 71, 104, 105, - 7, 149, 108, 77, 7, 111, 112, 81, 156, 79, - 84, 85, 86, 119, 88, 1, 90, 35, 92, 29, - 112, 95, 130, 131, 152, 99, 100, 101, 130, 131, - 104, 105, 152, 29, 108, 140, 141, 111, 112, 8, - 9, 147, 67, 149, 152, 119, 152, 67, 149, 35, - 152, 29, 7, 71, 1, 152, 8, 9, 10, 77, - 47, 48, 49, 81, 156, 7, 84, 85, 86, 67, - 88, 29, 90, 147, 92, 149, 28, 95, 30, 31, - 32, 99, 100, 101, 1, 71, 104, 105, 7, 77, - 108, 77, 29, 111, 112, 81, 7, 7, 84, 85, - 86, 119, 88, 128, 90, 152, 92, 154, 128, 95, - 28, 77, 29, 99, 100, 101, 1, 142, 104, 105, - 146, 29, 108, 149, 149, 111, 112, 72, 73, 149, - 128, 149, 79, 119, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 7, 142, 152, 72, 73, 7, 152, - 35, 149, 148, 15, 71, 143, 67, 29, 146, 1, - 77, 15, 150, 149, 81, 112, 15, 84, 85, 86, - 148, 88, 15, 90, 15, 92, 123, 143, 95, 15, - 146, 15, 99, 100, 101, 15, 71, 104, 105, 29, - 148, 108, 77, 54, 111, 112, 81, 29, 1, 84, - 85, 86, 119, 88, 29, 90, 35, 92, 74, 156, - 95, 148, 130, 131, 99, 100, 101, 128, 66, 104, - 105, 97, 98, 108, 102, 103, 111, 112, 67, 71, - 77, 142, 149, 77, 119, 77, 78, 82, 149, 81, - 148, 152, 84, 85, 86, 80, 88, 110, 90, 77, - 92, 102, 103, 95, 77, 67, 77, 99, 100, 101, - 106, 107, 104, 105, 149, 79, 108, 79, 71, 111, - 112, 83, 130, 131, 77, 148, 149, 119, 81, 77, - 0, 84, 85, 86, 77, 88, 77, 90, 77, 92, - 77, 77, 95, 148, 149, 79, 99, 100, 101, 79, - 112, 104, 105, 79, 82, 108, 87, 149, 111, 112, - 72, 73, 74, 8, 9, 10, 119, 129, 130, 86, - 89, 91, 93, 96, 96, 87, 94, 89, 94, 91, - 94, 93, 109, 28, 94, 30, 31, 32, 33, 151, - 102, 102, 127, 126, 156, 139, 149, 8, 9, 10, - 109, 113, 114, 112, 113, 114, 115, 116, 117, 118, - 122, 123, 124, 125, 112, 123, 123, 28, 142, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 126, 35, 102, 103, 139, 148, 148, 152, 150, 109, - 96, 97, 98, 113, 114, 142, 102, 142, 142, 148, - 150, 152, 122, 123, 124, 125, 146, 113, 114, 96, - 97, 98, 146, 67, 146, 102, 122, 123, 124, 125, - 146, 146, 146, 143, 146, 79, 113, 114, 148, 83, - 150, 8, 9, 10, 146, 122, 123, 124, 125, 147, - 149, 148, 148, 148, 150, 148, 148, 148, 148, 148, - 148, 28, 148, 30, 31, 148, 148, 148, 112, 148, - 148, 148, 148, 150, 148, 148, 148, 152, 149, 149, - 149, 149, 149, 149, 149, 129, 130, 149, 149, 149, - 149, 149, 149, 149, -1, 150, 150, 150, 150, -1, - 150, 150, 150, 150, 150, 150, -1, 151, 150, 150, - 150, 150, 156, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, -1, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, -1, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, -1, 153, 153, -1, 154, -1, 154, 154, - 154, 154, 154, -1, 155 + 132, 133, 30, 80, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 51, 1, 161, 101, 80, 150, 151, + 152, 8, 154, 9, 10, 11, 2, 3, 4, 5, + 6, 7, 164, 9, 10, 11, 12, 13, 123, 9, + 10, 11, 80, 161, 30, 83, 32, 33, 34, 35, + 36, 37, 38, 116, 117, 118, 119, 120, 121, 122, + 30, 37, 38, 106, 107, 1, 9, 10, 11, 1, + 53, 54, 55, 116, 57, 1, 8, 14, 155, 156, + 157, 57, 9, 10, 11, 162, 69, 30, 116, 32, + 33, 119, 120, 121, 122, 71, 72, 73, 74, 75, + 76, 77, 8, 30, 80, 32, 33, 34, 35, 137, + 138, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 84, 70, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 9, + 9, 10, 11, 160, 150, 151, 152, 164, 154, 2, + 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, + 13, 30, 8, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 116, 57, 14, + 9, 10, 11, 134, 135, 161, 8, 164, 160, 1, + 69, 167, 164, 159, 57, 161, 80, 8, 137, 138, + 1, 30, 1, 32, 33, 34, 1, 14, 71, 72, + 73, 74, 75, 76, 77, 31, 1, 80, 30, 70, + 30, 9, 10, 11, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 8, 156, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 8, 134, 135, 8, 8, 150, 151, 152, + 2, 3, 4, 5, 6, 7, 97, 82, 149, 31, + 12, 13, 101, 15, 116, 8, 116, 106, 80, 108, + 161, 85, 163, 106, 113, 108, 8, 116, 117, 118, + 119, 120, 121, 122, 123, 137, 138, 137, 138, 14, + 9, 10, 11, 80, 82, 14, 8, 85, 50, 51, + 50, 51, 52, 128, 56, 1, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 70, 70, 71, + 72, 73, 74, 162, 159, 97, 78, 79, 80, 116, + 82, 1, 146, 158, 86, 87, 88, 89, 163, 91, + 31, 93, 167, 95, 156, 14, 98, 99, 35, 161, + 37, 103, 104, 105, 106, 107, 1, 109, 110, 147, + 148, 31, 160, 115, 116, 8, 164, 1, 155, 156, + 157, 70, 124, 125, 126, 8, 70, 1, 70, 37, + 38, 134, 135, 8, 136, 137, 82, 139, 140, 141, + 142, 143, 144, 145, 8, 35, 149, 37, 164, 151, + 152, 164, 164, 155, 156, 157, 158, 1, 161, 8, + 163, 163, 82, 165, 166, 167, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 75, 76, 77, 75, 76, 134, 135, 31, 8, 84, + 134, 135, 134, 135, 1, 90, 8, 92, 82, 94, + 149, 96, 37, 38, 8, 149, 80, 149, 128, 59, + 60, 106, 161, 8, 1, 161, 8, 161, 159, 161, + 70, 167, 117, 118, 31, 8, 106, 70, 108, 106, + 14, 108, 127, 128, 129, 130, 131, 70, 158, 74, + 84, 75, 76, 163, 31, 80, 159, 167, 161, 101, + 102, 14, 87, 88, 89, 14, 91, 31, 93, 16, + 95, 37, 38, 98, 159, 1, 161, 162, 103, 104, + 105, 37, 38, 1, 109, 110, 16, 84, 16, 163, + 115, 116, 16, 167, 134, 135, 16, 161, 31, 124, + 16, 134, 135, 167, 70, 31, 16, 84, 16, 149, + 16, 134, 135, 31, 106, 107, 82, 31, 74, 31, + 86, 161, 106, 107, 80, 159, 31, 161, 161, 154, + 31, 87, 88, 89, 31, 91, 31, 93, 161, 95, + 111, 112, 98, 31, 31, 31, 31, 103, 104, 105, + 31, 31, 31, 109, 110, 31, 31, 31, 84, 115, + 116, 31, 159, 31, 161, 37, 84, 38, 124, 35, + 136, 137, 35, 139, 140, 141, 142, 143, 144, 35, + 31, 70, 159, 37, 161, 151, 152, 69, 57, 74, + 80, 82, 85, 77, 90, 80, 94, 163, 92, 82, + 166, 167, 87, 88, 89, 83, 91, 114, 93, 113, + 95, 128, 85, 98, 116, 128, 153, 128, 103, 104, + 105, 146, 89, 74, 109, 110, 0, 1, 149, 80, + 115, 116, 96, 159, 133, 161, 87, 88, 89, 124, + 91, 159, 93, 161, 95, 97, 146, 98, 97, 97, + 100, 154, 103, 104, 105, 74, 100, 149, 109, 110, + -1, 80, -1, -1, 115, 116, -1, 132, 87, 88, + 89, 132, 91, 124, 93, -1, 95, -1, 155, 98, + -1, -1, -1, 102, 103, 104, 105, 74, -1, 149, + 109, 110, 149, 80, 81, 153, 115, 116, 160, 1, + 87, 88, 89, 149, 91, 124, 93, 160, 95, 164, + 84, 98, 159, 158, -1, -1, 103, 104, 105, 159, + 159, 159, 109, 110, 159, 159, 159, 159, 115, 116, + 159, 159, 106, 159, 108, 1, 159, 124, 159, 113, + 160, 159, 159, 117, 118, 159, 159, 159, 163, 160, + 160, 160, -1, 127, 128, 129, 130, 131, 161, 161, + 74, 161, 161, 161, 161, 161, 80, 161, 161, 161, + 161, 161, 167, 87, 88, 89, 150, 91, 162, 93, + 162, 95, 84, 162, 98, 159, 162, 161, 162, 103, + 104, 105, 162, 162, 162, 109, 110, 162, 100, 101, + 102, 115, 116, 162, 106, 70, 162, 162, 162, 162, + 124, 162, 162, 162, 162, 117, 118, 82, 84, 162, + 162, 86, 162, 162, 162, 127, 128, 129, 130, 131, + 162, 162, 162, 162, 100, 101, 102, 163, 163, 163, + 106, 163, 163, 163, 163, 163, 163, 163, 163, -1, + 163, 117, 118, 163, 163, 163, 163, 159, 163, 161, + 162, 127, 128, 129, 130, 131, 163, 163, 163, 163, + 163, 163, 137, 163, 139, 140, 141, 142, 143, 144, + 163, 163, 163, 163, 163, 163, 151, 152, 163, 163, + 163, 163, 163, 159, 164, 161, 162, 164, 163, -1, + 164, 166, 167, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, -1, 165, 165, -1, 166 ); protected $actionBase = array( - 0, 568, 610, 624, 643, 182, 342, 567, -2, -2, - -2, -2, -36, 393, 110, 334, 110, 372, 422, 648, - 648, 648, 224, 256, 312, 312, 312, 488, 413, 445, - 344, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 527, 527, - 527, 527, 527, 527, 527, 45, 45, 352, 43, 645, - 729, 725, 565, 730, 566, 724, 726, 168, 693, 694, - 505, 695, 692, 691, 690, 727, 752, 579, 728, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 30, 179, 361, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 207, 275, 275, 275, - 753, 378, 419, 635, 17, 305, 27, 669, 669, 669, - 669, 669, 423, 423, 423, 423, 676, 676, 518, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 689, 580, 665, 666, 383, 343, 343, 222, 222, 222, - 222, 238, 228, -45, 412, 183, 536, 759, 472, 229, - 229, 118, 169, -22, -22, -22, 49, 552, 582, 582, - 582, 582, 225, 225, 582, 582, 4, -37, 305, 305, - 332, 305, 452, 452, 452, 364, 304, 485, 364, 621, - 558, 667, 557, 681, 310, 283, 32, 605, -16, 604, - 569, -16, 484, 404, 385, 737, 45, 583, 45, 45, - 45, 45, 45, 45, 45, 45, 45, -16, -16, 45, - 121, 45, 457, 352, 475, 469, 543, 174, 655, 327, - 233, 165, 469, 469, 469, 658, 649, 119, 210, 664, - 202, 479, 323, 260, 483, 483, 501, 507, 486, 483, - 483, 483, 483, 516, 483, 700, 700, 704, 501, 483, - 700, 501, 227, 411, 245, 259, 501, 388, 547, 483, - 584, 584, 261, 507, 550, 214, 466, 545, 700, 700, - 545, 486, 190, 501, 375, 625, 627, 553, 622, 67, - 498, 498, 471, 553, 26, 501, 498, 516, 420, 58, - 498, 31, 705, 722, 490, 721, 702, 720, 706, 719, - 537, 650, 572, 573, 714, 713, 718, 502, 532, 703, - 701, 596, 509, 494, 489, 585, 491, 696, 569, 618, - 482, 482, 482, 491, 698, 482, 482, 482, 482, 482, - 482, 482, 482, 758, 267, 586, 563, 487, 606, 570, - 481, 662, 575, 596, 596, 684, 751, 750, 541, 712, - 735, 717, 632, 468, 744, 711, 683, 608, 544, 598, - 710, 743, 734, 661, 494, 733, 685, 539, 596, 686, - 482, 697, 723, 756, 757, 699, 754, 742, 590, 495, - 755, 687, 732, 660, 659, 623, 747, 736, 741, 688, - 740, 628, 549, 749, 559, 707, 546, 708, 651, 680, - 679, 496, 629, 678, 716, 630, 746, 745, 748, 631, - 642, 652, 653, 500, 675, 476, 647, 715, 320, 464, - 560, 646, 554, 731, 674, 654, 709, 644, 581, 673, - 672, 738, 564, 618, 556, 467, 562, 561, 663, 671, - 739, 458, 641, 639, 638, 637, 670, 634, 668, 0, + 0, -2, 154, 565, 876, 948, 984, 514, 53, 398, + 837, 307, 307, 67, 307, 307, 307, 653, 724, 724, + 732, 724, 616, 673, 204, 204, 204, 625, 625, 625, + 625, 694, 694, 831, 831, 863, 799, 765, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, + 936, 936, 375, 519, 369, 701, 1017, 1023, 1019, 1024, + 1015, 1014, 1018, 1020, 1025, 911, 912, 782, 918, 919, + 920, 921, 1021, 841, 1016, 1022, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 290, 491, 44, 382, 382, 382, 382, 382, + 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, + 382, 382, 382, 382, 382, 160, 160, 160, 187, 684, + 684, 341, 203, 610, 47, 985, 985, 985, 985, 985, + 985, 985, 985, 985, 985, 144, 144, 7, 7, 7, + 7, 7, 371, -25, -25, -25, -25, 540, 385, 102, + 576, 358, 45, 377, 460, 460, 360, 231, 231, 231, + 231, 231, 231, -78, -78, -78, -78, -78, -66, 319, + 457, -94, 396, 423, 586, 586, 586, 586, 423, 423, + 423, 423, 750, 1029, 423, 423, 423, 511, 516, 516, + 518, 147, 147, 147, 516, 583, 777, 422, 583, 422, + 194, 92, 748, -40, 87, 412, 748, 617, 627, 198, + 143, 773, 658, 773, 1013, 757, 764, 717, 838, 860, + 1026, 800, 908, 806, 910, 219, 686, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 855, 552, + 1013, 286, 855, 855, 855, 552, 552, 552, 552, 552, + 552, 552, 552, 552, 552, 679, 286, 568, 626, 286, + 794, 552, 375, 758, 375, 375, 375, 375, 958, 375, + 375, 375, 375, 375, 375, 970, 769, -16, 375, 519, + 12, 12, 547, 83, 12, 12, 12, 12, 375, 375, + 375, 658, 781, 713, 666, 792, 448, 781, 781, 781, + 438, 444, 193, 447, 570, 523, 580, 760, 760, 767, + 929, 929, 760, 759, 760, 767, 934, 760, 929, 805, + 359, 648, 577, 611, 656, 929, 478, 760, 760, 760, + 760, 665, 760, 467, 433, 760, 760, 785, 774, 789, + 60, 929, 929, 929, 789, 596, 751, 751, 751, 811, + 812, 746, 771, 567, 498, 677, 348, 779, 771, 771, + 760, 640, 746, 771, 746, 771, 747, 771, 771, 771, + 746, 771, 759, 585, 771, 734, 668, 224, 771, 6, + 935, 937, 354, 940, 932, 941, 979, 942, 943, 851, + 956, 933, 945, 931, 930, 780, 703, 720, 790, 729, + 928, 768, 768, 768, 925, 768, 768, 768, 768, 768, + 768, 768, 768, 703, 788, 804, 733, 783, 960, 722, + 726, 725, 868, 1027, 1028, 737, 739, 958, 1006, 953, + 803, 730, 992, 967, 866, 848, 968, 969, 993, 1007, + 1008, 871, 761, 874, 880, 797, 971, 852, 768, 935, + 943, 933, 945, 931, 930, 763, 762, 753, 755, 749, + 745, 736, 738, 770, 1009, 924, 835, 830, 970, 926, + 703, 839, 986, 847, 994, 995, 850, 801, 772, 840, + 881, 972, 975, 976, 853, 1010, 810, 989, 795, 996, + 802, 882, 997, 998, 999, 1000, 885, 854, 856, 857, + 815, 754, 980, 786, 891, 335, 787, 796, 978, 363, + 957, 858, 894, 895, 1001, 1002, 1003, 896, 954, 816, + 990, 752, 991, 983, 817, 818, 485, 784, 778, 541, + 676, 897, 899, 900, 955, 775, 766, 821, 822, 1011, + 901, 697, 824, 740, 902, 1005, 742, 744, 756, 859, + 793, 743, 798, 977, 776, 827, 907, 829, 832, 833, + 1004, 836, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, - 143, 143, 143, -2, -2, -2, 0, 0, 0, 0, - -2, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, + 0, 458, 458, 458, 458, 458, 458, 307, 307, 307, + 307, 0, 0, 307, 0, 0, 0, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - -3, 128, 128, -3, 128, 128, 128, 128, 128, 128, - -22, -22, -22, -22, 364, 364, 364, 364, 364, 364, - 364, 364, 364, 364, 364, 364, 364, 364, 571, 571, - 571, 571, 364, -22, -22, 364, 364, 364, 364, 364, - 364, 571, 364, 225, 225, 225, 364, -16, -16, 0, - 0, 0, 0, 0, 483, 225, 364, 364, 364, 364, - 0, 0, 364, 364, -16, 0, 0, 0, 0, 0, - 483, 483, 483, 0, 483, 225, 0, 45, 454, 454, - 454, 454, 0, 0, 0, 483, 0, 483, 550, 0, - 0, 0, 0, 501, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 482, 712, 0, 541, 0, 0, 0, - 482, 482, 482, 541, 541, 0, 0, 541 + 0, 0, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 291, 291, 291, 423, + 423, 291, 291, 0, 291, 423, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 291, 291, 291, 291, 291, + 291, 291, 805, 147, 147, 147, 147, 423, 423, 423, + 423, 423, -88, -88, 147, 147, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 423, 423, 0, 0, + 0, 286, 422, 0, 759, 759, 759, 759, 0, 0, + 0, 0, 422, 422, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 286, 422, 0, 286, 0, + 759, 759, 423, 805, 805, 314, 423, 0, 0, 0, + 0, 286, 759, 286, 552, 422, 552, 552, 12, 375, + 314, 608, 608, 608, 608, 0, 658, 805, 805, 805, + 805, 805, 805, 805, 805, 805, 805, 805, 759, 0, + 805, 0, 759, 759, 759, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 759, 0, 0, 929, 0, 0, 0, 0, 760, 0, + 0, 0, 0, 0, 0, 760, 934, 0, 0, 0, + 0, 0, 0, 759, 0, 0, 0, 0, 0, 0, + 0, 0, 768, 801, 0, 801, 0, 768, 768, 768 ); protected $actionDefault = array( - 3,32767,32767,32767,32767,32767,32767,32767,32767, 88, - 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767, 88, 489, 489, 489,32767,32767,32767, - 32767, 302, 302, 302,32767, 481, 439, 439, 439, 439, - 439, 439, 439, 481,32767,32767,32767,32767,32767, 381, + 3,32767, 103,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 101,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 578, 578, 578, + 578,32767,32767, 246, 103,32767,32767, 454, 372, 372, + 372,32767,32767, 522, 522, 522, 522, 522, 522,32767, + 32767,32767,32767,32767,32767, 454,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767, 88,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 101,32767, + 32767,32767, 37, 7, 8, 10, 11, 50, 17, 310, + 32767,32767,32767,32767, 103,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767, 486,32767, + 32767,32767,32767,32767,32767, 571,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 364, - 365, 367, 368, 301, 440, 250, 485, 300, 126, 261, - 252, 204, 298, 236, 130, 329, 382, 331, 380, 384, - 330, 307, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 305, 306, 383, 361, 360, 359, - 327, 328, 304, 332, 334, 304, 333, 350, 351, 348, - 349, 352, 353, 354, 355, 356,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767, 88,32767, - 284, 284, 284, 284,32767, 341, 342, 242, 242, 242, - 242,32767, 242, 285,32767,32767,32767,32767,32767,32767, - 32767, 433, 358, 336, 337, 335,32767, 411,32767,32767, - 32767,32767,32767, 413,32767, 88,32767,32767, 324, 326, - 405, 308,32767,32767, 90,32767,32767,32767,32767,32767, - 32767,32767,32767,32767, 408, 441, 441,32767,32767, 88, - 399, 88, 169, 223, 225, 174,32767, 416,32767,32767, + 32767,32767,32767,32767,32767,32767, 458, 437, 438, 440, + 441, 371, 523, 577, 313, 574, 370, 146, 325, 315, + 234, 316, 250, 459, 251, 460, 463, 464, 211, 279, + 367, 150, 401, 455, 403, 453, 457, 402, 377, 382, + 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 375, 376, 456, 434, 433, 432, 399,32767, + 32767, 400, 404, 374, 407,32767,32767,32767,32767,32767, + 32767,32767,32767, 103,32767, 405, 406, 423, 424, 421, + 422, 425,32767, 426, 427, 428, 429,32767,32767, 302, + 32767,32767, 351, 349, 414, 415, 302,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 516, + 431,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 103,32767, 101, 518, 396, 398, + 486, 409, 410, 408, 378,32767, 493,32767, 103, 495, + 32767,32767,32767, 112,32767,32767,32767, 517,32767, 524, + 524,32767, 479, 101, 194,32767, 194, 194,32767,32767, + 32767,32767,32767,32767,32767, 585, 479, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111,32767, 194, + 111,32767,32767,32767, 101, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 189,32767, 260, 262, 103, + 539, 194,32767, 498,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767, 491,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 346,32767, 496,32767, 441, - 32767,32767, 338, 339, 340,32767,32767, 441, 441,32767, - 441,32767, 441,32767,32767,32767, 174,32767,32767,32767, - 32767,32767,32767,32767, 90, 414, 414, 409, 174,32767, - 32767, 174, 87, 87, 87, 87, 174, 87, 187,32767, - 185, 185, 87, 88, 88, 87, 87, 189,32767, 455, - 189, 88, 87, 174, 87, 209, 209, 390, 176, 89, - 244, 244, 89, 390, 87, 174, 244, 88, 87, 87, - 244,32767,32767,32767, 82,32767,32767,32767,32767,32767, + 32767, 479, 419, 139,32767, 139, 524, 411, 412, 413, + 481, 524, 524, 524, 298, 281,32767,32767,32767,32767, + 496, 496, 101, 101, 101, 101, 491,32767,32767, 112, + 100, 100, 100, 100, 100, 104, 102,32767,32767,32767, + 32767, 100,32767, 102, 102,32767,32767, 217, 208, 215, + 102,32767, 543, 544, 215, 102, 219, 219, 219, 239, + 239, 470, 304, 102, 100, 102, 102, 196, 304, 304, + 32767, 102, 470, 304, 470, 304, 198, 304, 304, 304, + 470, 304,32767, 102, 304, 210, 100, 100, 304,32767, + 32767,32767, 481,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 511,32767, 528, + 541, 417, 418, 420, 526, 442, 443, 444, 445, 446, + 447, 448, 450, 573,32767, 485,32767,32767,32767,32767, + 324, 583,32767, 583,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767, 401,32767,32767, 421,32767, 434, 453, 399,32767, - 344, 345, 347,32767, 443, 369, 370, 371, 372, 373, - 374, 375, 377,32767, 482, 404,32767,32767, 84, 117, - 260,32767, 494, 84, 402,32767, 494,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767, 84,32767, 84, - 32767,32767,32767,32767, 478,32767, 441,32767, 403,32767, - 343, 417, 460,32767,32767, 442,32767,32767, 84,32767, - 32767,32767,32767,32767,32767,32767,32767, 421,32767,32767, - 32767,32767,32767, 441,32767,32767,32767,32767,32767,32767, - 32767, 297,32767,32767,32767,32767,32767,32767, 441,32767, - 32767,32767,32767, 235,32767,32767,32767,32767,32767,32767, + 32767, 584,32767, 524,32767,32767,32767,32767, 416, 9, + 76, 43, 44, 52, 58, 502, 503, 504, 505, 499, + 500, 506, 501,32767,32767, 507, 549,32767,32767, 525, + 576,32767,32767,32767,32767,32767,32767, 139,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 511,32767, + 137,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 524,32767,32767,32767, 300, 301,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767, 82, 60,32767, 278,32767,32767,32767,32767, - 32767,32767,32767,32767,32767,32767,32767,32767,32767, 132, - 132, 3, 3, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 263, 164, 263, 217, - 263, 263, 220, 209, 209, 270, 132, 132 + 32767,32767,32767, 524,32767,32767,32767, 283, 284,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 278,32767,32767, 366,32767,32767,32767, + 32767, 345,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 152, 152, 3, 3, 327, 152, 152, 152, + 327, 152, 327, 327, 327, 152, 152, 152, 152, 152, + 152, 272, 184, 254, 257, 239, 239, 152, 337, 152 ); protected $goto = array( - 165, 165, 138, 138, 138, 148, 150, 181, 166, 163, - 163, 163, 163, 147, 164, 164, 164, 164, 164, 164, - 164, 147, 159, 160, 161, 162, 178, 176, 179, 420, - 421, 315, 422, 425, 426, 427, 428, 429, 430, 431, - 432, 888, 136, 139, 140, 141, 142, 143, 144, 145, - 146, 149, 175, 177, 180, 197, 200, 201, 203, 204, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 235, 236, 253, 254, 255, 322, 323, 324, 470, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 151, 196, 152, 167, 168, 169, 198, - 170, 153, 154, 155, 171, 156, 199, 137, 172, 157, - 173, 174, 158, 534, 202, 438, 736, 281, 471, 857, - 547, 7, 202, 526, 855, 472, 669, 231, 464, 232, - 233, 443, 443, 443, 671, 443, 464, 793, 774, 772, - 774, 569, 670, 436, 802, 797, 459, 456, 443, 545, - 572, 492, 494, 520, 524, 529, 530, 804, 537, 539, - 546, 800, 548, 424, 424, 424, 424, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 423, 423, 423, - 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, - 423, 485, 506, 443, 443, 488, 490, 540, 457, 478, - 443, 443, 974, 443, 768, 312, 543, 706, 444, 300, - 303, 450, 473, 474, 476, 469, 481, 733, 468, 487, - 487, 999, 999, 999, 999, 999, 999, 999, 999, 999, - 999, 999, 999, 701, 689, 831, 435, 835, 776, 697, - 1068, 1068, 779, 435, 263, 749, 482, 3, 4, 247, - 316, 827, 809, 449, 769, 975, 465, 1068, 460, 673, - 770, 770, 770, 770, 872, 1061, 764, 771, 705, 970, - 697, 1071, 697, 976, 1030, 378, 678, 298, 728, 723, - 724, 737, 679, 725, 676, 726, 727, 10, 1053, 677, - 507, 731, 462, 935, 823, 328, 508, 332, 319, 319, - 268, 269, 285, 466, 271, 327, 286, 330, 493, 807, - 807, 1058, 1069, 1069, 282, 283, 812, 688, 688, 816, - 1042, 512, 698, 698, 698, 700, 525, 687, 499, 1069, - 314, 287, 693, 279, 309, 690, 832, 576, 966, 514, - 370, 978, 971, 484, 817, 817, 817, 817, 978, 817, - 836, 817, 865, 702, 1039, 817, 781, 686, 874, 386, - 0, 1039, 0, 0, 0, 978, 978, 978, 978, 1050, - 1050, 978, 978, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 744, 0, 0, 745, 1036, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 834, 0, - 0, 834, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1043, 1044 + 194, 194, 670, 422, 643, 463, 1264, 1265, 1022, 416, + 308, 309, 329, 563, 314, 421, 330, 423, 622, 801, + 678, 637, 586, 651, 652, 653, 165, 165, 165, 165, + 218, 195, 191, 191, 175, 177, 213, 191, 191, 191, + 191, 191, 192, 192, 192, 192, 192, 192, 186, 187, + 188, 189, 190, 215, 213, 216, 521, 522, 412, 523, + 525, 526, 527, 528, 529, 530, 531, 532, 1091, 166, + 167, 168, 193, 169, 170, 171, 164, 172, 173, 174, + 176, 212, 214, 217, 235, 238, 241, 242, 244, 255, + 256, 257, 258, 259, 260, 261, 263, 264, 265, 266, + 274, 275, 311, 312, 313, 417, 418, 419, 568, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 178, 234, 179, 196, 197, 198, + 236, 186, 187, 188, 189, 190, 215, 1091, 199, 180, + 181, 182, 200, 196, 183, 237, 201, 199, 163, 202, + 203, 184, 204, 205, 206, 185, 207, 208, 209, 210, + 211, 323, 323, 323, 323, 827, 608, 608, 824, 547, + 538, 342, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + 1221, 1221, 1239, 1239, 288, 288, 288, 288, 1239, 1239, + 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, 388, 538, + 547, 556, 557, 395, 566, 588, 602, 603, 832, 825, + 880, 875, 876, 889, 15, 833, 877, 830, 878, 879, + 831, 799, 251, 251, 883, 919, 992, 1000, 1004, 1001, + 1005, 1237, 1237, 938, 1043, 1039, 1040, 1237, 1237, 1237, + 1237, 1237, 1237, 1237, 1237, 1237, 1237, 858, 248, 248, + 248, 248, 250, 252, 533, 533, 533, 533, 487, 590, + 488, 1190, 1190, 997, 1190, 997, 494, 1290, 1290, 560, + 997, 997, 997, 997, 997, 997, 997, 997, 997, 997, + 997, 997, 1261, 1261, 1290, 1261, 340, 1190, 930, 402, + 677, 1279, 1190, 1190, 1190, 1190, 959, 345, 1190, 1190, + 1190, 1271, 1271, 1271, 1271, 606, 640, 345, 345, 1273, + 1273, 1273, 1273, 820, 820, 805, 896, 884, 840, 885, + 897, 345, 345, 5, 345, 6, 1306, 384, 535, 535, + 559, 535, 415, 852, 597, 1257, 839, 540, 524, 524, + 345, 1289, 1289, 642, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 445, 805, 1140, 805, 1289, 932, + 932, 932, 932, 1063, 1064, 445, 926, 933, 386, 390, + 548, 587, 591, 1030, 1292, 331, 554, 1259, 1259, 1030, + 704, 621, 623, 823, 641, 1250, 319, 303, 660, 664, + 973, 668, 676, 969, 429, 553, 962, 936, 936, 934, + 936, 703, 601, 537, 971, 966, 343, 344, 663, 817, + 595, 609, 612, 613, 614, 615, 634, 635, 636, 680, + 439, 1186, 845, 454, 454, 439, 439, 1266, 1267, 820, + 901, 1079, 454, 394, 539, 551, 1183, 605, 540, 539, + 842, 551, 978, 272, 387, 618, 619, 981, 536, 536, + 844, 707, 646, 957, 567, 457, 458, 459, 838, 850, + 254, 254, 1297, 1298, 400, 401, 976, 976, 464, 649, + 1182, 650, 1028, 404, 405, 406, 1187, 661, 424, 1032, + 407, 564, 600, 815, 338, 424, 854, 848, 853, 841, + 1027, 1031, 1009, 1002, 1006, 1003, 1007, 1185, 941, 1188, + 1247, 1248, 943, 0, 1074, 439, 439, 439, 439, 439, + 439, 439, 439, 439, 439, 439, 0, 468, 439, 585, + 1056, 931, 681, 667, 667, 0, 495, 673, 1054, 1171, + 912, 0, 0, 1172, 1175, 913, 1176, 0, 0, 0, + 0, 0, 0, 1072, 857 ); protected $gotoCheck = array( - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 60, 53, 8, 10, 76, 7, 7, - 7, 106, 53, 7, 7, 93, 13, 69, 81, 69, - 69, 8, 8, 8, 15, 8, 81, 13, 13, 13, - 13, 13, 14, 13, 13, 13, 8, 36, 8, 5, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 129, 129, 129, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 43, 43, 8, 8, 64, 64, 64, 8, 8, - 8, 8, 88, 8, 72, 72, 72, 33, 8, 46, - 46, 46, 46, 46, 46, 2, 2, 52, 8, 82, - 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 11, 11, 11, 71, 11, 37, 23, - 139, 139, 11, 71, 128, 11, 11, 34, 34, 128, - 62, 90, 11, 62, 11, 88, 130, 139, 62, 10, - 71, 71, 71, 71, 11, 138, 71, 71, 11, 11, - 23, 139, 23, 88, 88, 62, 10, 49, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 62, 136, 10, - 51, 10, 50, 112, 86, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 81, - 81, 81, 140, 140, 76, 76, 84, 23, 23, 87, - 133, 65, 23, 23, 23, 23, 65, 23, 21, 140, - 65, 17, 27, 9, 16, 25, 92, 78, 118, 20, - 67, 60, 121, 68, 60, 60, 60, 60, 60, 60, - 95, 60, 106, 29, 93, 60, 75, 12, 109, 116, - -1, 93, -1, -1, -1, 60, 60, 60, 60, 93, - 93, 60, 60, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 60, -1, -1, 60, 93, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, - -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 93, 93 + 42, 42, 72, 65, 65, 166, 166, 166, 119, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 7, + 9, 84, 122, 84, 84, 84, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 23, 23, 23, 23, 15, 104, 104, 26, 75, + 75, 93, 104, 104, 104, 104, 104, 104, 104, 104, + 104, 104, 160, 160, 24, 24, 24, 24, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 160, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 15, 27, + 15, 15, 15, 15, 75, 15, 15, 15, 15, 15, + 15, 6, 5, 5, 15, 87, 87, 87, 87, 87, + 87, 161, 161, 49, 15, 15, 15, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 45, 5, 5, + 5, 5, 5, 5, 103, 103, 103, 103, 147, 103, + 147, 72, 72, 72, 72, 72, 147, 173, 173, 162, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 122, 122, 173, 122, 169, 72, 89, 89, + 89, 171, 72, 72, 72, 72, 99, 14, 72, 72, + 72, 9, 9, 9, 9, 55, 55, 14, 14, 122, + 122, 122, 122, 22, 22, 12, 72, 64, 35, 64, + 72, 14, 14, 46, 14, 46, 14, 61, 19, 19, + 100, 19, 13, 35, 13, 122, 35, 14, 163, 163, + 14, 172, 172, 63, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 163, 19, 12, 143, 12, 172, 19, + 19, 19, 19, 136, 136, 19, 19, 19, 58, 58, + 58, 58, 58, 122, 172, 29, 48, 122, 122, 122, + 48, 48, 48, 25, 48, 14, 159, 159, 48, 48, + 48, 48, 48, 48, 109, 9, 25, 25, 25, 25, + 25, 25, 9, 25, 25, 25, 93, 93, 14, 18, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 23, 20, 39, 141, 141, 23, 23, 168, 168, 22, + 17, 17, 141, 28, 9, 9, 152, 17, 14, 9, + 37, 9, 17, 24, 9, 83, 83, 106, 24, 24, + 17, 95, 17, 17, 9, 9, 9, 9, 17, 9, + 5, 5, 9, 9, 80, 80, 103, 103, 149, 80, + 17, 80, 121, 80, 80, 80, 20, 80, 113, 124, + 80, 2, 2, 20, 80, 113, 41, 9, 16, 16, + 16, 16, 113, 113, 113, 113, 113, 14, 16, 20, + 20, 20, 92, -1, 139, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, -1, 82, 23, 8, + 8, 16, 8, 8, 8, -1, 8, 8, 8, 78, + 78, -1, -1, 78, 78, 78, 78, -1, -1, -1, + -1, -1, -1, 16, 16 ); protected $gotoBase = array( - 0, 0, -336, 0, 0, 137, 0, 113, -141, 57, - -20, -120, -25, 124, 140, 132, 47, 75, 0, 0, - 4, 55, 0, -17, 0, 46, 0, 58, 0, -10, - -22, 0, 0, 198, -329, 0, -403, 220, 0, 0, - 0, 0, 0, 159, 0, 0, 172, 0, 0, 243, - 72, 73, 201, 79, 0, 0, 0, 0, 0, 0, - 107, 0, -98, 0, -43, -60, 0, -21, -27, -441, - 0, 2, -55, 0, 0, -15, -259, 0, 24, 0, - 0, 93, 3, 0, 74, 0, 50, 71, -95, 0, - 228, 0, 45, 120, 0, -14, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 109, 0, 0, -29, - 0, 0, 52, 0, 0, 0, -24, 0, -8, 0, - 0, 6, 0, 0, 0, 0, 0, 0, -13, -39, - 231, -53, 0, 70, 0, 0, 245, 0, 239, -6, - 66, 0, 0 + 0, 0, -203, 0, 0, 221, 208, 10, 512, 7, + 0, 0, 24, 1, 5, -174, 47, -23, 105, 61, + 38, 0, -10, 158, 181, 379, 164, 205, 102, 84, + 0, 0, 0, 0, 0, -43, 0, 107, 0, 104, + 0, 54, -1, 0, 0, 235, -384, 0, -307, 210, + 0, 0, 0, 0, 0, 266, 0, 0, 324, 0, + 0, 286, 0, 103, 298, -236, 0, 0, 0, 0, + 0, 0, -6, 0, 0, -167, 0, 0, 129, 62, + -14, 0, 53, -22, -669, 0, 0, -52, 0, -11, + 0, 0, 68, -299, 0, 52, 0, 0, 0, 262, + 288, 0, 0, 227, -73, 0, 87, 0, 0, 118, + 0, 0, 0, 209, 0, 0, 0, 0, 0, 6, + 0, 108, 15, 0, 46, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 91, 0, 0, 69, + 0, 390, 0, 86, 0, 0, 0, -224, 0, 37, + 0, 0, 77, 0, 0, 0, 0, 0, 0, 70, + -57, -8, 241, 99, 0, 0, -290, 0, 65, 257, + 0, 261, 39, -35, 0, 0 ); protected $gotoDefault = array( - -32768, 391, 579, 2, 580, 651, 659, 515, 411, 439, - 730, 877, 692, 712, 713, 714, 304, 342, 296, 302, - 500, 489, 382, 699, 354, 691, 379, 694, 353, 703, - 135, 516, 388, 707, 1, 709, 445, 740, 293, 717, - 294, 519, 719, 452, 721, 722, 299, 305, 306, 881, - 461, 486, 732, 205, 454, 734, 292, 735, 743, 333, - 297, 365, 522, 496, 477, 511, 412, 367, 483, 230, - 463, 985, 766, 374, 362, 780, 280, 788, 577, 796, - 799, 413, 414, 372, 811, 373, 821, 815, 993, 366, - 826, 355, 833, 1025, 357, 837, 840, 343, 502, 331, - 844, 845, 6, 849, 535, 536, 864, 243, 384, 873, - 352, 887, 346, 954, 956, 447, 381, 967, 361, 523, - 389, 972, 1029, 350, 415, 368, 270, 284, 246, 416, - 433, 251, 417, 369, 1032, 320, 1054, 434, 1062, 1070, - 277, 317, 480 + -32768, 499, 711, 4, 712, 905, 788, 797, 583, 515, + 679, 339, 610, 413, 1255, 882, 1078, 565, 816, 1199, + 1207, 446, 819, 324, 701, 864, 865, 866, 391, 376, + 382, 389, 632, 611, 481, 851, 442, 843, 473, 846, + 441, 855, 162, 410, 497, 859, 3, 861, 542, 892, + 377, 869, 378, 656, 871, 550, 873, 874, 385, 392, + 393, 1083, 558, 607, 886, 243, 552, 887, 375, 888, + 895, 380, 383, 665, 453, 492, 486, 403, 1058, 594, + 629, 450, 467, 617, 616, 604, 466, 425, 408, 928, + 474, 451, 942, 341, 950, 709, 1090, 624, 476, 958, + 625, 965, 968, 516, 517, 465, 980, 269, 983, 477, + 1015, 647, 648, 995, 626, 627, 1013, 460, 584, 1021, + 443, 1029, 1243, 444, 1033, 262, 1036, 276, 409, 426, + 1041, 1042, 8, 1048, 671, 672, 10, 273, 496, 1073, + 666, 440, 1089, 430, 1159, 1161, 544, 478, 1179, 1178, + 659, 493, 1184, 1246, 438, 518, 461, 310, 519, 302, + 327, 307, 534, 289, 328, 520, 462, 1252, 1260, 325, + 30, 1280, 1291, 335, 562, 599 ); protected $ruleToNonTerminal = array( - 0, 1, 3, 3, 2, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, - 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 17, 17, 18, 18, 18, 18, 20, 22, - 22, 16, 24, 24, 21, 26, 26, 23, 23, 25, - 25, 27, 27, 19, 28, 28, 29, 31, 32, 32, - 33, 34, 34, 36, 35, 35, 35, 35, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 13, 13, 56, 56, 59, 59, 58, 57, - 57, 50, 61, 61, 62, 62, 63, 63, 14, 15, - 15, 15, 66, 66, 66, 67, 67, 70, 70, 68, - 68, 72, 73, 73, 44, 44, 52, 52, 55, 55, - 55, 54, 74, 74, 75, 45, 45, 45, 45, 76, - 76, 77, 77, 78, 78, 42, 42, 38, 38, 79, - 40, 40, 80, 39, 39, 41, 41, 51, 51, 51, - 51, 64, 64, 83, 83, 84, 84, 86, 86, 87, - 87, 87, 85, 85, 65, 65, 88, 88, 89, 89, - 90, 90, 90, 47, 91, 91, 92, 48, 94, 94, - 95, 95, 69, 69, 96, 96, 96, 96, 101, 101, - 102, 102, 103, 103, 103, 103, 103, 104, 105, 105, - 100, 100, 97, 97, 99, 99, 107, 107, 106, 106, - 106, 106, 106, 106, 98, 108, 108, 109, 109, 49, - 110, 110, 43, 43, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, 30, 30, 117, 111, 111, - 116, 116, 119, 120, 120, 121, 122, 122, 122, 71, - 71, 60, 60, 60, 112, 112, 112, 124, 124, 113, - 113, 115, 115, 115, 118, 118, 129, 129, 129, 82, - 131, 131, 131, 114, 114, 114, 114, 114, 114, 114, - 114, 114, 114, 114, 114, 114, 114, 114, 114, 46, - 46, 127, 127, 127, 123, 123, 123, 132, 132, 132, - 132, 132, 132, 53, 53, 53, 93, 93, 93, 93, - 134, 126, 126, 126, 126, 126, 126, 125, 125, 125, - 133, 133, 133, 133, 81, 135, 135, 136, 136, 136, - 136, 136, 130, 137, 137, 138, 138, 138, 138, 138, - 128, 128, 128, 128, 140, 141, 139, 139, 139, 139, - 139, 139, 139, 142, 142, 142, 142 + 0, 1, 3, 3, 2, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, + 7, 7, 7, 7, 7, 7, 8, 8, 9, 10, + 11, 11, 11, 12, 12, 13, 13, 14, 15, 15, + 16, 16, 17, 17, 18, 18, 21, 21, 22, 23, + 23, 24, 24, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 29, 29, 30, 30, 32, 34, + 34, 28, 36, 36, 33, 38, 38, 35, 35, 37, + 37, 39, 39, 31, 40, 40, 41, 43, 44, 44, + 45, 46, 46, 48, 47, 47, 47, 47, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 25, 25, 68, 68, 71, 71, 70, 69, + 69, 62, 74, 74, 75, 75, 76, 76, 77, 77, + 78, 78, 26, 26, 27, 27, 27, 27, 86, 86, + 88, 88, 81, 81, 81, 82, 82, 85, 85, 83, + 83, 89, 90, 90, 56, 56, 64, 64, 67, 67, + 67, 66, 91, 91, 92, 57, 57, 57, 57, 93, + 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, + 99, 99, 54, 54, 50, 50, 101, 52, 52, 102, + 51, 51, 53, 53, 63, 63, 63, 63, 79, 79, + 105, 105, 107, 107, 108, 108, 108, 108, 106, 106, + 106, 110, 110, 110, 110, 87, 87, 113, 113, 113, + 111, 111, 114, 114, 112, 112, 115, 115, 116, 116, + 116, 116, 109, 109, 80, 80, 80, 20, 20, 20, + 118, 117, 117, 119, 119, 119, 119, 59, 120, 120, + 121, 60, 123, 123, 124, 124, 125, 125, 84, 126, + 126, 126, 126, 126, 126, 131, 131, 132, 132, 133, + 133, 133, 133, 133, 134, 135, 135, 130, 130, 127, + 127, 129, 129, 137, 137, 136, 136, 136, 136, 136, + 136, 136, 128, 138, 138, 140, 139, 139, 61, 100, + 141, 141, 55, 55, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 148, 142, 142, + 147, 147, 150, 151, 151, 152, 153, 153, 153, 19, + 19, 72, 72, 72, 72, 143, 143, 143, 143, 155, + 155, 144, 144, 146, 146, 146, 149, 149, 160, 160, + 160, 160, 160, 160, 160, 160, 160, 161, 161, 104, + 163, 163, 163, 163, 145, 145, 145, 145, 145, 145, + 145, 145, 58, 58, 158, 158, 158, 158, 164, 164, + 154, 154, 154, 165, 165, 165, 165, 165, 165, 73, + 73, 65, 65, 65, 65, 122, 122, 122, 122, 168, + 167, 157, 157, 157, 157, 157, 157, 157, 156, 156, + 156, 166, 166, 166, 166, 103, 162, 170, 170, 169, + 169, 171, 171, 171, 171, 171, 171, 171, 171, 159, + 159, 159, 159, 173, 174, 172, 172, 172, 172, 172, + 172, 172, 172, 175, 175, 175, 175 ); protected $ruleToLength = array( @@ -768,2105 +909,1896 @@ class Php7 extends \PhpParser\ParserAbstract 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 1, 1, 1, 0, 1, 0, - 1, 1, 1, 1, 1, 3, 5, 4, 3, 4, - 2, 3, 1, 1, 7, 8, 6, 7, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 0, 1, 1, 2, 1, 3, 4, 1, + 2, 0, 1, 1, 1, 1, 1, 3, 5, 4, + 3, 4, 2, 3, 1, 1, 7, 6, 2, 3, 1, 2, 3, 1, 2, 3, 1, 1, 3, 1, - 2, 1, 2, 2, 3, 1, 3, 2, 3, 1, + 3, 1, 2, 2, 3, 1, 3, 2, 3, 1, 3, 2, 0, 1, 1, 1, 1, 1, 3, 7, 10, 5, 7, 9, 5, 3, 3, 3, 3, 3, - 3, 1, 2, 5, 7, 9, 5, 6, 3, 3, + 3, 1, 2, 5, 7, 9, 6, 5, 6, 3, 2, 1, 1, 1, 0, 2, 1, 3, 8, 0, - 4, 2, 1, 3, 0, 1, 0, 1, 10, 7, - 6, 5, 1, 2, 2, 0, 2, 0, 2, 0, + 4, 2, 1, 3, 0, 1, 0, 1, 0, 1, + 3, 1, 8, 9, 8, 7, 6, 8, 0, 2, + 0, 2, 1, 2, 2, 0, 2, 0, 2, 0, 2, 2, 1, 3, 1, 4, 1, 4, 1, 1, 4, 2, 1, 3, 3, 3, 4, 4, 5, 0, - 2, 4, 3, 1, 1, 1, 4, 0, 2, 5, - 0, 2, 6, 0, 2, 0, 3, 1, 2, 1, - 1, 2, 0, 1, 3, 4, 6, 1, 2, 1, - 1, 1, 0, 1, 0, 2, 2, 4, 1, 3, - 1, 2, 2, 2, 3, 1, 1, 2, 3, 1, - 1, 3, 2, 0, 3, 4, 9, 3, 1, 3, - 0, 2, 4, 5, 4, 4, 4, 3, 1, 1, - 1, 3, 1, 1, 0, 1, 1, 2, 1, 1, - 1, 1, 1, 1, 2, 1, 3, 1, 3, 2, + 2, 4, 3, 1, 1, 7, 0, 2, 1, 3, + 3, 4, 1, 4, 0, 2, 5, 0, 2, 6, + 0, 2, 0, 3, 1, 2, 1, 1, 2, 0, + 1, 3, 0, 2, 1, 1, 1, 1, 6, 8, + 6, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, + 1, 1, 0, 1, 0, 2, 2, 2, 4, 3, + 1, 1, 3, 1, 2, 2, 3, 2, 3, 1, + 1, 2, 3, 1, 1, 3, 2, 0, 1, 5, + 5, 10, 3, 5, 1, 1, 3, 0, 2, 4, + 5, 4, 4, 4, 3, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 2, 1, 3, 1, 1, 3, 2, 2, 3, 1, 0, 1, 1, 3, 3, 3, 4, 1, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, + 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, - 4, 3, 4, 4, 2, 2, 4, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, - 2, 1, 2, 4, 2, 10, 11, 7, 3, 2, + 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 5, 4, 3, 4, 4, 2, 2, 4, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 3, 2, 1, 2, 4, 2, 2, 8, + 9, 8, 9, 9, 10, 9, 10, 8, 3, 2, 0, 4, 2, 1, 3, 2, 2, 2, 4, 1, - 1, 1, 2, 3, 1, 1, 1, 1, 1, 0, - 3, 0, 1, 1, 0, 1, 1, 3, 3, 3, - 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 2, 3, 3, 0, - 1, 1, 3, 1, 1, 3, 1, 1, 4, 4, - 4, 1, 4, 1, 1, 3, 1, 4, 2, 2, - 3, 1, 4, 4, 3, 3, 3, 1, 3, 1, - 1, 3, 1, 1, 4, 3, 1, 1, 1, 3, - 3, 0, 1, 3, 1, 3, 1, 4, 2, 0, - 2, 2, 1, 2, 1, 1, 1, 4, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, + 1, 0, 3, 0, 1, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, + 4, 1, 1, 3, 1, 1, 1, 1, 1, 3, + 2, 3, 0, 1, 1, 3, 1, 1, 1, 1, + 1, 3, 1, 1, 4, 4, 1, 4, 4, 0, + 1, 1, 1, 3, 3, 1, 4, 2, 2, 1, + 3, 1, 4, 4, 3, 3, 3, 3, 1, 3, + 1, 1, 3, 1, 1, 4, 1, 1, 1, 3, + 1, 1, 2, 1, 3, 4, 3, 2, 0, 2, + 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, 3, 6, 3, 1, 1, 2, 1 ); - protected function reduceRule0() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule1() { - $this->semValue = $this->handleNamespaces($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule2() { - if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; - } - - protected function reduceRule3() { - $this->semValue = array(); - } - - protected function reduceRule4() { - $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; - if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule5() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule6() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule7() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule8() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule9() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule10() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule11() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule12() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule13() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule14() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule15() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule16() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule17() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule18() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule19() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule20() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule21() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule22() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule23() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule24() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule25() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule26() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule27() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule28() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule29() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule30() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule31() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule32() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule33() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule34() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule35() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule36() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule37() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule38() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule39() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule40() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule41() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule42() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule43() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule44() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule45() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule46() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule47() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule48() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule49() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule50() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule51() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule52() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule53() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule54() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule55() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule56() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule57() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule58() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule59() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule60() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule61() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule62() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule63() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule64() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule65() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule66() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule67() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule68() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule69() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule70() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule71() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule72() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule73() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule74() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule75() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule76() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule77() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule78() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule79() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule80() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule81() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule82() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule83() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule84() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule85() { - /* nothing */ - } - - protected function reduceRule86() { - /* nothing */ - } - - protected function reduceRule87() { - /* nothing */ - } - - protected function reduceRule88() { - $this->emitError(new Error('A trailing comma is not allowed here', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes)); - } - - protected function reduceRule89() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule90() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule91() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule92() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule93() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule94() { - $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule95() { - $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(3-2)], null, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); + protected function initReduceCallbacks() { + $this->reduceCallbacks = [ + 0 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 1 => function ($stackPos) { + $this->semValue = $this->handleNamespaces($this->semStack[$stackPos-(1-1)]); + }, + 2 => function ($stackPos) { + if (is_array($this->semStack[$stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); } else { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }; + }, + 3 => function ($stackPos) { + $this->semValue = array(); + }, + 4 => function ($stackPos) { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 5 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 6 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 7 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 8 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 9 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 10 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 11 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 12 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 13 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 14 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 15 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 16 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 17 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 18 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 19 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 20 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 21 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 22 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 23 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 24 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 25 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 26 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 27 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 28 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 29 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 30 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 31 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 32 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 33 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 34 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 35 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 36 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 37 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 38 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 39 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 40 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 41 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 42 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 43 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 44 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 45 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 46 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 47 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 48 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 49 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 50 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 51 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 52 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 53 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 54 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 55 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 56 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 57 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 58 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 59 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 60 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 61 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 62 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 63 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 64 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 65 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 66 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 67 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 68 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 69 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 70 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 71 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 72 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 73 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 74 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 75 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 76 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 77 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 78 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 79 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 80 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 81 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 82 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 83 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 84 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 85 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 86 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 87 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 88 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 89 => function ($stackPos) { + $this->semValue = new Node\Identifier($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 90 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 91 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 92 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 93 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 94 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 95 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 96 => function ($stackPos) { + $this->semValue = new Name(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 97 => function ($stackPos) { + $this->semValue = new Expr\Variable(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 98 => function ($stackPos) { + /* nothing */ + }, + 99 => function ($stackPos) { + /* nothing */ + }, + 100 => function ($stackPos) { + /* nothing */ + }, + 101 => function ($stackPos) { + $this->emitError(new Error('A trailing comma is not allowed here', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); + }, + 102 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 103 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 104 => function ($stackPos) { + $this->semValue = new Node\Attribute($this->semStack[$stackPos-(1-1)], [], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 105 => function ($stackPos) { + $this->semValue = new Node\Attribute($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 106 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 107 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 108 => function ($stackPos) { + $this->semValue = new Node\AttributeGroup($this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 109 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 110 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 111 => function ($stackPos) { + $this->semValue = []; + }, + 112 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 113 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 114 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 115 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 116 => function ($stackPos) { + $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 117 => function ($stackPos) { + $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos-(3-2)], null, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); $this->checkNamespace($this->semValue); - } - - protected function reduceRule96() { - $this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); + }, + 118 => function ($stackPos) { + $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos-(5-2)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); $this->checkNamespace($this->semValue); - } - - protected function reduceRule97() { - $this->semValue = new Stmt\Namespace_(null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); + }, + 119 => function ($stackPos) { + $this->semValue = new Stmt\Namespace_(null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); $this->checkNamespace($this->semValue); - } + }, + 120 => function ($stackPos) { + $this->semValue = new Stmt\Use_($this->semStack[$stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 121 => function ($stackPos) { + $this->semValue = new Stmt\Use_($this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 122 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 123 => function ($stackPos) { + $this->semValue = new Stmt\Const_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 124 => function ($stackPos) { + $this->semValue = Stmt\Use_::TYPE_FUNCTION; + }, + 125 => function ($stackPos) { + $this->semValue = Stmt\Use_::TYPE_CONSTANT; + }, + 126 => function ($stackPos) { + $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-6)], $this->semStack[$stackPos-(7-2)], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 127 => function ($stackPos) { + $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 128 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 129 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 130 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 131 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 132 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 133 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 134 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 135 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 136 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 137 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(1-1)); + }, + 138 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(3-3)); + }, + 139 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(1-1)); + }, + 140 => function ($stackPos) { + $this->semValue = new Stmt\UseUse($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $stackPos-(3-3)); + }, + 141 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL; + }, + 142 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; $this->semValue->type = $this->semStack[$stackPos-(2-1)]; + }, + 143 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 144 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 145 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 146 => function ($stackPos) { + $this->semValue = new Node\Const_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 147 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 148 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 149 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 150 => function ($stackPos) { + $this->semValue = new Node\Const_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 151 => function ($stackPos) { + if (is_array($this->semStack[$stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); } else { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }; + }, + 152 => function ($stackPos) { + $this->semValue = array(); + }, + 153 => function ($stackPos) { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 154 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 155 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 156 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 157 => function ($stackPos) { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 158 => function ($stackPos) { - protected function reduceRule98() { - $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule99() { - $this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule100() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule101() { - $this->semValue = new Stmt\Const_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule102() { - $this->semValue = Stmt\Use_::TYPE_FUNCTION; - } - - protected function reduceRule103() { - $this->semValue = Stmt\Use_::TYPE_CONSTANT; - } - - protected function reduceRule104() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], $this->semStack[$this->stackPos-(7-2)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule105() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(8-4)], $this->startAttributeStack[$this->stackPos-(8-4)] + $this->endAttributeStack[$this->stackPos-(8-4)]), $this->semStack[$this->stackPos-(8-7)], $this->semStack[$this->stackPos-(8-2)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); - } - - protected function reduceRule106() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-2)] + $this->endAttributeStack[$this->stackPos-(6-2)]), $this->semStack[$this->stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule107() { - $this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule108() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule109() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule110() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule111() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule112() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule113() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule114() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule115() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule116() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule117() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(1-1)); - } - - protected function reduceRule118() { - $this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(3-3)); - } - - protected function reduceRule119() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule120() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule121() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL; - } - - protected function reduceRule122() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; $this->semValue->type = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule123() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule124() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule125() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule126() { - $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule127() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule128() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule129() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule130() { - $this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule131() { - if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; }; - } - - protected function reduceRule132() { - $this->semValue = array(); - } - - protected function reduceRule133() { - $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; }; - if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule134() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule135() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule136() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule137() { - throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule138() { - - if ($this->semStack[$this->stackPos-(3-2)]) { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; $attrs = $this->startAttributeStack[$this->stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); }; + if ($this->semStack[$stackPos-(3-2)]) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; $attrs = $this->startAttributeStack[$stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); }; } else { - $startAttributes = $this->startAttributeStack[$this->stackPos-(3-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; }; + $startAttributes = $this->startAttributeStack[$stackPos-(3-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); } else { $this->semValue = null; }; if (null === $this->semValue) { $this->semValue = array(); } } - } + }, + 159 => function ($stackPos) { + $this->semValue = new Stmt\If_($this->semStack[$stackPos-(7-3)], ['stmts' => is_array($this->semStack[$stackPos-(7-5)]) ? $this->semStack[$stackPos-(7-5)] : array($this->semStack[$stackPos-(7-5)]), 'elseifs' => $this->semStack[$stackPos-(7-6)], 'else' => $this->semStack[$stackPos-(7-7)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 160 => function ($stackPos) { + $this->semValue = new Stmt\If_($this->semStack[$stackPos-(10-3)], ['stmts' => $this->semStack[$stackPos-(10-6)], 'elseifs' => $this->semStack[$stackPos-(10-7)], 'else' => $this->semStack[$stackPos-(10-8)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + }, + 161 => function ($stackPos) { + $this->semValue = new Stmt\While_($this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 162 => function ($stackPos) { + $this->semValue = new Stmt\Do_($this->semStack[$stackPos-(7-5)], is_array($this->semStack[$stackPos-(7-2)]) ? $this->semStack[$stackPos-(7-2)] : array($this->semStack[$stackPos-(7-2)]), $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 163 => function ($stackPos) { + $this->semValue = new Stmt\For_(['init' => $this->semStack[$stackPos-(9-3)], 'cond' => $this->semStack[$stackPos-(9-5)], 'loop' => $this->semStack[$stackPos-(9-7)], 'stmts' => $this->semStack[$stackPos-(9-9)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 164 => function ($stackPos) { + $this->semValue = new Stmt\Switch_($this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 165 => function ($stackPos) { + $this->semValue = new Stmt\Break_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 166 => function ($stackPos) { + $this->semValue = new Stmt\Continue_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 167 => function ($stackPos) { + $this->semValue = new Stmt\Return_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 168 => function ($stackPos) { + $this->semValue = new Stmt\Global_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 169 => function ($stackPos) { + $this->semValue = new Stmt\Static_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 170 => function ($stackPos) { + $this->semValue = new Stmt\Echo_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 171 => function ($stackPos) { + $this->semValue = new Stmt\InlineHTML($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 172 => function ($stackPos) { - protected function reduceRule139() { - $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(7-3)], ['stmts' => is_array($this->semStack[$this->stackPos-(7-5)]) ? $this->semStack[$this->stackPos-(7-5)] : array($this->semStack[$this->stackPos-(7-5)]), 'elseifs' => $this->semStack[$this->stackPos-(7-6)], 'else' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } + $e = $this->semStack[$stackPos-(2-1)]; + if ($e instanceof Expr\Throw_) { + // For backwards-compatibility reasons, convert throw in statement position into + // Stmt\Throw_ rather than Stmt\Expression(Expr\Throw_). + $this->semValue = new Stmt\Throw_($e->expr, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + } else { + $this->semValue = new Stmt\Expression($e, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + } - protected function reduceRule140() { - $this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(10-3)], ['stmts' => $this->semStack[$this->stackPos-(10-6)], 'elseifs' => $this->semStack[$this->stackPos-(10-7)], 'else' => $this->semStack[$this->stackPos-(10-8)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); - } - - protected function reduceRule141() { - $this->semValue = new Stmt\While_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule142() { - $this->semValue = new Stmt\Do_($this->semStack[$this->stackPos-(7-5)], is_array($this->semStack[$this->stackPos-(7-2)]) ? $this->semStack[$this->stackPos-(7-2)] : array($this->semStack[$this->stackPos-(7-2)]), $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule143() { - $this->semValue = new Stmt\For_(['init' => $this->semStack[$this->stackPos-(9-3)], 'cond' => $this->semStack[$this->stackPos-(9-5)], 'loop' => $this->semStack[$this->stackPos-(9-7)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - } - - protected function reduceRule144() { - $this->semValue = new Stmt\Switch_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule145() { - $this->semValue = new Stmt\Break_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule146() { - $this->semValue = new Stmt\Continue_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule147() { - $this->semValue = new Stmt\Return_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule148() { - $this->semValue = new Stmt\Global_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule149() { - $this->semValue = new Stmt\Static_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule150() { - $this->semValue = new Stmt\Echo_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule151() { - $this->semValue = new Stmt\InlineHTML($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule152() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule153() { - $this->semValue = new Stmt\Unset_($this->semStack[$this->stackPos-(5-3)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule154() { - $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(7-3)], $this->semStack[$this->stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$this->stackPos-(7-5)][1], 'stmts' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - } - - protected function reduceRule155() { - $this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(9-3)], $this->semStack[$this->stackPos-(9-7)][0], ['keyVar' => $this->semStack[$this->stackPos-(9-5)], 'byRef' => $this->semStack[$this->stackPos-(9-7)][1], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - } - - protected function reduceRule156() { - $this->semValue = new Stmt\Declare_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule157() { - $this->semValue = new Stmt\TryCatch($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-5)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkTryCatch($this->semValue); - } - - protected function reduceRule158() { - $this->semValue = new Stmt\Throw_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule159() { - $this->semValue = new Stmt\Goto_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule160() { - $this->semValue = new Stmt\Label($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule161() { - $this->semValue = array(); /* means: no statement */ - } - - protected function reduceRule162() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule163() { - $startAttributes = $this->startAttributeStack[$this->stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; }; + }, + 173 => function ($stackPos) { + $this->semValue = new Stmt\Unset_($this->semStack[$stackPos-(5-3)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 174 => function ($stackPos) { + $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$stackPos-(7-5)][1], 'stmts' => $this->semStack[$stackPos-(7-7)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 175 => function ($stackPos) { + $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos-(9-3)], $this->semStack[$stackPos-(9-7)][0], ['keyVar' => $this->semStack[$stackPos-(9-5)], 'byRef' => $this->semStack[$stackPos-(9-7)][1], 'stmts' => $this->semStack[$stackPos-(9-9)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 176 => function ($stackPos) { + $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos-(6-3)], new Expr\Error($this->startAttributeStack[$stackPos-(6-4)] + $this->endAttributeStack[$stackPos-(6-4)]), ['stmts' => $this->semStack[$stackPos-(6-6)]], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 177 => function ($stackPos) { + $this->semValue = new Stmt\Declare_($this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 178 => function ($stackPos) { + $this->semValue = new Stmt\TryCatch($this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-5)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); $this->checkTryCatch($this->semValue); + }, + 179 => function ($stackPos) { + $this->semValue = new Stmt\Goto_($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 180 => function ($stackPos) { + $this->semValue = new Stmt\Label($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 181 => function ($stackPos) { + $this->semValue = array(); /* means: no statement */ + }, + 182 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 183 => function ($stackPos) { + $startAttributes = $this->startAttributeStack[$stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); } else { $this->semValue = null; }; if ($this->semValue === null) $this->semValue = array(); /* means: no statement */ - } - - protected function reduceRule164() { - $this->semValue = array(); - } - - protected function reduceRule165() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule166() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule167() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule168() { - $this->semValue = new Stmt\Catch_($this->semStack[$this->stackPos-(8-3)], substr($this->semStack[$this->stackPos-(8-4)], 1), $this->semStack[$this->stackPos-(8-7)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes); - } - - protected function reduceRule169() { - $this->semValue = null; - } - - protected function reduceRule170() { - $this->semValue = new Stmt\Finally_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule171() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule172() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule173() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule174() { - $this->semValue = false; - } - - protected function reduceRule175() { - $this->semValue = true; - } - - protected function reduceRule176() { - $this->semValue = false; - } - - protected function reduceRule177() { - $this->semValue = true; - } - - protected function reduceRule178() { - $this->semValue = new Stmt\Function_($this->semStack[$this->stackPos-(10-3)], ['byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-5)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); - } - - protected function reduceRule179() { - $this->semValue = new Stmt\Class_($this->semStack[$this->stackPos-(7-2)], ['type' => $this->semStack[$this->stackPos-(7-1)], 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes); - $this->checkClass($this->semValue, $this->stackPos-(7-2)); - } - - protected function reduceRule180() { - $this->semValue = new Stmt\Interface_($this->semStack[$this->stackPos-(6-2)], ['extends' => $this->semStack[$this->stackPos-(6-3)], 'stmts' => $this->semStack[$this->stackPos-(6-5)]], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - $this->checkInterface($this->semValue, $this->stackPos-(6-2)); - } - - protected function reduceRule181() { - $this->semValue = new Stmt\Trait_($this->semStack[$this->stackPos-(5-2)], ['stmts' => $this->semStack[$this->stackPos-(5-4)]], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule182() { - $this->semValue = 0; - } - - protected function reduceRule183() { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - } - - protected function reduceRule184() { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - } - - protected function reduceRule185() { - $this->semValue = null; - } - - protected function reduceRule186() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule187() { - $this->semValue = array(); - } - - protected function reduceRule188() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule189() { - $this->semValue = array(); - } - - protected function reduceRule190() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule191() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule192() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule193() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule194() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule195() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule196() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule197() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule198() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule199() { - $this->semValue = null; - } - - protected function reduceRule200() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule201() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule202() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule203() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule204() { - $this->semValue = new Stmt\DeclareDeclare($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule205() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule206() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule207() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule208() { - $this->semValue = $this->semStack[$this->stackPos-(5-3)]; - } - - protected function reduceRule209() { - $this->semValue = array(); - } - - protected function reduceRule210() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule211() { - $this->semValue = new Stmt\Case_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule212() { - $this->semValue = new Stmt\Case_(null, $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule213() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule214() { - $this->semValue = $this->semStack[$this->stackPos]; - } - - protected function reduceRule215() { - $this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule216() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule217() { - $this->semValue = array(); - } - - protected function reduceRule218() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule219() { - $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(5-3)], is_array($this->semStack[$this->stackPos-(5-5)]) ? $this->semStack[$this->stackPos-(5-5)] : array($this->semStack[$this->stackPos-(5-5)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule220() { - $this->semValue = array(); - } - - protected function reduceRule221() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule222() { - $this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule223() { - $this->semValue = null; - } - - protected function reduceRule224() { - $this->semValue = new Stmt\Else_(is_array($this->semStack[$this->stackPos-(2-2)]) ? $this->semStack[$this->stackPos-(2-2)] : array($this->semStack[$this->stackPos-(2-2)]), $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule225() { - $this->semValue = null; - } - - protected function reduceRule226() { - $this->semValue = new Stmt\Else_($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule227() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); - } - - protected function reduceRule228() { - $this->semValue = array($this->semStack[$this->stackPos-(2-2)], true); - } - - protected function reduceRule229() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); - } - - protected function reduceRule230() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)], false); - } - - protected function reduceRule231() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule232() { - $this->semValue = array(); - } - - protected function reduceRule233() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule234() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule235() { - $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(4-4)], 1), null, $this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); $this->checkParam($this->semValue); - } - - protected function reduceRule236() { - $this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(6-4)], 1), $this->semStack[$this->stackPos-(6-6)], $this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-3)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkParam($this->semValue); - } - - protected function reduceRule237() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule238() { - $this->semValue = new Node\NullableType($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule239() { - $this->semValue = $this->handleBuiltinTypes($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule240() { - $this->semValue = 'array'; - } - - protected function reduceRule241() { - $this->semValue = 'callable'; - } - - protected function reduceRule242() { - $this->semValue = null; - } - - protected function reduceRule243() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule244() { - $this->semValue = null; - } - - protected function reduceRule245() { - $this->semValue = $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule246() { - $this->semValue = array(); - } - - protected function reduceRule247() { - $this->semValue = $this->semStack[$this->stackPos-(4-2)]; - } - - protected function reduceRule248() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule249() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule250() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(1-1)], false, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule251() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], true, false, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule252() { - $this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], false, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule253() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule254() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule255() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule256() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule257() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule258() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule259() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule260() { - $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule261() { - $this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule262() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule263() { - $this->semValue = array(); - } - - protected function reduceRule264() { - $this->semValue = new Stmt\Property($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkProperty($this->semValue, $this->stackPos-(3-1)); - } - - protected function reduceRule265() { - $this->semValue = new Stmt\ClassConst($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-1)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); $this->checkClassConst($this->semValue, $this->stackPos-(4-1)); - } - - protected function reduceRule266() { - $this->semValue = new Stmt\ClassMethod($this->semStack[$this->stackPos-(9-4)], ['type' => $this->semStack[$this->stackPos-(9-1)], 'byRef' => $this->semStack[$this->stackPos-(9-3)], 'params' => $this->semStack[$this->stackPos-(9-6)], 'returnType' => $this->semStack[$this->stackPos-(9-8)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes); - $this->checkClassMethod($this->semValue, $this->stackPos-(9-1)); - } - - protected function reduceRule267() { - $this->semValue = new Stmt\TraitUse($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule268() { - $this->semValue = array(); - } - - protected function reduceRule269() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule270() { - $this->semValue = array(); - } - - protected function reduceRule271() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule272() { - $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule273() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(5-1)][0], $this->semStack[$this->stackPos-(5-1)][1], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule274() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], null, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule275() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule276() { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule277() { - $this->semValue = array($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)]); - } - - protected function reduceRule278() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule279() { - $this->semValue = array(null, $this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule280() { - $this->semValue = null; - } - - protected function reduceRule281() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule282() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule283() { - $this->semValue = 0; - } - - protected function reduceRule284() { - $this->semValue = 0; - } - - protected function reduceRule285() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule286() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule287() { - $this->checkModifier($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->stackPos-(2-2)); $this->semValue = $this->semStack[$this->stackPos-(2-1)] | $this->semStack[$this->stackPos-(2-2)]; - } - - protected function reduceRule288() { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; - } - - protected function reduceRule289() { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; - } - - protected function reduceRule290() { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; - } - - protected function reduceRule291() { - $this->semValue = Stmt\Class_::MODIFIER_STATIC; - } - - protected function reduceRule292() { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - } - - protected function reduceRule293() { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - } - - protected function reduceRule294() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule295() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule296() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule297() { - $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule298() { - $this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule299() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule300() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule301() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule302() { - $this->semValue = array(); - } - - protected function reduceRule303() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule304() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule305() { - $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule306() { - $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule307() { - $this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule308() { - $this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule309() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule310() { - $this->semValue = new Expr\Clone_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule311() { - $this->semValue = new Expr\AssignOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule312() { - $this->semValue = new Expr\AssignOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule313() { - $this->semValue = new Expr\AssignOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule314() { - $this->semValue = new Expr\AssignOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule315() { - $this->semValue = new Expr\AssignOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule316() { - $this->semValue = new Expr\AssignOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule317() { - $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule318() { - $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule319() { - $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule320() { - $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule321() { - $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule322() { - $this->semValue = new Expr\AssignOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule323() { - $this->semValue = new Expr\PostInc($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule324() { - $this->semValue = new Expr\PreInc($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule325() { - $this->semValue = new Expr\PostDec($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule326() { - $this->semValue = new Expr\PreDec($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule327() { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule328() { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule329() { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule330() { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule331() { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule332() { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule333() { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule334() { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule335() { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule336() { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule337() { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule338() { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule339() { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule340() { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule341() { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule342() { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule343() { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule344() { - $this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule345() { - $this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule346() { - $this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule347() { - $this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule348() { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule349() { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule350() { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule351() { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule352() { - $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule353() { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule354() { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule355() { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule356() { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule357() { - $this->semValue = new Expr\Instanceof_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule358() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule359() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes); - } - - protected function reduceRule360() { - $this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule361() { - $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule362() { - $this->semValue = new Expr\Isset_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule363() { - $this->semValue = new Expr\Empty_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule364() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule365() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule366() { - $this->semValue = new Expr\Eval_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule367() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule368() { - $this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule369() { - $this->semValue = new Expr\Cast\Int_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule370() { - $this->semValue = new Expr\Cast\Double($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule371() { - $this->semValue = new Expr\Cast\String_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule372() { - $this->semValue = new Expr\Cast\Array_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule373() { - $this->semValue = new Expr\Cast\Object_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule374() { - $this->semValue = new Expr\Cast\Bool_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule375() { - $this->semValue = new Expr\Cast\Unset_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule376() { - $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; - $attrs['kind'] = strtolower($this->semStack[$this->stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; - $this->semValue = new Expr\Exit_($this->semStack[$this->stackPos-(2-2)], $attrs); - } - - protected function reduceRule377() { - $this->semValue = new Expr\ErrorSuppress($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule378() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule379() { - $this->semValue = new Expr\ShellExec($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule380() { - $this->semValue = new Expr\Print_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule381() { - $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule382() { - $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule383() { - $this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule384() { - $this->semValue = new Expr\YieldFrom($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule385() { - $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-4)], 'uses' => $this->semStack[$this->stackPos-(10-6)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes); - } - - protected function reduceRule386() { - $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$this->stackPos-(11-3)], 'params' => $this->semStack[$this->stackPos-(11-5)], 'uses' => $this->semStack[$this->stackPos-(11-7)], 'returnType' => $this->semStack[$this->stackPos-(11-8)], 'stmts' => $this->semStack[$this->stackPos-(11-10)]], $this->startAttributeStack[$this->stackPos-(11-1)] + $this->endAttributes); - } - - protected function reduceRule387() { - $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-2)]); + }, + 184 => function ($stackPos) { + $this->semValue = array(); + }, + 185 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 186 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 187 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 188 => function ($stackPos) { + $this->semValue = new Stmt\Catch_($this->semStack[$stackPos-(8-3)], $this->semStack[$stackPos-(8-4)], $this->semStack[$stackPos-(8-7)], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + }, + 189 => function ($stackPos) { + $this->semValue = null; + }, + 190 => function ($stackPos) { + $this->semValue = new Stmt\Finally_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 191 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 192 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 193 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 194 => function ($stackPos) { + $this->semValue = false; + }, + 195 => function ($stackPos) { + $this->semValue = true; + }, + 196 => function ($stackPos) { + $this->semValue = false; + }, + 197 => function ($stackPos) { + $this->semValue = true; + }, + 198 => function ($stackPos) { + $this->semValue = false; + }, + 199 => function ($stackPos) { + $this->semValue = true; + }, + 200 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 201 => function ($stackPos) { + $this->semValue = []; + }, + 202 => function ($stackPos) { + $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(8-3)], ['byRef' => $this->semStack[$stackPos-(8-2)], 'params' => $this->semStack[$stackPos-(8-5)], 'returnType' => $this->semStack[$stackPos-(8-7)], 'stmts' => $this->semStack[$stackPos-(8-8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + }, + 203 => function ($stackPos) { + $this->semValue = new Stmt\Function_($this->semStack[$stackPos-(9-4)], ['byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-6)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => $this->semStack[$stackPos-(9-1)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 204 => function ($stackPos) { + $this->semValue = new Stmt\Class_($this->semStack[$stackPos-(8-3)], ['type' => $this->semStack[$stackPos-(8-2)], 'extends' => $this->semStack[$stackPos-(8-4)], 'implements' => $this->semStack[$stackPos-(8-5)], 'stmts' => $this->semStack[$stackPos-(8-7)], 'attrGroups' => $this->semStack[$stackPos-(8-1)]], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + $this->checkClass($this->semValue, $stackPos-(8-3)); + }, + 205 => function ($stackPos) { + $this->semValue = new Stmt\Interface_($this->semStack[$stackPos-(7-3)], ['extends' => $this->semStack[$stackPos-(7-4)], 'stmts' => $this->semStack[$stackPos-(7-6)], 'attrGroups' => $this->semStack[$stackPos-(7-1)]], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + $this->checkInterface($this->semValue, $stackPos-(7-3)); + }, + 206 => function ($stackPos) { + $this->semValue = new Stmt\Trait_($this->semStack[$stackPos-(6-3)], ['stmts' => $this->semStack[$stackPos-(6-5)], 'attrGroups' => $this->semStack[$stackPos-(6-1)]], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 207 => function ($stackPos) { + $this->semValue = new Stmt\Enum_($this->semStack[$stackPos-(8-3)], ['scalarType' => $this->semStack[$stackPos-(8-4)], 'implements' => $this->semStack[$stackPos-(8-5)], 'stmts' => $this->semStack[$stackPos-(8-7)], 'attrGroups' => $this->semStack[$stackPos-(8-1)]], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + $this->checkEnum($this->semValue, $stackPos-(8-3)); + }, + 208 => function ($stackPos) { + $this->semValue = null; + }, + 209 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 210 => function ($stackPos) { + $this->semValue = null; + }, + 211 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 212 => function ($stackPos) { + $this->semValue = 0; + }, + 213 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + }, + 214 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + }, + 215 => function ($stackPos) { + $this->semValue = null; + }, + 216 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 217 => function ($stackPos) { + $this->semValue = array(); + }, + 218 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 219 => function ($stackPos) { + $this->semValue = array(); + }, + 220 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 221 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 222 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 223 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 224 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 225 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 226 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 227 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 228 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 229 => function ($stackPos) { + $this->semValue = null; + }, + 230 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 231 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 232 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 233 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 234 => function ($stackPos) { + $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 235 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 236 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-3)]; + }, + 237 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 238 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(5-3)]; + }, + 239 => function ($stackPos) { + $this->semValue = array(); + }, + 240 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 241 => function ($stackPos) { + $this->semValue = new Stmt\Case_($this->semStack[$stackPos-(4-2)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 242 => function ($stackPos) { + $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 243 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 244 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 245 => function ($stackPos) { + $this->semValue = new Expr\Match_($this->semStack[$stackPos-(7-3)], $this->semStack[$stackPos-(7-6)], $this->startAttributeStack[$stackPos-(7-1)] + $this->endAttributes); + }, + 246 => function ($stackPos) { + $this->semValue = []; + }, + 247 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 248 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 249 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 250 => function ($stackPos) { + $this->semValue = new Node\MatchArm($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 251 => function ($stackPos) { + $this->semValue = new Node\MatchArm(null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 252 => function ($stackPos) { + $this->semValue = is_array($this->semStack[$stackPos-(1-1)]) ? $this->semStack[$stackPos-(1-1)] : array($this->semStack[$stackPos-(1-1)]); + }, + 253 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 254 => function ($stackPos) { + $this->semValue = array(); + }, + 255 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 256 => function ($stackPos) { + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(5-3)], is_array($this->semStack[$stackPos-(5-5)]) ? $this->semStack[$stackPos-(5-5)] : array($this->semStack[$stackPos-(5-5)]), $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 257 => function ($stackPos) { + $this->semValue = array(); + }, + 258 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 259 => function ($stackPos) { + $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-6)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 260 => function ($stackPos) { + $this->semValue = null; + }, + 261 => function ($stackPos) { + $this->semValue = new Stmt\Else_(is_array($this->semStack[$stackPos-(2-2)]) ? $this->semStack[$stackPos-(2-2)] : array($this->semStack[$stackPos-(2-2)]), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 262 => function ($stackPos) { + $this->semValue = null; + }, + 263 => function ($stackPos) { + $this->semValue = new Stmt\Else_($this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 264 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + }, + 265 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(2-2)], true); + }, + 266 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + }, + 267 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)], false); + }, + 268 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 269 => function ($stackPos) { + $this->semValue = array(); + }, + 270 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 271 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 272 => function ($stackPos) { + $this->semValue = 0; + }, + 273 => function ($stackPos) { + $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + }, + 274 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + }, + 275 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + }, + 276 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + }, + 277 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_READONLY; + }, + 278 => function ($stackPos) { + $this->semValue = new Node\Param($this->semStack[$stackPos-(6-6)], null, $this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes, $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-1)]); + $this->checkParam($this->semValue); + }, + 279 => function ($stackPos) { + $this->semValue = new Node\Param($this->semStack[$stackPos-(8-6)], $this->semStack[$stackPos-(8-8)], $this->semStack[$stackPos-(8-3)], $this->semStack[$stackPos-(8-4)], $this->semStack[$stackPos-(8-5)], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes, $this->semStack[$stackPos-(8-2)], $this->semStack[$stackPos-(8-1)]); + $this->checkParam($this->semValue); + }, + 280 => function ($stackPos) { + $this->semValue = new Node\Param(new Expr\Error($this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes), null, $this->semStack[$stackPos-(6-3)], $this->semStack[$stackPos-(6-4)], $this->semStack[$stackPos-(6-5)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes, $this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-1)]); + }, + 281 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 282 => function ($stackPos) { + $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 283 => function ($stackPos) { + $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 284 => function ($stackPos) { + $this->semValue = new Node\IntersectionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 285 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 286 => function ($stackPos) { + $this->semValue = new Node\Name('static', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 287 => function ($stackPos) { + $this->semValue = $this->handleBuiltinTypes($this->semStack[$stackPos-(1-1)]); + }, + 288 => function ($stackPos) { + $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 289 => function ($stackPos) { + $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 290 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + }, + 291 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 292 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + }, + 293 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 294 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + }, + 295 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 296 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + }, + 297 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 298 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 299 => function ($stackPos) { + $this->semValue = new Node\NullableType($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 300 => function ($stackPos) { + $this->semValue = new Node\UnionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 301 => function ($stackPos) { + $this->semValue = new Node\IntersectionType($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 302 => function ($stackPos) { + $this->semValue = null; + }, + 303 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 304 => function ($stackPos) { + $this->semValue = null; + }, + 305 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-2)]; + }, + 306 => function ($stackPos) { + $this->semValue = null; + }, + 307 => function ($stackPos) { + $this->semValue = array(); + }, + 308 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-2)]; + }, + 309 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-2)]); + }, + 310 => function ($stackPos) { + $this->semValue = new Node\VariadicPlaceholder($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 311 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 312 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 313 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(1-1)], false, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 314 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], true, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 315 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(2-2)], false, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 316 => function ($stackPos) { + $this->semValue = new Node\Arg($this->semStack[$stackPos-(3-3)], false, false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->semStack[$stackPos-(3-1)]); + }, + 317 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 318 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 319 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 320 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 321 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 322 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 323 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 324 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 325 => function ($stackPos) { + $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 326 => function ($stackPos) { + if ($this->semStack[$stackPos-(2-2)] !== null) { $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; } + }, + 327 => function ($stackPos) { + $this->semValue = array(); + }, + 328 => function ($stackPos) { + $startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); } else { $nop = null; }; + if ($nop !== null) { $this->semStack[$stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 329 => function ($stackPos) { + $this->semValue = new Stmt\Property($this->semStack[$stackPos-(5-2)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes, $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-1)]); + $this->checkProperty($this->semValue, $stackPos-(5-2)); + }, + 330 => function ($stackPos) { + $this->semValue = new Stmt\ClassConst($this->semStack[$stackPos-(5-4)], $this->semStack[$stackPos-(5-2)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes, $this->semStack[$stackPos-(5-1)]); + $this->checkClassConst($this->semValue, $stackPos-(5-2)); + }, + 331 => function ($stackPos) { + $this->semValue = new Stmt\ClassMethod($this->semStack[$stackPos-(10-5)], ['type' => $this->semStack[$stackPos-(10-2)], 'byRef' => $this->semStack[$stackPos-(10-4)], 'params' => $this->semStack[$stackPos-(10-7)], 'returnType' => $this->semStack[$stackPos-(10-9)], 'stmts' => $this->semStack[$stackPos-(10-10)], 'attrGroups' => $this->semStack[$stackPos-(10-1)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + $this->checkClassMethod($this->semValue, $stackPos-(10-2)); + }, + 332 => function ($stackPos) { + $this->semValue = new Stmt\TraitUse($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 333 => function ($stackPos) { + $this->semValue = new Stmt\EnumCase($this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->semStack[$stackPos-(5-1)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 334 => function ($stackPos) { + $this->semValue = null; /* will be skipped */ + }, + 335 => function ($stackPos) { + $this->semValue = array(); + }, + 336 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 337 => function ($stackPos) { + $this->semValue = array(); + }, + 338 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 339 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 340 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(5-1)][0], $this->semStack[$stackPos-(5-1)][1], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-4)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 341 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], $this->semStack[$stackPos-(4-3)], null, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 342 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 343 => function ($stackPos) { + $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos-(4-1)][0], $this->semStack[$stackPos-(4-1)][1], null, $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 344 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)]); + }, + 345 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 346 => function ($stackPos) { + $this->semValue = array(null, $this->semStack[$stackPos-(1-1)]); + }, + 347 => function ($stackPos) { + $this->semValue = null; + }, + 348 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 349 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 350 => function ($stackPos) { + $this->semValue = 0; + }, + 351 => function ($stackPos) { + $this->semValue = 0; + }, + 352 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 353 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 354 => function ($stackPos) { + $this->checkModifier($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $this->semValue = $this->semStack[$stackPos-(2-1)] | $this->semStack[$stackPos-(2-2)]; + }, + 355 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; + }, + 356 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; + }, + 357 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; + }, + 358 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_STATIC; + }, + 359 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; + }, + 360 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_FINAL; + }, + 361 => function ($stackPos) { + $this->semValue = Stmt\Class_::MODIFIER_READONLY; + }, + 362 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 363 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 364 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 365 => function ($stackPos) { + $this->semValue = new Node\VarLikeIdentifier(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 366 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(1-1)], null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 367 => function ($stackPos) { + $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 368 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 369 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 370 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 371 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 372 => function ($stackPos) { + $this->semValue = array(); + }, + 373 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 374 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 375 => function ($stackPos) { + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 376 => function ($stackPos) { + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 377 => function ($stackPos) { + $this->semValue = new Expr\Assign($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 378 => function ($stackPos) { + $this->semValue = new Expr\AssignRef($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 379 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 380 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 381 => function ($stackPos) { + $this->semValue = new Expr\Clone_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 382 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 383 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 384 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 385 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 386 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 387 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 388 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 389 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 390 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 391 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 392 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 393 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 394 => function ($stackPos) { + $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 395 => function ($stackPos) { + $this->semValue = new Expr\PostInc($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 396 => function ($stackPos) { + $this->semValue = new Expr\PreInc($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 397 => function ($stackPos) { + $this->semValue = new Expr\PostDec($this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 398 => function ($stackPos) { + $this->semValue = new Expr\PreDec($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 399 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 400 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 401 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 402 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 403 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 404 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 405 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 406 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 407 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 408 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 409 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 410 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 411 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 412 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 413 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 414 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 415 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 416 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 417 => function ($stackPos) { + $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 418 => function ($stackPos) { + $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 419 => function ($stackPos) { + $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 420 => function ($stackPos) { + $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 421 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 422 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 423 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 424 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 425 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 426 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 427 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 428 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 429 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 430 => function ($stackPos) { + $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 431 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 432 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(5-1)], $this->semStack[$stackPos-(5-3)], $this->semStack[$stackPos-(5-5)], $this->startAttributeStack[$stackPos-(5-1)] + $this->endAttributes); + }, + 433 => function ($stackPos) { + $this->semValue = new Expr\Ternary($this->semStack[$stackPos-(4-1)], null, $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 434 => function ($stackPos) { + $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 435 => function ($stackPos) { + $this->semValue = new Expr\Isset_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 436 => function ($stackPos) { + $this->semValue = new Expr\Empty_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 437 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 438 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 439 => function ($stackPos) { + $this->semValue = new Expr\Eval_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 440 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 441 => function ($stackPos) { + $this->semValue = new Expr\Include_($this->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 442 => function ($stackPos) { + $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 443 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; + $attrs['kind'] = $this->getFloatCastKind($this->semStack[$stackPos-(2-1)]); + $this->semValue = new Expr\Cast\Double($this->semStack[$stackPos-(2-2)], $attrs); + }, + 444 => function ($stackPos) { + $this->semValue = new Expr\Cast\String_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 445 => function ($stackPos) { + $this->semValue = new Expr\Cast\Array_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 446 => function ($stackPos) { + $this->semValue = new Expr\Cast\Object_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 447 => function ($stackPos) { + $this->semValue = new Expr\Cast\Bool_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 448 => function ($stackPos) { + $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 449 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes; + $attrs['kind'] = strtolower($this->semStack[$stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $this->semValue = new Expr\Exit_($this->semStack[$stackPos-(2-2)], $attrs); + }, + 450 => function ($stackPos) { + $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 451 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 452 => function ($stackPos) { + $this->semValue = new Expr\ShellExec($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 453 => function ($stackPos) { + $this->semValue = new Expr\Print_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 454 => function ($stackPos) { + $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 455 => function ($stackPos) { + $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(2-2)], null, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 456 => function ($stackPos) { + $this->semValue = new Expr\Yield_($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-2)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 457 => function ($stackPos) { + $this->semValue = new Expr\YieldFrom($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 458 => function ($stackPos) { + $this->semValue = new Expr\Throw_($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 459 => function ($stackPos) { + $this->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $this->semStack[$stackPos-(8-2)], 'params' => $this->semStack[$stackPos-(8-4)], 'returnType' => $this->semStack[$stackPos-(8-6)], 'expr' => $this->semStack[$stackPos-(8-8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + }, + 460 => function ($stackPos) { + $this->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'returnType' => $this->semStack[$stackPos-(9-7)], 'expr' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 461 => function ($stackPos) { + $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$stackPos-(8-2)], 'params' => $this->semStack[$stackPos-(8-4)], 'uses' => $this->semStack[$stackPos-(8-6)], 'returnType' => $this->semStack[$stackPos-(8-7)], 'stmts' => $this->semStack[$stackPos-(8-8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes); + }, + 462 => function ($stackPos) { + $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'uses' => $this->semStack[$stackPos-(9-7)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => []], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 463 => function ($stackPos) { + $this->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'returnType' => $this->semStack[$stackPos-(9-7)], 'expr' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => $this->semStack[$stackPos-(9-1)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 464 => function ($stackPos) { + $this->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $this->semStack[$stackPos-(10-4)], 'params' => $this->semStack[$stackPos-(10-6)], 'returnType' => $this->semStack[$stackPos-(10-8)], 'expr' => $this->semStack[$stackPos-(10-10)], 'attrGroups' => $this->semStack[$stackPos-(10-1)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + }, + 465 => function ($stackPos) { + $this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$stackPos-(9-3)], 'params' => $this->semStack[$stackPos-(9-5)], 'uses' => $this->semStack[$stackPos-(9-7)], 'returnType' => $this->semStack[$stackPos-(9-8)], 'stmts' => $this->semStack[$stackPos-(9-9)], 'attrGroups' => $this->semStack[$stackPos-(9-1)]], $this->startAttributeStack[$stackPos-(9-1)] + $this->endAttributes); + }, + 466 => function ($stackPos) { + $this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$stackPos-(10-4)], 'params' => $this->semStack[$stackPos-(10-6)], 'uses' => $this->semStack[$stackPos-(10-8)], 'returnType' => $this->semStack[$stackPos-(10-9)], 'stmts' => $this->semStack[$stackPos-(10-10)], 'attrGroups' => $this->semStack[$stackPos-(10-1)]], $this->startAttributeStack[$stackPos-(10-1)] + $this->endAttributes); + }, + 467 => function ($stackPos) { + $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$stackPos-(8-4)], 'implements' => $this->semStack[$stackPos-(8-5)], 'stmts' => $this->semStack[$stackPos-(8-7)], 'attrGroups' => $this->semStack[$stackPos-(8-1)]], $this->startAttributeStack[$stackPos-(8-1)] + $this->endAttributes), $this->semStack[$stackPos-(8-3)]); $this->checkClass($this->semValue[0], -1); - } - - protected function reduceRule388() { - $this->semValue = new Expr\New_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule389() { - list($class, $ctorArgs) = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule390() { - $this->semValue = array(); - } - - protected function reduceRule391() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule392() { - $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule393() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule394() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule395() { - $this->semValue = new Expr\ClosureUse(substr($this->semStack[$this->stackPos-(2-2)], 1), $this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule396() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule397() { - $this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule398() { - $this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule399() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule400() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule401() { - $this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule402() { - $this->semValue = new Name\FullyQualified($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule403() { - $this->semValue = new Name\Relative($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule404() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule405() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule406() { - $this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; - } - - protected function reduceRule407() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule408() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule409() { - $this->semValue = null; - } - - protected function reduceRule410() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule411() { - $this->semValue = array(); - } - - protected function reduceRule412() { - $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$this->stackPos-(1-1)], '`'), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes)); - } - - protected function reduceRule413() { - foreach ($this->semStack[$this->stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule414() { - $this->semValue = array(); - } - - protected function reduceRule415() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule416() { - $this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule417() { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule418() { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], new Expr\Error($this->startAttributeStack[$this->stackPos-(3-3)] + $this->endAttributeStack[$this->stackPos-(3-3)]), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->errorState = 2; - } - - protected function reduceRule419() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $attrs); - } - - protected function reduceRule420() { - $attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; - $this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $attrs); - } - - protected function reduceRule421() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule422() { - $attrs = $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(1-1)][0] === "'" || ($this->semStack[$this->stackPos-(1-1)][1] === "'" && ($this->semStack[$this->stackPos-(1-1)][0] === 'b' || $this->semStack[$this->stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); - $this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)]), $attrs); - } - - protected function reduceRule423() { - $this->semValue = $this->parseLNumber($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule424() { - $this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule425() { - $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule426() { - $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule427() { - $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule428() { - $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule429() { - $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule430() { - $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule431() { - $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule432() { - $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule433() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule434() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule435() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; - $this->semValue = new Scalar\String_(Scalar\String_::parseDocString($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)]), $attrs); - } - - protected function reduceRule436() { - $attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(2-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(2-1)], $matches); $attrs['docLabel'] = $matches[1];; - $this->semValue = new Scalar\String_('', $attrs); - } - - protected function reduceRule437() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; - foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); - } - - protected function reduceRule438() { - $attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];; - foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs); - } - - protected function reduceRule439() { - $this->semValue = null; - } - - protected function reduceRule440() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule441() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule442() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule443() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule444() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule445() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule446() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule447() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule448() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule449() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule450() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule451() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule452() { - $this->semValue = new Expr\MethodCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule453() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule454() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule455() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule456() { - $this->semValue = substr($this->semStack[$this->stackPos-(1-1)], 1); - } - - protected function reduceRule457() { - $this->semValue = $this->semStack[$this->stackPos-(4-3)]; - } - - protected function reduceRule458() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule459() { - $this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); $this->errorState = 2; - } - - protected function reduceRule460() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule461() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule462() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule463() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule464() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule465() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule466() { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule467() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule468() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule469() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule470() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule471() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule472() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule473() { - $this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; - } - - protected function reduceRule474() { - $this->semValue = new Expr\List_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule475() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule476() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule477() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule478() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule479() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule480() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule481() { - $this->semValue = null; - } - - protected function reduceRule482() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end] === null) unset($this->semValue[$end]); - } - - protected function reduceRule483() { - $this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)]; - } - - protected function reduceRule484() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule485() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule486() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule487() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-1)], true, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule488() { - $this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(2-2)], null, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule489() { - $this->semValue = null; - } - - protected function reduceRule490() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule491() { - $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; - } - - protected function reduceRule492() { - $this->semValue = array($this->semStack[$this->stackPos-(1-1)]); - } - - protected function reduceRule493() { - $this->semValue = array($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); - } - - protected function reduceRule494() { - $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule495() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule496() { - $this->semValue = $this->semStack[$this->stackPos-(1-1)]; - } - - protected function reduceRule497() { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); - } - - protected function reduceRule498() { - $this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule499() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule500() { - $this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); - } - - protected function reduceRule501() { - $this->semValue = new Expr\ArrayDimFetch(new Expr\Variable($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-4)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); - } - - protected function reduceRule502() { - $this->semValue = $this->semStack[$this->stackPos-(3-2)]; - } - - protected function reduceRule503() { - $this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule504() { - $this->semValue = $this->parseNumString($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); - } - - protected function reduceRule505() { - $this->semValue = $this->parseNumString('-' . $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); - } - - protected function reduceRule506() { - $this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); + }, + 468 => function ($stackPos) { + $this->semValue = new Expr\New_($this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 469 => function ($stackPos) { + list($class, $ctorArgs) = $this->semStack[$stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 470 => function ($stackPos) { + $this->semValue = array(); + }, + 471 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-3)]; + }, + 472 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 473 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 474 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 475 => function ($stackPos) { + $this->semValue = new Expr\ClosureUse($this->semStack[$stackPos-(2-2)], $this->semStack[$stackPos-(2-1)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 476 => function ($stackPos) { + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 477 => function ($stackPos) { + $this->semValue = new Expr\FuncCall($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 478 => function ($stackPos) { + $this->semValue = new Expr\StaticCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 479 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 480 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 481 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 482 => function ($stackPos) { + $this->semValue = new Name($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 483 => function ($stackPos) { + $this->semValue = new Name\FullyQualified(substr($this->semStack[$stackPos-(1-1)], 1), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 484 => function ($stackPos) { + $this->semValue = new Name\Relative(substr($this->semStack[$stackPos-(1-1)], 10), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 485 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 486 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 487 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 488 => function ($stackPos) { + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; + }, + 489 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 490 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 491 => function ($stackPos) { + $this->semValue = null; + }, + 492 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 493 => function ($stackPos) { + $this->semValue = array(); + }, + 494 => function ($stackPos) { + $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`'), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); + }, + 495 => function ($stackPos) { + foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 496 => function ($stackPos) { + $this->semValue = array(); + }, + 497 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 498 => function ($stackPos) { + $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 499 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 500 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 501 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 502 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 503 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 504 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 505 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 506 => function ($stackPos) { + $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 507 => function ($stackPos) { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 508 => function ($stackPos) { + $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos-(3-1)], new Expr\Error($this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)]), $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); $this->errorState = 2; + }, + 509 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT; + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(3-2)], $attrs); + }, + 510 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG; + $this->semValue = new Expr\Array_($this->semStack[$stackPos-(4-3)], $attrs); + }, + 511 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 512 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$stackPos-(1-1)][0] === "'" || ($this->semStack[$stackPos-(1-1)][1] === "'" && ($this->semStack[$stackPos-(1-1)][0] === 'b' || $this->semStack[$stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED); + $this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$stackPos-(1-1)]), $attrs); + }, + 513 => function ($stackPos) { + $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs); + }, + 514 => function ($stackPos) { + $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 515 => function ($stackPos) { + $this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$stackPos-(1-1)]), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 516 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 517 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 518 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 519 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); + }, + 520 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], true); + }, + 521 => function ($stackPos) { + $this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true); + }, + 522 => function ($stackPos) { + $this->semValue = null; + }, + 523 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 524 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 525 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 526 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 527 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 528 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 529 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 530 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 531 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 532 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 533 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 534 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 535 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 536 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 537 => function ($stackPos) { + $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 538 => function ($stackPos) { + $this->semValue = new Expr\NullsafeMethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 539 => function ($stackPos) { + $this->semValue = null; + }, + 540 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 541 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 542 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 543 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 544 => function ($stackPos) { + $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 545 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 546 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 547 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 548 => function ($stackPos) { + $this->semValue = new Expr\Variable(new Expr\Error($this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes), $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); $this->errorState = 2; + }, + 549 => function ($stackPos) { + $var = $this->semStack[$stackPos-(1-1)]->name; $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; + }, + 550 => function ($stackPos) { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 551 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 552 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 553 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 554 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 555 => function ($stackPos) { + $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 556 => function ($stackPos) { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 557 => function ($stackPos) { + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 558 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 559 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 560 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 561 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 562 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 563 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 564 => function ($stackPos) { + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; + }, + 565 => function ($stackPos) { + $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 566 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end] === null) array_pop($this->semValue); + }, + 567 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos]; + }, + 568 => function ($stackPos) { + /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ + }, + 569 => function ($stackPos) { + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + }, + 570 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 571 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 572 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 573 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 574 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 575 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 576 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 577 => function ($stackPos) { + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 578 => function ($stackPos) { + $this->semValue = null; + }, + 579 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 580 => function ($stackPos) { + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + }, + 581 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(1-1)]); + }, + 582 => function ($stackPos) { + $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); + }, + 583 => function ($stackPos) { + $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 584 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 585 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + 586 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 587 => function ($stackPos) { + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 588 => function ($stackPos) { + $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 589 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 590 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + }, + 591 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + }, + 592 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(3-2)]; + }, + 593 => function ($stackPos) { + $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 594 => function ($stackPos) { + $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 595 => function ($stackPos) { + $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 596 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, + ]; } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Parser/Tokens.php b/lib/nikic/php-parser/lib/PhpParser/Parser/Tokens.php index 861663fae..b76a5d94c 100644 --- a/lib/nikic/php-parser/lib/PhpParser/Parser/Tokens.php +++ b/lib/nikic/php-parser/lib/PhpParser/Parser/Tokens.php @@ -6,131 +6,131 @@ namespace PhpParser\Parser; final class Tokens { const YYERRTOK = 256; - const T_INCLUDE = 257; - const T_INCLUDE_ONCE = 258; - const T_EVAL = 259; - const T_REQUIRE = 260; - const T_REQUIRE_ONCE = 261; - const T_LOGICAL_OR = 262; - const T_LOGICAL_XOR = 263; - const T_LOGICAL_AND = 264; - const T_PRINT = 265; - const T_YIELD = 266; - const T_DOUBLE_ARROW = 267; - const T_YIELD_FROM = 268; - const T_PLUS_EQUAL = 269; - const T_MINUS_EQUAL = 270; - const T_MUL_EQUAL = 271; - const T_DIV_EQUAL = 272; - const T_CONCAT_EQUAL = 273; - const T_MOD_EQUAL = 274; - const T_AND_EQUAL = 275; - const T_OR_EQUAL = 276; - const T_XOR_EQUAL = 277; - const T_SL_EQUAL = 278; - const T_SR_EQUAL = 279; - const T_POW_EQUAL = 280; - const T_COALESCE = 281; - const T_BOOLEAN_OR = 282; - const T_BOOLEAN_AND = 283; - const T_IS_EQUAL = 284; - const T_IS_NOT_EQUAL = 285; - const T_IS_IDENTICAL = 286; - const T_IS_NOT_IDENTICAL = 287; - const T_SPACESHIP = 288; - const T_IS_SMALLER_OR_EQUAL = 289; - const T_IS_GREATER_OR_EQUAL = 290; - const T_SL = 291; - const T_SR = 292; - const T_INSTANCEOF = 293; - const T_INC = 294; - const T_DEC = 295; - const T_INT_CAST = 296; - const T_DOUBLE_CAST = 297; - const T_STRING_CAST = 298; - const T_ARRAY_CAST = 299; - const T_OBJECT_CAST = 300; - const T_BOOL_CAST = 301; - const T_UNSET_CAST = 302; - const T_POW = 303; - const T_NEW = 304; - const T_CLONE = 305; - const T_EXIT = 306; - const T_IF = 307; - const T_ELSEIF = 308; - const T_ELSE = 309; - const T_ENDIF = 310; - const T_LNUMBER = 311; - const T_DNUMBER = 312; - const T_STRING = 313; - const T_STRING_VARNAME = 314; - const T_VARIABLE = 315; - const T_NUM_STRING = 316; - const T_INLINE_HTML = 317; - const T_CHARACTER = 318; - const T_BAD_CHARACTER = 319; - const T_ENCAPSED_AND_WHITESPACE = 320; - const T_CONSTANT_ENCAPSED_STRING = 321; - const T_ECHO = 322; - const T_DO = 323; - const T_WHILE = 324; - const T_ENDWHILE = 325; - const T_FOR = 326; - const T_ENDFOR = 327; - const T_FOREACH = 328; - const T_ENDFOREACH = 329; - const T_DECLARE = 330; - const T_ENDDECLARE = 331; - const T_AS = 332; - const T_SWITCH = 333; - const T_ENDSWITCH = 334; - const T_CASE = 335; - const T_DEFAULT = 336; - const T_BREAK = 337; - const T_CONTINUE = 338; - const T_GOTO = 339; - const T_FUNCTION = 340; - const T_CONST = 341; - const T_RETURN = 342; - const T_TRY = 343; - const T_CATCH = 344; - const T_FINALLY = 345; - const T_THROW = 346; - const T_USE = 347; - const T_INSTEADOF = 348; - const T_GLOBAL = 349; - const T_STATIC = 350; - const T_ABSTRACT = 351; - const T_FINAL = 352; - const T_PRIVATE = 353; - const T_PROTECTED = 354; - const T_PUBLIC = 355; - const T_VAR = 356; - const T_UNSET = 357; - const T_ISSET = 358; - const T_EMPTY = 359; - const T_HALT_COMPILER = 360; - const T_CLASS = 361; - const T_TRAIT = 362; - const T_INTERFACE = 363; - const T_EXTENDS = 364; - const T_IMPLEMENTS = 365; - const T_OBJECT_OPERATOR = 366; - const T_LIST = 367; - const T_ARRAY = 368; - const T_CALLABLE = 369; - const T_CLASS_C = 370; - const T_TRAIT_C = 371; - const T_METHOD_C = 372; - const T_FUNC_C = 373; - const T_LINE = 374; - const T_FILE = 375; - const T_COMMENT = 376; - const T_DOC_COMMENT = 377; - const T_OPEN_TAG = 378; - const T_OPEN_TAG_WITH_ECHO = 379; - const T_CLOSE_TAG = 380; - const T_WHITESPACE = 381; + const T_THROW = 257; + const T_INCLUDE = 258; + const T_INCLUDE_ONCE = 259; + const T_EVAL = 260; + const T_REQUIRE = 261; + const T_REQUIRE_ONCE = 262; + const T_LOGICAL_OR = 263; + const T_LOGICAL_XOR = 264; + const T_LOGICAL_AND = 265; + const T_PRINT = 266; + const T_YIELD = 267; + const T_DOUBLE_ARROW = 268; + const T_YIELD_FROM = 269; + const T_PLUS_EQUAL = 270; + const T_MINUS_EQUAL = 271; + const T_MUL_EQUAL = 272; + const T_DIV_EQUAL = 273; + const T_CONCAT_EQUAL = 274; + const T_MOD_EQUAL = 275; + const T_AND_EQUAL = 276; + const T_OR_EQUAL = 277; + const T_XOR_EQUAL = 278; + const T_SL_EQUAL = 279; + const T_SR_EQUAL = 280; + const T_POW_EQUAL = 281; + const T_COALESCE_EQUAL = 282; + const T_COALESCE = 283; + const T_BOOLEAN_OR = 284; + const T_BOOLEAN_AND = 285; + const T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG = 286; + const T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG = 287; + const T_IS_EQUAL = 288; + const T_IS_NOT_EQUAL = 289; + const T_IS_IDENTICAL = 290; + const T_IS_NOT_IDENTICAL = 291; + const T_SPACESHIP = 292; + const T_IS_SMALLER_OR_EQUAL = 293; + const T_IS_GREATER_OR_EQUAL = 294; + const T_SL = 295; + const T_SR = 296; + const T_INSTANCEOF = 297; + const T_INC = 298; + const T_DEC = 299; + const T_INT_CAST = 300; + const T_DOUBLE_CAST = 301; + const T_STRING_CAST = 302; + const T_ARRAY_CAST = 303; + const T_OBJECT_CAST = 304; + const T_BOOL_CAST = 305; + const T_UNSET_CAST = 306; + const T_POW = 307; + const T_NEW = 308; + const T_CLONE = 309; + const T_EXIT = 310; + const T_IF = 311; + const T_ELSEIF = 312; + const T_ELSE = 313; + const T_ENDIF = 314; + const T_LNUMBER = 315; + const T_DNUMBER = 316; + const T_STRING = 317; + const T_STRING_VARNAME = 318; + const T_VARIABLE = 319; + const T_NUM_STRING = 320; + const T_INLINE_HTML = 321; + const T_ENCAPSED_AND_WHITESPACE = 322; + const T_CONSTANT_ENCAPSED_STRING = 323; + const T_ECHO = 324; + const T_DO = 325; + const T_WHILE = 326; + const T_ENDWHILE = 327; + const T_FOR = 328; + const T_ENDFOR = 329; + const T_FOREACH = 330; + const T_ENDFOREACH = 331; + const T_DECLARE = 332; + const T_ENDDECLARE = 333; + const T_AS = 334; + const T_SWITCH = 335; + const T_MATCH = 336; + const T_ENDSWITCH = 337; + const T_CASE = 338; + const T_DEFAULT = 339; + const T_BREAK = 340; + const T_CONTINUE = 341; + const T_GOTO = 342; + const T_FUNCTION = 343; + const T_FN = 344; + const T_CONST = 345; + const T_RETURN = 346; + const T_TRY = 347; + const T_CATCH = 348; + const T_FINALLY = 349; + const T_USE = 350; + const T_INSTEADOF = 351; + const T_GLOBAL = 352; + const T_STATIC = 353; + const T_ABSTRACT = 354; + const T_FINAL = 355; + const T_PRIVATE = 356; + const T_PROTECTED = 357; + const T_PUBLIC = 358; + const T_READONLY = 359; + const T_VAR = 360; + const T_UNSET = 361; + const T_ISSET = 362; + const T_EMPTY = 363; + const T_HALT_COMPILER = 364; + const T_CLASS = 365; + const T_TRAIT = 366; + const T_INTERFACE = 367; + const T_ENUM = 368; + const T_EXTENDS = 369; + const T_IMPLEMENTS = 370; + const T_OBJECT_OPERATOR = 371; + const T_NULLSAFE_OBJECT_OPERATOR = 372; + const T_LIST = 373; + const T_ARRAY = 374; + const T_CALLABLE = 375; + const T_CLASS_C = 376; + const T_TRAIT_C = 377; + const T_METHOD_C = 378; + const T_FUNC_C = 379; + const T_LINE = 380; + const T_FILE = 381; const T_START_HEREDOC = 382; const T_END_HEREDOC = 383; const T_DOLLAR_OPEN_CURLY_BRACES = 384; @@ -141,4 +141,8 @@ final class Tokens const T_DIR = 389; const T_NS_SEPARATOR = 390; const T_ELLIPSIS = 391; + const T_NAME_FULLY_QUALIFIED = 392; + const T_NAME_QUALIFIED = 393; + const T_NAME_RELATIVE = 394; + const T_ATTRIBUTE = 395; } diff --git a/lib/nikic/php-parser/lib/PhpParser/ParserAbstract.php b/lib/nikic/php-parser/lib/PhpParser/ParserAbstract.php index e0f6e2592..5ee5a64bb 100644 --- a/lib/nikic/php-parser/lib/PhpParser/ParserAbstract.php +++ b/lib/nikic/php-parser/lib/PhpParser/ParserAbstract.php @@ -1,4 +1,4 @@ -lexer = $lexer; - $this->errors = array(); if (isset($options['throwOnError'])) { throw new \LogicException( '"throwOnError" is no longer supported, use "errorHandler" instead'); } + + $this->initReduceCallbacks(); } /** @@ -137,45 +149,56 @@ abstract class ParserAbstract implements Parser * @param ErrorHandler|null $errorHandler Error handler to use for lexer/parser errors, defaults * to ErrorHandler\Throwing. * - * @return Node[]|null Array of statements (or null if the 'throwOnError' option is disabled and the parser was - * unable to recover from an error). + * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and + * the parser was unable to recover from an error). */ - public function parse($code, ErrorHandler $errorHandler = null) { + public function parse(string $code, ErrorHandler $errorHandler = null) { $this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing; - // Initialize the lexer $this->lexer->startLexing($code, $this->errorHandler); + $result = $this->doParse(); + // Clear out some of the interior state, so we don't hold onto unnecessary + // memory between uses of the parser + $this->startAttributeStack = []; + $this->endAttributeStack = []; + $this->semStack = []; + $this->semValue = null; + + return $result; + } + + protected function doParse() { // We start off with no lookahead-token $symbol = self::SYMBOL_NONE; // The attributes for a node are taken from the first and last token of the node. // From the first token only the startAttributes are taken and from the last only // the endAttributes. Both are merged using the array union operator (+). - $startAttributes = '*POISON'; - $endAttributes = '*POISON'; + $startAttributes = []; + $endAttributes = []; $this->endAttributes = $endAttributes; // Keep stack of start and end attributes - $this->startAttributeStack = array(); - $this->endAttributeStack = array($endAttributes); + $this->startAttributeStack = []; + $this->endAttributeStack = [$endAttributes]; // Start off in the initial state and keep a stack of previous states $state = 0; - $stateStack = array($state); + $stateStack = [$state]; // Semantic value stack (contains values of tokens and semantic action results) - $this->semStack = array(); + $this->semStack = []; // Current position in the stack(s) - $this->stackPos = 0; + $stackPos = 0; $this->errorState = 0; for (;;) { //$this->traceNewState($state, $symbol); - if ($this->actionBase[$state] == 0) { + if ($this->actionBase[$state] === 0) { $rule = $this->actionDefault[$state]; } else { if ($symbol === self::SYMBOL_NONE) { @@ -197,23 +220,20 @@ abstract class ParserAbstract implements Parser )); } - // This is necessary to assign some meaningful attributes to /* empty */ productions. They'll get - // the attributes of the next token, even though they don't contain it themselves. - $this->startAttributeStack[$this->stackPos+1] = $startAttributes; - $this->endAttributeStack[$this->stackPos+1] = $endAttributes; + // Allow productions to access the start attributes of the lookahead token. $this->lookaheadStartAttributes = $startAttributes; //$this->traceRead($symbol); } $idx = $this->actionBase[$state] + $symbol; - if ((($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] == $symbol) + if ((($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol) || ($state < $this->YY2TBLSTATE - && ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $symbol) >= 0 - && $idx < $this->actionTableSize && $this->actionCheck[$idx] == $symbol)) - && ($action = $this->action[$idx]) != $this->defaultAction) { + && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0 + && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol)) + && ($action = $this->action[$idx]) !== $this->defaultAction) { /* - * >= YYNLSTATES: shift and reduce + * >= numNonLeafStates: shift and reduce * > 0: shift * = 0: accept * < 0: reduce @@ -223,11 +243,11 @@ abstract class ParserAbstract implements Parser /* shift */ //$this->traceShift($symbol); - ++$this->stackPos; - $stateStack[$this->stackPos] = $state = $action; - $this->semStack[$this->stackPos] = $tokenValue; - $this->startAttributeStack[$this->stackPos] = $startAttributes; - $this->endAttributeStack[$this->stackPos] = $endAttributes; + ++$stackPos; + $stateStack[$stackPos] = $state = $action; + $this->semStack[$stackPos] = $tokenValue; + $this->startAttributeStack[$stackPos] = $startAttributes; + $this->endAttributeStack[$stackPos] = $endAttributes; $this->endAttributes = $endAttributes; $symbol = self::SYMBOL_NONE; @@ -235,12 +255,12 @@ abstract class ParserAbstract implements Parser --$this->errorState; } - if ($action < $this->YYNLSTATES) { + if ($action < $this->numNonLeafStates) { continue; } - /* $yyn >= YYNLSTATES means shift-and-reduce */ - $rule = $action - $this->YYNLSTATES; + /* $yyn >= numNonLeafStates means shift-and-reduce */ + $rule = $action - $this->numNonLeafStates; } else { $rule = -$action; } @@ -259,7 +279,7 @@ abstract class ParserAbstract implements Parser //$this->traceReduce($rule); try { - $this->{'reduceRule' . $rule}(); + $this->reduceCallbacks[$rule]($stackPos); } catch (Error $e) { if (-1 === $e->getStartLine() && isset($startAttributes['startLine'])) { $e->setStartLine($startAttributes['startLine']); @@ -271,20 +291,25 @@ abstract class ParserAbstract implements Parser } /* Goto - shift nonterminal */ - $lastEndAttributes = $this->endAttributeStack[$this->stackPos]; - $this->stackPos -= $this->ruleToLength[$rule]; + $lastEndAttributes = $this->endAttributeStack[$stackPos]; + $ruleLength = $this->ruleToLength[$rule]; + $stackPos -= $ruleLength; $nonTerminal = $this->ruleToNonTerminal[$rule]; - $idx = $this->gotoBase[$nonTerminal] + $stateStack[$this->stackPos]; - if ($idx >= 0 && $idx < $this->gotoTableSize && $this->gotoCheck[$idx] == $nonTerminal) { + $idx = $this->gotoBase[$nonTerminal] + $stateStack[$stackPos]; + if ($idx >= 0 && $idx < $this->gotoTableSize && $this->gotoCheck[$idx] === $nonTerminal) { $state = $this->goto[$idx]; } else { $state = $this->gotoDefault[$nonTerminal]; } - ++$this->stackPos; - $stateStack[$this->stackPos] = $state; - $this->semStack[$this->stackPos] = $this->semValue; - $this->endAttributeStack[$this->stackPos] = $lastEndAttributes; + ++$stackPos; + $stateStack[$stackPos] = $state; + $this->semStack[$stackPos] = $this->semValue; + $this->endAttributeStack[$stackPos] = $lastEndAttributes; + if ($ruleLength === 0) { + // Empty productions use the start attributes of the lookahead token. + $this->startAttributeStack[$stackPos] = $this->lookaheadStartAttributes; + } } else { /* error */ switch ($this->errorState) { @@ -299,27 +324,28 @@ abstract class ParserAbstract implements Parser // Pop until error-expecting state uncovered while (!( (($idx = $this->actionBase[$state] + $this->errorSymbol) >= 0 - && $idx < $this->actionTableSize && $this->actionCheck[$idx] == $this->errorSymbol) + && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol) || ($state < $this->YY2TBLSTATE - && ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $this->errorSymbol) >= 0 - && $idx < $this->actionTableSize && $this->actionCheck[$idx] == $this->errorSymbol) - ) || ($action = $this->action[$idx]) == $this->defaultAction) { // Not totally sure about this - if ($this->stackPos <= 0) { + && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $this->errorSymbol) >= 0 + && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol) + ) || ($action = $this->action[$idx]) === $this->defaultAction) { // Not totally sure about this + if ($stackPos <= 0) { // Could not recover from error return null; } - $state = $stateStack[--$this->stackPos]; + $state = $stateStack[--$stackPos]; //$this->tracePop($state); } //$this->traceShift($this->errorSymbol); - ++$this->stackPos; - $stateStack[$this->stackPos] = $state = $action; + ++$stackPos; + $stateStack[$stackPos] = $state = $action; // We treat the error symbol as being empty, so we reset the end attributes // to the end attributes of the last non-error symbol - $this->endAttributeStack[$this->stackPos] = $this->endAttributeStack[$this->stackPos - 1]; - $this->endAttributes = $this->endAttributeStack[$this->stackPos - 1]; + $this->startAttributeStack[$stackPos] = $this->lookaheadStartAttributes; + $this->endAttributeStack[$stackPos] = $this->endAttributeStack[$stackPos - 1]; + $this->endAttributes = $this->endAttributeStack[$stackPos - 1]; break; case 3: @@ -334,12 +360,12 @@ abstract class ParserAbstract implements Parser } } - if ($state < $this->YYNLSTATES) { + if ($state < $this->numNonLeafStates) { break; } - /* >= YYNLSTATES means shift-and-reduce */ - $rule = $state - $this->YYNLSTATES; + /* >= numNonLeafStates means shift-and-reduce */ + $rule = $state - $this->numNonLeafStates; } } @@ -350,7 +376,15 @@ abstract class ParserAbstract implements Parser $this->errorHandler->handleError($error); } - protected function getErrorMessage($symbol, $state) { + /** + * Format error message including expected tokens. + * + * @param int $symbol Unexpected symbol + * @param int $state State at time of error + * + * @return string Formatted error message + */ + protected function getErrorMessage(int $symbol, int $state) : string { $expectedString = ''; if ($expected = $this->getExpectedTokens($state)) { $expectedString = ', expecting ' . implode(' or ', $expected); @@ -359,24 +393,31 @@ abstract class ParserAbstract implements Parser return 'Syntax error, unexpected ' . $this->symbolToName[$symbol] . $expectedString; } - protected function getExpectedTokens($state) { - $expected = array(); + /** + * Get limited number of expected tokens in given state. + * + * @param int $state State + * + * @return string[] Expected tokens. If too many, an empty array is returned. + */ + protected function getExpectedTokens(int $state) : array { + $expected = []; $base = $this->actionBase[$state]; foreach ($this->symbolToName as $symbol => $name) { $idx = $base + $symbol; if ($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol || $state < $this->YY2TBLSTATE - && ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $symbol) >= 0 + && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol ) { - if ($this->action[$idx] != $this->unexpectedTokenRule - && $this->action[$idx] != $this->defaultAction - && $symbol != $this->errorSymbol + if ($this->action[$idx] !== $this->unexpectedTokenRule + && $this->action[$idx] !== $this->defaultAction + && $symbol !== $this->errorSymbol ) { - if (count($expected) == 4) { + if (count($expected) === 4) { /* Too many expected tokens */ - return array(); + return []; } $expected[] = $name; @@ -429,10 +470,10 @@ abstract class ParserAbstract implements Parser /** * Moves statements of semicolon-style namespaces into $ns->stmts and checks various error conditions. * - * @param Node[] $stmts - * @return Node[] + * @param Node\Stmt[] $stmts + * @return Node\Stmt[] */ - protected function handleNamespaces(array $stmts) { + protected function handleNamespaces(array $stmts) : array { $hasErrored = false; $style = $this->getNamespacingStyle($stmts); if (null === $style) { @@ -455,12 +496,16 @@ abstract class ParserAbstract implements Parser return $stmts; } else { // For semicolon namespaces we have to move the statements after a namespace declaration into ->stmts - $resultStmts = array(); + $resultStmts = []; $targetStmts =& $resultStmts; + $lastNs = null; foreach ($stmts as $stmt) { if ($stmt instanceof Node\Stmt\Namespace_) { + if ($lastNs !== null) { + $this->fixupNamespaceAttributes($lastNs); + } if ($stmt->stmts === null) { - $stmt->stmts = array(); + $stmt->stmts = []; $targetStmts =& $stmt->stmts; $resultStmts[] = $stmt; } else { @@ -468,6 +513,7 @@ abstract class ParserAbstract implements Parser $resultStmts[] = $stmt; $targetStmts =& $resultStmts; } + $lastNs = $stmt; } elseif ($stmt instanceof Node\Stmt\HaltCompiler) { // __halt_compiler() is not moved into the namespace $resultStmts[] = $stmt; @@ -475,10 +521,38 @@ abstract class ParserAbstract implements Parser $targetStmts[] = $stmt; } } + if ($lastNs !== null) { + $this->fixupNamespaceAttributes($lastNs); + } return $resultStmts; } } + private function fixupNamespaceAttributes(Node\Stmt\Namespace_ $stmt) { + // We moved the statements into the namespace node, as such the end of the namespace node + // needs to be extended to the end of the statements. + if (empty($stmt->stmts)) { + return; + } + + // We only move the builtin end attributes here. This is the best we can do with the + // knowledge we have. + $endAttributes = ['endLine', 'endFilePos', 'endTokenPos']; + $lastStmt = $stmt->stmts[count($stmt->stmts) - 1]; + foreach ($endAttributes as $endAttribute) { + if ($lastStmt->hasAttribute($endAttribute)) { + $stmt->setAttribute($endAttribute, $lastStmt->getAttribute($endAttribute)); + } + } + } + + /** + * Determine namespacing style (semicolon or brace) + * + * @param Node[] $stmts Top-level statements. + * + * @return null|string One of "semicolon", "brace" or null (no namespaces) + */ private function getNamespacingStyle(array $stmts) { $style = null; $hasNotAllowedStmts = false; @@ -512,7 +586,7 @@ abstract class ParserAbstract implements Parser } /* There may be a hashbang line at the very start of the file */ - if ($i == 0 && $stmt instanceof Node\Stmt\InlineHTML && preg_match('/\A#!.*\r?\n\z/', $stmt->value)) { + if ($i === 0 && $stmt instanceof Node\Stmt\InlineHTML && preg_match('/\A#!.*\r?\n\z/', $stmt->value)) { continue; } @@ -522,8 +596,63 @@ abstract class ParserAbstract implements Parser return $style; } + /** + * Fix up parsing of static property calls in PHP 5. + * + * In PHP 5 A::$b[c][d] and A::$b[c][d]() have very different interpretation. The former is + * interpreted as (A::$b)[c][d], while the latter is the same as A::{$b[c][d]}(). We parse the + * latter as the former initially and this method fixes the AST into the correct form when we + * encounter the "()". + * + * @param Node\Expr\StaticPropertyFetch|Node\Expr\ArrayDimFetch $prop + * @param Node\Arg[] $args + * @param array $attributes + * + * @return Expr\StaticCall + */ + protected function fixupPhp5StaticPropCall($prop, array $args, array $attributes) : Expr\StaticCall { + if ($prop instanceof Node\Expr\StaticPropertyFetch) { + $name = $prop->name instanceof VarLikeIdentifier + ? $prop->name->toString() : $prop->name; + $var = new Expr\Variable($name, $prop->name->getAttributes()); + return new Expr\StaticCall($prop->class, $var, $args, $attributes); + } elseif ($prop instanceof Node\Expr\ArrayDimFetch) { + $tmp = $prop; + while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { + $tmp = $tmp->var; + } + + /** @var Expr\StaticPropertyFetch $staticProp */ + $staticProp = $tmp->var; + + // Set start attributes to attributes of innermost node + $tmp = $prop; + $this->fixupStartAttributes($tmp, $staticProp->name); + while ($tmp->var instanceof Node\Expr\ArrayDimFetch) { + $tmp = $tmp->var; + $this->fixupStartAttributes($tmp, $staticProp->name); + } + + $name = $staticProp->name instanceof VarLikeIdentifier + ? $staticProp->name->toString() : $staticProp->name; + $tmp->var = new Expr\Variable($name, $staticProp->name->getAttributes()); + return new Expr\StaticCall($staticProp->class, $prop, $args, $attributes); + } else { + throw new \Exception; + } + } + + protected function fixupStartAttributes(Node $to, Node $from) { + $startAttributes = ['startLine', 'startFilePos', 'startTokenPos']; + foreach ($startAttributes as $startAttribute) { + if ($from->hasAttribute($startAttribute)) { + $to->setAttribute($startAttribute, $from->getAttribute($startAttribute)); + } + } + } + protected function handleBuiltinTypes(Name $name) { - $scalarTypes = [ + $builtinTypes = [ 'bool' => true, 'int' => true, 'float' => true, @@ -531,26 +660,49 @@ abstract class ParserAbstract implements Parser 'iterable' => true, 'void' => true, 'object' => true, + 'null' => true, + 'false' => true, + 'mixed' => true, + 'never' => true, ]; if (!$name->isUnqualified()) { return $name; } - $lowerName = strtolower($name->toString()); - return isset($scalarTypes[$lowerName]) ? $lowerName : $name; + $lowerName = $name->toLowerString(); + if (!isset($builtinTypes[$lowerName])) { + return $name; + } + + return new Node\Identifier($lowerName, $name->getAttributes()); } - protected static $specialNames = array( - 'self' => true, - 'parent' => true, - 'static' => true, - ); - - protected function getAttributesAt($pos) { + /** + * Get combined start and end attributes at a stack location + * + * @param int $pos Stack location + * + * @return array Combined start and end attributes + */ + protected function getAttributesAt(int $pos) : array { return $this->startAttributeStack[$pos] + $this->endAttributeStack[$pos]; } + protected function getFloatCastKind(string $cast): int + { + $cast = strtolower($cast); + if (strpos($cast, 'float') !== false) { + return Double::KIND_FLOAT; + } + + if (strpos($cast, 'real') !== false) { + return Double::KIND_REAL; + } + + return Double::KIND_DOUBLE; + } + protected function parseLNumber($str, $attributes, $allowInvalidOctal = false) { try { return LNumber::fromString($str, $attributes, $allowInvalidOctal); @@ -561,7 +713,15 @@ abstract class ParserAbstract implements Parser } } - protected function parseNumString($str, $attributes) { + /** + * Parse a T_NUM_STRING token into either an integer or string node. + * + * @param string $str Number string + * @param array $attributes Attributes + * + * @return LNumber|String_ Integer or string node. + */ + protected function parseNumString(string $str, array $attributes) { if (!preg_match('/^(?:0|-?[1-9][0-9]*)$/', $str)) { return new String_($str, $attributes); } @@ -574,6 +734,147 @@ abstract class ParserAbstract implements Parser return new LNumber($num, $attributes); } + protected function stripIndentation( + string $string, int $indentLen, string $indentChar, + bool $newlineAtStart, bool $newlineAtEnd, array $attributes + ) { + if ($indentLen === 0) { + return $string; + } + + $start = $newlineAtStart ? '(?:(?<=\n)|\A)' : '(?<=\n)'; + $end = $newlineAtEnd ? '(?:(?=[\r\n])|\z)' : '(?=[\r\n])'; + $regex = '/' . $start . '([ \t]*)(' . $end . ')?/'; + return preg_replace_callback( + $regex, + function ($matches) use ($indentLen, $indentChar, $attributes) { + $prefix = substr($matches[1], 0, $indentLen); + if (false !== strpos($prefix, $indentChar === " " ? "\t" : " ")) { + $this->emitError(new Error( + 'Invalid indentation - tabs and spaces cannot be mixed', $attributes + )); + } elseif (strlen($prefix) < $indentLen && !isset($matches[2])) { + $this->emitError(new Error( + 'Invalid body indentation level ' . + '(expecting an indentation level of at least ' . $indentLen . ')', + $attributes + )); + } + return substr($matches[0], strlen($prefix)); + }, + $string + ); + } + + protected function parseDocString( + string $startToken, $contents, string $endToken, + array $attributes, array $endTokenAttributes, bool $parseUnicodeEscape + ) { + $kind = strpos($startToken, "'") === false + ? String_::KIND_HEREDOC : String_::KIND_NOWDOC; + + $regex = '/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/'; + $result = preg_match($regex, $startToken, $matches); + assert($result === 1); + $label = $matches[1]; + + $result = preg_match('/\A[ \t]*/', $endToken, $matches); + assert($result === 1); + $indentation = $matches[0]; + + $attributes['kind'] = $kind; + $attributes['docLabel'] = $label; + $attributes['docIndentation'] = $indentation; + + $indentHasSpaces = false !== strpos($indentation, " "); + $indentHasTabs = false !== strpos($indentation, "\t"); + if ($indentHasSpaces && $indentHasTabs) { + $this->emitError(new Error( + 'Invalid indentation - tabs and spaces cannot be mixed', + $endTokenAttributes + )); + + // Proceed processing as if this doc string is not indented + $indentation = ''; + } + + $indentLen = \strlen($indentation); + $indentChar = $indentHasSpaces ? " " : "\t"; + + if (\is_string($contents)) { + if ($contents === '') { + return new String_('', $attributes); + } + + $contents = $this->stripIndentation( + $contents, $indentLen, $indentChar, true, true, $attributes + ); + $contents = preg_replace('~(\r\n|\n|\r)\z~', '', $contents); + + if ($kind === String_::KIND_HEREDOC) { + $contents = String_::parseEscapeSequences($contents, null, $parseUnicodeEscape); + } + + return new String_($contents, $attributes); + } else { + assert(count($contents) > 0); + if (!$contents[0] instanceof Node\Scalar\EncapsedStringPart) { + // If there is no leading encapsed string part, pretend there is an empty one + $this->stripIndentation( + '', $indentLen, $indentChar, true, false, $contents[0]->getAttributes() + ); + } + + $newContents = []; + foreach ($contents as $i => $part) { + if ($part instanceof Node\Scalar\EncapsedStringPart) { + $isLast = $i === \count($contents) - 1; + $part->value = $this->stripIndentation( + $part->value, $indentLen, $indentChar, + $i === 0, $isLast, $part->getAttributes() + ); + $part->value = String_::parseEscapeSequences($part->value, null, $parseUnicodeEscape); + if ($isLast) { + $part->value = preg_replace('~(\r\n|\n|\r)\z~', '', $part->value); + } + if ('' === $part->value) { + continue; + } + } + $newContents[] = $part; + } + return new Encapsed($newContents, $attributes); + } + } + + /** + * Create attributes for a zero-length common-capturing nop. + * + * @param Comment[] $comments + * @return array + */ + protected function createCommentNopAttributes(array $comments) { + $comment = $comments[count($comments) - 1]; + $commentEndLine = $comment->getEndLine(); + $commentEndFilePos = $comment->getEndFilePos(); + $commentEndTokenPos = $comment->getEndTokenPos(); + + $attributes = ['comments' => $comments]; + if (-1 !== $commentEndLine) { + $attributes['startLine'] = $commentEndLine; + $attributes['endLine'] = $commentEndLine; + } + if (-1 !== $commentEndFilePos) { + $attributes['startFilePos'] = $commentEndFilePos + 1; + $attributes['endFilePos'] = $commentEndFilePos; + } + if (-1 !== $commentEndTokenPos) { + $attributes['startTokenPos'] = $commentEndTokenPos + 1; + $attributes['endTokenPos'] = $commentEndTokenPos; + } + return $attributes; + } + protected function checkModifier($a, $b, $modifierPos) { // Jumping through some hoops here because verifyModifier() is also used elsewhere try { @@ -602,13 +903,6 @@ abstract class ParserAbstract implements Parser } protected function checkNamespace(Namespace_ $node) { - if (isset(self::$specialNames[strtolower($node->name)])) { - $this->emitError(new Error( - sprintf('Cannot use \'%s\' as namespace name', $node->name), - $node->name->getAttributes() - )); - } - if (null !== $node->stmts) { foreach ($node->stmts as $stmt) { if ($stmt instanceof Namespace_) { @@ -620,52 +914,52 @@ abstract class ParserAbstract implements Parser } } - protected function checkClass(Class_ $node, $namePos) { - if (null !== $node->name && isset(self::$specialNames[strtolower($node->name)])) { + private function checkClassName($name, $namePos) { + if (null !== $name && $name->isSpecialClassName()) { $this->emitError(new Error( - sprintf('Cannot use \'%s\' as class name as it is reserved', $node->name), + sprintf('Cannot use \'%s\' as class name as it is reserved', $name), $this->getAttributesAt($namePos) )); } + } - if (isset(self::$specialNames[strtolower($node->extends)])) { + private function checkImplementedInterfaces(array $interfaces) { + foreach ($interfaces as $interface) { + if ($interface->isSpecialClassName()) { + $this->emitError(new Error( + sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), + $interface->getAttributes() + )); + } + } + } + + protected function checkClass(Class_ $node, $namePos) { + $this->checkClassName($node->name, $namePos); + + if ($node->extends && $node->extends->isSpecialClassName()) { $this->emitError(new Error( sprintf('Cannot use \'%s\' as class name as it is reserved', $node->extends), $node->extends->getAttributes() )); } - foreach ($node->implements as $interface) { - if (isset(self::$specialNames[strtolower($interface)])) { - $this->emitError(new Error( - sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), - $interface->getAttributes() - )); - } - } + $this->checkImplementedInterfaces($node->implements); } protected function checkInterface(Interface_ $node, $namePos) { - if (null !== $node->name && isset(self::$specialNames[strtolower($node->name)])) { - $this->emitError(new Error( - sprintf('Cannot use \'%s\' as class name as it is reserved', $node->name), - $this->getAttributesAt($namePos) - )); - } + $this->checkClassName($node->name, $namePos); + $this->checkImplementedInterfaces($node->extends); + } - foreach ($node->extends as $interface) { - if (isset(self::$specialNames[strtolower($interface)])) { - $this->emitError(new Error( - sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), - $interface->getAttributes() - )); - } - } + protected function checkEnum(Enum_ $node, $namePos) { + $this->checkClassName($node->name, $namePos); + $this->checkImplementedInterfaces($node->implements); } protected function checkClassMethod(ClassMethod $node, $modifierPos) { if ($node->flags & Class_::MODIFIER_STATIC) { - switch (strtolower($node->name)) { + switch ($node->name->toLowerString()) { case '__construct': $this->emitError(new Error( sprintf('Constructor %s() cannot be static', $node->name), @@ -683,6 +977,12 @@ abstract class ParserAbstract implements Parser break; } } + + if ($node->flags & Class_::MODIFIER_READONLY) { + $this->emitError(new Error( + sprintf('Method %s() cannot be readonly', $node->name), + $this->getAttributesAt($modifierPos))); + } } protected function checkClassConst(ClassConst $node, $modifierPos) { @@ -696,9 +996,9 @@ abstract class ParserAbstract implements Parser "Cannot use 'abstract' as constant modifier", $this->getAttributesAt($modifierPos))); } - if ($node->flags & Class_::MODIFIER_FINAL) { + if ($node->flags & Class_::MODIFIER_READONLY) { $this->emitError(new Error( - "Cannot use 'final' as constant modifier", + "Cannot use 'readonly' as constant modifier", $this->getAttributesAt($modifierPos))); } } @@ -716,7 +1016,7 @@ abstract class ParserAbstract implements Parser } protected function checkUseUse(UseUse $node, $namePos) { - if ('self' == strtolower($node->alias) || 'parent' == strtolower($node->alias)) { + if ($node->alias && $node->alias->isSpecialClassName()) { $this->emitError(new Error( sprintf( 'Cannot use %s as %s because \'%2$s\' is a special class name', diff --git a/lib/nikic/php-parser/lib/PhpParser/ParserFactory.php b/lib/nikic/php-parser/lib/PhpParser/ParserFactory.php index 28b9070d4..f041e7ffe 100644 --- a/lib/nikic/php-parser/lib/PhpParser/ParserFactory.php +++ b/lib/nikic/php-parser/lib/PhpParser/ParserFactory.php @@ -1,8 +1,9 @@ -type ? $this->pType($node->type) . ' ' : '') + return $this->pAttrGroups($node->attrGroups, true) + . $this->pModifiers($node->flags) + . ($node->type ? $this->p($node->type) . ' ' : '') . ($node->byRef ? '&' : '') . ($node->variadic ? '...' : '') - . '$' . $node->name + . $this->p($node->var) . ($node->default ? ' = ' . $this->p($node->default) : ''); } protected function pArg(Node\Arg $node) { - return ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') . $this->p($node->value); + return ($node->name ? $node->name->toString() . ': ' : '') + . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') + . $this->p($node->value); + } + + protected function pVariadicPlaceholder(Node\VariadicPlaceholder $node) { + return '...'; } protected function pConst(Node\Const_ $node) { @@ -34,7 +42,32 @@ class Standard extends PrettyPrinterAbstract } protected function pNullableType(Node\NullableType $node) { - return '?' . $this->pType($node->type); + return '?' . $this->p($node->type); + } + + protected function pUnionType(Node\UnionType $node) { + return $this->pImplode($node->types, '|'); + } + + protected function pIntersectionType(Node\IntersectionType $node) { + return $this->pImplode($node->types, '&'); + } + + protected function pIdentifier(Node\Identifier $node) { + return $node->name; + } + + protected function pVarLikeIdentifier(Node\VarLikeIdentifier $node) { + return '$' . $node->name; + } + + protected function pAttribute(Node\Attribute $node) { + return $this->p($node->name) + . ($node->args ? '(' . $this->pCommaSeparated($node->args) . ')' : ''); + } + + protected function pAttributeGroup(Node\AttributeGroup $node) { + return '#[' . $this->pCommaSeparated($node->attrs) . ']'; } // Names @@ -94,24 +127,24 @@ class Standard extends PrettyPrinterAbstract $label = $node->getAttribute('docLabel'); if ($label && !$this->containsEndLabel($node->value, $label)) { if ($node->value === '') { - return $this->pNoIndent("<<<'$label'\n$label") . $this->docStringEndToken; + return "<<<'$label'\n$label" . $this->docStringEndToken; } - return $this->pNoIndent("<<<'$label'\n$node->value\n$label") + return "<<<'$label'\n$node->value\n$label" . $this->docStringEndToken; } /* break missing intentionally */ case Scalar\String_::KIND_SINGLE_QUOTED: - return '\'' . $this->pNoIndent(addcslashes($node->value, '\'\\')) . '\''; + return $this->pSingleQuotedString($node->value); case Scalar\String_::KIND_HEREDOC: $label = $node->getAttribute('docLabel'); if ($label && !$this->containsEndLabel($node->value, $label)) { if ($node->value === '') { - return $this->pNoIndent("<<<$label\n$label") . $this->docStringEndToken; + return "<<<$label\n$label" . $this->docStringEndToken; } $escaped = $this->escapeString($node->value, null); - return $this->pNoIndent("<<<$label\n" . $escaped ."\n$label") + return "<<<$label\n" . $escaped . "\n$label" . $this->docStringEndToken; } /* break missing intentionally */ @@ -129,12 +162,11 @@ class Standard extends PrettyPrinterAbstract && $node->parts[0] instanceof Scalar\EncapsedStringPart && $node->parts[0]->value === '' ) { - return $this->pNoIndent("<<<$label\n$label") . $this->docStringEndToken; + return "<<<$label\n$label" . $this->docStringEndToken; } - return $this->pNoIndent( - "<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label" - ) . $this->docStringEndToken; + return "<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label" + . $this->docStringEndToken; } } return '"' . $this->pEncapsList($node->parts, '"') . '"'; @@ -152,8 +184,13 @@ class Standard extends PrettyPrinterAbstract return (string) $node->value; } - $sign = $node->value < 0 ? '-' : ''; - $str = (string) $node->value; + if ($node->value < 0) { + $sign = '-'; + $str = (string) -$node->value; + } else { + $sign = ''; + $str = (string) $node->value; + } switch ($kind) { case Scalar\LNumber::KIND_BIN: return $sign . '0b' . base_convert($str, 10, 2); @@ -191,186 +228,197 @@ class Standard extends PrettyPrinterAbstract return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue; } + protected function pScalar_EncapsedStringPart(Scalar\EncapsedStringPart $node) { + throw new \LogicException('Cannot directly print EncapsedStringPart'); + } + // Assignments protected function pExpr_Assign(Expr\Assign $node) { - return $this->pInfixOp('Expr_Assign', $node->var, ' = ', $node->expr); + return $this->pInfixOp(Expr\Assign::class, $node->var, ' = ', $node->expr); } protected function pExpr_AssignRef(Expr\AssignRef $node) { - return $this->pInfixOp('Expr_AssignRef', $node->var, ' =& ', $node->expr); + return $this->pInfixOp(Expr\AssignRef::class, $node->var, ' =& ', $node->expr); } protected function pExpr_AssignOp_Plus(AssignOp\Plus $node) { - return $this->pInfixOp('Expr_AssignOp_Plus', $node->var, ' += ', $node->expr); + return $this->pInfixOp(AssignOp\Plus::class, $node->var, ' += ', $node->expr); } protected function pExpr_AssignOp_Minus(AssignOp\Minus $node) { - return $this->pInfixOp('Expr_AssignOp_Minus', $node->var, ' -= ', $node->expr); + return $this->pInfixOp(AssignOp\Minus::class, $node->var, ' -= ', $node->expr); } protected function pExpr_AssignOp_Mul(AssignOp\Mul $node) { - return $this->pInfixOp('Expr_AssignOp_Mul', $node->var, ' *= ', $node->expr); + return $this->pInfixOp(AssignOp\Mul::class, $node->var, ' *= ', $node->expr); } protected function pExpr_AssignOp_Div(AssignOp\Div $node) { - return $this->pInfixOp('Expr_AssignOp_Div', $node->var, ' /= ', $node->expr); + return $this->pInfixOp(AssignOp\Div::class, $node->var, ' /= ', $node->expr); } protected function pExpr_AssignOp_Concat(AssignOp\Concat $node) { - return $this->pInfixOp('Expr_AssignOp_Concat', $node->var, ' .= ', $node->expr); + return $this->pInfixOp(AssignOp\Concat::class, $node->var, ' .= ', $node->expr); } protected function pExpr_AssignOp_Mod(AssignOp\Mod $node) { - return $this->pInfixOp('Expr_AssignOp_Mod', $node->var, ' %= ', $node->expr); + return $this->pInfixOp(AssignOp\Mod::class, $node->var, ' %= ', $node->expr); } protected function pExpr_AssignOp_BitwiseAnd(AssignOp\BitwiseAnd $node) { - return $this->pInfixOp('Expr_AssignOp_BitwiseAnd', $node->var, ' &= ', $node->expr); + return $this->pInfixOp(AssignOp\BitwiseAnd::class, $node->var, ' &= ', $node->expr); } protected function pExpr_AssignOp_BitwiseOr(AssignOp\BitwiseOr $node) { - return $this->pInfixOp('Expr_AssignOp_BitwiseOr', $node->var, ' |= ', $node->expr); + return $this->pInfixOp(AssignOp\BitwiseOr::class, $node->var, ' |= ', $node->expr); } protected function pExpr_AssignOp_BitwiseXor(AssignOp\BitwiseXor $node) { - return $this->pInfixOp('Expr_AssignOp_BitwiseXor', $node->var, ' ^= ', $node->expr); + return $this->pInfixOp(AssignOp\BitwiseXor::class, $node->var, ' ^= ', $node->expr); } protected function pExpr_AssignOp_ShiftLeft(AssignOp\ShiftLeft $node) { - return $this->pInfixOp('Expr_AssignOp_ShiftLeft', $node->var, ' <<= ', $node->expr); + return $this->pInfixOp(AssignOp\ShiftLeft::class, $node->var, ' <<= ', $node->expr); } protected function pExpr_AssignOp_ShiftRight(AssignOp\ShiftRight $node) { - return $this->pInfixOp('Expr_AssignOp_ShiftRight', $node->var, ' >>= ', $node->expr); + return $this->pInfixOp(AssignOp\ShiftRight::class, $node->var, ' >>= ', $node->expr); } protected function pExpr_AssignOp_Pow(AssignOp\Pow $node) { - return $this->pInfixOp('Expr_AssignOp_Pow', $node->var, ' **= ', $node->expr); + return $this->pInfixOp(AssignOp\Pow::class, $node->var, ' **= ', $node->expr); + } + + protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node) { + return $this->pInfixOp(AssignOp\Coalesce::class, $node->var, ' ??= ', $node->expr); } // Binary expressions protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) { - return $this->pInfixOp('Expr_BinaryOp_Plus', $node->left, ' + ', $node->right); + return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right); } protected function pExpr_BinaryOp_Minus(BinaryOp\Minus $node) { - return $this->pInfixOp('Expr_BinaryOp_Minus', $node->left, ' - ', $node->right); + return $this->pInfixOp(BinaryOp\Minus::class, $node->left, ' - ', $node->right); } protected function pExpr_BinaryOp_Mul(BinaryOp\Mul $node) { - return $this->pInfixOp('Expr_BinaryOp_Mul', $node->left, ' * ', $node->right); + return $this->pInfixOp(BinaryOp\Mul::class, $node->left, ' * ', $node->right); } protected function pExpr_BinaryOp_Div(BinaryOp\Div $node) { - return $this->pInfixOp('Expr_BinaryOp_Div', $node->left, ' / ', $node->right); + return $this->pInfixOp(BinaryOp\Div::class, $node->left, ' / ', $node->right); } protected function pExpr_BinaryOp_Concat(BinaryOp\Concat $node) { - return $this->pInfixOp('Expr_BinaryOp_Concat', $node->left, ' . ', $node->right); + return $this->pInfixOp(BinaryOp\Concat::class, $node->left, ' . ', $node->right); } protected function pExpr_BinaryOp_Mod(BinaryOp\Mod $node) { - return $this->pInfixOp('Expr_BinaryOp_Mod', $node->left, ' % ', $node->right); + return $this->pInfixOp(BinaryOp\Mod::class, $node->left, ' % ', $node->right); } protected function pExpr_BinaryOp_BooleanAnd(BinaryOp\BooleanAnd $node) { - return $this->pInfixOp('Expr_BinaryOp_BooleanAnd', $node->left, ' && ', $node->right); + return $this->pInfixOp(BinaryOp\BooleanAnd::class, $node->left, ' && ', $node->right); } protected function pExpr_BinaryOp_BooleanOr(BinaryOp\BooleanOr $node) { - return $this->pInfixOp('Expr_BinaryOp_BooleanOr', $node->left, ' || ', $node->right); + return $this->pInfixOp(BinaryOp\BooleanOr::class, $node->left, ' || ', $node->right); } protected function pExpr_BinaryOp_BitwiseAnd(BinaryOp\BitwiseAnd $node) { - return $this->pInfixOp('Expr_BinaryOp_BitwiseAnd', $node->left, ' & ', $node->right); + return $this->pInfixOp(BinaryOp\BitwiseAnd::class, $node->left, ' & ', $node->right); } protected function pExpr_BinaryOp_BitwiseOr(BinaryOp\BitwiseOr $node) { - return $this->pInfixOp('Expr_BinaryOp_BitwiseOr', $node->left, ' | ', $node->right); + return $this->pInfixOp(BinaryOp\BitwiseOr::class, $node->left, ' | ', $node->right); } protected function pExpr_BinaryOp_BitwiseXor(BinaryOp\BitwiseXor $node) { - return $this->pInfixOp('Expr_BinaryOp_BitwiseXor', $node->left, ' ^ ', $node->right); + return $this->pInfixOp(BinaryOp\BitwiseXor::class, $node->left, ' ^ ', $node->right); } protected function pExpr_BinaryOp_ShiftLeft(BinaryOp\ShiftLeft $node) { - return $this->pInfixOp('Expr_BinaryOp_ShiftLeft', $node->left, ' << ', $node->right); + return $this->pInfixOp(BinaryOp\ShiftLeft::class, $node->left, ' << ', $node->right); } protected function pExpr_BinaryOp_ShiftRight(BinaryOp\ShiftRight $node) { - return $this->pInfixOp('Expr_BinaryOp_ShiftRight', $node->left, ' >> ', $node->right); + return $this->pInfixOp(BinaryOp\ShiftRight::class, $node->left, ' >> ', $node->right); } protected function pExpr_BinaryOp_Pow(BinaryOp\Pow $node) { - return $this->pInfixOp('Expr_BinaryOp_Pow', $node->left, ' ** ', $node->right); + return $this->pInfixOp(BinaryOp\Pow::class, $node->left, ' ** ', $node->right); } protected function pExpr_BinaryOp_LogicalAnd(BinaryOp\LogicalAnd $node) { - return $this->pInfixOp('Expr_BinaryOp_LogicalAnd', $node->left, ' and ', $node->right); + return $this->pInfixOp(BinaryOp\LogicalAnd::class, $node->left, ' and ', $node->right); } protected function pExpr_BinaryOp_LogicalOr(BinaryOp\LogicalOr $node) { - return $this->pInfixOp('Expr_BinaryOp_LogicalOr', $node->left, ' or ', $node->right); + return $this->pInfixOp(BinaryOp\LogicalOr::class, $node->left, ' or ', $node->right); } protected function pExpr_BinaryOp_LogicalXor(BinaryOp\LogicalXor $node) { - return $this->pInfixOp('Expr_BinaryOp_LogicalXor', $node->left, ' xor ', $node->right); + return $this->pInfixOp(BinaryOp\LogicalXor::class, $node->left, ' xor ', $node->right); } protected function pExpr_BinaryOp_Equal(BinaryOp\Equal $node) { - return $this->pInfixOp('Expr_BinaryOp_Equal', $node->left, ' == ', $node->right); + return $this->pInfixOp(BinaryOp\Equal::class, $node->left, ' == ', $node->right); } protected function pExpr_BinaryOp_NotEqual(BinaryOp\NotEqual $node) { - return $this->pInfixOp('Expr_BinaryOp_NotEqual', $node->left, ' != ', $node->right); + return $this->pInfixOp(BinaryOp\NotEqual::class, $node->left, ' != ', $node->right); } protected function pExpr_BinaryOp_Identical(BinaryOp\Identical $node) { - return $this->pInfixOp('Expr_BinaryOp_Identical', $node->left, ' === ', $node->right); + return $this->pInfixOp(BinaryOp\Identical::class, $node->left, ' === ', $node->right); } protected function pExpr_BinaryOp_NotIdentical(BinaryOp\NotIdentical $node) { - return $this->pInfixOp('Expr_BinaryOp_NotIdentical', $node->left, ' !== ', $node->right); + return $this->pInfixOp(BinaryOp\NotIdentical::class, $node->left, ' !== ', $node->right); } protected function pExpr_BinaryOp_Spaceship(BinaryOp\Spaceship $node) { - return $this->pInfixOp('Expr_BinaryOp_Spaceship', $node->left, ' <=> ', $node->right); + return $this->pInfixOp(BinaryOp\Spaceship::class, $node->left, ' <=> ', $node->right); } protected function pExpr_BinaryOp_Greater(BinaryOp\Greater $node) { - return $this->pInfixOp('Expr_BinaryOp_Greater', $node->left, ' > ', $node->right); + return $this->pInfixOp(BinaryOp\Greater::class, $node->left, ' > ', $node->right); } protected function pExpr_BinaryOp_GreaterOrEqual(BinaryOp\GreaterOrEqual $node) { - return $this->pInfixOp('Expr_BinaryOp_GreaterOrEqual', $node->left, ' >= ', $node->right); + return $this->pInfixOp(BinaryOp\GreaterOrEqual::class, $node->left, ' >= ', $node->right); } protected function pExpr_BinaryOp_Smaller(BinaryOp\Smaller $node) { - return $this->pInfixOp('Expr_BinaryOp_Smaller', $node->left, ' < ', $node->right); + return $this->pInfixOp(BinaryOp\Smaller::class, $node->left, ' < ', $node->right); } protected function pExpr_BinaryOp_SmallerOrEqual(BinaryOp\SmallerOrEqual $node) { - return $this->pInfixOp('Expr_BinaryOp_SmallerOrEqual', $node->left, ' <= ', $node->right); + return $this->pInfixOp(BinaryOp\SmallerOrEqual::class, $node->left, ' <= ', $node->right); } protected function pExpr_BinaryOp_Coalesce(BinaryOp\Coalesce $node) { - return $this->pInfixOp('Expr_BinaryOp_Coalesce', $node->left, ' ?? ', $node->right); + return $this->pInfixOp(BinaryOp\Coalesce::class, $node->left, ' ?? ', $node->right); } protected function pExpr_Instanceof(Expr\Instanceof_ $node) { - return $this->pInfixOp('Expr_Instanceof', $node->expr, ' instanceof ', $node->class); + list($precedence, $associativity) = $this->precedenceMap[Expr\Instanceof_::class]; + return $this->pPrec($node->expr, $precedence, $associativity, -1) + . ' instanceof ' + . $this->pNewVariable($node->class); } // Unary expressions protected function pExpr_BooleanNot(Expr\BooleanNot $node) { - return $this->pPrefixOp('Expr_BooleanNot', '!', $node->expr); + return $this->pPrefixOp(Expr\BooleanNot::class, '!', $node->expr); } protected function pExpr_BitwiseNot(Expr\BitwiseNot $node) { - return $this->pPrefixOp('Expr_BitwiseNot', '~', $node->expr); + return $this->pPrefixOp(Expr\BitwiseNot::class, '~', $node->expr); } protected function pExpr_UnaryMinus(Expr\UnaryMinus $node) { @@ -378,7 +426,7 @@ class Standard extends PrettyPrinterAbstract // Enforce -(-$expr) instead of --$expr return '-(' . $this->p($node->expr) . ')'; } - return $this->pPrefixOp('Expr_UnaryMinus', '-', $node->expr); + return $this->pPrefixOp(Expr\UnaryMinus::class, '-', $node->expr); } protected function pExpr_UnaryPlus(Expr\UnaryPlus $node) { @@ -386,65 +434,73 @@ class Standard extends PrettyPrinterAbstract // Enforce +(+$expr) instead of ++$expr return '+(' . $this->p($node->expr) . ')'; } - return $this->pPrefixOp('Expr_UnaryPlus', '+', $node->expr); + return $this->pPrefixOp(Expr\UnaryPlus::class, '+', $node->expr); } protected function pExpr_PreInc(Expr\PreInc $node) { - return $this->pPrefixOp('Expr_PreInc', '++', $node->var); + return $this->pPrefixOp(Expr\PreInc::class, '++', $node->var); } protected function pExpr_PreDec(Expr\PreDec $node) { - return $this->pPrefixOp('Expr_PreDec', '--', $node->var); + return $this->pPrefixOp(Expr\PreDec::class, '--', $node->var); } protected function pExpr_PostInc(Expr\PostInc $node) { - return $this->pPostfixOp('Expr_PostInc', $node->var, '++'); + return $this->pPostfixOp(Expr\PostInc::class, $node->var, '++'); } protected function pExpr_PostDec(Expr\PostDec $node) { - return $this->pPostfixOp('Expr_PostDec', $node->var, '--'); + return $this->pPostfixOp(Expr\PostDec::class, $node->var, '--'); } protected function pExpr_ErrorSuppress(Expr\ErrorSuppress $node) { - return $this->pPrefixOp('Expr_ErrorSuppress', '@', $node->expr); + return $this->pPrefixOp(Expr\ErrorSuppress::class, '@', $node->expr); } protected function pExpr_YieldFrom(Expr\YieldFrom $node) { - return $this->pPrefixOp('Expr_YieldFrom', 'yield from ', $node->expr); + return $this->pPrefixOp(Expr\YieldFrom::class, 'yield from ', $node->expr); } protected function pExpr_Print(Expr\Print_ $node) { - return $this->pPrefixOp('Expr_Print', 'print ', $node->expr); + return $this->pPrefixOp(Expr\Print_::class, 'print ', $node->expr); } // Casts protected function pExpr_Cast_Int(Cast\Int_ $node) { - return $this->pPrefixOp('Expr_Cast_Int', '(int) ', $node->expr); + return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr); } protected function pExpr_Cast_Double(Cast\Double $node) { - return $this->pPrefixOp('Expr_Cast_Double', '(double) ', $node->expr); + $kind = $node->getAttribute('kind', Cast\Double::KIND_DOUBLE); + if ($kind === Cast\Double::KIND_DOUBLE) { + $cast = '(double)'; + } elseif ($kind === Cast\Double::KIND_FLOAT) { + $cast = '(float)'; + } elseif ($kind === Cast\Double::KIND_REAL) { + $cast = '(real)'; + } + return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr); } protected function pExpr_Cast_String(Cast\String_ $node) { - return $this->pPrefixOp('Expr_Cast_String', '(string) ', $node->expr); + return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr); } protected function pExpr_Cast_Array(Cast\Array_ $node) { - return $this->pPrefixOp('Expr_Cast_Array', '(array) ', $node->expr); + return $this->pPrefixOp(Cast\Array_::class, '(array) ', $node->expr); } protected function pExpr_Cast_Object(Cast\Object_ $node) { - return $this->pPrefixOp('Expr_Cast_Object', '(object) ', $node->expr); + return $this->pPrefixOp(Cast\Object_::class, '(object) ', $node->expr); } protected function pExpr_Cast_Bool(Cast\Bool_ $node) { - return $this->pPrefixOp('Expr_Cast_Bool', '(bool) ', $node->expr); + return $this->pPrefixOp(Cast\Bool_::class, '(bool) ', $node->expr); } protected function pExpr_Cast_Unset(Cast\Unset_ $node) { - return $this->pPrefixOp('Expr_Cast_Unset', '(unset) ', $node->expr); + return $this->pPrefixOp(Cast\Unset_::class, '(unset) ', $node->expr); } // Function calls and similar constructs @@ -459,6 +515,11 @@ class Standard extends PrettyPrinterAbstract . '(' . $this->pMaybeMultiline($node->args) . ')'; } + protected function pExpr_NullsafeMethodCall(Expr\NullsafeMethodCall $node) { + return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name) + . '(' . $this->pMaybeMultiline($node->args) . ')'; + } + protected function pExpr_StaticCall(Expr\StaticCall $node) { return $this->pDereferenceLhs($node->class) . '::' . ($node->name instanceof Expr @@ -482,12 +543,12 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_Include(Expr\Include_ $node) { - static $map = array( + static $map = [ Expr\Include_::TYPE_INCLUDE => 'include', Expr\Include_::TYPE_INCLUDE_ONCE => 'include_once', Expr\Include_::TYPE_REQUIRE => 'require', Expr\Include_::TYPE_REQUIRE_ONCE => 'require_once', - ); + ]; return $map[$node->type] . ' ' . $this->p($node->expr); } @@ -522,7 +583,9 @@ class Standard extends PrettyPrinterAbstract protected function pExpr_ArrayItem(Expr\ArrayItem $node) { return (null !== $node->key ? $this->p($node->key) . ' => ' : '') - . ($node->byRef ? '&' : '') . $this->p($node->value); + . ($node->byRef ? '&' : '') + . ($node->unpack ? '...' : '') + . $this->p($node->value); } protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) { @@ -535,14 +598,17 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) { - return $this->p($node->class) . '::' - . (is_string($node->name) ? $node->name : $this->p($node->name)); + return $this->pDereferenceLhs($node->class) . '::' . $this->p($node->name); } protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) { return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name); } + protected function pExpr_NullsafePropertyFetch(Expr\NullsafePropertyFetch $node) { + return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name); + } + protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) { return $this->pDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name); } @@ -552,16 +618,39 @@ class Standard extends PrettyPrinterAbstract } protected function pExpr_Closure(Expr\Closure $node) { - return ($node->static ? 'static ' : '') + return $this->pAttrGroups($node->attrGroups, true) + . ($node->static ? 'static ' : '') . 'function ' . ($node->byRef ? '&' : '') . '(' . $this->pCommaSeparated($node->params) . ')' - . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')': '') - . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '') - . ' {' . $this->pStmts($node->stmts) . "\n" . '}'; + . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '') + . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') + . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pExpr_Match(Expr\Match_ $node) { + return 'match (' . $this->p($node->cond) . ') {' + . $this->pCommaSeparatedMultiline($node->arms, true) + . $this->nl + . '}'; + } + + protected function pMatchArm(Node\MatchArm $node) { + return ($node->conds ? $this->pCommaSeparated($node->conds) : 'default') + . ' => ' . $this->p($node->body); + } + + protected function pExpr_ArrowFunction(Expr\ArrowFunction $node) { + return $this->pAttrGroups($node->attrGroups, true) + . ($node->static ? 'static ' : '') + . 'fn' . ($node->byRef ? '&' : '') + . '(' . $this->pCommaSeparated($node->params) . ')' + . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') + . ' => ' + . $this->p($node->expr); } protected function pExpr_ClosureUse(Expr\ClosureUse $node) { - return ($node->byRef ? '&' : '') . '$' . $node->var; + return ($node->byRef ? '&' : '') . $this->p($node->var); } protected function pExpr_New(Expr\New_ $node) { @@ -569,7 +658,8 @@ class Standard extends PrettyPrinterAbstract $args = $node->args ? '(' . $this->pMaybeMultiline($node->args) . ')' : ''; return 'new ' . $this->pClassCommon($node->class, $args); } - return 'new ' . $this->p($node->class) . '(' . $this->pMaybeMultiline($node->args) . ')'; + return 'new ' . $this->pNewVariable($node->class) + . '(' . $this->pMaybeMultiline($node->args) . ')'; } protected function pExpr_Clone(Expr\Clone_ $node) { @@ -579,7 +669,7 @@ class Standard extends PrettyPrinterAbstract protected function pExpr_Ternary(Expr\Ternary $node) { // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator. // this is okay because the part between ? and : never needs parentheses. - return $this->pInfixOp('Expr_Ternary', + return $this->pInfixOp(Expr\Ternary::class, $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else ); } @@ -590,6 +680,10 @@ class Standard extends PrettyPrinterAbstract . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); } + protected function pExpr_Throw(Expr\Throw_ $node) { + return 'throw ' . $this->p($node->expr); + } + protected function pExpr_Yield(Expr\Yield_ $node) { if ($node->value === null) { return 'yield'; @@ -606,10 +700,11 @@ class Standard extends PrettyPrinterAbstract protected function pStmt_Namespace(Stmt\Namespace_ $node) { if ($this->canUseSemicolonNamespaces) { - return 'namespace ' . $this->p($node->name) . ';' . "\n" . $this->pStmts($node->stmts, false); + return 'namespace ' . $this->p($node->name) . ';' + . $this->nl . $this->pStmts($node->stmts, false); } else { return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '') - . ' {' . $this->pStmts($node->stmts) . "\n" . '}'; + . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; } } @@ -625,7 +720,7 @@ class Standard extends PrettyPrinterAbstract protected function pStmt_UseUse(Stmt\UseUse $node) { return $this->pUseType($node->type) . $this->p($node->name) - . ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : ''); + . (null !== $node->alias ? ' as ' . $node->alias : ''); } protected function pUseType($type) { @@ -634,9 +729,18 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_Interface(Stmt\Interface_ $node) { - return 'interface ' . $node->name + return $this->pAttrGroups($node->attrGroups) + . 'interface ' . $node->name . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') - . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'; + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Enum(Stmt\Enum_ $node) { + return $this->pAttrGroups($node->attrGroups) + . 'enum ' . $node->name + . ($node->scalarType ? " : $node->scalarType" : '') + . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Class(Stmt\Class_ $node) { @@ -644,15 +748,23 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_Trait(Stmt\Trait_ $node) { - return 'trait ' . $node->name - . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'; + return $this->pAttrGroups($node->attrGroups) + . 'trait ' . $node->name + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_EnumCase(Stmt\EnumCase $node) { + return $this->pAttrGroups($node->attrGroups) + . 'case ' . $node->name + . ($node->expr ? ' = ' . $this->p($node->expr) : '') + . ';'; } protected function pStmt_TraitUse(Stmt\TraitUse $node) { return 'use ' . $this->pCommaSeparated($node->traits) . (empty($node->adaptations) ? ';' - : ' {' . $this->pStmts($node->adaptations) . "\n" . '}'); + : ' {' . $this->pStmts($node->adaptations) . $this->nl . '}'); } protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) { @@ -669,7 +781,10 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_Property(Stmt\Property $node) { - return (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) . $this->pCommaSeparated($node->props) . ';'; + return $this->pAttrGroups($node->attrGroups) + . (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) + . ($node->type ? $this->p($node->type) . ' ' : '') + . $this->pCommaSeparated($node->props) . ';'; } protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) { @@ -678,25 +793,28 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_ClassMethod(Stmt\ClassMethod $node) { - return $this->pModifiers($node->flags) + return $this->pAttrGroups($node->attrGroups) + . $this->pModifiers($node->flags) . 'function ' . ($node->byRef ? '&' : '') . $node->name - . '(' . $this->pCommaSeparated($node->params) . ')' - . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '') + . '(' . $this->pMaybeMultiline($node->params) . ')' + . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') . (null !== $node->stmts - ? "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}' + ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); } protected function pStmt_ClassConst(Stmt\ClassConst $node) { - return $this->pModifiers($node->flags) + return $this->pAttrGroups($node->attrGroups) + . $this->pModifiers($node->flags) . 'const ' . $this->pCommaSeparated($node->consts) . ';'; } protected function pStmt_Function(Stmt\Function_ $node) { - return 'function ' . ($node->byRef ? '&' : '') . $node->name + return $this->pAttrGroups($node->attrGroups) + . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pCommaSeparated($node->params) . ')' - . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '') - . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'; + . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Const(Stmt\Const_ $node) { @@ -705,7 +823,7 @@ class Standard extends PrettyPrinterAbstract protected function pStmt_Declare(Stmt\Declare_ $node) { return 'declare (' . $this->pCommaSeparated($node->declares) . ')' - . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . "\n" . '}' : ';'); + . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); } protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) { @@ -716,18 +834,18 @@ class Standard extends PrettyPrinterAbstract protected function pStmt_If(Stmt\If_ $node) { return 'if (' . $this->p($node->cond) . ') {' - . $this->pStmts($node->stmts) . "\n" . '}' - . $this->pImplode($node->elseifs) - . (null !== $node->else ? $this->p($node->else) : ''); + . $this->pStmts($node->stmts) . $this->nl . '}' + . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '') + . (null !== $node->else ? ' ' . $this->p($node->else) : ''); } protected function pStmt_ElseIf(Stmt\ElseIf_ $node) { - return ' elseif (' . $this->p($node->cond) . ') {' - . $this->pStmts($node->stmts) . "\n" . '}'; + return 'elseif (' . $this->p($node->cond) . ') {' + . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Else(Stmt\Else_ $node) { - return ' else {' . $this->pStmts($node->stmts) . "\n" . '}'; + return 'else {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_For(Stmt\For_ $node) { @@ -735,29 +853,29 @@ class Standard extends PrettyPrinterAbstract . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '') . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '') . $this->pCommaSeparated($node->loop) - . ') {' . $this->pStmts($node->stmts) . "\n" . '}'; + . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Foreach(Stmt\Foreach_ $node) { return 'foreach (' . $this->p($node->expr) . ' as ' . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '') . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' - . $this->pStmts($node->stmts) . "\n" . '}'; + . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_While(Stmt\While_ $node) { return 'while (' . $this->p($node->cond) . ') {' - . $this->pStmts($node->stmts) . "\n" . '}'; + . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Do(Stmt\Do_ $node) { - return 'do {' . $this->pStmts($node->stmts) . "\n" + return 'do {' . $this->pStmts($node->stmts) . $this->nl . '} while (' . $this->p($node->cond) . ');'; } protected function pStmt_Switch(Stmt\Switch_ $node) { return 'switch (' . $this->p($node->cond) . ') {' - . $this->pStmts($node->cases) . "\n" . '}'; + . $this->pStmts($node->cases) . $this->nl . '}'; } protected function pStmt_Case(Stmt\Case_ $node) { @@ -766,18 +884,19 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_TryCatch(Stmt\TryCatch $node) { - return 'try {' . $this->pStmts($node->stmts) . "\n" . '}' - . $this->pImplode($node->catches) - . ($node->finally !== null ? $this->p($node->finally) : ''); + return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}' + . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '') + . ($node->finally !== null ? ' ' . $this->p($node->finally) : ''); } protected function pStmt_Catch(Stmt\Catch_ $node) { - return ' catch (' . $this->pImplode($node->types, '|') . ' $' . $node->var . ') {' - . $this->pStmts($node->stmts) . "\n" . '}'; + return 'catch (' . $this->pImplode($node->types, '|') + . ($node->var !== null ? ' ' . $this->p($node->var) : '') + . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Finally(Stmt\Finally_ $node) { - return ' finally {' . $this->pStmts($node->stmts) . "\n" . '}'; + return 'finally {' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pStmt_Break(Stmt\Break_ $node) { @@ -806,6 +925,10 @@ class Standard extends PrettyPrinterAbstract // Other + protected function pStmt_Expression(Stmt\Expression $node) { + return $this->p($node->expr) . ';'; + } + protected function pStmt_Echo(Stmt\Echo_ $node) { return 'echo ' . $this->pCommaSeparated($node->exprs) . ';'; } @@ -819,7 +942,7 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_StaticVar(Stmt\StaticVar $node) { - return '$' . $node->name + return $this->p($node->var) . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); } @@ -829,7 +952,7 @@ class Standard extends PrettyPrinterAbstract protected function pStmt_InlineHTML(Stmt\InlineHTML $node) { $newline = $node->getAttribute('hasLeadingNewline', true) ? "\n" : ''; - return '?>' . $this->pNoIndent($newline . $node->value) . '' . $newline . $node->value . 'p($node); - } - protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) { - return $this->pModifiers($node->flags) - . 'class' . $afterClassToken - . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '') - . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') - . "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'; + return $this->pAttrGroups($node->attrGroups, $node->name === null) + . $this->pModifiers($node->flags) + . 'class' . $afterClassToken + . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '') + . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } protected function pObjectProperty($node) { @@ -862,15 +982,6 @@ class Standard extends PrettyPrinterAbstract } } - protected function pModifiers($modifiers) { - return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') - . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '') - . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '') - . ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '') - . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '') - . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : ''); - } - protected function pEncapsList(array $encapsList, $quote) { $return = ''; foreach ($encapsList as $element) { @@ -884,6 +995,10 @@ class Standard extends PrettyPrinterAbstract return $return; } + protected function pSingleQuotedString(string $string) { + return '\'' . addcslashes($string, '\'\\') . '\''; + } + protected function escapeString($string, $quote) { if (null === $quote) { // For doc strings, don't escape newlines @@ -892,14 +1007,27 @@ class Standard extends PrettyPrinterAbstract $escaped = addcslashes($string, "\n\r\t\f\v$" . $quote . "\\"); } - // Escape other control characters - return preg_replace_callback('/([\0-\10\16-\37])(?=([0-7]?))/', function ($matches) { - $oct = decoct(ord($matches[1])); - if ($matches[2] !== '') { - // If there is a trailing digit, use the full three character form - return '\\' . str_pad($oct, 3, '0', STR_PAD_LEFT); - } - return '\\' . $oct; + // Escape control characters and non-UTF-8 characters. + // Regex based on https://stackoverflow.com/a/11709412/385378. + $regex = '/( + [\x00-\x08\x0E-\x1F] # Control characters + | [\xC0-\xC1] # Invalid UTF-8 Bytes + | [\xF5-\xFF] # Invalid UTF-8 Bytes + | \xE0(?=[\x80-\x9F]) # Overlong encoding of prior code point + | \xF0(?=[\x80-\x8F]) # Overlong encoding of prior code point + | [\xC2-\xDF](?![\x80-\xBF]) # Invalid UTF-8 Sequence Start + | [\xE0-\xEF](?![\x80-\xBF]{2}) # Invalid UTF-8 Sequence Start + | [\xF0-\xF4](?![\x80-\xBF]{3}) # Invalid UTF-8 Sequence Start + | (?<=[\x00-\x7F\xF5-\xFF])[\x80-\xBF] # Invalid UTF-8 Sequence Middle + | (?dereferenceLhsRequiresParens($node)) { return $this->p($node); } else { return '(' . $this->p($node) . ')'; @@ -944,34 +1060,46 @@ class Standard extends PrettyPrinterAbstract } protected function pCallLhs(Node $node) { - if ($node instanceof Name - || $node instanceof Expr\Variable - || $node instanceof Expr\ArrayDimFetch - || $node instanceof Expr\FuncCall - || $node instanceof Expr\MethodCall - || $node instanceof Expr\StaticCall - || $node instanceof Expr\Array_ - ) { + if (!$this->callLhsRequiresParens($node)) { return $this->p($node); } else { return '(' . $this->p($node) . ')'; } } - private function hasNodeWithComments(array $nodes) { + protected function pNewVariable(Node $node) { + // TODO: This is not fully accurate. + return $this->pDereferenceLhs($node); + } + + /** + * @param Node[] $nodes + * @return bool + */ + protected function hasNodeWithComments(array $nodes) { foreach ($nodes as $node) { - if ($node && $node->getAttribute('comments')) { + if ($node && $node->getComments()) { return true; } } return false; } - private function pMaybeMultiline(array $nodes, $trailingComma = false) { + protected function pMaybeMultiline(array $nodes, bool $trailingComma = false) { if (!$this->hasNodeWithComments($nodes)) { return $this->pCommaSeparated($nodes); } else { - return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . "\n"; + return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl; } } + + protected function pAttrGroups(array $nodes, bool $inline = false): string { + $result = ''; + $sep = $inline ? ' ' : $this->nl; + foreach ($nodes as $node) { + $result .= $this->p($node) . $sep; + } + + return $result; + } } diff --git a/lib/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php b/lib/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php index 24bae5936..2c7fc3070 100644 --- a/lib/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +++ b/lib/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php @@ -1,84 +1,140 @@ - array( 0, 1), - 'Expr_BitwiseNot' => array( 10, 1), - 'Expr_PreInc' => array( 10, 1), - 'Expr_PreDec' => array( 10, 1), - 'Expr_PostInc' => array( 10, -1), - 'Expr_PostDec' => array( 10, -1), - 'Expr_UnaryPlus' => array( 10, 1), - 'Expr_UnaryMinus' => array( 10, 1), - 'Expr_Cast_Int' => array( 10, 1), - 'Expr_Cast_Double' => array( 10, 1), - 'Expr_Cast_String' => array( 10, 1), - 'Expr_Cast_Array' => array( 10, 1), - 'Expr_Cast_Object' => array( 10, 1), - 'Expr_Cast_Bool' => array( 10, 1), - 'Expr_Cast_Unset' => array( 10, 1), - 'Expr_ErrorSuppress' => array( 10, 1), - 'Expr_Instanceof' => array( 20, 0), - 'Expr_BooleanNot' => array( 30, 1), - 'Expr_BinaryOp_Mul' => array( 40, -1), - 'Expr_BinaryOp_Div' => array( 40, -1), - 'Expr_BinaryOp_Mod' => array( 40, -1), - 'Expr_BinaryOp_Plus' => array( 50, -1), - 'Expr_BinaryOp_Minus' => array( 50, -1), - 'Expr_BinaryOp_Concat' => array( 50, -1), - 'Expr_BinaryOp_ShiftLeft' => array( 60, -1), - 'Expr_BinaryOp_ShiftRight' => array( 60, -1), - 'Expr_BinaryOp_Smaller' => array( 70, 0), - 'Expr_BinaryOp_SmallerOrEqual' => array( 70, 0), - 'Expr_BinaryOp_Greater' => array( 70, 0), - 'Expr_BinaryOp_GreaterOrEqual' => array( 70, 0), - 'Expr_BinaryOp_Equal' => array( 80, 0), - 'Expr_BinaryOp_NotEqual' => array( 80, 0), - 'Expr_BinaryOp_Identical' => array( 80, 0), - 'Expr_BinaryOp_NotIdentical' => array( 80, 0), - 'Expr_BinaryOp_Spaceship' => array( 80, 0), - 'Expr_BinaryOp_BitwiseAnd' => array( 90, -1), - 'Expr_BinaryOp_BitwiseXor' => array(100, -1), - 'Expr_BinaryOp_BitwiseOr' => array(110, -1), - 'Expr_BinaryOp_BooleanAnd' => array(120, -1), - 'Expr_BinaryOp_BooleanOr' => array(130, -1), - 'Expr_BinaryOp_Coalesce' => array(140, 1), - 'Expr_Ternary' => array(150, -1), - // parser uses %left for assignments, but they really behave as %right - 'Expr_Assign' => array(160, 1), - 'Expr_AssignRef' => array(160, 1), - 'Expr_AssignOp_Plus' => array(160, 1), - 'Expr_AssignOp_Minus' => array(160, 1), - 'Expr_AssignOp_Mul' => array(160, 1), - 'Expr_AssignOp_Div' => array(160, 1), - 'Expr_AssignOp_Concat' => array(160, 1), - 'Expr_AssignOp_Mod' => array(160, 1), - 'Expr_AssignOp_BitwiseAnd' => array(160, 1), - 'Expr_AssignOp_BitwiseOr' => array(160, 1), - 'Expr_AssignOp_BitwiseXor' => array(160, 1), - 'Expr_AssignOp_ShiftLeft' => array(160, 1), - 'Expr_AssignOp_ShiftRight' => array(160, 1), - 'Expr_AssignOp_Pow' => array(160, 1), - 'Expr_YieldFrom' => array(165, 1), - 'Expr_Print' => array(168, 1), - 'Expr_BinaryOp_LogicalAnd' => array(170, -1), - 'Expr_BinaryOp_LogicalXor' => array(180, -1), - 'Expr_BinaryOp_LogicalOr' => array(190, -1), - 'Expr_Include' => array(200, -1), - ); + const FIXUP_PREC_LEFT = 0; // LHS operand affected by precedence + const FIXUP_PREC_RIGHT = 1; // RHS operand affected by precedence + const FIXUP_CALL_LHS = 2; // LHS of call + const FIXUP_DEREF_LHS = 3; // LHS of dereferencing operation + const FIXUP_BRACED_NAME = 4; // Name operand that may require bracing + const FIXUP_VAR_BRACED_NAME = 5; // Name operand that may require ${} bracing + const FIXUP_ENCAPSED = 6; // Encapsed string part - protected $noIndentToken; + protected $precedenceMap = [ + // [precedence, associativity] + // where for precedence -1 is %left, 0 is %nonassoc and 1 is %right + BinaryOp\Pow::class => [ 0, 1], + Expr\BitwiseNot::class => [ 10, 1], + Expr\PreInc::class => [ 10, 1], + Expr\PreDec::class => [ 10, 1], + Expr\PostInc::class => [ 10, -1], + Expr\PostDec::class => [ 10, -1], + Expr\UnaryPlus::class => [ 10, 1], + Expr\UnaryMinus::class => [ 10, 1], + Cast\Int_::class => [ 10, 1], + Cast\Double::class => [ 10, 1], + Cast\String_::class => [ 10, 1], + Cast\Array_::class => [ 10, 1], + Cast\Object_::class => [ 10, 1], + Cast\Bool_::class => [ 10, 1], + Cast\Unset_::class => [ 10, 1], + Expr\ErrorSuppress::class => [ 10, 1], + Expr\Instanceof_::class => [ 20, 0], + Expr\BooleanNot::class => [ 30, 1], + BinaryOp\Mul::class => [ 40, -1], + BinaryOp\Div::class => [ 40, -1], + BinaryOp\Mod::class => [ 40, -1], + BinaryOp\Plus::class => [ 50, -1], + BinaryOp\Minus::class => [ 50, -1], + BinaryOp\Concat::class => [ 50, -1], + BinaryOp\ShiftLeft::class => [ 60, -1], + BinaryOp\ShiftRight::class => [ 60, -1], + BinaryOp\Smaller::class => [ 70, 0], + BinaryOp\SmallerOrEqual::class => [ 70, 0], + BinaryOp\Greater::class => [ 70, 0], + BinaryOp\GreaterOrEqual::class => [ 70, 0], + BinaryOp\Equal::class => [ 80, 0], + BinaryOp\NotEqual::class => [ 80, 0], + BinaryOp\Identical::class => [ 80, 0], + BinaryOp\NotIdentical::class => [ 80, 0], + BinaryOp\Spaceship::class => [ 80, 0], + BinaryOp\BitwiseAnd::class => [ 90, -1], + BinaryOp\BitwiseXor::class => [100, -1], + BinaryOp\BitwiseOr::class => [110, -1], + BinaryOp\BooleanAnd::class => [120, -1], + BinaryOp\BooleanOr::class => [130, -1], + BinaryOp\Coalesce::class => [140, 1], + Expr\Ternary::class => [150, 0], + // parser uses %left for assignments, but they really behave as %right + Expr\Assign::class => [160, 1], + Expr\AssignRef::class => [160, 1], + AssignOp\Plus::class => [160, 1], + AssignOp\Minus::class => [160, 1], + AssignOp\Mul::class => [160, 1], + AssignOp\Div::class => [160, 1], + AssignOp\Concat::class => [160, 1], + AssignOp\Mod::class => [160, 1], + AssignOp\BitwiseAnd::class => [160, 1], + AssignOp\BitwiseOr::class => [160, 1], + AssignOp\BitwiseXor::class => [160, 1], + AssignOp\ShiftLeft::class => [160, 1], + AssignOp\ShiftRight::class => [160, 1], + AssignOp\Pow::class => [160, 1], + AssignOp\Coalesce::class => [160, 1], + Expr\YieldFrom::class => [165, 1], + Expr\Print_::class => [168, 1], + BinaryOp\LogicalAnd::class => [170, -1], + BinaryOp\LogicalXor::class => [180, -1], + BinaryOp\LogicalOr::class => [190, -1], + Expr\Include_::class => [200, -1], + ]; + + /** @var int Current indentation level. */ + protected $indentLevel; + /** @var string Newline including current indentation. */ + protected $nl; + /** @var string Token placed at end of doc string to ensure it is followed by a newline. */ protected $docStringEndToken; + /** @var bool Whether semicolon namespaces can be used (i.e. no global namespace is used) */ protected $canUseSemicolonNamespaces; + /** @var array Pretty printer options */ protected $options; + /** @var TokenStream Original tokens for use in format-preserving pretty print */ + protected $origTokens; + /** @var Internal\Differ Differ for node lists */ + protected $nodeListDiffer; + /** @var bool[] Map determining whether a certain character is a label character */ + protected $labelCharMap; + /** + * @var int[][] Map from token classes and subnode names to FIXUP_* constants. This is used + * during format-preserving prints to place additional parens/braces if necessary. + */ + protected $fixupMap; + /** + * @var int[][] Map from "{$node->getType()}->{$subNode}" to ['left' => $l, 'right' => $r], + * where $l and $r specify the token type that needs to be stripped when removing + * this node. + */ + protected $removalMap; + /** + * @var mixed[] Map from "{$node->getType()}->{$subNode}" to [$find, $beforeToken, $extraLeft, $extraRight]. + * $find is an optional token after which the insertion occurs. $extraLeft/Right + * are optionally added before/after the main insertions. + */ + protected $insertionMap; + /** + * @var string[] Map From "{$node->getType()}->{$subNode}" to string that should be inserted + * between elements of this list subnode. + */ + protected $listInsertionMap; + protected $emptyListInsertionMap; + /** @var int[] Map from "{$node->getType()}->{$subNode}" to token before which the modifiers + * should be reprinted. */ + protected $modifierChangeMap; + /** * Creates a pretty printer instance using the given options. * @@ -89,13 +145,48 @@ abstract class PrettyPrinterAbstract * @param array $options Dictionary of formatting options */ public function __construct(array $options = []) { - $this->noIndentToken = '_NO_INDENT_' . mt_rand(); $this->docStringEndToken = '_DOC_STRING_END_' . mt_rand(); $defaultOptions = ['shortArraySyntax' => false]; $this->options = $options + $defaultOptions; } + /** + * Reset pretty printing state. + */ + protected function resetState() { + $this->indentLevel = 0; + $this->nl = "\n"; + $this->origTokens = null; + } + + /** + * Set indentation level + * + * @param int $level Level in number of spaces + */ + protected function setIndentLevel(int $level) { + $this->indentLevel = $level; + $this->nl = "\n" . \str_repeat(' ', $level); + } + + /** + * Increase indentation level. + */ + protected function indent() { + $this->indentLevel += 4; + $this->nl .= ' '; + } + + /** + * Decrease indentation level. + */ + protected function outdent() { + assert($this->indentLevel >= 4); + $this->indentLevel -= 4; + $this->nl = "\n" . str_repeat(' ', $this->indentLevel); + } + /** * Pretty prints an array of statements. * @@ -103,7 +194,8 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - public function prettyPrint(array $stmts) { + public function prettyPrint(array $stmts) : string { + $this->resetState(); $this->preprocessNodes($stmts); return ltrim($this->handleMagicTokens($this->pStmts($stmts, false))); @@ -116,7 +208,8 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed node */ - public function prettyPrintExpr(Expr $node) { + public function prettyPrintExpr(Expr $node) : string { + $this->resetState(); return $this->handleMagicTokens($this->p($node)); } @@ -127,7 +220,7 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - public function prettyPrintFile(array $stmts) { + public function prettyPrintFile(array $stmts) : string { if (!$stmts) { return "name) { $this->canUseSemicolonNamespaces = false; + break; } } } - protected function handleMagicTokens($str) { - // Drop no-indent tokens - $str = str_replace($this->noIndentToken, '', $str); - + /** + * Handles (and removes) no-indent and doc-string-end tokens. + * + * @param string $str + * @return string + */ + protected function handleMagicTokens(string $str) : string { // Replace doc-string-end tokens with nothing or a newline $str = str_replace($this->docStringEndToken . ";\n", ";\n", $str); $str = str_replace($this->docStringEndToken, "\n", $str); @@ -178,53 +275,74 @@ abstract class PrettyPrinterAbstract * * @return string Pretty printed statements */ - protected function pStmts(array $nodes, $indent = true) { + protected function pStmts(array $nodes, bool $indent = true) : string { + if ($indent) { + $this->indent(); + } + $result = ''; foreach ($nodes as $node) { - $comments = $node->getAttribute('comments', array()); + $comments = $node->getComments(); if ($comments) { - $result .= "\n" . $this->pComments($comments); + $result .= $this->nl . $this->pComments($comments); if ($node instanceof Stmt\Nop) { continue; } } - $result .= "\n" . $this->p($node) . ($node instanceof Expr ? ';' : ''); + $result .= $this->nl . $this->p($node); } if ($indent) { - return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n ", $result); - } else { - return $result; + $this->outdent(); } + + return $result; } /** - * Pretty prints a node. + * Pretty-print an infix operation while taking precedence into account. * - * @param Node $node Node to be pretty printed + * @param string $class Node class of operator + * @param Node $leftNode Left-hand side node + * @param string $operatorString String representation of the operator + * @param Node $rightNode Right-hand side node * - * @return string Pretty printed node + * @return string Pretty printed infix operation */ - protected function p(Node $node) { - return $this->{'p' . $node->getType()}($node); - } - - protected function pInfixOp($type, Node $leftNode, $operatorString, Node $rightNode) { - list($precedence, $associativity) = $this->precedenceMap[$type]; + protected function pInfixOp(string $class, Node $leftNode, string $operatorString, Node $rightNode) : string { + list($precedence, $associativity) = $this->precedenceMap[$class]; return $this->pPrec($leftNode, $precedence, $associativity, -1) . $operatorString . $this->pPrec($rightNode, $precedence, $associativity, 1); } - protected function pPrefixOp($type, $operatorString, Node $node) { - list($precedence, $associativity) = $this->precedenceMap[$type]; + /** + * Pretty-print a prefix operation while taking precedence into account. + * + * @param string $class Node class of operator + * @param string $operatorString String representation of the operator + * @param Node $node Node + * + * @return string Pretty printed prefix operation + */ + protected function pPrefixOp(string $class, string $operatorString, Node $node) : string { + list($precedence, $associativity) = $this->precedenceMap[$class]; return $operatorString . $this->pPrec($node, $precedence, $associativity, 1); } - protected function pPostfixOp($type, Node $node, $operatorString) { - list($precedence, $associativity) = $this->precedenceMap[$type]; + /** + * Pretty-print a postfix operation while taking precedence into account. + * + * @param string $class Node class of operator + * @param string $operatorString String representation of the operator + * @param Node $node Node + * + * @return string Pretty printed postfix operation + */ + protected function pPostfixOp(string $class, Node $node, string $operatorString) : string { + list($precedence, $associativity) = $this->precedenceMap[$class]; return $this->pPrec($node, $precedence, $associativity, -1) . $operatorString; } @@ -240,12 +358,12 @@ abstract class PrettyPrinterAbstract * * @return string The pretty printed node */ - protected function pPrec(Node $node, $parentPrecedence, $parentAssociativity, $childPosition) { - $type = $node->getType(); - if (isset($this->precedenceMap[$type])) { - $childPrecedence = $this->precedenceMap[$type][0]; + protected function pPrec(Node $node, int $parentPrecedence, int $parentAssociativity, int $childPosition) : string { + $class = \get_class($node); + if (isset($this->precedenceMap[$class])) { + $childPrecedence = $this->precedenceMap[$class][0]; if ($childPrecedence > $parentPrecedence - || ($parentPrecedence == $childPrecedence && $parentAssociativity != $childPosition) + || ($parentPrecedence === $childPrecedence && $parentAssociativity !== $childPosition) ) { return '(' . $this->p($node) . ')'; } @@ -262,8 +380,8 @@ abstract class PrettyPrinterAbstract * * @return string Imploded pretty printed nodes */ - protected function pImplode(array $nodes, $glue = '') { - $pNodes = array(); + protected function pImplode(array $nodes, string $glue = '') : string { + $pNodes = []; foreach ($nodes as $node) { if (null === $node) { $pNodes[] = ''; @@ -282,7 +400,7 @@ abstract class PrettyPrinterAbstract * * @return string Comma separated pretty printed nodes */ - protected function pCommaSeparated(array $nodes) { + protected function pCommaSeparated(array $nodes) : string { return $this->pImplode($nodes, ', '); } @@ -296,37 +414,29 @@ abstract class PrettyPrinterAbstract * * @return string Comma separated pretty printed nodes in multiline style */ - protected function pCommaSeparatedMultiline(array $nodes, $trailingComma) { + protected function pCommaSeparatedMultiline(array $nodes, bool $trailingComma) : string { + $this->indent(); + $result = ''; $lastIdx = count($nodes) - 1; foreach ($nodes as $idx => $node) { if ($node !== null) { - $comments = $node->getAttribute('comments', array()); + $comments = $node->getComments(); if ($comments) { - $result .= "\n" . $this->pComments($comments); + $result .= $this->nl . $this->pComments($comments); } - $result .= "\n" . $this->p($node); + $result .= $this->nl . $this->p($node); } else { - $result .= "\n"; + $result .= $this->nl; } if ($trailingComma || $idx !== $lastIdx) { $result .= ','; } } - return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n ", $result); - } - - /** - * Signals the pretty printer that a string shall not be indented. - * - * @param string $string Not to be indented string - * - * @return string String marked with $this->noIndentToken's. - */ - protected function pNoIndent($string) { - return str_replace("\n", "\n" . $this->noIndentToken, $string); + $this->outdent(); + return $result; } /** @@ -336,13 +446,1061 @@ abstract class PrettyPrinterAbstract * * @return string Reformatted text of comments */ - protected function pComments(array $comments) { + protected function pComments(array $comments) : string { $formattedComments = []; foreach ($comments as $comment) { - $formattedComments[] = $comment->getReformattedText(); + $formattedComments[] = str_replace("\n", $this->nl, $comment->getReformattedText()); } - return implode("\n", $formattedComments); + return implode($this->nl, $formattedComments); + } + + /** + * Perform a format-preserving pretty print of an AST. + * + * The format preservation is best effort. For some changes to the AST the formatting will not + * be preserved (at least not locally). + * + * In order to use this method a number of prerequisites must be satisfied: + * * The startTokenPos and endTokenPos attributes in the lexer must be enabled. + * * The CloningVisitor must be run on the AST prior to modification. + * * The original tokens must be provided, using the getTokens() method on the lexer. + * + * @param Node[] $stmts Modified AST with links to original AST + * @param Node[] $origStmts Original AST with token offset information + * @param array $origTokens Tokens of the original code + * + * @return string + */ + public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens) : string { + $this->initializeNodeListDiffer(); + $this->initializeLabelCharMap(); + $this->initializeFixupMap(); + $this->initializeRemovalMap(); + $this->initializeInsertionMap(); + $this->initializeListInsertionMap(); + $this->initializeEmptyListInsertionMap(); + $this->initializeModifierChangeMap(); + + $this->resetState(); + $this->origTokens = new TokenStream($origTokens); + + $this->preprocessNodes($stmts); + + $pos = 0; + $result = $this->pArray($stmts, $origStmts, $pos, 0, 'File', 'stmts', null); + if (null !== $result) { + $result .= $this->origTokens->getTokenCode($pos, count($origTokens), 0); + } else { + // Fallback + // TODO Add pStmts($stmts, false); + } + + return ltrim($this->handleMagicTokens($result)); + } + + protected function pFallback(Node $node) { + return $this->{'p' . $node->getType()}($node); + } + + /** + * Pretty prints a node. + * + * This method also handles formatting preservation for nodes. + * + * @param Node $node Node to be pretty printed + * @param bool $parentFormatPreserved Whether parent node has preserved formatting + * + * @return string Pretty printed node + */ + protected function p(Node $node, $parentFormatPreserved = false) : string { + // No orig tokens means this is a normal pretty print without preservation of formatting + if (!$this->origTokens) { + return $this->{'p' . $node->getType()}($node); + } + + /** @var Node $origNode */ + $origNode = $node->getAttribute('origNode'); + if (null === $origNode) { + return $this->pFallback($node); + } + + $class = \get_class($node); + \assert($class === \get_class($origNode)); + + $startPos = $origNode->getStartTokenPos(); + $endPos = $origNode->getEndTokenPos(); + \assert($startPos >= 0 && $endPos >= 0); + + $fallbackNode = $node; + if ($node instanceof Expr\New_ && $node->class instanceof Stmt\Class_) { + // Normalize node structure of anonymous classes + $node = PrintableNewAnonClassNode::fromNewNode($node); + $origNode = PrintableNewAnonClassNode::fromNewNode($origNode); + } + + // InlineHTML node does not contain closing and opening PHP tags. If the parent formatting + // is not preserved, then we need to use the fallback code to make sure the tags are + // printed. + if ($node instanceof Stmt\InlineHTML && !$parentFormatPreserved) { + return $this->pFallback($fallbackNode); + } + + $indentAdjustment = $this->indentLevel - $this->origTokens->getIndentationBefore($startPos); + + $type = $node->getType(); + $fixupInfo = $this->fixupMap[$class] ?? null; + + $result = ''; + $pos = $startPos; + foreach ($node->getSubNodeNames() as $subNodeName) { + $subNode = $node->$subNodeName; + $origSubNode = $origNode->$subNodeName; + + if ((!$subNode instanceof Node && $subNode !== null) + || (!$origSubNode instanceof Node && $origSubNode !== null) + ) { + if ($subNode === $origSubNode) { + // Unchanged, can reuse old code + continue; + } + + if (is_array($subNode) && is_array($origSubNode)) { + // Array subnode changed, we might be able to reconstruct it + $listResult = $this->pArray( + $subNode, $origSubNode, $pos, $indentAdjustment, $type, $subNodeName, + $fixupInfo[$subNodeName] ?? null + ); + if (null === $listResult) { + return $this->pFallback($fallbackNode); + } + + $result .= $listResult; + continue; + } + + if (is_int($subNode) && is_int($origSubNode)) { + // Check if this is a modifier change + $key = $type . '->' . $subNodeName; + if (!isset($this->modifierChangeMap[$key])) { + return $this->pFallback($fallbackNode); + } + + $findToken = $this->modifierChangeMap[$key]; + $result .= $this->pModifiers($subNode); + $pos = $this->origTokens->findRight($pos, $findToken); + continue; + } + + // If a non-node, non-array subnode changed, we don't be able to do a partial + // reconstructions, as we don't have enough offset information. Pretty print the + // whole node instead. + return $this->pFallback($fallbackNode); + } + + $extraLeft = ''; + $extraRight = ''; + if ($origSubNode !== null) { + $subStartPos = $origSubNode->getStartTokenPos(); + $subEndPos = $origSubNode->getEndTokenPos(); + \assert($subStartPos >= 0 && $subEndPos >= 0); + } else { + if ($subNode === null) { + // Both null, nothing to do + continue; + } + + // A node has been inserted, check if we have insertion information for it + $key = $type . '->' . $subNodeName; + if (!isset($this->insertionMap[$key])) { + return $this->pFallback($fallbackNode); + } + + list($findToken, $beforeToken, $extraLeft, $extraRight) = $this->insertionMap[$key]; + if (null !== $findToken) { + $subStartPos = $this->origTokens->findRight($pos, $findToken) + + (int) !$beforeToken; + } else { + $subStartPos = $pos; + } + + if (null === $extraLeft && null !== $extraRight) { + // If inserting on the right only, skipping whitespace looks better + $subStartPos = $this->origTokens->skipRightWhitespace($subStartPos); + } + $subEndPos = $subStartPos - 1; + } + + if (null === $subNode) { + // A node has been removed, check if we have removal information for it + $key = $type . '->' . $subNodeName; + if (!isset($this->removalMap[$key])) { + return $this->pFallback($fallbackNode); + } + + // Adjust positions to account for additional tokens that must be skipped + $removalInfo = $this->removalMap[$key]; + if (isset($removalInfo['left'])) { + $subStartPos = $this->origTokens->skipLeft($subStartPos - 1, $removalInfo['left']) + 1; + } + if (isset($removalInfo['right'])) { + $subEndPos = $this->origTokens->skipRight($subEndPos + 1, $removalInfo['right']) - 1; + } + } + + $result .= $this->origTokens->getTokenCode($pos, $subStartPos, $indentAdjustment); + + if (null !== $subNode) { + $result .= $extraLeft; + + $origIndentLevel = $this->indentLevel; + $this->setIndentLevel($this->origTokens->getIndentationBefore($subStartPos) + $indentAdjustment); + + // If it's the same node that was previously in this position, it certainly doesn't + // need fixup. It's important to check this here, because our fixup checks are more + // conservative than strictly necessary. + if (isset($fixupInfo[$subNodeName]) + && $subNode->getAttribute('origNode') !== $origSubNode + ) { + $fixup = $fixupInfo[$subNodeName]; + $res = $this->pFixup($fixup, $subNode, $class, $subStartPos, $subEndPos); + } else { + $res = $this->p($subNode, true); + } + + $this->safeAppend($result, $res); + $this->setIndentLevel($origIndentLevel); + + $result .= $extraRight; + } + + $pos = $subEndPos + 1; + } + + $result .= $this->origTokens->getTokenCode($pos, $endPos + 1, $indentAdjustment); + return $result; + } + + /** + * Perform a format-preserving pretty print of an array. + * + * @param array $nodes New nodes + * @param array $origNodes Original nodes + * @param int $pos Current token position (updated by reference) + * @param int $indentAdjustment Adjustment for indentation + * @param string $parentNodeType Type of the containing node. + * @param string $subNodeName Name of array subnode. + * @param null|int $fixup Fixup information for array item nodes + * + * @return null|string Result of pretty print or null if cannot preserve formatting + */ + protected function pArray( + array $nodes, array $origNodes, int &$pos, int $indentAdjustment, + string $parentNodeType, string $subNodeName, $fixup + ) { + $diff = $this->nodeListDiffer->diffWithReplacements($origNodes, $nodes); + + $mapKey = $parentNodeType . '->' . $subNodeName; + $insertStr = $this->listInsertionMap[$mapKey] ?? null; + $isStmtList = $subNodeName === 'stmts'; + + $beforeFirstKeepOrReplace = true; + $skipRemovedNode = false; + $delayedAdd = []; + $lastElemIndentLevel = $this->indentLevel; + + $insertNewline = false; + if ($insertStr === "\n") { + $insertStr = ''; + $insertNewline = true; + } + + if ($isStmtList && \count($origNodes) === 1 && \count($nodes) !== 1) { + $startPos = $origNodes[0]->getStartTokenPos(); + $endPos = $origNodes[0]->getEndTokenPos(); + \assert($startPos >= 0 && $endPos >= 0); + if (!$this->origTokens->haveBraces($startPos, $endPos)) { + // This was a single statement without braces, but either additional statements + // have been added, or the single statement has been removed. This requires the + // addition of braces. For now fall back. + // TODO: Try to preserve formatting + return null; + } + } + + $result = ''; + foreach ($diff as $i => $diffElem) { + $diffType = $diffElem->type; + /** @var Node|null $arrItem */ + $arrItem = $diffElem->new; + /** @var Node|null $origArrItem */ + $origArrItem = $diffElem->old; + + if ($diffType === DiffElem::TYPE_KEEP || $diffType === DiffElem::TYPE_REPLACE) { + $beforeFirstKeepOrReplace = false; + + if ($origArrItem === null || $arrItem === null) { + // We can only handle the case where both are null + if ($origArrItem === $arrItem) { + continue; + } + return null; + } + + if (!$arrItem instanceof Node || !$origArrItem instanceof Node) { + // We can only deal with nodes. This can occur for Names, which use string arrays. + return null; + } + + $itemStartPos = $origArrItem->getStartTokenPos(); + $itemEndPos = $origArrItem->getEndTokenPos(); + \assert($itemStartPos >= 0 && $itemEndPos >= 0 && $itemStartPos >= $pos); + + $origIndentLevel = $this->indentLevel; + $lastElemIndentLevel = $this->origTokens->getIndentationBefore($itemStartPos) + $indentAdjustment; + $this->setIndentLevel($lastElemIndentLevel); + + $comments = $arrItem->getComments(); + $origComments = $origArrItem->getComments(); + $commentStartPos = $origComments ? $origComments[0]->getStartTokenPos() : $itemStartPos; + \assert($commentStartPos >= 0); + + if ($commentStartPos < $pos) { + // Comments may be assigned to multiple nodes if they start at the same position. + // Make sure we don't try to print them multiple times. + $commentStartPos = $itemStartPos; + } + + if ($skipRemovedNode) { + if ($isStmtList && $this->origTokens->haveBracesInRange($pos, $itemStartPos)) { + // We'd remove the brace of a code block. + // TODO: Preserve formatting. + $this->setIndentLevel($origIndentLevel); + return null; + } + } else { + $result .= $this->origTokens->getTokenCode( + $pos, $commentStartPos, $indentAdjustment); + } + + if (!empty($delayedAdd)) { + /** @var Node $delayedAddNode */ + foreach ($delayedAdd as $delayedAddNode) { + if ($insertNewline) { + $delayedAddComments = $delayedAddNode->getComments(); + if ($delayedAddComments) { + $result .= $this->pComments($delayedAddComments) . $this->nl; + } + } + + $this->safeAppend($result, $this->p($delayedAddNode, true)); + + if ($insertNewline) { + $result .= $insertStr . $this->nl; + } else { + $result .= $insertStr; + } + } + + $delayedAdd = []; + } + + if ($comments !== $origComments) { + if ($comments) { + $result .= $this->pComments($comments) . $this->nl; + } + } else { + $result .= $this->origTokens->getTokenCode( + $commentStartPos, $itemStartPos, $indentAdjustment); + } + + // If we had to remove anything, we have done so now. + $skipRemovedNode = false; + } elseif ($diffType === DiffElem::TYPE_ADD) { + if (null === $insertStr) { + // We don't have insertion information for this list type + return null; + } + + // We go multiline if the original code was multiline, + // or if it's an array item with a comment above it. + if ($insertStr === ', ' && + ($this->isMultiline($origNodes) || $arrItem->getComments()) + ) { + $insertStr = ','; + $insertNewline = true; + } + + if ($beforeFirstKeepOrReplace) { + // Will be inserted at the next "replace" or "keep" element + $delayedAdd[] = $arrItem; + continue; + } + + $itemStartPos = $pos; + $itemEndPos = $pos - 1; + + $origIndentLevel = $this->indentLevel; + $this->setIndentLevel($lastElemIndentLevel); + + if ($insertNewline) { + $result .= $insertStr . $this->nl; + $comments = $arrItem->getComments(); + if ($comments) { + $result .= $this->pComments($comments) . $this->nl; + } + } else { + $result .= $insertStr; + } + } elseif ($diffType === DiffElem::TYPE_REMOVE) { + if (!$origArrItem instanceof Node) { + // We only support removal for nodes + return null; + } + + $itemStartPos = $origArrItem->getStartTokenPos(); + $itemEndPos = $origArrItem->getEndTokenPos(); + \assert($itemStartPos >= 0 && $itemEndPos >= 0); + + // Consider comments part of the node. + $origComments = $origArrItem->getComments(); + if ($origComments) { + $itemStartPos = $origComments[0]->getStartTokenPos(); + } + + if ($i === 0) { + // If we're removing from the start, keep the tokens before the node and drop those after it, + // instead of the other way around. + $result .= $this->origTokens->getTokenCode( + $pos, $itemStartPos, $indentAdjustment); + $skipRemovedNode = true; + } else { + if ($isStmtList && $this->origTokens->haveBracesInRange($pos, $itemStartPos)) { + // We'd remove the brace of a code block. + // TODO: Preserve formatting. + return null; + } + } + + $pos = $itemEndPos + 1; + continue; + } else { + throw new \Exception("Shouldn't happen"); + } + + if (null !== $fixup && $arrItem->getAttribute('origNode') !== $origArrItem) { + $res = $this->pFixup($fixup, $arrItem, null, $itemStartPos, $itemEndPos); + } else { + $res = $this->p($arrItem, true); + } + $this->safeAppend($result, $res); + + $this->setIndentLevel($origIndentLevel); + $pos = $itemEndPos + 1; + } + + if ($skipRemovedNode) { + // TODO: Support removing single node. + return null; + } + + if (!empty($delayedAdd)) { + if (!isset($this->emptyListInsertionMap[$mapKey])) { + return null; + } + + list($findToken, $extraLeft, $extraRight) = $this->emptyListInsertionMap[$mapKey]; + if (null !== $findToken) { + $insertPos = $this->origTokens->findRight($pos, $findToken) + 1; + $result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment); + $pos = $insertPos; + } + + $first = true; + $result .= $extraLeft; + foreach ($delayedAdd as $delayedAddNode) { + if (!$first) { + $result .= $insertStr; + } + $result .= $this->p($delayedAddNode, true); + $first = false; + } + $result .= $extraRight; + } + + return $result; + } + + /** + * Print node with fixups. + * + * Fixups here refer to the addition of extra parentheses, braces or other characters, that + * are required to preserve program semantics in a certain context (e.g. to maintain precedence + * or because only certain expressions are allowed in certain places). + * + * @param int $fixup Fixup type + * @param Node $subNode Subnode to print + * @param string|null $parentClass Class of parent node + * @param int $subStartPos Original start pos of subnode + * @param int $subEndPos Original end pos of subnode + * + * @return string Result of fixed-up print of subnode + */ + protected function pFixup(int $fixup, Node $subNode, $parentClass, int $subStartPos, int $subEndPos) : string { + switch ($fixup) { + case self::FIXUP_PREC_LEFT: + case self::FIXUP_PREC_RIGHT: + if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { + list($precedence, $associativity) = $this->precedenceMap[$parentClass]; + return $this->pPrec($subNode, $precedence, $associativity, + $fixup === self::FIXUP_PREC_LEFT ? -1 : 1); + } + break; + case self::FIXUP_CALL_LHS: + if ($this->callLhsRequiresParens($subNode) + && !$this->origTokens->haveParens($subStartPos, $subEndPos) + ) { + return '(' . $this->p($subNode) . ')'; + } + break; + case self::FIXUP_DEREF_LHS: + if ($this->dereferenceLhsRequiresParens($subNode) + && !$this->origTokens->haveParens($subStartPos, $subEndPos) + ) { + return '(' . $this->p($subNode) . ')'; + } + break; + case self::FIXUP_BRACED_NAME: + case self::FIXUP_VAR_BRACED_NAME: + if ($subNode instanceof Expr + && !$this->origTokens->haveBraces($subStartPos, $subEndPos) + ) { + return ($fixup === self::FIXUP_VAR_BRACED_NAME ? '$' : '') + . '{' . $this->p($subNode) . '}'; + } + break; + case self::FIXUP_ENCAPSED: + if (!$subNode instanceof Scalar\EncapsedStringPart + && !$this->origTokens->haveBraces($subStartPos, $subEndPos) + ) { + return '{' . $this->p($subNode) . '}'; + } + break; + default: + throw new \Exception('Cannot happen'); + } + + // Nothing special to do + return $this->p($subNode); + } + + /** + * Appends to a string, ensuring whitespace between label characters. + * + * Example: "echo" and "$x" result in "echo$x", but "echo" and "x" result in "echo x". + * Without safeAppend the result would be "echox", which does not preserve semantics. + * + * @param string $str + * @param string $append + */ + protected function safeAppend(string &$str, string $append) { + if ($str === "") { + $str = $append; + return; + } + + if ($append === "") { + return; + } + + if (!$this->labelCharMap[$append[0]] + || !$this->labelCharMap[$str[\strlen($str) - 1]]) { + $str .= $append; + } else { + $str .= " " . $append; + } + } + + /** + * Determines whether the LHS of a call must be wrapped in parenthesis. + * + * @param Node $node LHS of a call + * + * @return bool Whether parentheses are required + */ + protected function callLhsRequiresParens(Node $node) : bool { + return !($node instanceof Node\Name + || $node instanceof Expr\Variable + || $node instanceof Expr\ArrayDimFetch + || $node instanceof Expr\FuncCall + || $node instanceof Expr\MethodCall + || $node instanceof Expr\NullsafeMethodCall + || $node instanceof Expr\StaticCall + || $node instanceof Expr\Array_); + } + + /** + * Determines whether the LHS of a dereferencing operation must be wrapped in parenthesis. + * + * @param Node $node LHS of dereferencing operation + * + * @return bool Whether parentheses are required + */ + protected function dereferenceLhsRequiresParens(Node $node) : bool { + return !($node instanceof Expr\Variable + || $node instanceof Node\Name + || $node instanceof Expr\ArrayDimFetch + || $node instanceof Expr\PropertyFetch + || $node instanceof Expr\NullsafePropertyFetch + || $node instanceof Expr\StaticPropertyFetch + || $node instanceof Expr\FuncCall + || $node instanceof Expr\MethodCall + || $node instanceof Expr\NullsafeMethodCall + || $node instanceof Expr\StaticCall + || $node instanceof Expr\Array_ + || $node instanceof Scalar\String_ + || $node instanceof Expr\ConstFetch + || $node instanceof Expr\ClassConstFetch); + } + + /** + * Print modifiers, including trailing whitespace. + * + * @param int $modifiers Modifier mask to print + * + * @return string Printed modifiers + */ + protected function pModifiers(int $modifiers) { + return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') + . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '') + . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '') + . ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '') + . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '') + . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : '') + . ($modifiers & Stmt\Class_::MODIFIER_READONLY ? 'readonly ' : ''); + } + + /** + * Determine whether a list of nodes uses multiline formatting. + * + * @param (Node|null)[] $nodes Node list + * + * @return bool Whether multiline formatting is used + */ + protected function isMultiline(array $nodes) : bool { + if (\count($nodes) < 2) { + return false; + } + + $pos = -1; + foreach ($nodes as $node) { + if (null === $node) { + continue; + } + + $endPos = $node->getEndTokenPos() + 1; + if ($pos >= 0) { + $text = $this->origTokens->getTokenCode($pos, $endPos, 0); + if (false === strpos($text, "\n")) { + // We require that a newline is present between *every* item. If the formatting + // is inconsistent, with only some items having newlines, we don't consider it + // as multiline + return false; + } + } + $pos = $endPos; + } + + return true; + } + + /** + * Lazily initializes label char map. + * + * The label char map determines whether a certain character may occur in a label. + */ + protected function initializeLabelCharMap() { + if ($this->labelCharMap) return; + + $this->labelCharMap = []; + for ($i = 0; $i < 256; $i++) { + // Since PHP 7.1 The lower range is 0x80. However, we also want to support code for + // older versions. + $chr = chr($i); + $this->labelCharMap[$chr] = $i >= 0x7f || ctype_alnum($chr); + } + } + + /** + * Lazily initializes node list differ. + * + * The node list differ is used to determine differences between two array subnodes. + */ + protected function initializeNodeListDiffer() { + if ($this->nodeListDiffer) return; + + $this->nodeListDiffer = new Internal\Differ(function ($a, $b) { + if ($a instanceof Node && $b instanceof Node) { + return $a === $b->getAttribute('origNode'); + } + // Can happen for array destructuring + return $a === null && $b === null; + }); + } + + /** + * Lazily initializes fixup map. + * + * The fixup map is used to determine whether a certain subnode of a certain node may require + * some kind of "fixup" operation, e.g. the addition of parenthesis or braces. + */ + protected function initializeFixupMap() { + if ($this->fixupMap) return; + + $this->fixupMap = [ + Expr\PreInc::class => ['var' => self::FIXUP_PREC_RIGHT], + Expr\PreDec::class => ['var' => self::FIXUP_PREC_RIGHT], + Expr\PostInc::class => ['var' => self::FIXUP_PREC_LEFT], + Expr\PostDec::class => ['var' => self::FIXUP_PREC_LEFT], + Expr\Instanceof_::class => [ + 'expr' => self::FIXUP_PREC_LEFT, + 'class' => self::FIXUP_PREC_RIGHT, // TODO: FIXUP_NEW_VARIABLE + ], + Expr\Ternary::class => [ + 'cond' => self::FIXUP_PREC_LEFT, + 'else' => self::FIXUP_PREC_RIGHT, + ], + + Expr\FuncCall::class => ['name' => self::FIXUP_CALL_LHS], + Expr\StaticCall::class => ['class' => self::FIXUP_DEREF_LHS], + Expr\ArrayDimFetch::class => ['var' => self::FIXUP_DEREF_LHS], + Expr\ClassConstFetch::class => ['var' => self::FIXUP_DEREF_LHS], + Expr\New_::class => ['class' => self::FIXUP_DEREF_LHS], // TODO: FIXUP_NEW_VARIABLE + Expr\MethodCall::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Expr\NullsafeMethodCall::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Expr\StaticPropertyFetch::class => [ + 'class' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_VAR_BRACED_NAME, + ], + Expr\PropertyFetch::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Expr\NullsafePropertyFetch::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Scalar\Encapsed::class => [ + 'parts' => self::FIXUP_ENCAPSED, + ], + ]; + + $binaryOps = [ + BinaryOp\Pow::class, BinaryOp\Mul::class, BinaryOp\Div::class, BinaryOp\Mod::class, + BinaryOp\Plus::class, BinaryOp\Minus::class, BinaryOp\Concat::class, + BinaryOp\ShiftLeft::class, BinaryOp\ShiftRight::class, BinaryOp\Smaller::class, + BinaryOp\SmallerOrEqual::class, BinaryOp\Greater::class, BinaryOp\GreaterOrEqual::class, + BinaryOp\Equal::class, BinaryOp\NotEqual::class, BinaryOp\Identical::class, + BinaryOp\NotIdentical::class, BinaryOp\Spaceship::class, BinaryOp\BitwiseAnd::class, + BinaryOp\BitwiseXor::class, BinaryOp\BitwiseOr::class, BinaryOp\BooleanAnd::class, + BinaryOp\BooleanOr::class, BinaryOp\Coalesce::class, BinaryOp\LogicalAnd::class, + BinaryOp\LogicalXor::class, BinaryOp\LogicalOr::class, + ]; + foreach ($binaryOps as $binaryOp) { + $this->fixupMap[$binaryOp] = [ + 'left' => self::FIXUP_PREC_LEFT, + 'right' => self::FIXUP_PREC_RIGHT + ]; + } + + $assignOps = [ + Expr\Assign::class, Expr\AssignRef::class, AssignOp\Plus::class, AssignOp\Minus::class, + AssignOp\Mul::class, AssignOp\Div::class, AssignOp\Concat::class, AssignOp\Mod::class, + AssignOp\BitwiseAnd::class, AssignOp\BitwiseOr::class, AssignOp\BitwiseXor::class, + AssignOp\ShiftLeft::class, AssignOp\ShiftRight::class, AssignOp\Pow::class, AssignOp\Coalesce::class + ]; + foreach ($assignOps as $assignOp) { + $this->fixupMap[$assignOp] = [ + 'var' => self::FIXUP_PREC_LEFT, + 'expr' => self::FIXUP_PREC_RIGHT, + ]; + } + + $prefixOps = [ + Expr\BitwiseNot::class, Expr\BooleanNot::class, Expr\UnaryPlus::class, Expr\UnaryMinus::class, + Cast\Int_::class, Cast\Double::class, Cast\String_::class, Cast\Array_::class, + Cast\Object_::class, Cast\Bool_::class, Cast\Unset_::class, Expr\ErrorSuppress::class, + Expr\YieldFrom::class, Expr\Print_::class, Expr\Include_::class, + ]; + foreach ($prefixOps as $prefixOp) { + $this->fixupMap[$prefixOp] = ['expr' => self::FIXUP_PREC_RIGHT]; + } + } + + /** + * Lazily initializes the removal map. + * + * The removal map is used to determine which additional tokens should be removed when a + * certain node is replaced by null. + */ + protected function initializeRemovalMap() { + if ($this->removalMap) return; + + $stripBoth = ['left' => \T_WHITESPACE, 'right' => \T_WHITESPACE]; + $stripLeft = ['left' => \T_WHITESPACE]; + $stripRight = ['right' => \T_WHITESPACE]; + $stripDoubleArrow = ['right' => \T_DOUBLE_ARROW]; + $stripColon = ['left' => ':']; + $stripEquals = ['left' => '=']; + $this->removalMap = [ + 'Expr_ArrayDimFetch->dim' => $stripBoth, + 'Expr_ArrayItem->key' => $stripDoubleArrow, + 'Expr_ArrowFunction->returnType' => $stripColon, + 'Expr_Closure->returnType' => $stripColon, + 'Expr_Exit->expr' => $stripBoth, + 'Expr_Ternary->if' => $stripBoth, + 'Expr_Yield->key' => $stripDoubleArrow, + 'Expr_Yield->value' => $stripBoth, + 'Param->type' => $stripRight, + 'Param->default' => $stripEquals, + 'Stmt_Break->num' => $stripBoth, + 'Stmt_Catch->var' => $stripLeft, + 'Stmt_ClassMethod->returnType' => $stripColon, + 'Stmt_Class->extends' => ['left' => \T_EXTENDS], + 'Stmt_Enum->scalarType' => $stripColon, + 'Stmt_EnumCase->expr' => $stripEquals, + 'Expr_PrintableNewAnonClass->extends' => ['left' => \T_EXTENDS], + 'Stmt_Continue->num' => $stripBoth, + 'Stmt_Foreach->keyVar' => $stripDoubleArrow, + 'Stmt_Function->returnType' => $stripColon, + 'Stmt_If->else' => $stripLeft, + 'Stmt_Namespace->name' => $stripLeft, + 'Stmt_Property->type' => $stripRight, + 'Stmt_PropertyProperty->default' => $stripEquals, + 'Stmt_Return->expr' => $stripBoth, + 'Stmt_StaticVar->default' => $stripEquals, + 'Stmt_TraitUseAdaptation_Alias->newName' => $stripLeft, + 'Stmt_TryCatch->finally' => $stripLeft, + // 'Stmt_Case->cond': Replace with "default" + // 'Stmt_Class->name': Unclear what to do + // 'Stmt_Declare->stmts': Not a plain node + // 'Stmt_TraitUseAdaptation_Alias->newModifier': Not a plain node + ]; + } + + protected function initializeInsertionMap() { + if ($this->insertionMap) return; + + // TODO: "yield" where both key and value are inserted doesn't work + // [$find, $beforeToken, $extraLeft, $extraRight] + $this->insertionMap = [ + 'Expr_ArrayDimFetch->dim' => ['[', false, null, null], + 'Expr_ArrayItem->key' => [null, false, null, ' => '], + 'Expr_ArrowFunction->returnType' => [')', false, ' : ', null], + 'Expr_Closure->returnType' => [')', false, ' : ', null], + 'Expr_Ternary->if' => ['?', false, ' ', ' '], + 'Expr_Yield->key' => [\T_YIELD, false, null, ' => '], + 'Expr_Yield->value' => [\T_YIELD, false, ' ', null], + 'Param->type' => [null, false, null, ' '], + 'Param->default' => [null, false, ' = ', null], + 'Stmt_Break->num' => [\T_BREAK, false, ' ', null], + 'Stmt_Catch->var' => [null, false, ' ', null], + 'Stmt_ClassMethod->returnType' => [')', false, ' : ', null], + 'Stmt_Class->extends' => [null, false, ' extends ', null], + 'Stmt_Enum->scalarType' => [null, false, ' : ', null], + 'Stmt_EnumCase->expr' => [null, false, ' = ', null], + 'Expr_PrintableNewAnonClass->extends' => [null, ' extends ', null], + 'Stmt_Continue->num' => [\T_CONTINUE, false, ' ', null], + 'Stmt_Foreach->keyVar' => [\T_AS, false, null, ' => '], + 'Stmt_Function->returnType' => [')', false, ' : ', null], + 'Stmt_If->else' => [null, false, ' ', null], + 'Stmt_Namespace->name' => [\T_NAMESPACE, false, ' ', null], + 'Stmt_Property->type' => [\T_VARIABLE, true, null, ' '], + 'Stmt_PropertyProperty->default' => [null, false, ' = ', null], + 'Stmt_Return->expr' => [\T_RETURN, false, ' ', null], + 'Stmt_StaticVar->default' => [null, false, ' = ', null], + //'Stmt_TraitUseAdaptation_Alias->newName' => [T_AS, false, ' ', null], // TODO + 'Stmt_TryCatch->finally' => [null, false, ' ', null], + + // 'Expr_Exit->expr': Complicated due to optional () + // 'Stmt_Case->cond': Conversion from default to case + // 'Stmt_Class->name': Unclear + // 'Stmt_Declare->stmts': Not a proper node + // 'Stmt_TraitUseAdaptation_Alias->newModifier': Not a proper node + ]; + } + + protected function initializeListInsertionMap() { + if ($this->listInsertionMap) return; + + $this->listInsertionMap = [ + // special + //'Expr_ShellExec->parts' => '', // TODO These need to be treated more carefully + //'Scalar_Encapsed->parts' => '', + 'Stmt_Catch->types' => '|', + 'UnionType->types' => '|', + 'IntersectionType->types' => '&', + 'Stmt_If->elseifs' => ' ', + 'Stmt_TryCatch->catches' => ' ', + + // comma-separated lists + 'Expr_Array->items' => ', ', + 'Expr_ArrowFunction->params' => ', ', + 'Expr_Closure->params' => ', ', + 'Expr_Closure->uses' => ', ', + 'Expr_FuncCall->args' => ', ', + 'Expr_Isset->vars' => ', ', + 'Expr_List->items' => ', ', + 'Expr_MethodCall->args' => ', ', + 'Expr_NullsafeMethodCall->args' => ', ', + 'Expr_New->args' => ', ', + 'Expr_PrintableNewAnonClass->args' => ', ', + 'Expr_StaticCall->args' => ', ', + 'Stmt_ClassConst->consts' => ', ', + 'Stmt_ClassMethod->params' => ', ', + 'Stmt_Class->implements' => ', ', + 'Stmt_Enum->implements' => ', ', + 'Expr_PrintableNewAnonClass->implements' => ', ', + 'Stmt_Const->consts' => ', ', + 'Stmt_Declare->declares' => ', ', + 'Stmt_Echo->exprs' => ', ', + 'Stmt_For->init' => ', ', + 'Stmt_For->cond' => ', ', + 'Stmt_For->loop' => ', ', + 'Stmt_Function->params' => ', ', + 'Stmt_Global->vars' => ', ', + 'Stmt_GroupUse->uses' => ', ', + 'Stmt_Interface->extends' => ', ', + 'Stmt_Match->arms' => ', ', + 'Stmt_Property->props' => ', ', + 'Stmt_StaticVar->vars' => ', ', + 'Stmt_TraitUse->traits' => ', ', + 'Stmt_TraitUseAdaptation_Precedence->insteadof' => ', ', + 'Stmt_Unset->vars' => ', ', + 'Stmt_Use->uses' => ', ', + 'MatchArm->conds' => ', ', + 'AttributeGroup->attrs' => ', ', + + // statement lists + 'Expr_Closure->stmts' => "\n", + 'Stmt_Case->stmts' => "\n", + 'Stmt_Catch->stmts' => "\n", + 'Stmt_Class->stmts' => "\n", + 'Stmt_Enum->stmts' => "\n", + 'Expr_PrintableNewAnonClass->stmts' => "\n", + 'Stmt_Interface->stmts' => "\n", + 'Stmt_Trait->stmts' => "\n", + 'Stmt_ClassMethod->stmts' => "\n", + 'Stmt_Declare->stmts' => "\n", + 'Stmt_Do->stmts' => "\n", + 'Stmt_ElseIf->stmts' => "\n", + 'Stmt_Else->stmts' => "\n", + 'Stmt_Finally->stmts' => "\n", + 'Stmt_Foreach->stmts' => "\n", + 'Stmt_For->stmts' => "\n", + 'Stmt_Function->stmts' => "\n", + 'Stmt_If->stmts' => "\n", + 'Stmt_Namespace->stmts' => "\n", + 'Stmt_Class->attrGroups' => "\n", + 'Stmt_Enum->attrGroups' => "\n", + 'Stmt_EnumCase->attrGroups' => "\n", + 'Stmt_Interface->attrGroups' => "\n", + 'Stmt_Trait->attrGroups' => "\n", + 'Stmt_Function->attrGroups' => "\n", + 'Stmt_ClassMethod->attrGroups' => "\n", + 'Stmt_ClassConst->attrGroups' => "\n", + 'Stmt_Property->attrGroups' => "\n", + 'Expr_PrintableNewAnonClass->attrGroups' => ' ', + 'Expr_Closure->attrGroups' => ' ', + 'Expr_ArrowFunction->attrGroups' => ' ', + 'Param->attrGroups' => ' ', + 'Stmt_Switch->cases' => "\n", + 'Stmt_TraitUse->adaptations' => "\n", + 'Stmt_TryCatch->stmts' => "\n", + 'Stmt_While->stmts' => "\n", + + // dummy for top-level context + 'File->stmts' => "\n", + ]; + } + + protected function initializeEmptyListInsertionMap() { + if ($this->emptyListInsertionMap) return; + + // TODO Insertion into empty statement lists. + + // [$find, $extraLeft, $extraRight] + $this->emptyListInsertionMap = [ + 'Expr_ArrowFunction->params' => ['(', '', ''], + 'Expr_Closure->uses' => [')', ' use(', ')'], + 'Expr_Closure->params' => ['(', '', ''], + 'Expr_FuncCall->args' => ['(', '', ''], + 'Expr_MethodCall->args' => ['(', '', ''], + 'Expr_NullsafeMethodCall->args' => ['(', '', ''], + 'Expr_New->args' => ['(', '', ''], + 'Expr_PrintableNewAnonClass->args' => ['(', '', ''], + 'Expr_PrintableNewAnonClass->implements' => [null, ' implements ', ''], + 'Expr_StaticCall->args' => ['(', '', ''], + 'Stmt_Class->implements' => [null, ' implements ', ''], + 'Stmt_Enum->implements' => [null, ' implements ', ''], + 'Stmt_ClassMethod->params' => ['(', '', ''], + 'Stmt_Interface->extends' => [null, ' extends ', ''], + 'Stmt_Function->params' => ['(', '', ''], + + /* These cannot be empty to start with: + * Expr_Isset->vars + * Stmt_Catch->types + * Stmt_Const->consts + * Stmt_ClassConst->consts + * Stmt_Declare->declares + * Stmt_Echo->exprs + * Stmt_Global->vars + * Stmt_GroupUse->uses + * Stmt_Property->props + * Stmt_StaticVar->vars + * Stmt_TraitUse->traits + * Stmt_TraitUseAdaptation_Precedence->insteadof + * Stmt_Unset->vars + * Stmt_Use->uses + * UnionType->types + */ + + /* TODO + * Stmt_If->elseifs + * Stmt_TryCatch->catches + * Expr_Array->items + * Expr_List->items + * Stmt_For->init + * Stmt_For->cond + * Stmt_For->loop + */ + ]; + } + + protected function initializeModifierChangeMap() { + if ($this->modifierChangeMap) return; + + $this->modifierChangeMap = [ + 'Stmt_ClassConst->flags' => \T_CONST, + 'Stmt_ClassMethod->flags' => \T_FUNCTION, + 'Stmt_Class->flags' => \T_CLASS, + 'Stmt_Property->flags' => \T_VARIABLE, + 'Param->flags' => \T_VARIABLE, + //'Stmt_TraitUseAdaptation_Alias->newModifier' => 0, // TODO + ]; + + // List of integer subnodes that are not modifiers: + // Expr_Include->type + // Stmt_GroupUse->type + // Stmt_Use->type + // Stmt_UseUse->type } } diff --git a/lib/nikic/php-parser/lib/PhpParser/Serializer.php b/lib/nikic/php-parser/lib/PhpParser/Serializer.php deleted file mode 100644 index 1dd790666..000000000 --- a/lib/nikic/php-parser/lib/PhpParser/Serializer.php +++ /dev/null @@ -1,18 +0,0 @@ -writer = new XMLWriter; - $this->writer->openMemory(); - $this->writer->setIndent(true); - } - - public function serialize(array $nodes) { - $this->writer->flush(); - $this->writer->startDocument('1.0', 'UTF-8'); - - $this->writer->startElement('AST'); - $this->writer->writeAttribute('xmlns:node', 'http://nikic.github.com/PHPParser/XML/node'); - $this->writer->writeAttribute('xmlns:subNode', 'http://nikic.github.com/PHPParser/XML/subNode'); - $this->writer->writeAttribute('xmlns:attribute', 'http://nikic.github.com/PHPParser/XML/attribute'); - $this->writer->writeAttribute('xmlns:scalar', 'http://nikic.github.com/PHPParser/XML/scalar'); - - $this->_serialize($nodes); - - $this->writer->endElement(); - - return $this->writer->outputMemory(); - } - - protected function _serialize($node) { - if ($node instanceof Node) { - $this->writer->startElement('node:' . $node->getType()); - - foreach ($node->getAttributes() as $name => $value) { - $this->writer->startElement('attribute:' . $name); - $this->_serialize($value); - $this->writer->endElement(); - } - - foreach ($node as $name => $subNode) { - $this->writer->startElement('subNode:' . $name); - $this->_serialize($subNode); - $this->writer->endElement(); - } - - $this->writer->endElement(); - } elseif ($node instanceof Comment) { - $this->writer->startElement('comment'); - $this->writer->writeAttribute('isDocComment', $node instanceof Comment\Doc ? 'true' : 'false'); - $this->writer->writeAttribute('line', (string) $node->getLine()); - $this->writer->text($node->getText()); - $this->writer->endElement(); - } elseif (is_array($node)) { - $this->writer->startElement('scalar:array'); - foreach ($node as $subNode) { - $this->_serialize($subNode); - } - $this->writer->endElement(); - } elseif (is_string($node)) { - $this->writer->writeElement('scalar:string', $node); - } elseif (is_int($node)) { - $this->writer->writeElement('scalar:int', (string) $node); - } elseif (is_float($node)) { - // TODO Higher precision conversion? - $this->writer->writeElement('scalar:float', (string) $node); - } elseif (true === $node) { - $this->writer->writeElement('scalar:true'); - } elseif (false === $node) { - $this->writer->writeElement('scalar:false'); - } elseif (null === $node) { - $this->writer->writeElement('scalar:null'); - } else { - throw new \InvalidArgumentException('Unexpected node type'); - } - } -} diff --git a/lib/nikic/php-parser/lib/PhpParser/Unserializer.php b/lib/nikic/php-parser/lib/PhpParser/Unserializer.php deleted file mode 100644 index 9c221a141..000000000 --- a/lib/nikic/php-parser/lib/PhpParser/Unserializer.php +++ /dev/null @@ -1,18 +0,0 @@ -reader = new XMLReader; - } - - public function unserialize($string) { - $this->reader->XML($string); - - $this->reader->read(); - if ('AST' !== $this->reader->name) { - throw new DomainException('AST root element not found'); - } - - return $this->read($this->reader->depth); - } - - protected function read($depthLimit, $throw = true, &$nodeFound = null) { - $nodeFound = true; - while ($this->reader->read() && $depthLimit < $this->reader->depth) { - if (XMLReader::ELEMENT !== $this->reader->nodeType) { - continue; - } - - if ('node' === $this->reader->prefix) { - return $this->readNode(); - } elseif ('scalar' === $this->reader->prefix) { - return $this->readScalar(); - } elseif ('comment' === $this->reader->name) { - return $this->readComment(); - } else { - throw new DomainException(sprintf('Unexpected node of type "%s"', $this->reader->name)); - } - } - - $nodeFound = false; - if ($throw) { - throw new DomainException('Expected node or scalar'); - } - } - - protected function readNode() { - $className = $this->getClassNameFromType($this->reader->localName); - - // create the node without calling it's constructor - $node = unserialize( - sprintf( - "O:%d:\"%s\":1:{s:13:\"\0*\0attributes\";a:0:{}}", - strlen($className), $className - ) - ); - - $depthLimit = $this->reader->depth; - while ($this->reader->read() && $depthLimit < $this->reader->depth) { - if (XMLReader::ELEMENT !== $this->reader->nodeType) { - continue; - } - - $type = $this->reader->prefix; - if ('subNode' !== $type && 'attribute' !== $type) { - throw new DomainException( - sprintf('Expected sub node or attribute, got node of type "%s"', $this->reader->name) - ); - } - - $name = $this->reader->localName; - $value = $this->read($this->reader->depth); - - if ('subNode' === $type) { - $node->$name = $value; - } else { - $node->setAttribute($name, $value); - } - } - - return $node; - } - - protected function readScalar() { - switch ($name = $this->reader->localName) { - case 'array': - $depth = $this->reader->depth; - $array = array(); - while (true) { - $node = $this->read($depth, false, $nodeFound); - if (!$nodeFound) { - break; - } - $array[] = $node; - } - return $array; - case 'string': - return $this->reader->readString(); - case 'int': - return $this->parseInt($this->reader->readString()); - case 'float': - $text = $this->reader->readString(); - if (false === $float = filter_var($text, FILTER_VALIDATE_FLOAT)) { - throw new DomainException(sprintf('"%s" is not a valid float', $text)); - } - return $float; - case 'true': - case 'false': - case 'null': - if (!$this->reader->isEmptyElement) { - throw new DomainException(sprintf('"%s" scalar must be empty', $name)); - } - return constant($name); - default: - throw new DomainException(sprintf('Unknown scalar type "%s"', $name)); - } - } - - private function parseInt($text) { - if (false === $int = filter_var($text, FILTER_VALIDATE_INT)) { - throw new DomainException(sprintf('"%s" is not a valid integer', $text)); - } - return $int; - } - - protected function readComment() { - $className = $this->reader->getAttribute('isDocComment') === 'true' - ? 'PhpParser\Comment\Doc' - : 'PhpParser\Comment' - ; - return new $className( - $this->reader->readString(), - $this->parseInt($this->reader->getAttribute('line')) - ); - } - - protected function getClassNameFromType($type) { - $className = 'PhpParser\\Node\\' . strtr($type, '_', '\\'); - if (!class_exists($className)) { - $className .= '_'; - } - if (!class_exists($className)) { - throw new DomainException(sprintf('Unknown node type "%s"', $type)); - } - return $className; - } -} diff --git a/lib/nikic/php-parser/lib/bootstrap.php b/lib/nikic/php-parser/lib/bootstrap.php deleted file mode 100644 index b0f517822..000000000 --- a/lib/nikic/php-parser/lib/bootstrap.php +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - ./test/ - - - - - - ./lib/PhpParser/ - - - diff --git a/lib/nikic/php-parser/test_old/run-php-src.sh b/lib/nikic/php-parser/test_old/run-php-src.sh deleted file mode 100755 index 0d37f851d..000000000 --- a/lib/nikic/php-parser/test_old/run-php-src.sh +++ /dev/null @@ -1,4 +0,0 @@ -wget -q https://github.com/php/php-src/archive/php-7.1.0.tar.gz -mkdir -p ./data/php-src -tar -xzf ./php-7.1.0.tar.gz -C ./data/php-src --strip-components=1 -php -n test_old/run.php --verbose --no-progress PHP7 ./data/php-src diff --git a/lib/nikic/php-parser/test_old/run.php b/lib/nikic/php-parser/test_old/run.php deleted file mode 100644 index bc14d893a..000000000 --- a/lib/nikic/php-parser/test_old/run.php +++ /dev/null @@ -1,220 +0,0 @@ -parse($code); - $parseTime += microtime(true) - $startTime; - - $startTime = microtime(true); - $code = 'prettyPrint($stmts); - $ppTime += microtime(true) - $startTime; - - try { - $startTime = microtime(true); - $ppStmts = $parser->parse($code); - $reparseTime += microtime(true) - $startTime; - - $startTime = microtime(true); - $same = $nodeDumper->dump($stmts) == $nodeDumper->dump($ppStmts); - $compareTime += microtime(true) - $startTime; - - if (!$same) { - echo $file, ":\n Result of initial parse and parse after pretty print differ\n"; - if ($verbose) { - echo "Pretty printer output:\n=====\n$code\n=====\n\n"; - } - - ++$compareFail; - } - } catch (PhpParser\Error $e) { - echo $file, ":\n Parse of pretty print failed with message: {$e->getMessage()}\n"; - if ($verbose) { - echo "Pretty printer output:\n=====\n$code\n=====\n\n"; - } - - ++$ppFail; - } - } catch (PhpParser\Error $e) { - echo $file, ":\n Parse failed with message: {$e->getMessage()}\n"; - - ++$parseFail; - } -} - -if (0 === $parseFail && 0 === $ppFail && 0 === $compareFail) { - $exit = 0; - echo "\n\n", 'All tests passed.', "\n"; -} else { - $exit = 1; - echo "\n\n", '==========', "\n\n", 'There were: ', "\n"; - if (0 !== $parseFail) { - echo ' ', $parseFail, ' parse failures.', "\n"; - } - if (0 !== $ppFail) { - echo ' ', $ppFail, ' pretty print failures.', "\n"; - } - if (0 !== $compareFail) { - echo ' ', $compareFail, ' compare failures.', "\n"; - } -} - -echo "\n", - 'Tested files: ', $count, "\n", - "\n", - 'Reading files took: ', $readTime, "\n", - 'Parsing took: ', $parseTime, "\n", - 'Pretty printing took: ', $ppTime, "\n", - 'Reparsing took: ', $reparseTime, "\n", - 'Comparing took: ', $compareTime, "\n", - "\n", - 'Total time: ', microtime(true) - $totalStartTime, "\n", - 'Maximum memory usage: ', memory_get_peak_usage(true), "\n"; - -exit($exit); From f4c7afc14818dd9c6752f6cc9379467da2fb3916 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 14:31:48 +0200 Subject: [PATCH 06/15] =?UTF-8?q?N=C2=B04824=20Update=20consumers=20&=20te?= =?UTF-8?q?sts=20after=20nikic/php-parser=20update=20Was=20done=20in=203.0?= =?UTF-8?q?.0=20with=20N=C2=B03867=20(cherry=20picked=20from=20commit=20cd?= =?UTF-8?q?1ba097cb9f26c5f23dff8a91a4c378bf7862c6)=20(cherry=20picked=20fr?= =?UTF-8?q?om=20commit=205b42f67a998dc76f647d2ab0613f66defe5acb76)=20(cher?= =?UTF-8?q?ry=20picked=20from=20commit=202d98ca23180ec30e3e6db002536dd48a2?= =?UTF-8?q?1a23f52)=20(cherry=20picked=20from=20commit=20ddc5bbd1bbd197fe8?= =?UTF-8?q?3f48b796388c3da488cdca0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/iTopConfigParser.php | 41 +- .../src/Validator/ConfigNodesVisitor.php | 2 + .../config-itop_KO_config_plus_code.php | 392 +++++++++++++++++ .../config-itop_KO_function.php | 7 + .../ConfigValidator/config-itop_VALID.php | 390 +++++++++++++++++ .../config-itop_VALID_log-level-min_const.php | 394 ++++++++++++++++++ .../iTopConfigAstValidatorTest.php | 69 +++ 7 files changed, 1281 insertions(+), 14 deletions(-) create mode 100644 test/core/ConfigValidator/config-itop_KO_config_plus_code.php create mode 100644 test/core/ConfigValidator/config-itop_KO_function.php create mode 100644 test/core/ConfigValidator/config-itop_VALID.php create mode 100644 test/core/ConfigValidator/config-itop_VALID_log-level-min_const.php create mode 100644 test/core/ConfigValidator/iTopConfigAstValidatorTest.php diff --git a/core/iTopConfigParser.php b/core/iTopConfigParser.php index 00b30864e..97327bca1 100644 --- a/core/iTopConfigParser.php +++ b/core/iTopConfigParser.php @@ -6,6 +6,8 @@ */ use PhpParser\Node\Expr\Assign; +use PhpParser\Node\Expr\Variable; +use PhpParser\Parser; use PhpParser\ParserFactory; use PhpParser\PrettyPrinter\Standard; @@ -80,38 +82,49 @@ class iTopConfigParser * @param \PhpParser\Parser $oParser * @param $sConfig * - * @return \Combodo\iTop\Config\Validator\ConfigNodesVisitor + * @return void */ - private function BrowseFile(\PhpParser\Parser $oParser, $sConfig) + private function BrowseFile(Parser $oParser, $sConfig) { $prettyPrinter = new Standard(); - try - { + try { $aNodes = $oParser->parse($sConfig); } - catch (\Error $e) - { + catch (\Error $e) { $sMessage = Dict::Format('config-parse-error', $e->getMessage(), $e->getLine()); $this->oException = new \Exception($sMessage, 0, $e); } - foreach ($aNodes as $oAssignation) - { - if (! $oAssignation instanceof Assign) - { + foreach ($aNodes as $sKey => $oNode) { + // With PhpParser 3 we had an Assign node at root + // In PhpParser 4 the root node is now an Expression + + if (false === ($oNode instanceof \PhpParser\Node\Stmt\Expression)) { + continue; + } + /** @var \PhpParser\Node\Stmt\Expression $oNode */ + + if (false === ($oNode->expr instanceof Assign)) { + continue; + } + /** @var Assign $oAssignation */ + $oAssignation = $oNode->expr; + + if (false === ($oAssignation->var instanceof Variable)) { + continue; + } + if (false === ($oAssignation->expr instanceof PhpParser\Node\Expr\Array_)) { continue; } $sCurrentRootVar = $oAssignation->var->name; - if (!array_key_exists($sCurrentRootVar, $this->aVarsMap)) - { + if (!array_key_exists($sCurrentRootVar, $this->aVarsMap)) { continue; } $aCurrentRootVarMap =& $this->aVarsMap[$sCurrentRootVar]; - foreach ($oAssignation->expr->items as $oItem) - { + foreach ($oAssignation->expr->items as $oItem) { $sValue = $prettyPrinter->prettyPrintExpr($oItem->value); $aCurrentRootVarMap[$oItem->key->value] = $sValue; } diff --git a/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php b/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php index 04493fac8..295a63ddf 100644 --- a/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php +++ b/datamodels/2.x/itop-config/src/Validator/ConfigNodesVisitor.php @@ -23,6 +23,7 @@ class ConfigNodesVisitor extends NodeVisitorAbstract Node\Name::class, Node\Const_::class, + Node\Identifier::class, Node\Expr\Array_::class, Node\Expr\ArrayDimFetch::class, @@ -44,6 +45,7 @@ class ConfigNodesVisitor extends NodeVisitorAbstract Node\Expr\PreDec::class, Node\Expr\PreInc::class, Node\Expr\Print_::class, + Node\Stmt\Expression::class, Node\Expr\Ternary::class, Node\Expr\UnaryMinus::class, Node\Expr\UnaryPlus::class, diff --git a/test/core/ConfigValidator/config-itop_KO_config_plus_code.php b/test/core/ConfigValidator/config-itop_KO_config_plus_code.php new file mode 100644 index 000000000..1db98d9f7 --- /dev/null +++ b/test/core/ConfigValidator/config-itop_KO_config_plus_code.php @@ -0,0 +1,392 @@ + 'iTop is temporarily frozen, please wait... (the admin team)', + + // access_mode: Access mode: ACCESS_READONLY = 0, ACCESS_ADMIN_WRITE = 2, ACCESS_FULL = 3 + // default: 3 + 'access_mode' => 3, + + // activity_panel.entry_form_opened_by_default: Whether or not the new entry form will be automatically opened when viewing an object. + // default: false + 'activity_panel.entry_form_opened_by_default' => false, + + // activity_panel.show_author_name_below_entries: Whether or not to show the author friendlyname next to the date on the last entry. + // default: false + 'activity_panel.show_author_name_below_entries' => false, + + 'allowed_login_types' => 'form|external|basic', + + // apc_cache.enabled: If set, the APC cache is allowed (the PHP extension must also be active) + // default: true + 'apc_cache.enabled' => true, + + // apc_cache.query_ttl: Time to live set in APC for the prepared queries (seconds - 0 means no timeout) + // default: 3600 + 'apc_cache.query_ttl' => 3600, + + // app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name) + // default: '' + 'app_root_url' => 'http://localhost/itop-dev/', + + // behind_reverse_proxy: If true, then proxies custom header (X-Forwarded-*) are taken into account. Use only if the webserver is not publicly accessible (reachable only by the reverse proxy) + // default: false + 'behind_reverse_proxy' => false, + + // cron_max_execution_time: Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout + // default: 600 + 'cron_max_execution_time' => 600, + + // csv_file_default_charset: Character set used by default for downloading and uploading data as a CSV file. Warning: it is case sensitive (uppercase is preferable). + // default: 'ISO-8859-1' + 'csv_file_default_charset' => 'ISO-8859-1', + + 'csv_import_charsets' => array(), + + // csv_import_history_display: Display the history tab in the import wizard + // default: false + 'csv_import_history_display' => false, + + // date_and_time_format: Format for date and time display (per language) + // default: array ( + // 'default' => + // array ( + // 'date' => 'Y-m-d', + // 'time' => 'H:i:s', + // 'date_time' => '$date $time', + // ), + // ) + 'date_and_time_format' => array( + 'default' => + array( + 'date' => 'Y-m-d', + 'time' => 'H:i:s', + 'date_time' => '$date $time', + ), + ), + + 'db_host' => 'localhost', + + 'db_name' => 'itop_dev', + + 'db_pwd' => '', + + 'db_subname' => '', + + 'db_user' => 'root', + + // deadline_format: The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$ + // default: '$difference$' + 'deadline_format' => '$difference$', + + 'default_language' => 'EN US', + + // email_asynchronous: If set, the emails are sent off line, which requires cron.php to be activated. Exception: some features like the email test utility will force the serialized mode + // default: false + 'email_asynchronous' => false, + + // email_default_sender_address: Default address provided in the email from header field. + // default: '' + 'email_default_sender_address' => '', + + // email_default_sender_label: Default label provided in the email from header field. + // default: '' + 'email_default_sender_label' => '', + + // email_transport: Mean to send emails: PHPMail (uses the function mail()) or SMTP (implements the client protocol) + // default: 'PHPMail' + 'email_transport' => 'PHPMail', + + // email_validation_pattern: Regular expression to validate/detect the format of an eMail address + // default: '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}' + 'email_validation_pattern' => '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}', + + 'encryption_key' => '061c5b88c47ed64664618cf37b91a442b5550704aacecc5f58f96fc98087333b', + + 'encryption_library' => 'OpenSSL', + + 'ext_auth_variable' => '$_SERVER[\'REMOTE_USER\']', + + 'fast_reload_interval' => 60, + + // graphviz_path: Path to the Graphviz "dot" executable for graphing objects lifecycle + // default: '/usr/bin/dot' + 'graphviz_path' => 'C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe', + + // high_cardinality_classes: List of classes with high cardinality (Force manual submit of search) + // default: array ( + // ) + 'high_cardinality_classes' => array(), + + // inline_image_max_display_width: The maximum width (in pixels) when displaying images inside an HTML formatted attribute. Images will be displayed using this this maximum width. + // default: '250' + 'inline_image_max_display_width' => '250', + + // inline_image_max_storage_width: The maximum width (in pixels) when uploading images to be used inside an HTML formatted attribute. Images larger than the given size will be downsampled before storing them in the database. + // default: '1600' + 'inline_image_max_storage_width' => '1600', + + // link_set_attribute_qualifier: Link set from string: attribute qualifier (encloses both the attcode and the value) + // default: '\'' + 'link_set_attribute_qualifier' => '\'', + + // link_set_attribute_separator: Link set from string: attribute separator + // default: ';' + 'link_set_attribute_separator' => ';', + + // link_set_item_separator: Link set from string: line separator + // default: '|' + 'link_set_item_separator' => '|', + + // link_set_value_separator: Link set from string: value separator (between the attcode and the value itself + // default: ':' + 'link_set_value_separator' => ':', + + 'log_global' => true, + + 'log_issue' => true, + + 'log_kpi_duration' => 0, + + 'log_notification' => true, + + 'log_web_service' => true, + + 'max_display_limit' => 30, + + // max_linkset_output: Maximum number of items shown when getting a list of related items in an email, using the form $this->some_list$. 0 means no limit. + // default: 100 + 'max_linkset_output' => 100, + + // mentions.allowed_classes: Classes which can be mentioned through the autocomplete in the caselogs. Key of the array must be a single character that will trigger the autocomplete, value can be either a DM class or a valid OQL (eg. "@" => "Person", "?" => "SELECT FAQ WHERE status = 'published'") + // default: array ( + // '@' => 'SELECT Person WHERE status = \'active\'', + // ) + 'mentions.allowed_classes' => array( + '@' => 'SELECT Person WHERE status = \'active\'', + ), + + 'min_display_limit' => 20, + + // online_help: Hyperlink to the online-help web page + // default: 'http://www.combodo.com/itop-help' + 'online_help' => 'http://www.combodo.com/itop-help', + + // optimize_requests_for_join_count: Optimize request joins to minimize the count (default is true, try to set it to false in case of performance issues) + // default: true + 'optimize_requests_for_join_count' => true, + + 'password_hash_algo' => '2y', + + // php_path: Path to the php executable in CLI mode + // default: 'php' + 'php_path' => 'php', + + // search_manual_submit: Force manual submit of search all requests + // default: false + 'search_manual_submit' => false, + + 'secure_connection_required' => false, + + // session_name: The name of the cookie used to store the PHP session id + // default: 'iTop' + 'session_name' => 'iTop', + + // shortcut_actions: Actions that are available as direct buttons next to the "Actions" menu + // default: 'UI:Menu:Modify,UI:Menu:New' + 'shortcut_actions' => 'UI:Menu:Modify,UI:Menu:New', + + // source_dir: Source directory for the datamodel files. (which gets compiled to env-production). + // default: '' + 'source_dir' => 'datamodels/2.x/', + + 'standard_reload_interval' => 300, + + // synchro_trace: Synchronization details: none, display, save (includes 'display') + // default: 'none' + 'synchro_trace' => 'none', + + // tag_set_item_separator: Tag set from string: tag label separator + // default: '|' + 'tag_set_item_separator' => '|', + + // timezone: Timezone (reference: http://php.net/manual/en/timezones.php). If empty, it will be left unchanged and MUST be explicitly configured in PHP + // default: 'Europe/Paris' + 'timezone' => 'Europe/Paris', + + // tracking_level_linked_set_default: Default tracking level if not explicitly set at the attribute level, for AttributeLinkedSet (defaults to NONE in case of a fresh install, LIST otherwise - this to preserve backward compatibility while upgrading from a version older than 2.0.3 - see TRAC #936) + // default: 1 + 'tracking_level_linked_set_default' => 0, + + // url_validation_pattern: Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes) + // default: '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?' + 'url_validation_pattern' => '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?', +); + +/** + * + * Modules specific settings + * + */ +$MyModuleSettings = array( + 'authent-cas' => array( + 'cas_debug' => false, + 'cas_host' => '', + 'cas_port' => '', + 'cas_context' => '', + 'cas_version' => '', + ), + 'authent-ldap' => array( + 'host' => 'localhost', + 'port' => 389, + 'default_user' => '', + 'default_pwd' => '', + 'base_dn' => 'dc=yourcompany,dc=com', + 'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))', + 'options' => array( + 17 => 3, + 8 => 0, + ), + 'start_tls' => false, + 'debug' => false, + ), + 'itop-attachments' => array( + 'allowed_classes' => array( + 0 => 'Ticket', + ), + 'position' => 'relations', + 'preview_max_width' => 290, + 'icon_preview_max_size' => 500000, + ), + 'itop-backup' => array( + 'mysql_bindir' => '', + 'week_days' => 'monday, tuesday, wednesday, thursday, friday', + 'time' => '23:30', + 'retention_count' => 5, + 'enabled' => true, + 'itop_backup_incident' => '', + ), + 'molkobain-console-tooltips' => array( + 'decoration_class' => 'fas fa-question', + 'enabled' => true, + ), + 'itop-time-tracking' => array( + 'allowed_classes' => array( + 'UserRequest' => + array( + 'calendar-tab' => 'SELECT UserRequest WHERE status != "closed"', + 'stopwatch' => 'SELECT UserRequest WHERE status != "closed"', + 'report-tab' => 'SELECT UserRequest WHERE status IN ("resolved", "closed")', + ), + 'Incident' => + array( + 'calendar-tab' => 'SELECT Incident WHERE status != "closed"', + 'stopwatch' => 'SELECT Incident WHERE status != "closed"', + 'report-tab' => 'SELECT Incident WHERE status IN ("resolved", "closed")', + ), + 'CustomerContract' => + array( + 'calendar-page' => 'SELECT CustomerContract WHERE status = "production"', + 'report-tab' => 'SELECT CustomerContract', + ), + ), + 'colors' => array( + 'default_stopwatch' => + array( + 'text' => '#ffffff', + 'background' => '#a6a6a6', + ), + 'default_calendar' => + array( + 'text' => '#ffffff', + 'background' => '#FFCC80', + ), + 'classes' => + array( + 'UserRequest' => + array( + 'text' => '#ffffff', + 'background' => 'shadeof:blue', + ), + 'Incident' => + array( + 'text' => '#ffffff', + 'background' => 'shadeof:green', + ), + 'CustomerContract' => + array( + 'text' => '#ffffff', + 'background' => 'shadeof:grey', + ), + ), + ), + 'clone_events' => false, + 'default_event_duration' => '00:30:00', + 'day_start_time' => '06:00:00', + 'day_end_time' => '22:00:00', + 'excluded_days' => array( + 0 => 'Saturday', + 1 => 'Sunday', + ), + 'first_day' => 1, + 'business_hours' => array( + 'days_of_week' => + array( + 0 => '1', + 1 => '2', + 2 => '3', + 3 => '4', + 4 => '5', + ), + 'start' => '08:00:00', + 'end' => '18:00:00', + ), + 'minimum_event_duration_display' => '00:30:00', + 'stopwatch_clean_periodicity' => 1, + 'stopwatch_max_time' => 4, + 'delete_max_event_age' => 30, + 'default_report_query' => 'SELECT TimeSpent WHERE contact_id = :contact_id AND start_date >= :start_date AND end_date < :end_date', + 'manager_report_query' => 'SELECT TimeSpent WHERE start_date >= :start_date AND end_date < :end_date', + 'manager_report_silo' => 'SELECT Person', + 'weekly_report_time_spent_attribute' => '', + 'weekly_report_time_spent_default' => '30hrs', + 'report_charts_definition' => array( + 0 => + array( + 'group_by_attribute' => 'contact_id', + 'label' => 'TimeTracking:ReportActivityPerUser', + ), + 1 => + array( + 'group_by_attribute' => 'org_id', + 'label' => 'TimeTracking:ReportActivityPerCustomer', + ), + ), + ), +); + +/** + * + * Data model modules to be loaded. Names are specified as relative paths + * + */ +$MyModules = array( + 'addons' => array( + 'user rights' => 'addons/userrights/userrightsprofile.class.inc.php', + ), +); + + +echo 'tutu'; + +?> \ No newline at end of file diff --git a/test/core/ConfigValidator/config-itop_KO_function.php b/test/core/ConfigValidator/config-itop_KO_function.php new file mode 100644 index 000000000..b6664cc95 --- /dev/null +++ b/test/core/ConfigValidator/config-itop_KO_function.php @@ -0,0 +1,7 @@ + 'iTop is temporarily frozen, please wait... (the admin team)', + + // access_mode: Access mode: ACCESS_READONLY = 0, ACCESS_ADMIN_WRITE = 2, ACCESS_FULL = 3 + // default: 3 + 'access_mode' => 3, + + // activity_panel.entry_form_opened_by_default: Whether or not the new entry form will be automatically opened when viewing an object. + // default: false + 'activity_panel.entry_form_opened_by_default' => false, + + // activity_panel.show_author_name_below_entries: Whether or not to show the author friendlyname next to the date on the last entry. + // default: false + 'activity_panel.show_author_name_below_entries' => false, + + 'allowed_login_types' => 'form|external|basic', + + // apc_cache.enabled: If set, the APC cache is allowed (the PHP extension must also be active) + // default: true + 'apc_cache.enabled' => true, + + // apc_cache.query_ttl: Time to live set in APC for the prepared queries (seconds - 0 means no timeout) + // default: 3600 + 'apc_cache.query_ttl' => 3600, + + // app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name) + // default: '' + 'app_root_url' => 'http://localhost/itop-dev/', + + // behind_reverse_proxy: If true, then proxies custom header (X-Forwarded-*) are taken into account. Use only if the webserver is not publicly accessible (reachable only by the reverse proxy) + // default: false + 'behind_reverse_proxy' => false, + + // cron_max_execution_time: Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout + // default: 600 + 'cron_max_execution_time' => 600, + + // csv_file_default_charset: Character set used by default for downloading and uploading data as a CSV file. Warning: it is case sensitive (uppercase is preferable). + // default: 'ISO-8859-1' + 'csv_file_default_charset' => 'ISO-8859-1', + + 'csv_import_charsets' => array ( + ), + + // csv_import_history_display: Display the history tab in the import wizard + // default: false + 'csv_import_history_display' => false, + + // date_and_time_format: Format for date and time display (per language) + // default: array ( + // 'default' => + // array ( + // 'date' => 'Y-m-d', + // 'time' => 'H:i:s', + // 'date_time' => '$date $time', + // ), + // ) + 'date_and_time_format' => array ( + 'default' => + array ( + 'date' => 'Y-m-d', + 'time' => 'H:i:s', + 'date_time' => '$date $time', + ), + ), + + 'db_host' => 'localhost', + + 'db_name' => 'itop_dev', + + 'db_pwd' => '', + + 'db_subname' => '', + + 'db_user' => 'root', + + // deadline_format: The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$ + // default: '$difference$' + 'deadline_format' => '$difference$', + + 'default_language' => 'EN US', + + // email_asynchronous: If set, the emails are sent off line, which requires cron.php to be activated. Exception: some features like the email test utility will force the serialized mode + // default: false + 'email_asynchronous' => false, + + // email_default_sender_address: Default address provided in the email from header field. + // default: '' + 'email_default_sender_address' => '', + + // email_default_sender_label: Default label provided in the email from header field. + // default: '' + 'email_default_sender_label' => '', + + // email_transport: Mean to send emails: PHPMail (uses the function mail()) or SMTP (implements the client protocol) + // default: 'PHPMail' + 'email_transport' => 'PHPMail', + + // email_validation_pattern: Regular expression to validate/detect the format of an eMail address + // default: '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}' + 'email_validation_pattern' => '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}', + + 'encryption_key' => '061c5b88c47ed64664618cf37b91a442b5550704aacecc5f58f96fc98087333b', + + 'encryption_library' => 'OpenSSL', + + 'ext_auth_variable' => '$_SERVER[\'REMOTE_USER\']', + + 'fast_reload_interval' => 60, + + // graphviz_path: Path to the Graphviz "dot" executable for graphing objects lifecycle + // default: '/usr/bin/dot' + 'graphviz_path' => 'C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe', + + // high_cardinality_classes: List of classes with high cardinality (Force manual submit of search) + // default: array ( + // ) + 'high_cardinality_classes' => array ( + ), + + // inline_image_max_display_width: The maximum width (in pixels) when displaying images inside an HTML formatted attribute. Images will be displayed using this this maximum width. + // default: '250' + 'inline_image_max_display_width' => '250', + + // inline_image_max_storage_width: The maximum width (in pixels) when uploading images to be used inside an HTML formatted attribute. Images larger than the given size will be downsampled before storing them in the database. + // default: '1600' + 'inline_image_max_storage_width' => '1600', + + // link_set_attribute_qualifier: Link set from string: attribute qualifier (encloses both the attcode and the value) + // default: '\'' + 'link_set_attribute_qualifier' => '\'', + + // link_set_attribute_separator: Link set from string: attribute separator + // default: ';' + 'link_set_attribute_separator' => ';', + + // link_set_item_separator: Link set from string: line separator + // default: '|' + 'link_set_item_separator' => '|', + + // link_set_value_separator: Link set from string: value separator (between the attcode and the value itself + // default: ':' + 'link_set_value_separator' => ':', + + 'log_global' => true, + + 'log_issue' => true, + + 'log_kpi_duration' => 0, + + 'log_notification' => true, + + 'log_web_service' => true, + + 'max_display_limit' => 30, + + // max_linkset_output: Maximum number of items shown when getting a list of related items in an email, using the form $this->some_list$. 0 means no limit. + // default: 100 + 'max_linkset_output' => 100, + + // mentions.allowed_classes: Classes which can be mentioned through the autocomplete in the caselogs. Key of the array must be a single character that will trigger the autocomplete, value can be either a DM class or a valid OQL (eg. "@" => "Person", "?" => "SELECT FAQ WHERE status = 'published'") + // default: array ( + // '@' => 'SELECT Person WHERE status = \'active\'', + // ) + 'mentions.allowed_classes' => array ( + '@' => 'SELECT Person WHERE status = \'active\'', + ), + + 'min_display_limit' => 20, + + // online_help: Hyperlink to the online-help web page + // default: 'http://www.combodo.com/itop-help' + 'online_help' => 'http://www.combodo.com/itop-help', + + // optimize_requests_for_join_count: Optimize request joins to minimize the count (default is true, try to set it to false in case of performance issues) + // default: true + 'optimize_requests_for_join_count' => true, + + 'password_hash_algo' => '2y', + + // php_path: Path to the php executable in CLI mode + // default: 'php' + 'php_path' => 'php', + + // search_manual_submit: Force manual submit of search all requests + // default: false + 'search_manual_submit' => false, + + 'secure_connection_required' => false, + + // session_name: The name of the cookie used to store the PHP session id + // default: 'iTop' + 'session_name' => 'iTop', + + // shortcut_actions: Actions that are available as direct buttons next to the "Actions" menu + // default: 'UI:Menu:Modify,UI:Menu:New' + 'shortcut_actions' => 'UI:Menu:Modify,UI:Menu:New', + + // source_dir: Source directory for the datamodel files. (which gets compiled to env-production). + // default: '' + 'source_dir' => 'datamodels/2.x/', + + 'standard_reload_interval' => 300, + + // synchro_trace: Synchronization details: none, display, save (includes 'display') + // default: 'none' + 'synchro_trace' => 'none', + + // tag_set_item_separator: Tag set from string: tag label separator + // default: '|' + 'tag_set_item_separator' => '|', + + // timezone: Timezone (reference: http://php.net/manual/en/timezones.php). If empty, it will be left unchanged and MUST be explicitly configured in PHP + // default: 'Europe/Paris' + 'timezone' => 'Europe/Paris', + + // tracking_level_linked_set_default: Default tracking level if not explicitly set at the attribute level, for AttributeLinkedSet (defaults to NONE in case of a fresh install, LIST otherwise - this to preserve backward compatibility while upgrading from a version older than 2.0.3 - see TRAC #936) + // default: 1 + 'tracking_level_linked_set_default' => 0, + + // url_validation_pattern: Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes) + // default: '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?' + 'url_validation_pattern' => '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?', +); + +/** + * + * Modules specific settings + * + */ +$MyModuleSettings = array( + 'authent-cas' => array ( + 'cas_debug' => false, + 'cas_host' => '', + 'cas_port' => '', + 'cas_context' => '', + 'cas_version' => '', + ), + 'authent-ldap' => array ( + 'host' => 'localhost', + 'port' => 389, + 'default_user' => '', + 'default_pwd' => '', + 'base_dn' => 'dc=yourcompany,dc=com', + 'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))', + 'options' => array ( + 17 => 3, + 8 => 0, + ), + 'start_tls' => false, + 'debug' => false, + ), + 'itop-attachments' => array ( + 'allowed_classes' => array ( + 0 => 'Ticket', + ), + 'position' => 'relations', + 'preview_max_width' => 290, + 'icon_preview_max_size' => 500000, + ), + 'itop-backup' => array ( + 'mysql_bindir' => '', + 'week_days' => 'monday, tuesday, wednesday, thursday, friday', + 'time' => '23:30', + 'retention_count' => 5, + 'enabled' => true, + 'itop_backup_incident' => '', + ), + 'molkobain-console-tooltips' => array ( + 'decoration_class' => 'fas fa-question', + 'enabled' => true, + ), + 'itop-time-tracking' => array ( + 'allowed_classes' => array ( + 'UserRequest' => + array ( + 'calendar-tab' => 'SELECT UserRequest WHERE status != "closed"', + 'stopwatch' => 'SELECT UserRequest WHERE status != "closed"', + 'report-tab' => 'SELECT UserRequest WHERE status IN ("resolved", "closed")', + ), + 'Incident' => + array ( + 'calendar-tab' => 'SELECT Incident WHERE status != "closed"', + 'stopwatch' => 'SELECT Incident WHERE status != "closed"', + 'report-tab' => 'SELECT Incident WHERE status IN ("resolved", "closed")', + ), + 'CustomerContract' => + array ( + 'calendar-page' => 'SELECT CustomerContract WHERE status = "production"', + 'report-tab' => 'SELECT CustomerContract', + ), + ), + 'colors' => array ( + 'default_stopwatch' => + array ( + 'text' => '#ffffff', + 'background' => '#a6a6a6', + ), + 'default_calendar' => + array ( + 'text' => '#ffffff', + 'background' => '#FFCC80', + ), + 'classes' => + array ( + 'UserRequest' => + array ( + 'text' => '#ffffff', + 'background' => 'shadeof:blue', + ), + 'Incident' => + array ( + 'text' => '#ffffff', + 'background' => 'shadeof:green', + ), + 'CustomerContract' => + array ( + 'text' => '#ffffff', + 'background' => 'shadeof:grey', + ), + ), + ), + 'clone_events' => false, + 'default_event_duration' => '00:30:00', + 'day_start_time' => '06:00:00', + 'day_end_time' => '22:00:00', + 'excluded_days' => array ( + 0 => 'Saturday', + 1 => 'Sunday', + ), + 'first_day' => 1, + 'business_hours' => array ( + 'days_of_week' => + array ( + 0 => '1', + 1 => '2', + 2 => '3', + 3 => '4', + 4 => '5', + ), + 'start' => '08:00:00', + 'end' => '18:00:00', + ), + 'minimum_event_duration_display' => '00:30:00', + 'stopwatch_clean_periodicity' => 1, + 'stopwatch_max_time' => 4, + 'delete_max_event_age' => 30, + 'default_report_query' => 'SELECT TimeSpent WHERE contact_id = :contact_id AND start_date >= :start_date AND end_date < :end_date', + 'manager_report_query' => 'SELECT TimeSpent WHERE start_date >= :start_date AND end_date < :end_date', + 'manager_report_silo' => 'SELECT Person', + 'weekly_report_time_spent_attribute' => '', + 'weekly_report_time_spent_default' => '30hrs', + 'report_charts_definition' => array ( + 0 => + array ( + 'group_by_attribute' => 'contact_id', + 'label' => 'TimeTracking:ReportActivityPerUser', + ), + 1 => + array ( + 'group_by_attribute' => 'org_id', + 'label' => 'TimeTracking:ReportActivityPerCustomer', + ), + ), + ), +); + +/** + * + * Data model modules to be loaded. Names are specified as relative paths + * + */ +$MyModules = array( + 'addons' => array ( + 'user rights' => 'addons/userrights/userrightsprofile.class.inc.php', + ), +); +?> \ No newline at end of file diff --git a/test/core/ConfigValidator/config-itop_VALID_log-level-min_const.php b/test/core/ConfigValidator/config-itop_VALID_log-level-min_const.php new file mode 100644 index 000000000..1d59e53c1 --- /dev/null +++ b/test/core/ConfigValidator/config-itop_VALID_log-level-min_const.php @@ -0,0 +1,394 @@ + 'iTop is temporarily frozen, please wait... (the admin team)', + + // access_mode: Access mode: ACCESS_READONLY = 0, ACCESS_ADMIN_WRITE = 2, ACCESS_FULL = 3 + // default: 3 + 'access_mode' => 3, + + // activity_panel.entry_form_opened_by_default: Whether or not the new entry form will be automatically opened when viewing an object. + // default: false + 'activity_panel.entry_form_opened_by_default' => false, + + // activity_panel.show_author_name_below_entries: Whether or not to show the author friendlyname next to the date on the last entry. + // default: false + 'activity_panel.show_author_name_below_entries' => false, + + 'allowed_login_types' => 'form|external|basic', + + // apc_cache.enabled: If set, the APC cache is allowed (the PHP extension must also be active) + // default: true + 'apc_cache.enabled' => true, + + // apc_cache.query_ttl: Time to live set in APC for the prepared queries (seconds - 0 means no timeout) + // default: 3600 + 'apc_cache.query_ttl' => 3600, + + // app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name) + // default: '' + 'app_root_url' => 'http://localhost/itop-dev/', + + // behind_reverse_proxy: If true, then proxies custom header (X-Forwarded-*) are taken into account. Use only if the webserver is not publicly accessible (reachable only by the reverse proxy) + // default: false + 'behind_reverse_proxy' => false, + + // cron_max_execution_time: Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout + // default: 600 + 'cron_max_execution_time' => 600, + + // csv_file_default_charset: Character set used by default for downloading and uploading data as a CSV file. Warning: it is case sensitive (uppercase is preferable). + // default: 'ISO-8859-1' + 'csv_file_default_charset' => 'ISO-8859-1', + + 'csv_import_charsets' => array(), + + // csv_import_history_display: Display the history tab in the import wizard + // default: false + 'csv_import_history_display' => false, + + // date_and_time_format: Format for date and time display (per language) + // default: array ( + // 'default' => + // array ( + // 'date' => 'Y-m-d', + // 'time' => 'H:i:s', + // 'date_time' => '$date $time', + // ), + // ) + 'date_and_time_format' => array( + 'default' => + array( + 'date' => 'Y-m-d', + 'time' => 'H:i:s', + 'date_time' => '$date $time', + ), + ), + + 'db_host' => 'localhost', + + 'db_name' => 'itop_dev', + + 'db_pwd' => '', + + 'db_subname' => '', + + 'db_user' => 'root', + + // deadline_format: The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$ + // default: '$difference$' + 'deadline_format' => '$difference$', + + 'default_language' => 'EN US', + + // email_asynchronous: If set, the emails are sent off line, which requires cron.php to be activated. Exception: some features like the email test utility will force the serialized mode + // default: false + 'email_asynchronous' => false, + + // email_default_sender_address: Default address provided in the email from header field. + // default: '' + 'email_default_sender_address' => '', + + // email_default_sender_label: Default label provided in the email from header field. + // default: '' + 'email_default_sender_label' => '', + + // email_transport: Mean to send emails: PHPMail (uses the function mail()) or SMTP (implements the client protocol) + // default: 'PHPMail' + 'email_transport' => 'PHPMail', + + // email_validation_pattern: Regular expression to validate/detect the format of an eMail address + // default: '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}' + 'email_validation_pattern' => '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}', + + 'encryption_key' => '061c5b88c47ed64664618cf37b91a442b5550704aacecc5f58f96fc98087333b', + + 'encryption_library' => 'OpenSSL', + + 'ext_auth_variable' => '$_SERVER[\'REMOTE_USER\']', + + 'fast_reload_interval' => 60, + + // graphviz_path: Path to the Graphviz "dot" executable for graphing objects lifecycle + // default: '/usr/bin/dot' + 'graphviz_path' => 'C:\\Program Files (x86)\\Graphviz2.38\\bin\\dot.exe', + + // high_cardinality_classes: List of classes with high cardinality (Force manual submit of search) + // default: array ( + // ) + 'high_cardinality_classes' => array(), + + // inline_image_max_display_width: The maximum width (in pixels) when displaying images inside an HTML formatted attribute. Images will be displayed using this this maximum width. + // default: '250' + 'inline_image_max_display_width' => '250', + + // inline_image_max_storage_width: The maximum width (in pixels) when uploading images to be used inside an HTML formatted attribute. Images larger than the given size will be downsampled before storing them in the database. + // default: '1600' + 'inline_image_max_storage_width' => '1600', + + // link_set_attribute_qualifier: Link set from string: attribute qualifier (encloses both the attcode and the value) + // default: '\'' + 'link_set_attribute_qualifier' => '\'', + + // link_set_attribute_separator: Link set from string: attribute separator + // default: ';' + 'link_set_attribute_separator' => ';', + + // link_set_item_separator: Link set from string: line separator + // default: '|' + 'link_set_item_separator' => '|', + + // link_set_value_separator: Link set from string: value separator (between the attcode and the value itself + // default: ':' + 'link_set_value_separator' => ':', + + 'log_global' => true, + + 'log_issue' => true, + + 'log_kpi_duration' => 0, + + 'log_level_min' => array( + '' => LogAPI::LEVEL_WARNING, + 'InlineImage' => LogAPI::LEVEL_TRACE, + 'UserRequest' => LogAPI::LEVEL_TRACE, + ), + + 'log_notification' => true, + + 'log_web_service' => true, + + 'max_display_limit' => 30, + + // max_linkset_output: Maximum number of items shown when getting a list of related items in an email, using the form $this->some_list$. 0 means no limit. + // default: 100 + 'max_linkset_output' => 100, + + // mentions.allowed_classes: Classes which can be mentioned through the autocomplete in the caselogs. Key of the array must be a single character that will trigger the autocomplete, value can be either a DM class or a valid OQL (eg. "@" => "Person", "?" => "SELECT FAQ WHERE status = 'published'") + // default: array ( + // '@' => 'SELECT Person WHERE status = \'active\'', + // ) + 'mentions.allowed_classes' => array( + '@' => 'SELECT Person WHERE status = \'active\'', + ), + + 'min_display_limit' => 20, + + // online_help: Hyperlink to the online-help web page + // default: 'http://www.combodo.com/itop-help' + 'online_help' => 'http://www.combodo.com/itop-help', + + // optimize_requests_for_join_count: Optimize request joins to minimize the count (default is true, try to set it to false in case of performance issues) + // default: true + 'optimize_requests_for_join_count' => true, + + 'password_hash_algo' => '2y', + + // php_path: Path to the php executable in CLI mode + // default: 'php' + 'php_path' => 'php', + + // search_manual_submit: Force manual submit of search all requests + // default: false + 'search_manual_submit' => false, + + 'secure_connection_required' => false, + + // session_name: The name of the cookie used to store the PHP session id + // default: 'iTop' + 'session_name' => 'iTop', + + // shortcut_actions: Actions that are available as direct buttons next to the "Actions" menu + // default: 'UI:Menu:Modify,UI:Menu:New' + 'shortcut_actions' => 'UI:Menu:Modify,UI:Menu:New', + + // source_dir: Source directory for the datamodel files. (which gets compiled to env-production). + // default: '' + 'source_dir' => 'datamodels/2.x/', + + 'standard_reload_interval' => 300, + + // synchro_trace: Synchronization details: none, display, save (includes 'display') + // default: 'none' + 'synchro_trace' => 'none', + + // tag_set_item_separator: Tag set from string: tag label separator + // default: '|' + 'tag_set_item_separator' => '|', + + // timezone: Timezone (reference: http://php.net/manual/en/timezones.php). If empty, it will be left unchanged and MUST be explicitly configured in PHP + // default: 'Europe/Paris' + 'timezone' => 'Europe/Paris', + + // tracking_level_linked_set_default: Default tracking level if not explicitly set at the attribute level, for AttributeLinkedSet (defaults to NONE in case of a fresh install, LIST otherwise - this to preserve backward compatibility while upgrading from a version older than 2.0.3 - see TRAC #936) + // default: 1 + 'tracking_level_linked_set_default' => 0, + + // url_validation_pattern: Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes) + // default: '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?' + 'url_validation_pattern' => '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?', +); + +/** + * + * Modules specific settings + * + */ +$MyModuleSettings = array( + 'authent-cas' => array( + 'cas_debug' => false, + 'cas_host' => '', + 'cas_port' => '', + 'cas_context' => '', + 'cas_version' => '', + ), + 'authent-ldap' => array( + 'host' => 'localhost', + 'port' => 389, + 'default_user' => '', + 'default_pwd' => '', + 'base_dn' => 'dc=yourcompany,dc=com', + 'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))', + 'options' => array( + 17 => 3, + 8 => 0, + ), + 'start_tls' => false, + 'debug' => false, + ), + 'itop-attachments' => array( + 'allowed_classes' => array( + 0 => 'Ticket', + ), + 'position' => 'relations', + 'preview_max_width' => 290, + 'icon_preview_max_size' => 500000, + ), + 'itop-backup' => array( + 'mysql_bindir' => '', + 'week_days' => 'monday, tuesday, wednesday, thursday, friday', + 'time' => '23:30', + 'retention_count' => 5, + 'enabled' => true, + 'itop_backup_incident' => '', + ), + 'molkobain-console-tooltips' => array( + 'decoration_class' => 'fas fa-question', + 'enabled' => true, + ), + 'itop-time-tracking' => array( + 'allowed_classes' => array( + 'UserRequest' => + array( + 'calendar-tab' => 'SELECT UserRequest WHERE status != "closed"', + 'stopwatch' => 'SELECT UserRequest WHERE status != "closed"', + 'report-tab' => 'SELECT UserRequest WHERE status IN ("resolved", "closed")', + ), + 'Incident' => + array( + 'calendar-tab' => 'SELECT Incident WHERE status != "closed"', + 'stopwatch' => 'SELECT Incident WHERE status != "closed"', + 'report-tab' => 'SELECT Incident WHERE status IN ("resolved", "closed")', + ), + 'CustomerContract' => + array( + 'calendar-page' => 'SELECT CustomerContract WHERE status = "production"', + 'report-tab' => 'SELECT CustomerContract', + ), + ), + 'colors' => array( + 'default_stopwatch' => + array( + 'text' => '#ffffff', + 'background' => '#a6a6a6', + ), + 'default_calendar' => + array( + 'text' => '#ffffff', + 'background' => '#FFCC80', + ), + 'classes' => + array( + 'UserRequest' => + array( + 'text' => '#ffffff', + 'background' => 'shadeof:blue', + ), + 'Incident' => + array( + 'text' => '#ffffff', + 'background' => 'shadeof:green', + ), + 'CustomerContract' => + array( + 'text' => '#ffffff', + 'background' => 'shadeof:grey', + ), + ), + ), + 'clone_events' => false, + 'default_event_duration' => '00:30:00', + 'day_start_time' => '06:00:00', + 'day_end_time' => '22:00:00', + 'excluded_days' => array( + 0 => 'Saturday', + 1 => 'Sunday', + ), + 'first_day' => 1, + 'business_hours' => array( + 'days_of_week' => + array( + 0 => '1', + 1 => '2', + 2 => '3', + 3 => '4', + 4 => '5', + ), + 'start' => '08:00:00', + 'end' => '18:00:00', + ), + 'minimum_event_duration_display' => '00:30:00', + 'stopwatch_clean_periodicity' => 1, + 'stopwatch_max_time' => 4, + 'delete_max_event_age' => 30, + 'default_report_query' => 'SELECT TimeSpent WHERE contact_id = :contact_id AND start_date >= :start_date AND end_date < :end_date', + 'manager_report_query' => 'SELECT TimeSpent WHERE start_date >= :start_date AND end_date < :end_date', + 'manager_report_silo' => 'SELECT Person', + 'weekly_report_time_spent_attribute' => '', + 'weekly_report_time_spent_default' => '30hrs', + 'report_charts_definition' => array( + 0 => + array( + 'group_by_attribute' => 'contact_id', + 'label' => 'TimeTracking:ReportActivityPerUser', + ), + 1 => + array( + 'group_by_attribute' => 'org_id', + 'label' => 'TimeTracking:ReportActivityPerCustomer', + ), + ), + ), +); + +/** + * + * Data model modules to be loaded. Names are specified as relative paths + * + */ +$MyModules = array( + 'addons' => array( + 'user rights' => 'addons/userrights/userrightsprofile.class.inc.php', + ), +); +?> \ No newline at end of file diff --git a/test/core/ConfigValidator/iTopConfigAstValidatorTest.php b/test/core/ConfigValidator/iTopConfigAstValidatorTest.php new file mode 100644 index 000000000..b30b67f14 --- /dev/null +++ b/test/core/ConfigValidator/iTopConfigAstValidatorTest.php @@ -0,0 +1,69 @@ +CallValidatorOnFile('config-itop_VALID.php'); + } + catch (Exception $e) { + $this->fail('An exception was thrown by the validation method on a valid file: '.$e->getMessage()); + } + + $this->assertTrue(true, 'The file is valid and interpreted as such'); + } + + public function testValidateFileValidLogLevelMinConst() + { + $this->markTestSkipped(' disabled test, is failing for now with error "Invalid configuration: LEVEL_WARNING of type Identifier is forbidden in line 152"'); + try { + $this->CallValidatorOnFile('config-itop_VALID_log-level-min_const.php'); + } + catch (Exception $e) { + $this->fail('An exception was thrown by the validation method on a valid file: '.$e->getMessage()); + } + + $this->assertTrue(true, 'The file is valid and interpreted as such'); + } + + public function testValidateFileWithCode() + { + $this->expectExceptionMessage('type Stmt_Function is forbidden'); + $this->CallValidatorOnFile('config-itop_KO_function.php'); + } + + public function testValidateFileValidWithCodeAtTheEnd() + { + $this->expectExceptionMessage('Stmt_Echo is forbidden'); + $this->CallValidatorOnFile('config-itop_KO_config_plus_code.php'); + } + + /** + * @throws \Exception + */ + private function CallValidatorOnFile(string $sConfigFilePath) + { + $sContents = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.$sConfigFilePath); + + $oiTopConfigValidator = new iTopConfigAstValidator(); + $oiTopConfigValidator->Validate($sContents); + } +} \ No newline at end of file From af8bcdc242bb3a87fce792fa1656b1a80717313b Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 14:39:02 +0200 Subject: [PATCH 07/15] =?UTF-8?q?:arrow=5Fup:=20N=C2=B04824=20Composer=20l?= =?UTF-8?q?ibs=20:=20update=20pear/archive=5Ftar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- composer.lock | 2 +- lib/composer/installed.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index be32dcb4b..cd4dff996 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "ext-soap": "*", "combodo/tcpdf": "~6.4.4", "nikic/php-parser": "~4.13.2", - "pear/archive_tar": "1.4.14", + "pear/archive_tar": "~1.4.14", "pelago/emogrifier": "2.1.0", "scssphp/scssphp": "1.0.6", "swiftmailer/swiftmailer": "5.4.12", diff --git a/composer.lock b/composer.lock index b36f69a74..4531a89ae 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": "2dff3cf0e45834a895b6f81f1af4016c", + "content-hash": "ebd8582859a03bc00f64b6155d36a387", "packages": [ { "name": "combodo/tcpdf", diff --git a/lib/composer/installed.php b/lib/composer/installed.php index e46a0ff33..53413b733 100644 --- a/lib/composer/installed.php +++ b/lib/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '1882b696c58d1e8e3d687196b0974e6b9ec64312', + 'reference' => '14f18371ff806c027100f6a593ec09f93d76ccf7', 'name' => '__root__', 'dev' => true, ), @@ -16,7 +16,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '1882b696c58d1e8e3d687196b0974e6b9ec64312', + 'reference' => '14f18371ff806c027100f6a593ec09f93d76ccf7', 'dev_requirement' => false, ), 'combodo/tcpdf' => array( From 001e222f67a6963f5fdb3ecdd9f4bb924430b800 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 29 Apr 2022 14:40:27 +0200 Subject: [PATCH 08/15] =?UTF-8?q?:arrow=5Fup:=20N=C2=B04824=20Composer=20l?= =?UTF-8?q?ibs=20:=20update=20pelago/emogrifier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- composer.lock | 50 +- lib/composer/autoload_classmap.php | 4 +- lib/composer/autoload_static.php | 4 +- lib/composer/installed.json | 50 +- lib/composer/installed.php | 10 +- lib/pelago/emogrifier/.gitignore | 25 - lib/pelago/emogrifier/.travis.yml | 65 - lib/pelago/emogrifier/CHANGELOG.md | 225 ++- lib/pelago/emogrifier/CODE_OF_CONDUCT.md | 77 - lib/pelago/emogrifier/README.md | 428 +++-- lib/pelago/emogrifier/composer.json | 16 +- lib/pelago/emogrifier/config/php-cs-fixer.php | 93 - lib/pelago/emogrifier/config/phpmd.xml | 49 - lib/pelago/emogrifier/phpcs.xml.dist | 140 -- lib/pelago/emogrifier/src/Emogrifier.php | 822 ++++----- .../emogrifier/src/Emogrifier/CssInliner.php | 1513 +++++++---------- .../HtmlProcessor/AbstractHtmlProcessor.php | 114 +- .../HtmlProcessor/CssToAttributeConverter.php | 32 +- .../HtmlProcessor/HtmlNormalizer.php | 2 - .../Emogrifier/HtmlProcessor/HtmlPruner.php | 143 ++ .../Emogrifier/Utilities/ArrayIntersector.php | 56 + .../{ => Utilities}/CssConcatenator.php | 10 +- 23 files changed, 1886 insertions(+), 2044 deletions(-) delete mode 100644 lib/pelago/emogrifier/.gitignore delete mode 100644 lib/pelago/emogrifier/.travis.yml delete mode 100644 lib/pelago/emogrifier/CODE_OF_CONDUCT.md delete mode 100644 lib/pelago/emogrifier/config/php-cs-fixer.php delete mode 100644 lib/pelago/emogrifier/config/phpmd.xml delete mode 100644 lib/pelago/emogrifier/phpcs.xml.dist create mode 100644 lib/pelago/emogrifier/src/Emogrifier/HtmlProcessor/HtmlPruner.php create mode 100644 lib/pelago/emogrifier/src/Emogrifier/Utilities/ArrayIntersector.php rename lib/pelago/emogrifier/src/Emogrifier/{ => Utilities}/CssConcatenator.php (94%) diff --git a/composer.json b/composer.json index cd4dff996..e43adbe39 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "combodo/tcpdf": "~6.4.4", "nikic/php-parser": "~4.13.2", "pear/archive_tar": "~1.4.14", - "pelago/emogrifier": "2.1.0", + "pelago/emogrifier": "~3.1.0", "scssphp/scssphp": "1.0.6", "swiftmailer/swiftmailer": "5.4.12", "symfony/console": "~3.4.47", diff --git a/composer.lock b/composer.lock index 4531a89ae..3af6a5144 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": "ebd8582859a03bc00f64b6155d36a387", + "content-hash": "92ecc4c90eca1b55654c99c1b1f8cc8e", "packages": [ { "name": "combodo/tcpdf", @@ -417,34 +417,34 @@ }, { "name": "pelago/emogrifier", - "version": "v2.1.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/MyIntervals/emogrifier.git", - "reference": "40c3d4f475d44ffc7265a760d1dd0e81f579f96f" + "reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/emogrifier/zipball/40c3d4f475d44ffc7265a760d1dd0e81f579f96f", - "reference": "40c3d4f475d44ffc7265a760d1dd0e81f579f96f", + "url": "https://api.github.com/repos/MyIntervals/emogrifier/zipball/f6a5c7d44612d86c3901c93f1592f5440e6b2cd8", + "reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^5.5.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0", - "symfony/css-selector": "^3.4.0 || ^4.0.0" + "php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4", + "symfony/css-selector": "^2.8 || ^3.0 || ^4.0 || ^5.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.2.0", - "phpmd/phpmd": "^2.6.0", - "phpunit/phpunit": "^4.8.0", - "squizlabs/php_codesniffer": "^3.3.2" + "friendsofphp/php-cs-fixer": "^2.15.3", + "phpmd/phpmd": "^2.7.0", + "phpunit/phpunit": "^5.7.27", + "squizlabs/php_codesniffer": "^3.5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -457,16 +457,6 @@ "MIT" ], "authors": [ - { - "name": "John Reeve", - "email": "jreeve@pelagodesign.com" - }, - { - "name": "Cameron Brooks" - }, - { - "name": "Jaime Prado" - }, { "name": "Oliver Klee", "email": "github@oliverklee.de" @@ -475,9 +465,19 @@ "name": "Zoli Szabó", "email": "zoli.szabo+github@gmail.com" }, + { + "name": "John Reeve", + "email": "jreeve@pelagodesign.com" + }, { "name": "Jake Hotson", "email": "jake@qzdesign.co.uk" + }, + { + "name": "Cameron Brooks" + }, + { + "name": "Jaime Prado" } ], "description": "Converts CSS styles into inline style attributes in your HTML code", @@ -487,7 +487,11 @@ "email", "pre-processing" ], - "time": "2018-12-08T13:55:46+00:00" + "support": { + "issues": "https://github.com/MyIntervals/emogrifier/issues", + "source": "https://github.com/MyIntervals/emogrifier" + }, + "time": "2019-12-26T19:37:31+00:00" }, { "name": "psr/cache", diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index 6cc6fef1e..0e459993d 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -385,11 +385,13 @@ return array( 'ParseyyStackEntry' => $baseDir . '/core/oql/build/PHP/Lempar.php', 'ParseyyToken' => $baseDir . '/core/oql/build/PHP/Lempar.php', 'Pelago\\Emogrifier' => $vendorDir . '/pelago/emogrifier/src/Emogrifier.php', - 'Pelago\\Emogrifier\\CssConcatenator' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/CssConcatenator.php', 'Pelago\\Emogrifier\\CssInliner' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/CssInliner.php', 'Pelago\\Emogrifier\\HtmlProcessor\\AbstractHtmlProcessor' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/AbstractHtmlProcessor.php', 'Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/CssToAttributeConverter.php', 'Pelago\\Emogrifier\\HtmlProcessor\\HtmlNormalizer' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/HtmlNormalizer.php', + 'Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/HtmlPruner.php', + 'Pelago\\Emogrifier\\Utilities\\ArrayIntersector' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/Utilities/ArrayIntersector.php', + 'Pelago\\Emogrifier\\Utilities\\CssConcatenator' => $vendorDir . '/pelago/emogrifier/src/Emogrifier/Utilities/CssConcatenator.php', 'PhpParser\\Builder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder.php', 'PhpParser\\BuilderFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', 'PhpParser\\BuilderHelpers' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderHelpers.php', diff --git a/lib/composer/autoload_static.php b/lib/composer/autoload_static.php index 642367c39..b80d41b55 100644 --- a/lib/composer/autoload_static.php +++ b/lib/composer/autoload_static.php @@ -615,11 +615,13 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b 'ParseyyStackEntry' => __DIR__ . '/../..' . '/core/oql/build/PHP/Lempar.php', 'ParseyyToken' => __DIR__ . '/../..' . '/core/oql/build/PHP/Lempar.php', 'Pelago\\Emogrifier' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier.php', - 'Pelago\\Emogrifier\\CssConcatenator' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/CssConcatenator.php', 'Pelago\\Emogrifier\\CssInliner' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/CssInliner.php', 'Pelago\\Emogrifier\\HtmlProcessor\\AbstractHtmlProcessor' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/AbstractHtmlProcessor.php', 'Pelago\\Emogrifier\\HtmlProcessor\\CssToAttributeConverter' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/CssToAttributeConverter.php', 'Pelago\\Emogrifier\\HtmlProcessor\\HtmlNormalizer' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/HtmlNormalizer.php', + 'Pelago\\Emogrifier\\HtmlProcessor\\HtmlPruner' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/HtmlProcessor/HtmlPruner.php', + 'Pelago\\Emogrifier\\Utilities\\ArrayIntersector' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/Utilities/ArrayIntersector.php', + 'Pelago\\Emogrifier\\Utilities\\CssConcatenator' => __DIR__ . '/..' . '/pelago/emogrifier/src/Emogrifier/Utilities/CssConcatenator.php', 'PhpParser\\Builder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder.php', 'PhpParser\\BuilderFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php', 'PhpParser\\BuilderHelpers' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderHelpers.php', diff --git a/lib/composer/installed.json b/lib/composer/installed.json index 4ada053c3..290313c8b 100644 --- a/lib/composer/installed.json +++ b/lib/composer/installed.json @@ -432,36 +432,36 @@ }, { "name": "pelago/emogrifier", - "version": "v2.1.0", - "version_normalized": "2.1.0.0", + "version": "v3.1.0", + "version_normalized": "3.1.0.0", "source": { "type": "git", "url": "https://github.com/MyIntervals/emogrifier.git", - "reference": "40c3d4f475d44ffc7265a760d1dd0e81f579f96f" + "reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/emogrifier/zipball/40c3d4f475d44ffc7265a760d1dd0e81f579f96f", - "reference": "40c3d4f475d44ffc7265a760d1dd0e81f579f96f", + "url": "https://api.github.com/repos/MyIntervals/emogrifier/zipball/f6a5c7d44612d86c3901c93f1592f5440e6b2cd8", + "reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^5.5.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0", - "symfony/css-selector": "^3.4.0 || ^4.0.0" + "php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4", + "symfony/css-selector": "^2.8 || ^3.0 || ^4.0 || ^5.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.2.0", - "phpmd/phpmd": "^2.6.0", - "phpunit/phpunit": "^4.8.0", - "squizlabs/php_codesniffer": "^3.3.2" + "friendsofphp/php-cs-fixer": "^2.15.3", + "phpmd/phpmd": "^2.7.0", + "phpunit/phpunit": "^5.7.27", + "squizlabs/php_codesniffer": "^3.5.0" }, - "time": "2018-12-08T13:55:46+00:00", + "time": "2019-12-26T19:37:31+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "4.0.x-dev" } }, "installation-source": "dist", @@ -475,16 +475,6 @@ "MIT" ], "authors": [ - { - "name": "John Reeve", - "email": "jreeve@pelagodesign.com" - }, - { - "name": "Cameron Brooks" - }, - { - "name": "Jaime Prado" - }, { "name": "Oliver Klee", "email": "github@oliverklee.de" @@ -493,9 +483,19 @@ "name": "Zoli Szabó", "email": "zoli.szabo+github@gmail.com" }, + { + "name": "John Reeve", + "email": "jreeve@pelagodesign.com" + }, { "name": "Jake Hotson", "email": "jake@qzdesign.co.uk" + }, + { + "name": "Cameron Brooks" + }, + { + "name": "Jaime Prado" } ], "description": "Converts CSS styles into inline style attributes in your HTML code", @@ -505,6 +505,10 @@ "email", "pre-processing" ], + "support": { + "issues": "https://github.com/MyIntervals/emogrifier/issues", + "source": "https://github.com/MyIntervals/emogrifier" + }, "install-path": "../pelago/emogrifier" }, { diff --git a/lib/composer/installed.php b/lib/composer/installed.php index 53413b733..292559691 100644 --- a/lib/composer/installed.php +++ b/lib/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '14f18371ff806c027100f6a593ec09f93d76ccf7', + 'reference' => '9ebd884f6e55363b145c271dfc1a9d64cae4d2db', 'name' => '__root__', 'dev' => true, ), @@ -16,7 +16,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '14f18371ff806c027100f6a593ec09f93d76ccf7', + 'reference' => '9ebd884f6e55363b145c271dfc1a9d64cae4d2db', 'dev_requirement' => false, ), 'combodo/tcpdf' => array( @@ -83,12 +83,12 @@ 'dev_requirement' => false, ), 'pelago/emogrifier' => array( - 'pretty_version' => 'v2.1.0', - 'version' => '2.1.0.0', + 'pretty_version' => 'v3.1.0', + 'version' => '3.1.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../pelago/emogrifier', 'aliases' => array(), - 'reference' => '40c3d4f475d44ffc7265a760d1dd0e81f579f96f', + 'reference' => 'f6a5c7d44612d86c3901c93f1592f5440e6b2cd8', 'dev_requirement' => false, ), 'psr/cache' => array( diff --git a/lib/pelago/emogrifier/.gitignore b/lib/pelago/emogrifier/.gitignore deleted file mode 100644 index 8bfbb851e..000000000 --- a/lib/pelago/emogrifier/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -######################### -# global ignore file -######################## -# ignoring temporary files (left by e.g. vim) -# ignoring by common IDE's used directories/files -# dont ignore .rej and .orig as we want to see/clean files after conflict resolution -# -# for local exclude patterns please edit .git/info/exclude -# -*~ -*.bak -*.idea -*.project -*.swp -.buildpath -.cache -.project -.session -.settings -.TemporaryItems -.webprj -nbproject -/.php_cs.cache -/vendor/ -composer.lock diff --git a/lib/pelago/emogrifier/.travis.yml b/lib/pelago/emogrifier/.travis.yml deleted file mode 100644 index f3a6c22ea..000000000 --- a/lib/pelago/emogrifier/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -sudo: false - -language: php - -php: -- 5.5 -- 5.6 -- 7.0 -- 7.1 -- 7.2 -- 7.3 - -cache: - directories: - - vendor - - $HOME/.composer/cache - -env: - matrix: - - DEPENDENCIES_PREFERENCE="--prefer-lowest" - - DEPENDENCIES_PREFERENCE="" - -before_install: -- phpenv config-rm xdebug.ini || echo "xdebug not available" - -install: -- > - export IGNORE_PLATFORM_REQS="$(composer php:version |grep -q '^7.3' && printf -- --ignore-platform-reqs)"; - echo; - echo "Updating the dependencies"; - composer update $IGNORE_PLATFORM_REQS --with-dependencies $DEPENDENCIES_PREFERENCE; - composer show; - -script: -- > - echo; - echo "Validating the composer.json"; - composer validate --no-check-all --no-check-lock --strict; - -- > - echo; - echo "Linting all PHP files"; - composer ci:php:lint; - -- > - echo; - echo "Running the unit tests"; - composer ci:tests:unit; - -- > - echo; - echo "Running PHPMD"; - composer ci:php:md; - -- > - echo; - function version_gte() { test "$(printf '%s\n' "$@" | sort -n -t. -r | head -n 1)" = "$1"; }; - if version_gte $(composer php:version) 7; then - echo "Installing slevomat/coding-standard only for PHP 7.x"; - composer require $IGNORE_PLATFORM_REQS --dev slevomat/coding-standard:^4.0 $DEPENDENCIES_PREFERENCE; - echo "Running PHP_CodeSniffer"; - composer ci:php:sniff; - else - echo "Skipped PHP_CodeSniffer due to insufficient PHP version: $(composer php:version)"; - fi; diff --git a/lib/pelago/emogrifier/CHANGELOG.md b/lib/pelago/emogrifier/CHANGELOG.md index 938e2b511..6ee477312 100644 --- a/lib/pelago/emogrifier/CHANGELOG.md +++ b/lib/pelago/emogrifier/CHANGELOG.md @@ -15,6 +15,200 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed +## 3.1.0 + +### Added +- Add support for PHP 7.4 + ([#821](https://github.com/MyIntervals/emogrifier/pull/821), + [#829](https://github.com/MyIntervals/emogrifier/pull/829)) + +### Changed +- Upgrade to Symfony 5.0 + ([#822](https://github.com/MyIntervals/emogrifier/pull/820) + +## 3.0.0 + +### Added +- Test and document excluding entire subtree with `addExcludedSelector()` + ([#347](https://github.com/MyIntervals/emogrifier/issues/347), + [#768](https://github.com/MyIntervals/emogrifier/pull/768)) +- Test that rules with `:optional` or `:required` are copied to the `