diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index a17c52c6..3471b368 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -17,9 +17,9 @@ jobs: - "highest" - "locked" php-version: - - "7.4" - "8.0" - "8.1" + - "8.2" operating-system: - "ubuntu-latest" diff --git a/classes/PHPTAL/Context.php b/classes/PHPTAL/Context.php index edc45df0..932c60ae 100644 --- a/classes/PHPTAL/Context.php +++ b/classes/PHPTAL/Context.php @@ -18,6 +18,7 @@ * Holds template variables and carries state/scope across macro executions. * */ +#[AllowDynamicProperties] class PHPTAL_Context { public $repeat; diff --git a/classes/PHPTAL/Dom/Element.php b/classes/PHPTAL/Dom/Element.php index 574c8302..a2f791c8 100644 --- a/classes/PHPTAL/Dom/Element.php +++ b/classes/PHPTAL/Dom/Element.php @@ -36,18 +36,23 @@ class PHPTAL_Dom_Element extends PHPTAL_Dom_Node public $childNodes = array(); public $parentNode; + private array $talHandlers; + /** * @param string $qname qualified name of the element, e.g. "tal:block" * @param string $namespace_uri namespace of this element * @param array $attribute_nodes array of PHPTAL_Dom_Attr elements - * @param object $xmlns object that represents namespaces/prefixes known in element's context + * @param PHPTAL_Dom_XmlnsState $xmlns object that represents namespaces/prefixes known in element's context */ - public function __construct($qname, $namespace_uri, array $attribute_nodes, PHPTAL_Dom_XmlnsState $xmlns) + public function __construct( + $qname, + $namespace_uri, + array $attribute_nodes, + private PHPTAL_Dom_XmlnsState $xmlns) { $this->qualifiedName = $qname; $this->attribute_nodes = $attribute_nodes; $this->namespace_uri = $namespace_uri; - $this->xmlns = $xmlns; // implements inheritance of element's namespace to tal attributes () foreach ($attribute_nodes as $index => $attr) { diff --git a/classes/PHPTAL/Dom/PHPTALDocumentBuilder.php b/classes/PHPTAL/Dom/PHPTALDocumentBuilder.php index a3157beb..f66b6578 100644 --- a/classes/PHPTAL/Dom/PHPTALDocumentBuilder.php +++ b/classes/PHPTAL/Dom/PHPTALDocumentBuilder.php @@ -24,6 +24,7 @@ class PHPTAL_Dom_PHPTALDocumentBuilder extends PHPTAL_Dom_DocumentBuilder { private $_xmlns; /* PHPTAL_Dom_XmlnsState */ private $encoding; + private ?PHPTAL_Dom_Element $documentElement = null; public function __construct() { diff --git a/classes/PHPTAL/Dom/SaxXmlParser.php b/classes/PHPTAL/Dom/SaxXmlParser.php index 76352767..292765fd 100644 --- a/classes/PHPTAL/Dom/SaxXmlParser.php +++ b/classes/PHPTAL/Dom/SaxXmlParser.php @@ -406,7 +406,9 @@ private function checkEncoding($str) $forbid = '/((?>[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F]+))/s'; if (preg_match($forbid, $str)) { - $str = preg_replace_callback($forbid, array('self', 'convertBytesToEntities'), $str); + $str = preg_replace_callback($forbid, static function (array $m): string { + return self::convertBytesToEntities($m); + }, $str); $this->raiseError("Invalid ISO-8859-1 characters: ".$str); } } @@ -419,10 +421,8 @@ private function checkEncoding($str) * Changes all bytes to hexadecimal XML entities * * @param array $m first array element is used for input - * - * @return string */ - private static function convertBytesToEntities(array $m) + private static function convertBytesToEntities(array $m): string { $m = $m[1]; $out = ""; @@ -444,7 +444,11 @@ private function sanitizeEscapedText($str) so they have to be converted into special TALES expression */ $types = version_compare(PHP_VERSION, '5.4.0') < 0 ? (ini_get('short_open_tag') ? 'php|=|' : 'php') : 'php|='; - $str = preg_replace_callback("/<\?($types)(.*?)\?>/", array('self', 'convertPHPBlockToTALES'), $str); + $str = preg_replace_callback("/<\?($types)(.*?)\?>/", static function ($m) { + list(, $type, $code) = $m; + if ($type === '=') $code = 'echo '.$code; + return '${structure phptal-internal-php-block:'.rawurlencode($code).'}'; + }, $str); // corrects all non-entities and neutralizes potentially problematic CDATA end marker $str = strtr(preg_replace('/&(?!(?:#x?[a-f0-9]+|[a-z][a-z0-9]*);)/i', '&', $str), array('<'=>'<', ']]>'=>']]>')); @@ -452,13 +456,6 @@ private function sanitizeEscapedText($str) return $str; } - private static function convertPHPBlockToTALES($m) - { - list(, $type, $code) = $m; - if ($type === '=') $code = 'echo '.$code; - return '${structure phptal-internal-php-block:'.rawurlencode($code).'}'; - } - public function getSourceFile() { return $this->_file; diff --git a/classes/PHPTAL/Php/Attribute.php b/classes/PHPTAL/Php/Attribute.php index ceb8a12c..e2c0620e 100644 --- a/classes/PHPTAL/Php/Attribute.php +++ b/classes/PHPTAL/Php/Attribute.php @@ -82,7 +82,10 @@ protected function doEchoAttribute(PHPTAL_Php_CodeWriter $codewriter, $code) $codewriter->doEchoRaw($code); } - protected function parseSetExpression($exp) + /** + * @return non-empty-array + */ + protected function parseSetExpression(string $exp) { $exp = trim($exp); // (dest) (value) diff --git a/classes/PHPTAL/Php/Attribute/TAL/Attributes.php b/classes/PHPTAL/Php/Attribute/TAL/Attributes.php index 158d079d..a1814429 100644 --- a/classes/PHPTAL/Php/Attribute/TAL/Attributes.php +++ b/classes/PHPTAL/Php/Attribute/TAL/Attributes.php @@ -46,6 +46,8 @@ class PHPTAL_Php_Attribute_TAL_Attributes * value for default keyword */ private $_default_escaped; + private string $_attribute = ''; + private string $_attkey = ''; public function before(PHPTAL_Php_CodeWriter $codewriter) { @@ -59,7 +61,7 @@ public function before(PHPTAL_Php_CodeWriter $codewriter) } } - private function prepareAttribute(PHPTAL_Php_CodeWriter $codewriter, $qname, $expression) + private function prepareAttribute(PHPTAL_Php_CodeWriter $codewriter, string $qname, $expression) { $tales_code = $this->extractEchoType($expression); $code = $codewriter->evaluateExpression($tales_code); @@ -127,7 +129,7 @@ private function prepareAttributeConditional(PHPTAL_Php_CodeWriter $codewriter, $this->phpelement->getOrCreateAttributeNode($qname)->overwriteFullWithVariable($attkey); } - private function prepareChainedAttribute(PHPTAL_Php_CodeWriter $codewriter, $qname, $chain) + private function prepareChainedAttribute(PHPTAL_Php_CodeWriter $codewriter, string $qname, $chain) { $this->_default_escaped = false; $this->_attribute = $qname; @@ -139,7 +141,7 @@ private function prepareChainedAttribute(PHPTAL_Php_CodeWriter $codewriter, $qna $this->phpelement->getOrCreateAttributeNode($qname)->overwriteFullWithVariable($this->_attkey); } - private function prepareBooleanAttribute(PHPTAL_Php_CodeWriter $codewriter, $qname, $code) + private function prepareBooleanAttribute(PHPTAL_Php_CodeWriter $codewriter, string $qname, $code) { $attkey = $this->getVarName($qname, $codewriter); @@ -156,7 +158,7 @@ private function prepareBooleanAttribute(PHPTAL_Php_CodeWriter $codewriter, $qna $this->phpelement->getOrCreateAttributeNode($qname)->overwriteFullWithVariable($attkey); } - private function getVarName($qname, PHPTAL_Php_CodeWriter $codewriter) + private function getVarName($qname, PHPTAL_Php_CodeWriter $codewriter): string { $var = $codewriter->createTempVariable(); $this->vars_to_recycle[] = $var; diff --git a/classes/PHPTAL/Php/TalesChainExecutor.php b/classes/PHPTAL/Php/TalesChainExecutor.php index da947242..517a3bbe 100644 --- a/classes/PHPTAL/Php/TalesChainExecutor.php +++ b/classes/PHPTAL/Php/TalesChainExecutor.php @@ -23,12 +23,15 @@ class PHPTAL_Php_TalesChainExecutor const CHAIN_BREAK = 1; const CHAIN_CONT = 2; - public function __construct(PHPTAL_Php_CodeWriter $codewriter, array $chain, PHPTAL_Php_TalesChainReader $reader) + private int $state = 0; + private bool $chainStarted = false; + + public function __construct( + private PHPTAL_Php_CodeWriter $codewriter, + private array $chain, + private PHPTAL_Php_TalesChainReader $reader + ) { - $this->_chain = $chain; - $this->_chainStarted = false; - $this->codewriter = $codewriter; - $this->_reader = $reader; $this->_executeChain(); } @@ -37,10 +40,10 @@ public function getCodeWriter() return $this->codewriter; } - public function doIf($condition) + public function doIf(string $condition) { - if ($this->_chainStarted == false) { - $this->_chainStarted = true; + if ($this->chainStarted == false) { + $this->chainStarted = true; $this->codewriter->doIf($condition); } else { $this->codewriter->doElseIf($condition); @@ -54,43 +57,38 @@ public function doElse() public function breakChain() { - $this->_state = self::CHAIN_BREAK; + $this->state = self::CHAIN_BREAK; } public function continueChain() { - $this->_state = self::CHAIN_CONT; + $this->state = self::CHAIN_CONT; } private function _executeChain() { $this->codewriter->noThrow(true); - end($this->_chain); $lastkey = key($this->_chain); + end($this->chain); $lastkey = key($this->chain); - foreach ($this->_chain as $key => $exp) { - $this->_state = 0; + foreach ($this->chain as $key => $exp) { + $this->state = 0; if ($exp == PHPTAL_Php_TalesInternal::NOTHING_KEYWORD) { - $this->_reader->talesChainNothingKeyword($this); + $this->reader->talesChainNothingKeyword($this); } elseif ($exp == PHPTAL_Php_TalesInternal::DEFAULT_KEYWORD) { - $this->_reader->talesChainDefaultKeyword($this); + $this->reader->talesChainDefaultKeyword($this); } else { - $this->_reader->talesChainPart($this, $exp, $lastkey === $key); + $this->reader->talesChainPart($this, $exp, $lastkey === $key); } - if ($this->_state == self::CHAIN_BREAK) + if ($this->state == self::CHAIN_BREAK) break; - if ($this->_state == self::CHAIN_CONT) + if ($this->state == self::CHAIN_CONT) continue; } $this->codewriter->doEnd('if'); $this->codewriter->noThrow(false); } - - private $_state = 0; - private $_chain; - private $_chainStarted = false; - private $codewriter = null; } diff --git a/classes/PHPTAL/RepeatController.php b/classes/PHPTAL/RepeatController.php index c1f21fe0..e5807a91 100644 --- a/classes/PHPTAL/RepeatController.php +++ b/classes/PHPTAL/RepeatController.php @@ -49,6 +49,7 @@ class PHPTAL_RepeatController implements Iterator * computed lazily */ private $length = null; + private PHPTAL_RepeatControllerGroups $groups; /** * Construct a new RepeatController. diff --git a/classes/PHPTAL/StringSource.php b/classes/PHPTAL/StringSource.php index b2de2cb4..8e35cf85 100644 --- a/classes/PHPTAL/StringSource.php +++ b/classes/PHPTAL/StringSource.php @@ -20,8 +20,10 @@ class PHPTAL_StringSource implements PHPTAL_Source { const NO_PATH_PREFIX = '_data = $data; $this->_realpath = $realpath ? $realpath : self::NO_PATH_PREFIX.md5($data).'>'; diff --git a/classes/PHPTAL/Tokenizer.php b/classes/PHPTAL/Tokenizer.php index 3d0ccbeb..0b1cc4e2 100644 --- a/classes/PHPTAL/Tokenizer.php +++ b/classes/PHPTAL/Tokenizer.php @@ -14,11 +14,17 @@ class PHPTAL_Tokenizer { - private $regex, $names, $offset, $str; + private string $regex; + private array $names; + private int $offset; + private string $str; - private $current_token, $current_value; + private ?string $current_token = null; + private ?string $current_value = null; - function __construct($str, array $tokens) + private int $end; + + function __construct(string $str, array $tokens) { $this->offset = 0; $this->str = $str; diff --git a/composer.json b/composer.json index e037be34..6e53377e 100644 --- a/composer.json +++ b/composer.json @@ -22,10 +22,10 @@ } ], "require": { - "php": "~7.4.0 || ~8.0.0 || ~8.1.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.5.10" + "phpunit/phpunit": "^9.5.24" }, "autoload": { "psr-0": { diff --git a/composer.lock b/composer.lock index 0f6d63f1..9cfb85cc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,34 +4,35 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3bef1412b7acb31bae651440472bbc92", + "content-hash": "a5732e077a87f8b960987ba0065b4c27", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -58,7 +59,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -74,41 +75,42 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -124,7 +126,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -132,20 +134,20 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -186,9 +188,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "phar-io/manifest", @@ -252,16 +254,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -297,256 +299,29 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" - }, - "time": "2021-02-23T14:00:09+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" - }, - "time": "2021-10-02T14:08:47+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.10", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -595,7 +370,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -603,7 +378,7 @@ "type": "github" } ], - "time": "2021-12-05T09:12:13+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -848,16 +623,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.10", + "version": "9.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "shasum": "" }, "require": { @@ -872,8 +647,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -887,13 +661,9 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.1", "sebastian/version": "^3.0.2" }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -908,11 +678,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -935,11 +705,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -947,7 +717,7 @@ "type": "github" } ], - "time": "2021-09-25T07:38:51+00:00" + "time": "2022-08-30T07:42:16+00:00" }, { "name": "sebastian/cli-parser", @@ -1118,16 +888,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -1180,7 +950,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -1188,7 +958,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -1315,16 +1085,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -1366,7 +1136,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -1374,20 +1144,20 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -1443,7 +1213,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -1451,20 +1221,20 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -1507,7 +1277,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -1515,7 +1285,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -1806,28 +1576,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1850,7 +1620,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -1858,7 +1628,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", @@ -1913,85 +1683,6 @@ ], "time": "2020-09-28T06:39:44+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.1", @@ -2041,64 +1732,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -2107,8 +1740,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4 || ^8.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/tests/ContentInterpolationTest.php b/tests/ContentInterpolationTest.php index 222f625c..0ccaf6d3 100644 --- a/tests/ContentInterpolationTest.php +++ b/tests/ContentInterpolationTest.php @@ -297,6 +297,9 @@ public function testPHPBlock54() { if (version_compare(PHP_VERSION, '5.4.0') < 0) $this->markTestSkipped('PHP < 5.4'); + ini_set('short_open_tag', 0); + if (ini_get('short_open_tag')) $this->markTestSkipped("PHP is buggy"); + $tpl = $this->newPHPTAL(); $tpl->setSource('

test"); ?>testtest

'); try diff --git a/tests/PhptalCacheTest.php b/tests/PhptalCacheTest.php index 8d249795..77ff913d 100644 --- a/tests/PhptalCacheTest.php +++ b/tests/PhptalCacheTest.php @@ -15,6 +15,8 @@ class PhptalCacheTest extends PHPTAL_TestCase { + private string $PhptalCacheTest_random; + function setUp(): void { parent::setUp(); diff --git a/tests/SourceTest.php b/tests/SourceTest.php index 93a2dd14..93aaac9a 100644 --- a/tests/SourceTest.php +++ b/tests/SourceTest.php @@ -33,10 +33,10 @@ function resolve($path) class MyCustomSource implements PHPTAL_Source { - function __construct($path) - { - $this->path = $path; - } + function __construct( + private string $path + ) + {} function getRealPath() { diff --git a/tests/TalCommentTest.php b/tests/TalCommentTest.php index a9c9c1e7..dc6201a3 100644 --- a/tests/TalCommentTest.php +++ b/tests/TalCommentTest.php @@ -28,7 +28,6 @@ function setUp(): void $state = new PHPTAL_Php_State($this->newPHPTAL()); $this->_gen = new PHPTAL_Php_CodeWriter($state); $this->_tag = new DummyPhpNode(); - $this->_tag->codewriter = $this->_gen; } private function newComment($expr) diff --git a/tests/TalConditionTest.php b/tests/TalConditionTest.php index a1310024..75a951e7 100644 --- a/tests/TalConditionTest.php +++ b/tests/TalConditionTest.php @@ -184,10 +184,11 @@ function testConditionCountable() class CountableImpl implements Countable { - function __construct($cnt=0) - { - $this->cnt = $cnt; - } + function __construct( + private int $cnt = 0 + ) + {} + /** * @see Countable */