From 84dac62a858605357611e0a31402745325c2abdd Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Sun, 5 Feb 2023 21:59:04 +0100 Subject: [PATCH 01/11] migrate to php8 --- composer.json | 10 +- composer.lock | 2792 ++++++++---------- phpunit.xml.dist | 11 +- src/Fenom.php | 425 +-- src/Fenom/Accessor.php | 2 +- src/Fenom/Error/UnexpectedTokenException.php | 2 +- src/Fenom/Template.php | 4 +- src/Fenom/Tokenizer.php | 257 +- tests/TestCase.php | 6 +- tests/autoload.php | 6 +- tests/cases/Fenom/TokenizerTest.php | 3 +- 11 files changed, 1630 insertions(+), 1888 deletions(-) diff --git a/composer.json b/composer.json index c85c46c..32c4c70 100644 --- a/composer.json +++ b/composer.json @@ -11,15 +11,17 @@ } ], "require": { - "php": ">=5.3.0", + "php": ">=8.0.0", "ext-tokenizer": "*" }, "require-dev": { - "phpunit/phpunit": "<6.0", - "satooshi/php-coveralls": "*" + "phpunit/phpunit": "9.*" }, "autoload": { - "psr-0": { "Fenom\\": "src/" }, + "psr-4": { "Fenom\\": "src/Fenom" }, "classmap": [ "src/Fenom.php" ] + }, + "autoload-dev": { + "classmap": [ "tests/cases" ] } } diff --git a/composer.lock b/composer.lock index a4beafb..4c4c155 100644 --- a/composer.lock +++ b/composer.lock @@ -4,41 +4,37 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5d9cc53199d5c45a0eaf758f5a5b9288", + "content-hash": "dc6a664578936c2f2259ba8657569d9d", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.3.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -52,7 +48,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -61,6 +57,10 @@ "constructor", "instantiate" ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -75,50 +75,74 @@ "type": "tidelift" } ], - "time": "2020-05-29T17:27:14+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { - "name": "guzzlehttp/guzzle", - "version": "6.5.5", + "name": "guzzle/guzzle", + "version": "v3.9.3", "source": { "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" + "url": "https://github.com/guzzle/guzzle3.git", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", - "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", "shasum": "" }, "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17.0" + "ext-curl": "*", + "php": ">=5.3.3", + "symfony/event-dispatcher": "~2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" }, "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" + "doctrine/cache": "~1.3", + "monolog/monolog": "~1.0", + "phpunit/phpunit": "3.7.*", + "psr/log": "~1.0", + "symfony/class-loader": "~2.1", + "zendframework/zend-cache": "2.*,<2.3", + "zendframework/zend-log": "2.*,<2.3" }, "suggest": { - "psr/log": "Required for using the Log middleware" + "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.5-dev" + "dev-master": "3.9-dev" } }, "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + "psr-0": { + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -129,9 +153,13 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" } ], - "description": "Guzzle is a PHP HTTP client library", + "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", "homepage": "http://guzzlephp.org/", "keywords": [ "client", @@ -142,163 +170,47 @@ "rest", "web service" ], - "time": "2020-06-16T21:01:06+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "support": { + "issues": "https://github.com/guzzle/guzzle3/issues", + "source": "https://github.com/guzzle/guzzle3/tree/master" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20T10:07:11+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" - }, - "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2019-07-01T23:21:34+00:00" + "abandoned": "guzzlehttp/guzzle", + "time": "2015-03-18T18:23:50+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.1", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "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": [ @@ -312,260 +224,225 @@ "object", "object graph" ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, "funding": [ { "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", "type": "tidelift" } ], - "time": "2020-06-29T13:22:24+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", + "name": "nikic/php-parser", + "version": "v4.15.3", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + }, + "time": "2023-01-16T22:05:37+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "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" - ], - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "shasum": "" - }, - "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" - }, - "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" - }, - "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": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" }, { - "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.", - "time": "2020-02-22T12:28:44+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*" - }, - "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", - "time": "2020-06-27T10:12:23+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.10.3", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10.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": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2020-03-05T15:02:03+00:00" + "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.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "version": "9.2.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "nikic/php-parser": "^4.14", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.5.1" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -580,7 +457,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -591,29 +468,42 @@ "testing", "xunit" ], - "time": "2017-04-02T07:44:40+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-01-26T08:26:55+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -628,7 +518,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -638,26 +528,107 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -679,32 +650,42 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -719,7 +700,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -728,104 +709,64 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.27", + "version": "9.6.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" - }, - "require-dev": { - "ext-pdo": "*" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "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", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" }, "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "ext-soap": "*", + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -833,10 +774,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "9.6-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "classmap": [ "src/" ] @@ -859,179 +803,38 @@ "testing", "xunit" ], - "time": "2018-02-01T05:50:59+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "abandoned": true, - "time": "2017-06-30T09:13:00+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-02-04T13:37:15+00:00" }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -1055,7 +858,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1065,91 +868,46 @@ "psr", "psr-3" ], - "time": "2020-03-23T09:12:05+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "time": "2019-03-08T08:55:37+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "satooshi/php-coveralls", - "version": "v2.2.0", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/php-coveralls/php-coveralls.git", - "reference": "3e6420fa666ef7bae5e750ddeac903153e193bae" + "url": "https://github.com/satooshi/php-coveralls.git", + "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-coveralls/php-coveralls/zipball/3e6420fa666ef7bae5e750ddeac903153e193bae", - "reference": "3e6420fa666ef7bae5e750ddeac903153e193bae", + "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/da51d304fe8622bf9a6da39a8446e7afd432115c", + "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c", "shasum": "" }, "require": { "ext-json": "*", "ext-simplexml": "*", - "guzzlehttp/guzzle": "^6.0", - "php": "^5.5 || ^7.0", + "guzzle/guzzle": "^2.8|^3.0", + "php": ">=5.3.3", "psr/log": "^1.0", - "symfony/config": "^2.1 || ^3.0 || ^4.0 || ^5.0", - "symfony/console": "^2.1 || ^3.0 || ^4.0 || ^5.0", - "symfony/stopwatch": "^2.0 || ^3.0 || ^4.0 || ^5.0", - "symfony/yaml": "^2.0.5 || ^3.0 || ^4.0 || ^5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0" + "symfony/config": "^2.1|^3.0", + "symfony/console": "^2.1|^3.0", + "symfony/stopwatch": "^2.0|^3.0", + "symfony/yaml": "^2.0|^3.0" }, "suggest": { "symfony/http-kernel": "Allows Symfony integration" }, "bin": [ - "bin/php-coveralls" + "bin/coveralls" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2-dev" - } - }, "autoload": { "psr-4": { - "PhpCoveralls\\": "src/" + "Satooshi\\": "src/Satooshi/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1160,61 +918,160 @@ { "name": "Kitamura Satoshi", "email": "with.no.parachute@gmail.com", - "homepage": "https://www.facebook.com/satooshi.jp", - "role": "Original creator" - }, - { - "name": "Takashi Matsuo", - "email": "tmatsuo@google.com" - }, - { - "name": "Google Inc" - }, - { - "name": "Dariusz Ruminski", - "email": "dariusz.ruminski@gmail.com", - "homepage": "https://github.com/keradus" - }, - { - "name": "Contributors", - "homepage": "https://github.com/php-coveralls/php-coveralls/graphs/contributors" + "homepage": "https://www.facebook.com/satooshi.jp" } ], "description": "PHP client library for Coveralls API", - "homepage": "https://github.com/php-coveralls/php-coveralls", + "homepage": "https://github.com/satooshi/php-coveralls", "keywords": [ "ci", "coverage", "github", "test" ], + "support": { + "issues": "https://github.com/satooshi/php-coveralls/issues", + "source": "https://github.com/satooshi/php-coveralls/tree/1.0" + }, "abandoned": "php-coveralls/php-coveralls", - "time": "2019-11-20T16:29:20+00:00" + "time": "2016-01-20T17:35:46+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", + "name": "sebastian/cli-parser", "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { @@ -1234,34 +1091,44 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1274,6 +1141,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1285,45 +1156,52 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" }, { - "name": "sebastian/diff", - "version": "1.4.3", + "name": "sebastian/complexity", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "nikic/php-parser": "^4.7", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1337,45 +1215,118 @@ ], "authors": [ { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-05-22T07:24:03+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -1400,34 +1351,44 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1440,6 +1401,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1448,46 +1413,55 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -1495,7 +1469,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1518,33 +1492,101 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-14T08:28:10+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "2.0.1", + "name": "sebastian/lines-of-code", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "nikic/php-parser": "^4.6", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { @@ -1564,32 +1606,42 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" }, { - "name": "sebastian/recursion-context", - "version": "2.0.0", + "name": "sebastian/object-reflector", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1603,43 +1655,111 @@ ], "authors": [ { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1659,29 +1779,95 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "sebastian/type", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" } }, "autoload": { @@ -1702,48 +1888,51 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "symfony/config", - "version": "v5.1.2", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "b8623ef3d99fe62a34baf7a111b576216965f880" + "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b8623ef3d99fe62a34baf7a111b576216965f880", - "reference": "b8623ef3d99fe62a34baf7a111b576216965f880", + "url": "https://api.github.com/repos/symfony/config/zipball/bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", + "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/filesystem": "^4.4|^5.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.15" + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/finder": "<4.4" + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" }, "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^4.4|^5.0" + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Config\\": "" @@ -1768,6 +1957,9 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/config/tree/v3.4.47" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1782,48 +1974,41 @@ "type": "tidelift" } ], - "time": "2020-05-23T13:08:13+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/console", - "version": "v5.1.2", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "34ac555a3627e324b660e318daa07572e1140123" + "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/34ac555a3627e324b660e318daa07572e1140123", - "reference": "34ac555a3627e324b660e318daa07572e1140123", + "url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81", + "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1832,11 +2017,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -1861,6 +2041,9 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/console/tree/v3.4.47" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1875,34 +2058,39 @@ "type": "tidelift" } ], - "time": "2020-06-15T12:59:21+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { - "name": "symfony/deprecation-contracts", - "version": "v2.1.2", + "name": "symfony/debug", + "version": "v4.4.44", "source": { "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337" + "url": "https://github.com/symfony/debug.git", + "reference": "1a692492190773c5310bc7877cb590c04c2f05be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337", - "reference": "dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337", + "url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be", + "reference": "1a692492190773c5310bc7877cb590c04c2f05be", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.1.3", + "psr/log": "^1|^2|^3" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "^3.4|^4.0|^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, "autoload": { - "files": [ - "function.php" + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1911,16 +2099,19 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "A generic function and convention to trigger deprecation notices", + "description": "Provides tools to ease debugging PHP code", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/debug/tree/v4.4.44" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1935,32 +2126,92 @@ "type": "tidelift" } ], - "time": "2020-05-27T08:34:37+00:00" + "abandoned": "symfony/error-handler", + "time": "2022-07-28T16:29:46+00:00" }, { - "name": "symfony/filesystem", - "version": "v5.1.2", + "name": "symfony/event-dispatcher", + "version": "v2.8.52", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "6e4320f06d5f2cce0d96530162491f4465179157" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/6e4320f06d5f2cce0d96530162491f4465179157", - "reference": "6e4320f06d5f2cce0d96530162491f4465179157", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a77e974a5fecb4398833b0709210e3d5e334ffb0", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8" + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-master": "2.8-dev" } }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v2.8.50" + }, + "time": "2018-11-21T14:20:20+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v4.4.42", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5", + "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -1983,8 +2234,11 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v4.4.42" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1999,24 +2253,27 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2022-05-20T08:49:14+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.1", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" @@ -2024,7 +2281,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2032,12 +2289,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2061,6 +2318,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2075,263 +2335,27 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.17.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "6e4dbcf5e81eba86e36731f94fe56b1726835846" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/6e4dbcf5e81eba86e36731f94fe56b1726835846", - "reference": "6e4dbcf5e81eba86e36731f94fe56b1726835846", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "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": "2020-06-06T08:46:27+00:00" - }, - { - "name": "symfony/polyfill-intl-idn", - "version": "v1.17.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a57f8161502549a742a63c09f0a604997bf47027" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a57f8161502549a742a63c09f0a604997bf47027", - "reference": "a57f8161502549a742a63c09f0a604997bf47027", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php72": "^1.10" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "idn", - "intl", - "polyfill", - "portable", - "shim" - ], - "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": "2020-06-06T08:46:27+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.17.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "40309d1700e8f72447bb9e7b54af756eeea35620" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/40309d1700e8f72447bb9e7b54af756eeea35620", - "reference": "40309d1700e8f72447bb9e7b54af756eeea35620", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "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": "2020-06-14T14:40:37+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.17.1", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7110338d81ce1cbc3e273136e4574663627037a7" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7110338d81ce1cbc3e273136e4574663627037a7", - "reference": "7110338d81ce1cbc3e273136e4574663627037a7", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { "ext-mbstring": "For best performance" @@ -2339,7 +2363,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2347,12 +2371,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2377,6 +2401,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2391,174 +2418,29 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.17.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "f048e612a3905f34931127360bdd2def19a5e582" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582", - "reference": "f048e612a3905f34931127360bdd2def19a5e582", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "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": "2020-05-12T16:47:27+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.17.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fa0837fe02d617d31fbb25f990655861bb27bd1a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fa0837fe02d617d31fbb25f990655861bb27bd1a", - "reference": "fa0837fe02d617d31fbb25f990655861bb27bd1a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "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": "2020-06-06T08:46:27+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.17.1", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "4a5b6bba3259902e386eb80dd1956181ee90b5b2" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4a5b6bba3259902e386eb80dd1956181ee90b5b2", - "reference": "4a5b6bba3259902e386eb80dd1956181ee90b5b2", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { - "php": ">=7.0.8" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2566,12 +2448,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2602,6 +2484,9 @@ "portable", "shim" ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2616,104 +2501,26 @@ "type": "tidelift" } ], - "time": "2020-06-06T08:46:27+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v2.1.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/66a8f0957a3ca54e4f724e49028ab19d75a8918b", - "reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "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": "2020-05-20T17:43:50+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.1.2", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "0f7c58cf81dbb5dd67d423a89d577524a2ec0323" + "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/0f7c58cf81dbb5dd67d423a89d577524a2ec0323", - "reference": "0f7c58cf81dbb5dd67d423a89d577524a2ec0323", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/298b81faad4ce60e94466226b2abbb8c9bca7462", + "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/service-contracts": "^1.0|^2" + "php": "^5.5.9|>=7.0.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" @@ -2738,6 +2545,9 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v3.4.47" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2752,126 +2562,36 @@ "type": "tidelift" } ], - "time": "2020-05-20T17:43:50+00:00" - }, - { - "name": "symfony/string", - "version": "v5.1.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ac70459db781108db7c6d8981dd31ce0e29e3298", - "reference": "ac70459db781108db7c6d8981dd31ce0e29e3298", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" - }, - "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "files": [ - "Resources/functions.php" - ], - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony String component", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "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": "2020-06-11T12:16:36+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.10", + "version": "v3.4.47", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a" + "reference": "88289caa3c166321883f67fe5130188ebbb47094" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", + "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", + "reference": "88289caa3c166321883f67fe5130188ebbb47094", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" + "symfony/console": "~3.4|~4.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -2896,6 +2616,9 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v3.4.47" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -2910,56 +2633,57 @@ "type": "tidelift" } ], - "time": "2020-05-20T08:37:50+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { - "name": "webmozart/assert", - "version": "1.9.0", + "name": "theseer/tokenizer", + "version": "1.2.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } ], - "time": "2020-06-16T10:16:42+00:00" + "time": "2021-07-28T10:34:58+00:00" } ], "aliases": [], @@ -2968,9 +2692,9 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.3.0", + "php": ">=8.0.0", "ext-tokenizer": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.3.0" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9365857..e933133 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="tests/autoload.php" > @@ -18,7 +17,7 @@ - + ./tests/ @@ -29,14 +28,6 @@ - - - ./src/ - - - ./tests/ - - diff --git a/src/Fenom.php b/src/Fenom.php index f8603ad..80cb8da 100644 --- a/src/Fenom.php +++ b/src/Fenom.php @@ -8,7 +8,9 @@ * file that was distributed with this source code. */ use Fenom\Error\CompileException; +use Fenom\Provider; use Fenom\ProviderInterface; +use Fenom\Render; use Fenom\Template; /** @@ -73,7 +75,7 @@ class Fenom * @var int[] of possible options, as associative array * @see setOptions */ - private static $_options_list = array( + private static $_options_list = [ "disable_accessor" => self::DENY_ACCESSOR, "disable_methods" => self::DENY_METHODS, "disable_native_funcs" => self::DENY_NATIVE_FUNCS, @@ -87,71 +89,71 @@ class Fenom "disable_php_calls" => self::DENY_PHP_CALLS, "disable_statics" => self::DENY_STATICS, "strip" => self::AUTO_STRIP, - ); + ]; /** * @var callable[] */ - public $pre_filters = array(); + public array $pre_filters = []; /** * @var callable[] */ - public $filters = array(); + public array $filters = []; /** * @var callable[] */ - public $tag_filters = array(); + public array $tag_filters = []; /** * @var string[] */ - public $call_filters = array(); + public array $call_filters = []; /** * @var callable[] */ - public $post_filters = array(); + public array $post_filters = []; /** * @var Fenom\Render[] Templates storage */ - protected $_storage = array(); + protected array $_storage = []; /** * @var string compile directory */ - protected $_compile_dir = "/tmp"; + protected string $_compile_dir = "/tmp"; /** * @var string compile prefix ID template */ - protected $_compile_id; + protected string $_compile_id; /** * @var string[] compile directory for custom provider */ - protected $_compiles = array(); + protected array $_compiles = []; /** * @var int masked options */ - protected $_options = 0; + protected int $_options = 0; /** * @var ProviderInterface */ - private $_provider; + private ProviderInterface $_provider; /** * @var Fenom\ProviderInterface[] */ - protected $_providers = array(); + protected array $_providers = []; /** * @var string[] list of modifiers [modifier_name => callable] */ - protected $_modifiers = array( + protected array $_modifiers = [ "upper" => 'strtoupper', "up" => 'strtoupper', "lower" => 'strtolower', @@ -174,12 +176,12 @@ class Fenom "join" => 'Fenom\Modifier::join', "in" => 'Fenom\Modifier::in', "range" => 'Fenom\Modifier::range', - ); + ]; /** * @var array of allowed PHP functions */ - protected $_allowed_funcs = array( + protected array $_allowed_funcs = [ "count" => 1, "is_string" => 1, "is_array" => 1, @@ -198,168 +200,168 @@ class Fenom "nl2br" => 1, "explode" => 1, "implode" => 1 - ); + ]; /** * @var string[] the disabled functions by `disable_functions` PHP's option */ - protected $_disabled_funcs; + protected array $_disabled_funcs = []; /** * @var array[] of compilers and functions */ - protected $_actions = array( - 'foreach' => array( // {foreach ...} {break} {continue} {foreachelse} {/foreach} + protected array $_actions = [ + 'foreach' => [ // {foreach ...} {break} {continue} {foreachelse} {/foreach} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::foreachOpen', 'close' => 'Fenom\Compiler::foreachClose', - 'tags' => array( + 'tags' => [ 'foreachelse' => 'Fenom\Compiler::foreachElse', 'break' => 'Fenom\Compiler::tagBreak', 'continue' => 'Fenom\Compiler::tagContinue', - ), - 'float_tags' => array('break' => 1, 'continue' => 1) - ), - 'if' => array( // {if ...} {elseif ...} {else} {/if} + ], + 'float_tags' => ['break' => 1, 'continue' => 1] + ], + 'if' => [ // {if ...} {elseif ...} {else} {/if} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::ifOpen', 'close' => 'Fenom\Compiler::stdClose', - 'tags' => array( + 'tags' => [ 'elseif' => 'Fenom\Compiler::tagElseIf', 'else' => 'Fenom\Compiler::tagElse' - ) - ), - 'switch' => array( // {switch ...} {case ..., ...} {default} {/switch} + ] + ], + 'switch' => [ // {switch ...} {case ..., ...} {default} {/switch} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::switchOpen', 'close' => 'Fenom\Compiler::switchClose', - 'tags' => array( + 'tags' => [ 'case' => 'Fenom\Compiler::tagCase', 'default' => 'Fenom\Compiler::tagDefault' - ), - 'float_tags' => array('break' => 1) - ), - 'for' => array( // {for ...} {break} {continue} {/for} + ], + 'float_tags' => ['break' => 1] + ], + 'for' => [ // {for ...} {break} {continue} {/for} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::forOpen', 'close' => 'Fenom\Compiler::forClose', - 'tags' => array( + 'tags' => [ 'forelse' => 'Fenom\Compiler::forElse', 'break' => 'Fenom\Compiler::tagBreak', 'continue' => 'Fenom\Compiler::tagContinue', - ), - 'float_tags' => array('break' => 1, 'continue' => 1) - ), - 'while' => array( // {while ...} {break} {continue} {/while} + ], + 'float_tags' => ['break' => 1, 'continue' => 1] + ], + 'while' => [ // {while ...} {break} {continue} {/while} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::whileOpen', 'close' => 'Fenom\Compiler::stdClose', - 'tags' => array( + 'tags' => [ 'break' => 'Fenom\Compiler::tagBreak', 'continue' => 'Fenom\Compiler::tagContinue', - ), - 'float_tags' => array('break' => 1, 'continue' => 1) - ), - 'include' => array( // {include ...} + ], + 'float_tags' => ['break' => 1, 'continue' => 1] + ], + 'include' => [ // {include ...} 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagInclude' - ), - 'insert' => array( // {include ...} + ], + 'insert' => [ // {include ...} 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagInsert' - ), - 'var' => array( // {var ...} + ], + 'var' => [ // {var ...} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::setOpen', 'close' => 'Fenom\Compiler::setClose' - ), - 'set' => array( // {set ...} + ], + 'set' => [ // {set ...} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::setOpen', 'close' => 'Fenom\Compiler::setClose' - ), - 'add' => array( // {add ...} + ], + 'add' => [ // {add ...} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::setOpen', 'close' => 'Fenom\Compiler::setClose' - ), - 'do' => array( // {do ...} + ], + 'do' => [ // {do ...} 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagDo' - ), - 'block' => array( // {block ...} {parent} {/block} + ], + 'block' => [ // {block ...} {parent} {/block} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::tagBlockOpen', 'close' => 'Fenom\Compiler::tagBlockClose', - 'tags' => array('parent' => 'Fenom\Compiler::tagParent'), - 'float_tags' => array('parent' => 1) - ), - 'extends' => array( // {extends ...} + 'tags' => ['parent' => 'Fenom\Compiler::tagParent'], + 'float_tags' => ['parent' => 1] + ], + 'extends' => [ // {extends ...} 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagExtends' - ), - 'use' => array( // {use} + ], + 'use' => [ // {use} 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagUse' - ), - 'filter' => array( // {filter} ... {/filter} + ], + 'filter' => [ // {filter} ... {/filter} 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::filterOpen', 'close' => 'Fenom\Compiler::filterClose' - ), - 'macro' => array( + ], + 'macro' => [ 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::macroOpen', 'close' => 'Fenom\Compiler::macroClose' - ), - 'import' => array( + ], + 'import' => [ 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagImport' - ), - 'cycle' => array( + ], + 'cycle' => [ 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagCycle' - ), - 'raw' => array( + ], + 'raw' => [ 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagRaw' - ), - 'autoescape' => array( // deprecated + ], + 'autoescape' => [ // deprecated 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::escapeOpen', 'close' => 'Fenom\Compiler::nope' - ), - 'escape' => array( + ], + 'escape' => [ 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::escapeOpen', 'close' => 'Fenom\Compiler::nope' - ), - 'strip' => array( + ], + 'strip' => [ 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::stripOpen', 'close' => 'Fenom\Compiler::nope' - ), - 'ignore' => array( + ], + 'ignore' => [ 'type' => self::BLOCK_COMPILER, 'open' => 'Fenom\Compiler::ignoreOpen', 'close' => 'Fenom\Compiler::nope' - ), - 'unset' => array( + ], + 'unset' => [ 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagUnset' - ), - 'paste' => array( // {include ...} + ], + 'paste' => [ // {include ...} 'type' => self::INLINE_COMPILER, 'parser' => 'Fenom\Compiler::tagPaste' - ), - ); + ], + ]; /** * List of tests * @see https://github.com/bzick/fenom/blob/develop/docs/operators.md#test-operator * @var array */ - protected $_tests = array( + protected array $_tests = [ 'integer' => 'is_int(%s)', 'int' => 'is_int(%s)', 'float' => 'is_float(%s)', @@ -385,9 +387,9 @@ class Fenom 'odd' => '(%s & 1)', 'even' => '!(%s %% 2)', 'third' => '!(%s %% 3)' - ); + ]; - protected $_accessors = array( + protected array $_accessors = [ 'get' => 'Fenom\Accessor::getVar', 'env' => 'Fenom\Accessor::getVar', 'post' => 'Fenom\Accessor::getVar', @@ -405,7 +407,7 @@ class Fenom 'tag' => 'Fenom\Accessor::Tag', 'fetch' => 'Fenom\Accessor::fetch', 'block' => 'Fenom\Accessor::block', - ); + ]; /** * Just factory @@ -416,7 +418,11 @@ class Fenom * @throws InvalidArgumentException * @return Fenom */ - public static function factory($source, $compile_dir = '/tmp', $options = 0) + public static function factory( + string|Fenom\ProviderInterface $source, + string $compile_dir = '/tmp', + int|array $options = 0 + ): Fenom { if (is_string($source)) { $provider = new Fenom\Provider($source); @@ -426,7 +432,6 @@ class Fenom throw new InvalidArgumentException("Source must be a valid path or provider object"); } $fenom = new static($provider); - /* @var Fenom $fenom */ $fenom->setCompileDir($compile_dir); if ($options) { $fenom->setOptions($options); @@ -447,9 +452,9 @@ class Fenom * * @param string $dir directory to store compiled templates in * @throws LogicException - * @return Fenom + * @return $this */ - public function setCompileDir($dir) + public function setCompileDir(string $dir): static { if (!is_writable($dir)) { throw new LogicException("Cache directory $dir is not writable"); @@ -462,9 +467,9 @@ class Fenom * Set compile prefix ID template * * @param string $id prefix ID to store compiled templates - * @return Fenom + * @return $this */ - public function setCompileId($id) + public function setCompileId(string $id): static { $this->_compile_id = $id; return $this; @@ -473,15 +478,18 @@ class Fenom /** * * @param callable $cb - * @return self + * @return $this */ - public function addPreFilter($cb) + public function addPreFilter(callable $cb): static { $this->pre_filters[] = $cb; return $this; } - public function getPreFilters() + /** + * @return callable[] + */ + public function getPreFilters(): array { return $this->pre_filters; } @@ -489,16 +497,18 @@ class Fenom /** * * @param callable $cb - * @return self + * @return $this */ - public function addPostFilter($cb) + public function addPostFilter(callable $cb): static { $this->post_filters[] = $cb; return $this; } - - public function getPostFilters() + /** + * @return callable[] + */ + public function getPostFilters(): array { return $this->post_filters; } @@ -507,14 +517,14 @@ class Fenom * @param callable $cb * @return self */ - public function addFilter($cb) + public function addFilter(callable $cb): static { $this->filters[] = $cb; return $this; } - public function getFilters() + public function getFilters(): array { return $this->filters; } @@ -523,14 +533,14 @@ class Fenom * @param callable $cb * @return self */ - public function addTagFilter($cb) + public function addTagFilter(callable $cb): static { $this->tag_filters[] = $cb; return $this; } - public function getTagFilters() + public function getTagFilters(): array { return $this->tag_filters; } @@ -542,7 +552,7 @@ class Fenom * @param callable $callback the modifier callback * @return Fenom */ - public function addModifier($modifier, $callback) + public function addModifier(string $modifier, callable $callback): static { $this->_modifiers[$modifier] = $callback; return $this; @@ -555,7 +565,7 @@ class Fenom * @param callable $parser * @return Fenom */ - public function addCompiler($compiler, $parser) + public function addCompiler(string $compiler, callable $parser): static { $this->_actions[$compiler] = array( 'type' => self::INLINE_COMPILER, @@ -569,7 +579,7 @@ class Fenom * @param string|object $storage * @return $this */ - public function addCompilerSmart($compiler, $storage) + public function addCompilerSmart(string $compiler, string|object $storage): static { if (method_exists($storage, "tag" . $compiler)) { $this->_actions[$compiler] = array( @@ -585,11 +595,17 @@ class Fenom * * @param string $compiler * @param callable $open_parser - * @param callable|string $close_parser + * @param callable $close_parser * @param array $tags * @return Fenom */ - public function addBlockCompiler($compiler, $open_parser, $close_parser = self::DEFAULT_CLOSE_COMPILER, array $tags = array()) { + public function addBlockCompiler( + string $compiler, + callable $open_parser, + callable $close_parser = self::DEFAULT_CLOSE_COMPILER, + array $tags = [] + ): static + { $this->_actions[$compiler] = array( 'type' => self::BLOCK_COMPILER, 'open' => $open_parser, @@ -600,14 +616,19 @@ class Fenom } /** - * @param $compiler - * @param $storage + * @param string $compiler + * @param string|object $storage * @param array $tags * @param array $floats * @throws LogicException * @return Fenom */ - public function addBlockCompilerSmart($compiler, $storage, array $tags, array $floats = array()) + public function addBlockCompilerSmart( + string $compiler, + string|object $storage, + array $tags, + array $floats = [] + ): static { $c = array( 'type' => self::BLOCK_COMPILER, @@ -641,10 +662,10 @@ class Fenom /** * @param string $function * @param callable $callback - * @param callable|string $parser + * @param callable $parser * @return Fenom */ - public function addFunction($function, $callback, $parser = self::DEFAULT_FUNC_PARSER) + public function addFunction(string $function, callable $callback, callable $parser = self::DEFAULT_FUNC_PARSER): static { $this->_actions[$function] = array( 'type' => self::INLINE_FUNCTION, @@ -659,7 +680,7 @@ class Fenom * @param callable $callback * @return Fenom */ - public function addFunctionSmart($function, $callback) + public function addFunctionSmart(string $function, callable $callback): static { $this->_actions[$function] = array( 'type' => self::INLINE_FUNCTION, @@ -672,11 +693,16 @@ class Fenom /** * @param string $function * @param callable $callback - * @param callable|string $parser_open - * @param callable|string $parser_close + * @param callable $parser_open + * @param callable $parser_close * @return Fenom */ - public function addBlockFunction($function, $callback, $parser_open = self::DEFAULT_FUNC_OPEN, $parser_close = self::DEFAULT_FUNC_CLOSE) + public function addBlockFunction( + string $function, + callable $callback, + callable $parser_open = self::DEFAULT_FUNC_OPEN, + callable $parser_close = self::DEFAULT_FUNC_CLOSE + ): static { $this->_actions[$function] = array( 'type' => self::BLOCK_FUNCTION, @@ -691,7 +717,7 @@ class Fenom * @param array $funcs * @return Fenom */ - public function addAllowedFunctions(array $funcs) + public function addAllowedFunctions(array $funcs): static { $this->_allowed_funcs = $this->_allowed_funcs + array_flip($funcs); return $this; @@ -700,31 +726,32 @@ class Fenom /** * Add custom test * @param string $name test name - * @param string $code test PHP code. Code may contains placeholder %s, which will be replaced by test-value. For example: is_callable(%s) + * @param string $code test PHP code. Code may contain placeholder %s, which will be replaced by test-value. For example: is_callable(%s) */ - public function addTest($name, $code) + public function addTest(string $name, string $code): static { $this->_tests[$name] = $code; + return $this; } /** * Get test code by name * @param string $name - * @return string|bool + * @return string */ - public function getTest($name) + public function getTest(string $name): string { - return isset($this->_tests[$name]) ? $this->_tests[$name] : false; + return $this->_tests[$name] ?? ""; } /** * Return modifier function * * @param string $modifier - * @param Fenom\Template $template + * @param Template|null $template * @return mixed */ - public function getModifier($modifier, Template $template = null) + public function getModifier(string $modifier, Fenom\Template $template = null): static { if (isset($this->_modifiers[$modifier])) { return $this->_modifiers[$modifier]; @@ -741,7 +768,7 @@ class Fenom * @param Fenom\Template $template * @return bool */ - protected function _loadModifier($modifier, $template) + protected function _loadModifier(string $modifier, Fenom\Template $template): bool { return false; } @@ -750,10 +777,10 @@ class Fenom * Returns tag info * * @param string $tag - * @param Fenom\Template $template - * @return string|bool + * @param Template|null $template + * @return array|null */ - public function getTag($tag, Template $template = null) + public function getTag(string $tag, Template $template = null): ?array { if (isset($this->_actions[$tag])) { return $this->_actions[$tag]; @@ -766,11 +793,11 @@ class Fenom * Tags autoloader * @param string $tag * @param Fenom\Template $template - * @return bool + * @return array|null */ - protected function _loadTag($tag, $template) + protected function _loadTag(string $tag, Template $template): ?array { - return false; + return null; } /** @@ -779,13 +806,12 @@ class Fenom * @param string $function the function name * @return bool */ - public function isAllowedFunction($function) + public function isAllowedFunction(string $function): bool { - $function = (string) $function; $allow = ($this->_options & self::DENY_NATIVE_FUNCS) ? isset($this->_allowed_funcs[$function]) : function_exists($function); - return $allow && !in_array($function, $this->getDisabledFuncs(), true); + return $allow && !in_array($function, $this->_getDisabledFuncs(), true); } /** @@ -793,18 +819,8 @@ class Fenom * * @return string[] */ - protected function _getDisabledFuncs() + protected function _getDisabledFuncs(): array { - if (!is_array($this->_disabled_funcs)) { - $disabled = ini_get('disable_functions'); - // adds execution functions to disabled for security - $this->_disabled_funcs = array_merge( - empty($disabled) ? [] : explode(',', $disabled), - array('exec', 'system', 'passthru', 'shell_exec', 'pcntl_exec', 'proc_open', 'popen'), - array('call_user_func', 'call_user_func_array') - ); - } - return $this->_disabled_funcs; } @@ -812,9 +828,9 @@ class Fenom * @param string $tag * @return array */ - public function getTagOwners($tag) + public function getTagOwners(string $tag): array { - $tags = array(); + $tags = []; foreach ($this->_actions as $owner => $params) { if (isset($params["tags"][$tag])) { $tags[] = $owner; @@ -828,10 +844,10 @@ class Fenom * * @param string $scm scheme name * @param Fenom\ProviderInterface $provider provider object - * @param string $compile_path + * @param string|null $compile_path * @return $this */ - public function addProvider($scm, \Fenom\ProviderInterface $provider, $compile_path = null) + public function addProvider(string $scm, ProviderInterface $provider, string $compile_path = null): static { $this->_providers[$scm] = $provider; if ($compile_path) { @@ -845,7 +861,7 @@ class Fenom * @param int|array $options * @return $this */ - public function setOptions($options) + public function setOptions(int|array $options): static { if (is_array($options)) { $options = self::_makeMask($options, self::$_options_list, $this->_options); @@ -859,7 +875,7 @@ class Fenom * Get options as bits * @return int */ - public function getOptions() + public function getOptions(): int { return $this->_options; } @@ -870,7 +886,7 @@ class Fenom * @param callable $parser * @return Fenom */ - public function addAccessor($name, $parser) + public function addAccessor(string $name, callable $parser): static { $this->_accessors[$name] = $parser; return $this; @@ -883,7 +899,7 @@ class Fenom * @param string $parser * @return Fenom */ - public function addAccessorSmart($name, $accessor, $parser = self::ACCESSOR_VAR) + public function addAccessorSmart(string $name, mixed $accessor, string $parser = self::ACCESSOR_VAR): static { $this->_accessors[$name] = array( "accessor" => $accessor, @@ -898,7 +914,7 @@ class Fenom * @param callable $callback * @return Fenom */ - public function addAccessorCallback($name, $callback) + public function addAccessorCallback(string $name, callable $callback): static { $this->_accessors[$name] = array( "callback" => $callback @@ -911,7 +927,7 @@ class Fenom * @param string $name * @return Fenom */ - public function removeAccessor($name) + public function removeAccessor(string $name): static { unset($this->_accessors[$name]); return $this; @@ -920,10 +936,10 @@ class Fenom /** * Get an accessor * @param string $name - * @param string $key - * @return callable + * @param string|null $key + * @return callable|null */ - public function getAccessor($name, $key = null) + public function getAccessor(string $name,string $key = null): ?callable { if(isset($this->_accessors[$name])) { if($key) { @@ -932,7 +948,7 @@ class Fenom return $this->_accessors[$name]; } } else { - return false; + return null; } } @@ -942,18 +958,18 @@ class Fenom * @param string $pattern * @return $this */ - public function addCallFilter($pattern) + public function addCallFilter(string $pattern): static { $this->call_filters[] = $pattern; return $this; } /** - * @param bool|string $scm - * @return Fenom\ProviderInterface + * @param string|null $scm + * @return ProviderInterface * @throws InvalidArgumentException */ - public function getProvider($scm = false) + public function getProvider(string $scm = null): Fenom\ProviderInterface { if ($scm) { if (isset($this->_providers[$scm])) { @@ -971,7 +987,7 @@ class Fenom * * @return Fenom\Template */ - public function getRawTemplate(Template $parent = null) + public function getRawTemplate(Template $parent = null): Template { return new Template($this, $this->_options, $parent); } @@ -983,20 +999,22 @@ class Fenom * If it is array of names of templates they will be extended from left to right. * @param array $vars array of data for template * @return Fenom\Render + * @throws CompileException */ - public function display($template, array $vars = array()) + public function display(string|array $template, array $vars = array()): Fenom\Render { return $this->getTemplate($template)->display($vars); } /** * - * @param string|array $template name of template. + * @param array|string $template name of template. * If it is array of names of templates they will be extended from left to right. * @param array $vars array of data for template * @return mixed + * @throws Exception */ - public function fetch($template, array $vars = array()) + public function fetch(array|string $template, array $vars = array()): mixed { return $this->getTemplate($template)->fetch($vars); } @@ -1004,14 +1022,15 @@ class Fenom /** * Creates pipe-line of template's data to callback * @note Method not works correctly in old PHP 5.3.* - * @param string|array $template name of the template. + * @param array|string $template name of the template. * If it is array of names of templates they will be extended from left to right. * @param callable $callback template's data handler * @param array $vars - * @param float $chunk amount of bytes of chunk + * @param int $chunk amount of bytes of chunk * @return array + * @throws CompileException */ - public function pipe($template, $callback, array $vars = array(), $chunk = 1e6) + public function pipe(array|string $template, callable $callback, array $vars = array(), int $chunk = 1_000_000): array { ob_start($callback, $chunk, PHP_OUTPUT_HANDLER_STDFLAGS); $data = $this->getTemplate($template)->display($vars); @@ -1022,11 +1041,12 @@ class Fenom /** * Get template by name * - * @param string $template template name with schema + * @param string|array $template template name with schema * @param int $options additional options and flags - * @return Fenom\Template + * @return Fenom\Render + * @throws CompileException */ - public function getTemplate($template, $options = 0) + public function getTemplate(string|array $template, int $options = 0): Render { $options |= $this->_options; if (is_array($template)) { @@ -1054,7 +1074,7 @@ class Fenom * @param string $template * @return bool */ - public function templateExists($template) + public function templateExists(string $template): bool { $key = $this->_options . "@" . $template; if (isset($this->_storage[$key])) { // already loaded @@ -1076,8 +1096,9 @@ class Fenom * @param string $template * @param int $opts * @return Fenom\Render + * @throws CompileException */ - protected function _load($template, $opts) + protected function _load(string $template, int $opts): Render { $file_name = $this->getCompileName($template, $opts); if (is_file($this->_compile_dir . "/" . $file_name)) { @@ -1101,7 +1122,7 @@ class Fenom * @param int $options additional options * @return string */ - public function getCompileName($tpl, $options = 0) + public function getCompileName(array|string $tpl, int $options = 0): string { $options = $this->_options | $options; if (is_array($tpl)) { @@ -1123,13 +1144,13 @@ class Fenom /** * Compile and save template * - * @param string|array $tpl + * @param array|string $tpl * @param bool $store store template on disk * @param int $options + * @return Template * @throws CompileException - * @return \Fenom\Template */ - public function compile($tpl, $store = true, $options = 0) + public function compile(array|string $tpl, bool $store = true, int $options = 0): Template { if (is_string($tpl)) { $template = $this->getRawTemplate()->load($tpl); @@ -1157,17 +1178,17 @@ class Fenom /** * Flush internal template in-memory-cache */ - public function flush() + public function flush(): void { - $this->_storage = array(); + $this->_storage = []; } /** * Remove all compiled templates */ - public function clearAllCompiles() + public function clearAllCompiles(): void { - \Fenom\Provider::clean($this->_compile_dir); + Provider::clean($this->_compile_dir); $this->flush(); } @@ -1178,7 +1199,7 @@ class Fenom * @param string $name * @return Fenom\Template */ - public function compileCode($code, $name = 'Runtime compile') + public function compileCode(string $code, string $name = 'Runtime compile'): Template { return $this->getRawTemplate()->source($name, $code); } @@ -1191,9 +1212,9 @@ class Fenom * @param array $options possible values, ["a" => 0b001, "b" => 0b010, "c" => 0b100] * @param int $mask the initial value of the mask * @return int result, ( $mask | a ) & ~b - * @throws \RuntimeException if key from custom assoc doesn't exists into possible values + * @throws \RuntimeException if key from custom assoc doesn't exist into possible values */ - private static function _makeMask(array $values, array $options, $mask = 0) + private static function _makeMask(array $values, array $options, int $mask = 0): int { foreach ($values as $key => $value) { if (isset($options[$key])) { @@ -1208,24 +1229,4 @@ class Fenom } return $mask; } - - /** - * Register PSR-0 autoload - * @param string $dir custom directory for autoloading, if NULL — autoload itself - * @return bool - */ - public static function registerAutoload($dir = null) - { - if (!$dir) { - $dir = __DIR__; - } - return spl_autoload_register( - function ($classname) use ($dir) { - $file = $dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php'; - if (is_file($file)) { - require_once $file; - } - } - ); - } } diff --git a/src/Fenom/Accessor.php b/src/Fenom/Accessor.php index 32bcf91..7635253 100644 --- a/src/Fenom/Accessor.php +++ b/src/Fenom/Accessor.php @@ -84,7 +84,7 @@ class Accessor { */ public static function getVar(Tokenizer $tokens, Template $tpl) { - $name = $tokens->prev[Tokenizer::TEXT]; + $name = $tokens->prevToken()[Tokenizer::TEXT]; if(isset(self::$vars[$name])) { $var = $tpl->parseVariable($tokens, self::$vars[$name]); return "(isset($var) ? $var : null)"; diff --git a/src/Fenom/Error/UnexpectedTokenException.php b/src/Fenom/Error/UnexpectedTokenException.php index a31557b..3db32d7 100644 --- a/src/Fenom/Error/UnexpectedTokenException.php +++ b/src/Fenom/Error/UnexpectedTokenException.php @@ -24,7 +24,7 @@ class UnexpectedTokenException extends \RuntimeException } else { $expect = ""; } - if (!$tokens->curr) { + if (!$tokens->currToken()) { $this->message = "Unexpected end of " . ($where ? : "expression") . "$expect"; } else { $this->message = "Unexpected token '" . $tokens->current() . "' in " . ($where ? : "expression") . "$expect"; diff --git a/src/Fenom/Template.php b/src/Fenom/Template.php index 0e060a4..714773d 100644 --- a/src/Fenom/Template.php +++ b/src/Fenom/Template.php @@ -951,8 +951,8 @@ class Template extends Render $code .= '->' . $tokens->next()->getAndNext(); } if ($tokens->current() === "." || $tokens->current() === "[") { - $code = substr($code, 0, -strlen($tokens->prev[1])); - $code .= $this->parseVariable($tokens, $tokens->prev[1]); + $code = substr($code, 0, -strlen($tokens->prevToken()[1])); + $code .= $this->parseVariable($tokens, $tokens->prevToken()[1]); } } while ($tokens->is('(', T_OBJECT_OPERATOR)); diff --git a/src/Fenom/Tokenizer.php b/src/Fenom/Tokenizer.php index 6273e43..834dcdf 100644 --- a/src/Fenom/Tokenizer.php +++ b/src/Fenom/Tokenizer.php @@ -19,9 +19,6 @@ use Fenom\Error\UnexpectedTokenException; * - Line number of the token * * @see http://php.net/tokenizer - * @property array $prev the previous token - * @property array $curr the current token - * @property array $next the next token * * @package Fenom * @author Ivan Shalganov @@ -70,18 +67,18 @@ class Tokenizer */ const MACRO_COND = 1008; - public $tokens; - public $p = 0; - public $quotes = 0; - private $_max = 0; - private $_last_no = 0; + public array $tokens; + public int $p = 0; + public int $quotes = 0; + private int $_max; + private mixed $_last_no; /** * @see http://docs.php.net/manual/en/tokens.php * @var array groups of tokens */ - public static $macros = array( - self::MACRO_STRING => array( + public static array $macros = [ + self::MACRO_STRING => [ \T_ABSTRACT => 1, \T_ARRAY => 1, \T_AS => 1, \T_BREAK => 1, \T_CASE => 1, \T_CATCH => 1, \T_CLASS => 1, \T_CLASS_C => 1, \T_CLONE => 1, \T_CONST => 1, \T_CONTINUE => 1, @@ -92,23 +89,23 @@ class Tokenizer \T_EXTENDS => 1, \T_FILE => 1, \T_FINAL => 1, \T_FOR => 1, \T_FOREACH => 1, \T_FUNCTION => 1, \T_FUNC_C => 1, \T_GLOBAL => 1, \T_GOTO => 1, \T_HALT_COMPILER => 1, \T_IF => 1, \T_IMPLEMENTS => 1, - \T_INCLUDE => 1, \T_INCLUDE_ONCE => 1, \T_INSTANCEOF => 1, 341 /* T_INSTEADOF */ => 1, + \T_INCLUDE => 1, \T_INCLUDE_ONCE => 1, \T_INSTANCEOF => 1, \T_INSTEADOF => 1, \T_INTERFACE => 1, \T_ISSET => 1, \T_LINE => 1, \T_LIST => 1, \T_LOGICAL_AND => 1, \T_LOGICAL_OR => 1, \T_LOGICAL_XOR => 1, \T_METHOD_C => 1, \T_NAMESPACE => 1, \T_NS_C => 1, \T_NEW => 1, \T_PRINT => 1, \T_PRIVATE => 1, \T_PUBLIC => 1, \T_PROTECTED => 1, \T_REQUIRE => 1, - \T_REQUIRE_ONCE => 1, \T_RETURN => 1, \T_RETURN => 1, \T_STRING => 1, - \T_SWITCH => 1, \T_THROW => 1, 355 /* T_TRAIT */ => 1, 365 /* T_TRAIT_C */ => 1, + \T_REQUIRE_ONCE => 1, \T_RETURN => 1, \T_STRING => 1, + \T_SWITCH => 1, \T_THROW => 1, \T_TRAIT => 1, \T_TRAIT_C => 1, \T_TRY => 1, \T_UNSET => 1, \T_USE => 1, \T_VAR => 1, - \T_WHILE => 1, 267 /* T_YIELD */ => 1 - ), - self::MACRO_INCDEC => array( + \T_WHILE => 1, \T_YIELD => 1, \T_YIELD_FROM => 1 + ], + self::MACRO_INCDEC => [ \T_INC => 1, \T_DEC => 1 - ), - self::MACRO_UNARY => array( + ], + self::MACRO_UNARY => [ "!" => 1, "~" => 1, "-" => 1 - ), - self::MACRO_BINARY => array( + ], + self::MACRO_BINARY => [ \T_BOOLEAN_AND => 1, \T_BOOLEAN_OR => 1, \T_IS_GREATER_OR_EQUAL => 1, \T_IS_EQUAL => 1, \T_IS_IDENTICAL => 1, \T_IS_NOT_EQUAL => 1, \T_IS_NOT_IDENTICAL => 1, \T_IS_SMALLER_OR_EQUAL => 1, \T_LOGICAL_AND => 1, @@ -117,36 +114,36 @@ class Tokenizer "*" => 1, "/" => 1, ">" => 1, "<" => 1, "^" => 1, "%" => 1, "&" => 1 - ), - self::MACRO_BOOLEAN => array( + ], + self::MACRO_BOOLEAN => [ \T_LOGICAL_OR => 1, \T_LOGICAL_XOR => 1, \T_BOOLEAN_AND => 1, \T_BOOLEAN_OR => 1, \T_LOGICAL_AND => 1 - ), - self::MACRO_MATH => array( + ], + self::MACRO_MATH => [ "+" => 1, "-" => 1, "*" => 1, "/" => 1, "^" => 1, "%" => 1, "&" => 1, "|" => 1 - ), - self::MACRO_COND => array( + ], + self::MACRO_COND => [ \T_IS_EQUAL => 1, \T_IS_IDENTICAL => 1, ">" => 1, "<" => 1, \T_SL => 1, \T_SR => 1, \T_IS_NOT_EQUAL => 1, \T_IS_NOT_IDENTICAL => 1, \T_IS_SMALLER_OR_EQUAL => 1, - ), - self::MACRO_EQUALS => array( + ], + self::MACRO_EQUALS => [ \T_AND_EQUAL => 1, \T_DIV_EQUAL => 1, \T_MINUS_EQUAL => 1, \T_MOD_EQUAL => 1, \T_MUL_EQUAL => 1, \T_OR_EQUAL => 1, \T_PLUS_EQUAL => 1, \T_SL_EQUAL => 1, \T_SR_EQUAL => 1, \T_XOR_EQUAL => 1, '=' => 1, - ), - self::MACRO_SCALAR => array( + ], + self::MACRO_SCALAR => [ \T_LNUMBER => 1, \T_DNUMBER => 1, \T_CONSTANT_ENCAPSED_STRING => 1 - ) - ); + ] + ]; - public static $description = array( + public static array $description = [ self::MACRO_STRING => 'string', self::MACRO_INCDEC => 'increment/decrement operator', self::MACRO_UNARY => 'unary operator', @@ -156,26 +153,33 @@ class Tokenizer self::MACRO_COND => 'conditional operator', self::MACRO_EQUALS => 'equal operator', self::MACRO_SCALAR => 'scalar value' - ); + ]; /** * Special tokens * @var array */ - private static $spec = array( + private static array $spec = [ 'true' => 1, 'false' => 1, 'null' => 1, 'TRUE' => 1, 'FALSE' => 1, 'NULL' => 1 - ); + ]; + + private ?array $_next; + private ?array $_prev; + private ?array $_curr; /** - * @param $query + * @param string $query */ - public function __construct($query) + public function __construct(string $query) { + $this->_curr = null; + $this->_next = null; + $this->_prev = null; $tokens = array(-1 => array(\T_WHITESPACE, '', '', 1)); $_tokens = token_get_all("quotes % 2) || ($this->tokens[$this->_max][0] === T_ENCAPSED_AND_WHITESPACE); } @@ -252,9 +256,10 @@ class Tokenizer * @link http://php.net/manual/en/iterator.current.php * @return mixed Can return any type. */ - public function current() + public function current(): mixed { - return $this->curr ? $this->curr[1] : null; + $curr = $this->currToken(); + return $curr ? $curr[1] : null; } /** @@ -263,13 +268,13 @@ class Tokenizer * @link http://php.net/manual/en/iterator.next.php * @return Tokenizer */ - public function next() + public function next(): static { if ($this->p > $this->_max) { return $this; } $this->p++; - unset($this->prev, $this->curr, $this->next); + $this->cleanTokenCache(); return $this; } @@ -277,10 +282,10 @@ class Tokenizer * Check token type. If token type is one of expected types return true. Otherwise return false * * @param array $expects - * @param string|int $token + * @param int|string $token * @return bool */ - private function _valid($expects, $token) + private function _valid(array $expects, int|string $token): bool { foreach ($expects as $expect) { if (is_string($expect) || $expect < 1000) { @@ -300,13 +305,13 @@ class Tokenizer /** * If the next token is a valid one, move the position of cursor one step forward. Otherwise throws an exception. * @param array $tokens - * @throws UnexpectedTokenException * @return mixed + * @throws UnexpectedTokenException */ - public function _next($tokens) + public function _next(array $tokens): void { $this->next(); - if (!$this->curr) { + if (!$this->currToken()) { throw new UnexpectedTokenException($this, $tokens); } if ($tokens) { @@ -323,7 +328,7 @@ class Tokenizer * Fetch next specified token or throw an exception * @return mixed */ - public function getNext( /*int|string $token1, int|string $token2, ... */) + public function getNext( /*int|string $token1, int|string $token2, ... */): mixed { $this->_next(func_get_args()); return $this->current(); @@ -333,9 +338,10 @@ class Tokenizer * @param $token * @return bool */ - public function isNextToken($token) + public function isNextToken($token): bool { - return $this->next ? $this->next[1] == $token : false; + $next = $this->nextToken(); + return $next && $next[1] == $token; } /** @@ -343,10 +349,11 @@ class Tokenizer * @return mixed * @throws UnexpectedTokenException */ - public function getAndNext( /* $token1, ... */) + public function getAndNext( /* $token1, ... */): mixed { - if ($this->curr) { - $cur = $this->curr[1]; + $curr = $this->currToken(); + if ($curr) { + $cur = $curr[1]; $this->next(); return $cur; } else { @@ -359,9 +366,10 @@ class Tokenizer * @param $token1 * @return bool */ - public function isNext($token1 /*, ...*/) + public function isNext($token1 /*, ...*/): bool { - return $this->next && $this->_valid(func_get_args(), $this->next[0]); + $next = $this->nextToken(); + return $next && $this->_valid(func_get_args(), $next[0]); } /** @@ -369,9 +377,10 @@ class Tokenizer * @param $token1 * @return bool */ - public function is($token1 /*, ...*/) + public function is($token1 /*, ...*/): bool { - return $this->curr && $this->_valid(func_get_args(), $this->curr[0]); + $curr = $this->currToken(); + return $curr && $this->_valid(func_get_args(), $curr[0]); } /** @@ -379,22 +388,24 @@ class Tokenizer * @param $token1 * @return bool */ - public function isPrev($token1 /*, ...*/) + public function isPrev($token1 /*, ...*/): bool { - return $this->prev && $this->_valid(func_get_args(), $this->prev[0]); + $prev = $this->prevToken(); + return $prev && $this->_valid(func_get_args(), $prev[0]); } /** * Get specified token * - * @param string|int $token1 - * @throws UnexpectedTokenException + * @param int|string $token1 * @return mixed + *@throws UnexpectedTokenException */ - public function get($token1 /*, $token2 ...*/) + public function get(int|string $token1 /*, $token2 ...*/): mixed { - if ($this->curr && $this->_valid(func_get_args(), $this->curr[0])) { - return $this->curr[1]; + $curr = $this->currToken(); + if ($curr && $this->_valid(func_get_args(), $curr[0])) { + return $curr[1]; } else { throw new UnexpectedTokenException($this, func_get_args()); } @@ -404,21 +415,21 @@ class Tokenizer * Step back * @return Tokenizer */ - public function back() + public function back(): static { if ($this->p === 0) { return $this; } $this->p--; - unset($this->prev, $this->curr, $this->next); + $this->cleanTokenCache(); return $this; } /** - * @param $token1 + * @param int|string $token1 * @return bool */ - public function hasBackList($token1 /*, $token2 ...*/) + public function hasBackList(int|string $token1 /*, $token2 ...*/): bool { $tokens = func_get_args(); $c = $this->p; @@ -431,27 +442,38 @@ class Tokenizer return true; } - /** - * Lazy load properties - * - * @param string $key - * @return mixed - */ - public function __get($key) + public function prevToken(): mixed { - switch ($key) { - case 'curr': - return $this->curr = ($this->p <= $this->_max) ? $this->tokens[$this->p] : null; - case 'next': - return $this->next = ($this->p + 1 <= $this->_max) ? $this->tokens[$this->p + 1] : null; - case 'prev': - return $this->prev = $this->p ? $this->tokens[$this->p - 1] : null; - default: - return $this->$key = null; + if ($this->_prev) { + return $this->_prev; } + return $this->_prev = $this->p ? $this->tokens[$this->p - 1] : null; } - public function count() + public function currToken(): mixed + { + if ($this->_curr !== null) { + return $this->_curr; + } + return $this->_curr = ($this->p <= $this->_max) ? $this->tokens[$this->p] : null; + } + + public function nextToken(): mixed + { + if ($this->_next) { + return $this->_next; + } + return $this->_next = ($this->p + 1 <= $this->_max) ? $this->tokens[$this->p + 1] : null; + } + + protected function cleanTokenCache(): void + { + $this->_prev = null; + $this->_curr = null; + $this->_next = null; + } + + public function count(): int { return $this->_max; } @@ -460,9 +482,10 @@ class Tokenizer * Return the key of the current element * @return mixed scalar on success, or null on failure. */ - public function key() + public function key(): mixed { - return $this->curr ? $this->curr[0] : null; + $curr = $this->currToken(); + return $curr ? $curr[0] : null; } /** @@ -470,18 +493,18 @@ class Tokenizer * @return boolean The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ - public function valid() + public function valid(): bool { - return (bool)$this->curr; + return (bool)$this->currToken(); } /** * Get token name * @static - * @param int|string $token - * @return string + * @param mixed $token + * @return string|null */ - public static function getName($token) + public static function getName(mixed $token): ?string { if (is_string($token)) { return $token; @@ -500,10 +523,11 @@ class Tokenizer * @throws UnexpectedTokenException * @return Tokenizer */ - public function skip( /*$token1, $token2, ...*/) + public function skip( /*$token1, $token2, ...*/): static { if (func_num_args()) { - if ($this->curr && $this->_valid(func_get_args(), $this->curr[0])) { + $curr = $this->currToken(); + if ($curr && $this->_valid(func_get_args(), $curr[0])) { $this->next(); return $this; } else { @@ -521,9 +545,10 @@ class Tokenizer * @param int|string $token1 * @return Tokenizer */ - public function skipIf($token1 /*, $token2, ...*/) + public function skipIf(int|string $token1 /*, $token2, ...*/): static { - if ($this->curr && $this->_valid(func_get_args(), $this->curr[0])) { + $curr = $this->currToken(); + if ($curr && $this->_valid(func_get_args(), $curr[0])) { $this->next(); } return $this; @@ -536,9 +561,10 @@ class Tokenizer * @return Tokenizer * @throws UnexpectedTokenException */ - public function need($token1 /*, $token2, ...*/) + public function need(int|string $token1 /*, $token2, ...*/): static { - if ($this->curr && $this->_valid(func_get_args(), $this->curr[0])) { + $curr = $this->currToken(); + if ($curr && $this->_valid(func_get_args(), $curr[0])) { return $this; } else { throw new UnexpectedTokenException($this, func_get_args()); @@ -551,7 +577,7 @@ class Tokenizer * @param int $after count tokens after current token * @return array */ - public function getSnippet($before = 0, $after = 0) + public function getSnippet(int $before = 0, int $after = 0): array { $from = 0; $to = $this->p; @@ -594,7 +620,7 @@ class Tokenizer * @param int $after * @return string */ - public function getSnippetAsString($before = 0, $after = 0) + public function getSnippetAsString(int $before = 0, int $after = 0): string { $str = ""; foreach ($this->getSnippet($before, $after) as $token) { @@ -607,7 +633,7 @@ class Tokenizer * Check if current is special value: true, TRUE, false, FALSE, null, NULL * @return bool */ - public function isSpecialVal() + public function isSpecialVal(): bool { return isset(self::$spec[$this->current()]); } @@ -616,7 +642,7 @@ class Tokenizer * Check if the token is last * @return bool */ - public function isLast() + public function isLast(): bool { return $this->p === $this->_max; } @@ -624,10 +650,10 @@ class Tokenizer /** * Move pointer to the end */ - public function end() + public function end(): static { $this->p = $this->_max; - unset($this->prev, $this->curr, $this->next); + $this->cleanTokenCache(); return $this; } @@ -635,23 +661,26 @@ class Tokenizer * Return line number of the current token * @return mixed */ - public function getLine() + public function getLine(): mixed { - return $this->curr ? $this->curr[3] : $this->_last_no; + $curr = $this->currToken(); + return $curr ? $curr[3] : $this->_last_no; } /** * Is current token whitespaced, means previous token has whitespace characters * @return bool */ - public function isWhiteSpaced() + public function isWhiteSpaced(): bool { - return $this->prev ? (bool)$this->prev[2] : false; + $prev = $this->prevToken(); + return $prev && $prev[2]; } public function getWhitespace() { - return $this->curr ? $this->curr[2] : false; + $curr = $this->currToken(); + return $curr ? $curr[2] : false; } /** @@ -659,10 +688,10 @@ class Tokenizer * @param int $p * @return $this */ - public function seek($p) + public function seek(int $p): static { $this->p = $p; - unset($this->prev, $this->curr, $this->next); + $this->cleanTokenCache(); return $this; } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 55dcf59..7c04289 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -53,7 +53,7 @@ class TestCase extends \PHPUnit\Framework\TestCase return FENOM_RESOURCES . '/compile'; } - public function setUp() + public function setUp(): void { if (!file_exists($this->getCompilePath())) { mkdir($this->getCompilePath(), 0777, true); @@ -89,7 +89,7 @@ class TestCase extends \PHPUnit\Framework\TestCase public static function inlineFunction($params) { - return isset($params["text"]) ? $params["text"] : ""; + return $params["text"] ?? ""; } public static function blockFunction($params, $text) @@ -97,7 +97,7 @@ class TestCase extends \PHPUnit\Framework\TestCase return $text; } - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!file_exists(FENOM_RESOURCES . '/template')) { mkdir(FENOM_RESOURCES . '/template', 0777, true); diff --git a/tests/autoload.php b/tests/autoload.php index 6672ece..9d71ebb 100644 --- a/tests/autoload.php +++ b/tests/autoload.php @@ -1,11 +1,7 @@ curr + $tokens->currToken() ); $this->assertSame("resolve", $tokens->getNext($tokens::MACRO_UNARY, T_STRING)); @@ -106,7 +106,6 @@ class TokenizerTest extends TestCase $this->assertSame($tokens, $tokens->next()); $tokens->p = -1000; $this->assertSame($tokens, $tokens->back()); - $this->assertNull($tokens->undef); } public function testFixFloats() { From 4cdfd306d9cd7b17ba7356de5840f89387408370 Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Sun, 5 Feb 2023 22:18:18 +0100 Subject: [PATCH 02/11] migrate to php8 --- src/Fenom/RangeIterator.php | 24 +++++++------ src/Fenom/Render.php | 72 ++++++++++++++++++------------------- src/Fenom/Tag.php | 67 +++++++++++++++++----------------- 3 files changed, 81 insertions(+), 82 deletions(-) diff --git a/src/Fenom/RangeIterator.php b/src/Fenom/RangeIterator.php index 8bb0a79..82c5656 100644 --- a/src/Fenom/RangeIterator.php +++ b/src/Fenom/RangeIterator.php @@ -2,15 +2,17 @@ namespace Fenom; +use Countable; +use Iterator; -class RangeIterator implements \Iterator, \Countable +class RangeIterator implements Iterator, Countable { - public $current; - public $index = 0; - public $min; - public $max; - public $step; + public int $current; + public int $index = 0; + public int $min; + public int $max; + public int $step; public function __construct($min, $max, $step = 1) { @@ -23,7 +25,7 @@ class RangeIterator implements \Iterator, \Countable * @param int $step * @return $this */ - public function setStep($step) + public function setStep(int $step): static { if($step > 0) { $this->current = min($this->min, $this->max); @@ -40,7 +42,7 @@ class RangeIterator implements \Iterator, \Countable /** * Return the current element */ - public function current() + public function current(): int { return $this->current; } @@ -58,7 +60,7 @@ class RangeIterator implements \Iterator, \Countable * Return the key of the current element * @return int */ - public function key() + public function key(): int { return $this->index; } @@ -67,7 +69,7 @@ class RangeIterator implements \Iterator, \Countable * Checks if current position is valid * @return bool */ - public function valid() + public function valid(): bool { return $this->current >= $this->min && $this->current <= $this->max; } @@ -88,7 +90,7 @@ class RangeIterator implements \Iterator, \Countable /** * Count elements of an object */ - public function count() + public function count(): int { return intval(($this->max - $this->min + 1) / $this->step); } diff --git a/src/Fenom/Render.php b/src/Fenom/Render.php index 64fd917..4cfc2a3 100644 --- a/src/Fenom/Render.php +++ b/src/Fenom/Render.php @@ -17,71 +17,72 @@ use Fenom; */ class Render extends \ArrayObject { - private static $_props = array( + private static array $_props = [ "name" => "runtime", "base_name" => "", "scm" => false, "time" => 0, - "depends" => array(), - "macros" => array() - ); + "depends" => [], + "macros" => [] + ]; /** * @var \Closure */ - protected $_code; + protected \Closure $_code; /** * Template name * @var string */ - protected $_name = 'runtime'; + protected mixed $_name = 'runtime'; /** * Provider's schema - * @var bool + * @var string|null */ - protected $_scm = false; + protected ?string $_scm; /** * Basic template name * @var string */ - protected $_base_name = 'runtime'; + protected string $_base_name = 'runtime'; /** * @var Fenom */ - protected $_fenom; + protected Fenom $_fenom; /** * Timestamp of compilation * @var float */ - protected $_time = 0.0; + protected float $_time = 0.0; /** * @var array depends list */ - protected $_depends = array(); + protected array $_depends = []; /** * @var int template options (see Fenom options) */ - protected $_options = 0; + protected int $_options = 0; /** * Template provider * @var ProviderInterface */ - protected $_provider; + protected ProviderInterface $_provider; /** * @var \Closure[] */ - protected $_macros; + protected array $_macros; /** * @param Fenom $fenom - * @param callable $code template body + * @param \Closure $code template body * @param array $props */ public function __construct(Fenom $fenom, \Closure $code, array $props = array()) { + parent::__construct(); $this->_fenom = $fenom; $props += self::$_props; $this->_name = $props["name"]; @@ -97,25 +98,25 @@ class Render extends \ArrayObject * Get template storage * @return \Fenom */ - public function getStorage() + public function getStorage(): Fenom { return $this->_fenom; } /** - * Get depends list + * Get list of dependencies. * @return array */ - public function getDepends() + public function getDepends(): array { return $this->_depends; } /** * Get schema name - * @return string + * @return string|null */ - public function getScm() + public function getScm(): ?string { return $this->_scm; } @@ -124,7 +125,7 @@ class Render extends \ArrayObject * Get provider of template source * @return ProviderInterface */ - public function getProvider() + public function getProvider(): ProviderInterface { return $this->_fenom->getProvider($this->_scm); } @@ -133,7 +134,7 @@ class Render extends \ArrayObject * Get name without schema * @return string */ - public function getBaseName() + public function getBaseName(): string { return $this->_base_name; } @@ -142,7 +143,7 @@ class Render extends \ArrayObject * Get parse options * @return int */ - public function getOptions() + public function getOptions(): int { return $this->_options; } @@ -159,7 +160,7 @@ class Render extends \ArrayObject * Get template name * @return string */ - public function getName() + public function getName(): string { return $this->_name; } @@ -174,7 +175,7 @@ class Render extends \ArrayObject * Validate template * @return bool */ - public function isValid() + public function isValid(): bool { foreach ($this->_depends as $scm => $templates) { $provider = $this->_fenom->getProvider($scm); @@ -197,7 +198,7 @@ class Render extends \ArrayObject * @throws \RuntimeException * @return mixed */ - public function getMacro($name) + public function getMacro($name): mixed { if (empty($this->_macros[$name])) { throw new \RuntimeException('macro ' . $name . ' not found'); @@ -208,9 +209,9 @@ class Render extends \ArrayObject /** * Execute template and write into output * @param array $values for template - * @return Render + * @return array */ - public function display(array $values) + public function display(array $values): array { $this->_code->__invoke($values, $this); return $values; @@ -222,7 +223,7 @@ class Render extends \ArrayObject * @return string * @throws \Exception */ - public function fetch(array $values) + public function fetch(array $values): string { ob_start(); try { @@ -236,17 +237,12 @@ class Render extends \ArrayObject /** * Stub - * @param $method - * @param $args + * @param string $method + * @param mixed $args * @throws \BadMethodCallException */ - public function __call($method, $args) + public function __call(string $method, mixed $args) { throw new \BadMethodCallException("Unknown method " . $method); } - - public function __get($name) - { - return $this->$name = null; - } } diff --git a/src/Fenom/Tag.php b/src/Fenom/Tag.php index 4e69c39..0456e5c 100644 --- a/src/Fenom/Tag.php +++ b/src/Fenom/Tag.php @@ -23,33 +23,34 @@ class Tag extends \ArrayObject /** * @var Template */ - public $tpl; - public $name; - public $options = array(); - public $line = 0; - public $level = 0; - public $callback; - public $escape; + public Template $tpl; + public string $name; + public array $options = []; + public int $line = 0; + public int $level = 0; + public mixed $callback; + public bool $escape; - private $_offset = 0; - private $_closed = true; - private $_body; - private $_type = 0; - private $_open; - private $_close; - private $_tags = array(); - private $_floats = array(); - private $_changed = array(); + private int $_offset = 0; + private bool $_closed = true; + private string $_body; + private int $_type = 0; + private string $_open; + private string $_close; + private array $_tags = []; + private array $_floats = []; + private array $_changed = []; /** * Create tag entity * @param string $name the tag name * @param Template $tpl current template - * @param string $info tag's information + * @param array $info tag's information * @param string $body template's code */ - public function __construct($name, Template $tpl, $info, &$body) + public function __construct(string $name, Template $tpl, array $info, string &$body) { + parent::__construct(); $this->tpl = $tpl; $this->name = $name; $this->line = $tpl->getLine(); @@ -62,8 +63,8 @@ class Tag extends \ArrayObject if ($this->_type & self::BLOCK) { $this->_open = $info["open"]; $this->_close = $info["close"]; - $this->_tags = isset($info["tags"]) ? $info["tags"] : array(); - $this->_floats = isset($info["float_tags"]) ? $info["float_tags"] : array(); + $this->_tags = $info["tags"] ?? []; + $this->_floats = $info["float_tags"] ?? []; $this->_closed = false; } else { $this->_open = $info["parser"]; @@ -79,7 +80,7 @@ class Tag extends \ArrayObject * @param string $option * @throws \RuntimeException */ - public function tagOption($option) + public function tagOption(string $option) { if (method_exists($this, 'opt' . $option)) { $this->options[] = $option; @@ -93,7 +94,7 @@ class Tag extends \ArrayObject * @param int $option option constant * @param bool $value true — add option, false — remove option */ - public function setOption($option, $value) + public function setOption(int $option, bool $value) { $actual = (bool)($this->tpl->getOptions() & $option); if ($actual != $value) { @@ -106,7 +107,7 @@ class Tag extends \ArrayObject * Restore the option * @param int $option */ - public function restore($option) + public function restore(int $option) { if (isset($this->_changed[$option])) { $this->tpl->setOption($option, $this->_changed[$option]); @@ -126,7 +127,7 @@ class Tag extends \ArrayObject * Check, if the tag closed * @return bool */ - public function isClosed() + public function isClosed(): bool { return $this->_closed; } @@ -137,7 +138,7 @@ class Tag extends \ArrayObject * @param Tokenizer $tokenizer * @return mixed */ - public function start($tokenizer) + public function start(Tokenizer $tokenizer): mixed { foreach ($this->options as $option) { $option = 'opt' . $option; @@ -153,7 +154,7 @@ class Tag extends \ArrayObject * @param int $level * @return bool */ - public function hasTag($tag, $level) + public function hasTag(string $tag, int $level): bool { if (isset($this->_tags[$tag])) { if ($level) { @@ -171,10 +172,10 @@ class Tag extends \ArrayObject * * @param string $tag * @param Tokenizer $tokenizer - * @throws \LogicException * @return string + * @throws \LogicException */ - public function tag($tag, $tokenizer) + public function tag(string $tag, Tokenizer $tokenizer): string { if (isset($this->_tags[$tag])) { return call_user_func($this->_tags[$tag], $tokenizer, $this); @@ -187,10 +188,10 @@ class Tag extends \ArrayObject * Close callback * * @param Tokenizer $tokenizer - * @throws \LogicException * @return string + * @throws \LogicException */ - public function end($tokenizer) + public function end(Tokenizer $tokenizer): string { if ($this->_closed) { throw new \LogicException("Tag {$this->name} already closed"); @@ -224,7 +225,7 @@ class Tag extends \ArrayObject * @throws \LogicException * @return string */ - public function getContent() + public function getContent(): string { return substr($this->_body, $this->_offset); } @@ -235,7 +236,7 @@ class Tag extends \ArrayObject * @return string * @throws \LogicException */ - public function cutContent() + public function cutContent(): string { $content = substr($this->_body, $this->_offset); $this->_body = substr($this->_body, 0, $this->_offset); @@ -258,7 +259,7 @@ class Tag extends \ArrayObject * @param string $code * @return string */ - public function out($code) + public function out(string $code): string { return $this->tpl->out($code, $this->escape); } From ba1bc18aba4b9a5f9772d5c230fe6446a98f40a9 Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Mon, 6 Feb 2023 23:49:54 +0100 Subject: [PATCH 03/11] migrate to php8 --- .gitignore | 3 +- README.md | 10 +- src/Fenom.php | 10 +- src/Fenom/Accessor.php | 42 ++++---- src/Fenom/Compiler.php | 9 +- src/Fenom/Modifier.php | 57 +++++------ src/Fenom/Render.php | 6 +- src/Fenom/Template.php | 214 +++++++++++++++++++++------------------- src/Fenom/Tokenizer.php | 1 + 9 files changed, 180 insertions(+), 172 deletions(-) diff --git a/.gitignore b/.gitignore index a8c7be1..f0c75a9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ composer.phar tests/resources/compile/* !.gitkeep tests/resources/template/* -sandbox/compiled/* \ No newline at end of file +sandbox/compiled/* +/.phpunit.result.cache diff --git a/README.md b/README.md index c385de4..70595d8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Fenom - Template Engine for PHP * **Subject:** Template engine * **Syntax:** Smarty-like * **Documentation:** **[English](./docs/en/readme.md)**, **[Russian](./docs/ru/readme.md)** -* **PHP version:** 5.4+ +* **PHP version:** 8.0+ * **State:** [![Build Status](https://travis-ci.org/fenom-template/fenom.svg?branch=master)](https://travis-ci.org/fenom-template/fenom) [![Coverage Status](https://coveralls.io/repos/fenom-template/fenom/badge.svg?branch=master)](https://coveralls.io/r/fenom-template/fenom?branch=master) * **Version:** [![Latest Stable Version](https://poser.pugx.org/fenom/fenom/v/stable.png)](https://packagist.org/packages/fenom/fenom) * **Packagist:** [fenom/fenom](https://packagist.org/packages/fenom/fenom) [![Total Downloads](https://poser.pugx.org/fenom/fenom/downloads.png)](https://packagist.org/packages/fenom/fenom) @@ -22,16 +22,10 @@ Fenom - Template Engine for PHP ### Install If you use composer in your project then you can to install Fenom as package. -However, if you are not using composer you have to configure _autoloader_ to work with Fenom. -Fenom implements the `PSR-0` PHP standard to load classes which are located in the `src/` directory. -Templater already has own autoload-function, to register call method `Fenom::registerAutoload`: -```php -Fenom::registerAutoload(); -``` ### Setup -There is two way to create Fenom instance: +There is two-way to create Fenom instance: * Long way: use operator `new` * Shot way: use static factory-method diff --git a/src/Fenom.php b/src/Fenom.php index 80cb8da..328542f 100644 --- a/src/Fenom.php +++ b/src/Fenom.php @@ -751,7 +751,7 @@ class Fenom * @param Template|null $template * @return mixed */ - public function getModifier(string $modifier, Fenom\Template $template = null): static + public function getModifier(string $modifier, Fenom\Template $template = null): string { if (isset($this->_modifiers[$modifier])) { return $this->_modifiers[$modifier]; @@ -765,12 +765,12 @@ class Fenom /** * Modifier autoloader * @param string $modifier - * @param Fenom\Template $template - * @return bool + * @param Template $template + * @return string|null */ - protected function _loadModifier(string $modifier, Fenom\Template $template): bool + protected function _loadModifier(string $modifier, Fenom\Template $template): ?string { - return false; + return null; } /** diff --git a/src/Fenom/Accessor.php b/src/Fenom/Accessor.php index 7635253..23e05d5 100644 --- a/src/Fenom/Accessor.php +++ b/src/Fenom/Accessor.php @@ -9,6 +9,7 @@ */ namespace Fenom; +use Fenom\Error\CompileException; use Fenom\Error\UnexpectedTokenException; /** @@ -16,7 +17,7 @@ use Fenom\Error\UnexpectedTokenException; * @package Fenom */ class Accessor { - public static $vars = array( + public static array $vars = array( 'get' => '$_GET', 'post' => '$_POST', 'session' => '$_SESSION', @@ -32,10 +33,11 @@ class Accessor { * @param string $var variable expression on PHP ('App::get("storage")->user') * @param Tokenizer $tokens * @param Template $tpl - * @param $is_var + * @param bool $is_var * @return string + * @throws CompileException */ - public static function parserVar($var, Tokenizer $tokens, Template $tpl, &$is_var) + public static function parserVar(string $var, Tokenizer $tokens, Template $tpl, bool &$is_var): string { $is_var = true; return $tpl->parseVariable($tokens, $var); @@ -47,7 +49,7 @@ class Accessor { * @param Template $tpl * @return string */ - public static function parserCall($call, Tokenizer $tokens, Template $tpl) + public static function parserCall(string $call, Tokenizer $tokens, Template $tpl): string { return $call.$tpl->parseArgs($tokens); } @@ -56,10 +58,11 @@ class Accessor { * @param string $prop fenom's property name * @param Tokenizer $tokens * @param Template $tpl - * @param $is_var + * @param bool $is_var * @return string + * @throws CompileException */ - public static function parserProperty($prop, Tokenizer $tokens, Template $tpl, &$is_var) + public static function parserProperty(string $prop, Tokenizer $tokens, Template $tpl, bool &$is_var): string { $is_var = true; return self::parserVar('$tpl->getStorage()->'.$prop, $tokens, $tpl, $is_var); @@ -71,7 +74,7 @@ class Accessor { * @param Template $tpl * @return string */ - public static function parserMethod($method, Tokenizer $tokens, Template $tpl) + public static function parserMethod(string $method, Tokenizer $tokens, Template $tpl): string { return self::parserCall('$tpl->getStorage()->'.$method, $tokens, $tpl); } @@ -81,13 +84,14 @@ class Accessor { * @param Tokenizer $tokens * @param Template $tpl * @return string + * @throws CompileException */ - public static function getVar(Tokenizer $tokens, Template $tpl) + public static function getVar(Tokenizer $tokens, Template $tpl): string { $name = $tokens->prevToken()[Tokenizer::TEXT]; if(isset(self::$vars[$name])) { $var = $tpl->parseVariable($tokens, self::$vars[$name]); - return "(isset($var) ? $var : null)"; + return "(($var) ?? null)"; } else { throw new UnexpectedTokenException($tokens->back()); } @@ -98,7 +102,7 @@ class Accessor { * @param Tokenizer $tokens * @return string */ - public static function tpl(Tokenizer $tokens) + public static function tpl(Tokenizer $tokens): string { $method = $tokens->skip('.')->need(T_STRING)->getAndNext(); if(method_exists('Fenom\Render', 'get'.$method)) { @@ -111,7 +115,7 @@ class Accessor { /** * @return string */ - public static function version() + public static function version(): string { return 'Fenom::VERSION'; } @@ -120,9 +124,9 @@ class Accessor { * @param Tokenizer $tokens * @return string */ - public static function constant(Tokenizer $tokens) + public static function constant(Tokenizer $tokens): string { - $const = array($tokens->skip('.')->need(Tokenizer::MACRO_STRING)->getAndNext()); + $const = [$tokens->skip('.')->need(Tokenizer::MACRO_STRING)->getAndNext()]; while($tokens->is('.')) { $const[] = $tokens->next()->need(Tokenizer::MACRO_STRING)->getAndNext(); } @@ -139,9 +143,9 @@ class Accessor { * @param Template $tpl * @return string */ - public static function call(Tokenizer $tokens, Template $tpl) + public static function call(Tokenizer $tokens, Template $tpl): string { - $callable = array($tokens->skip('.')->need(Tokenizer::MACRO_STRING)->getAndNext()); + $callable = [$tokens->skip('.')->need(Tokenizer::MACRO_STRING)->getAndNext()]; while($tokens->is('.')) { $callable[] = $tokens->next()->need(Tokenizer::MACRO_STRING)->getAndNext(); } @@ -175,7 +179,7 @@ class Accessor { * @param Template $tpl * @return string */ - public static function fetch(Tokenizer $tokens, Template $tpl) + public static function fetch(Tokenizer $tokens, Template $tpl): string { $tokens->skip('('); $name = $tpl->parsePlainArg($tokens, $static); @@ -188,7 +192,7 @@ class Accessor { $tokens->next(); if($tokens->is('[')){ $vars = $tpl->parseArray($tokens) . ' + $var'; - }elseif($tokens->is(T_VARIABLE)){ + } elseif($tokens->is(T_VARIABLE)){ $vars = $tpl->parseExpr($tokens) . ' + $var'; } } else { @@ -202,9 +206,9 @@ class Accessor { * Accessor {$.block.NAME} * @param Tokenizer $tokens * @param Template $tpl - * @return mixed + * @return string */ - public static function block(Tokenizer $tokens, Template $tpl) + public static function block(Tokenizer $tokens, Template $tpl): string { if($tokens->is('.')) { $name = $tokens->next()->get(Tokenizer::MACRO_STRING); diff --git a/src/Fenom/Compiler.php b/src/Fenom/Compiler.php index dd48c52..082db5a 100644 --- a/src/Fenom/Compiler.php +++ b/src/Fenom/Compiler.php @@ -30,7 +30,7 @@ class Compiler * @throws \LogicException * @return string */ - public static function tagInclude(Tokenizer $tokens, Tag $tag) + public static function tagInclude(Tokenizer $tokens, Tag $tag): string { $tpl = $tag->tpl; $name = false; @@ -72,10 +72,10 @@ class Compiler * Tag {insert ...} * @param Tokenizer $tokens * @param Tag $tag - * @throws Error\InvalidUsageException * @return string + * @throws Error\InvalidUsageException|CompileException */ - public static function tagInsert(Tokenizer $tokens, Tag $tag) + public static function tagInsert(Tokenizer $tokens, Tag $tag): string { $tpl = $tag->tpl; $tpl->parsePlainArg($tokens, $name); @@ -95,8 +95,9 @@ class Compiler * @param Tokenizer $tokens * @param Tag $scope * @return string + * @throws \Exception */ - public static function ifOpen(Tokenizer $tokens, Tag $scope) + public static function ifOpen(Tokenizer $tokens, Tag $scope): string { $scope["else"] = false; return 'if(' . $scope->tpl->parseExpr($tokens) . ') {'; diff --git a/src/Fenom/Modifier.php b/src/Fenom/Modifier.php index b51c7d3..3550ce9 100644 --- a/src/Fenom/Modifier.php +++ b/src/Fenom/Modifier.php @@ -19,11 +19,11 @@ class Modifier /** * Date format * - * @param string|int $date + * @param int|string $date * @param string $format * @return string */ - public static function dateFormat($date, $format = "%b %e, %Y") + public static function dateFormat(int|string $date, string $format = "%b %e, %Y"): string { if (!is_numeric($date)) { $date = strtotime($date); @@ -39,7 +39,7 @@ class Modifier * @param string $format * @return string */ - public static function date($date, $format = "Y m d") + public static function date(string $date, string $format = "Y m d"): string { if (!is_numeric($date)) { $date = strtotime($date); @@ -55,18 +55,18 @@ class Modifier * * @param string $text * @param string $type - * @param string $charset + * @param string|null $charset * @return string */ - public static function escape($text, $type = 'html', $charset = null) + public static function escape(string $text, string $type = 'html', string $charset = null): string { switch (strtolower($type)) { case "url": return urlencode($text); case "html"; - return htmlspecialchars($text, ENT_COMPAT, $charset ? $charset : \Fenom::$charset); + return htmlspecialchars($text, ENT_COMPAT, $charset ?: \Fenom::$charset); case "js": - return json_encode($text, 64 | 256); // JSON_UNESCAPED_SLASHES = 64, JSON_UNESCAPED_UNICODE = 256 + return json_encode($text, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); default: return $text; } @@ -79,7 +79,7 @@ class Modifier * @param string $type * @return string */ - public static function unescape($text, $type = 'html') + public static function unescape(string $text, string $type = 'html'): string { switch (strtolower($type)) { case "url": @@ -96,12 +96,12 @@ class Modifier * * @param string $string text witch will be truncate * @param int $length maximum symbols of result string - * @param string $etc place holder truncated symbols + * @param string $etc placeholder truncated symbols * @param bool $by_words * @param bool $middle * @return string */ - public static function truncate($string, $length = 80, $etc = '...', $by_words = false, $middle = false) + public static function truncate(string $string, int $length = 80, string $etc = '...', bool $by_words = false, bool $middle = false): string { if ($middle) { if (preg_match('#^(.{' . $length . '}).*?(.{' . $length . '})?$#usS', $string, $match)) { @@ -134,7 +134,7 @@ class Modifier * @param bool $to_line strip line ends * @return string */ - public static function strip($str, $to_line = false) + public static function strip(string $str, bool $to_line = false): string { $str = trim($str); if ($to_line) { @@ -149,7 +149,7 @@ class Modifier * @param mixed $item * @return int */ - public static function length($item) + public static function length(mixed $item): int { if (is_string($item)) { return strlen(preg_replace('#[\x00-\x7F]|[\x80-\xDF][\x00-\xBF]|[\xE0-\xEF][\x00-\xBF]{2}#s', ' ', $item)); @@ -168,13 +168,13 @@ class Modifier * @param mixed $haystack * @return bool */ - public static function in($value, $haystack) + public static function in(mixed $value, mixed $haystack): bool { if(is_scalar($value)) { if (is_array($haystack)) { return in_array($value, $haystack) || array_key_exists($value, $haystack); } elseif (is_string($haystack)) { - return strpos($haystack, $value) !== false; + return str_contains($haystack, $value); } } return false; @@ -184,7 +184,7 @@ class Modifier * @param mixed $value * @return bool */ - public static function isIterable($value) + public static function isIterable(mixed $value): bool { return is_array($value) || ($value instanceof \Iterator); } @@ -196,7 +196,7 @@ class Modifier * @param string $replace The replacement value that replaces found search * @return mixed */ - public static function replace($value, $search, $replace) + public static function replace(string $value, string $search, string $replace): string { return str_replace($search, $replace, $value); } @@ -207,7 +207,7 @@ class Modifier * @param string $replacement * @return mixed */ - public static function ereplace($value, $pattern, $replacement) + public static function ereplace(string $value, string $pattern, string $replacement): string { return preg_replace($pattern, $replacement, $value); } @@ -217,7 +217,7 @@ class Modifier * @param string $pattern * @return bool */ - public static function match($string, $pattern) + public static function match(string $string, string $pattern): bool { return fnmatch($pattern, $string); } @@ -227,7 +227,7 @@ class Modifier * @param string $pattern * @return int */ - public static function ematch($string, $pattern) + public static function ematch(string $string, string $pattern): int { return preg_match($pattern, $string); } @@ -237,23 +237,23 @@ class Modifier * @param string $delimiter * @return array */ - public static function split($value, $delimiter = ",") + public static function split(mixed $value, string $delimiter = ","): array { if(is_string($value)) { return explode($delimiter, $value); } elseif(is_array($value)) { return $value; } else { - return array(); + return []; } } /** - * @param $value + * @param mixed $value * @param string $pattern * @return array */ - public static function esplit($value, $pattern = '/,\s*/S') + public static function esplit(mixed $value, string $pattern = '/,\s*/S'): array { if(is_string($value)) { return preg_split($pattern, $value); @@ -265,11 +265,11 @@ class Modifier } /** - * @param $value + * @param mixed $value * @param string $glue * @return string */ - public static function join($value, $glue = ",") + public static function join(mixed $value, string $glue = ","): string { if(is_array($value)) { return implode($glue, $value); @@ -281,12 +281,13 @@ class Modifier } /** - * @param string|int $from - * @param string|int $to + * @param int $from + * @param int $to * @param int $step * @return RangeIterator */ - public static function range($from, $to, $step = 1) { + public static function range(mixed $from, int $to, int $step = 1): RangeIterator + { if($from instanceof RangeIterator) { return $from->setStep($to); } else { diff --git a/src/Fenom/Render.php b/src/Fenom/Render.php index 4cfc2a3..d83a57c 100644 --- a/src/Fenom/Render.php +++ b/src/Fenom/Render.php @@ -26,9 +26,9 @@ class Render extends \ArrayObject "macros" => [] ]; /** - * @var \Closure + * @var \Closure|null */ - protected \Closure $_code; + protected ?\Closure $_code = null; /** * Template name * @var string @@ -38,7 +38,7 @@ class Render extends \ArrayObject * Provider's schema * @var string|null */ - protected ?string $_scm; + protected ?string $_scm = null; /** * Basic template name * @var string diff --git a/src/Fenom/Template.php b/src/Fenom/Template.php index 714773d..99885c3 100644 --- a/src/Fenom/Template.php +++ b/src/Fenom/Template.php @@ -52,77 +52,87 @@ class Template extends Render /** * @var int shared counter */ - public $i = 1; + public int $i = 1; /** * @var array of macros */ - public $macros = array(); + public array $macros = []; /** * @var array of blocks */ - public $blocks = array(); + public array $blocks = []; /** * @var string|null */ - public $extends; + public ?string $extends; /** * @var string|null */ - public $extended; + public ?string $extended; /** * Stack of extended templates * @var array */ - public $ext_stack = array(); + public array $ext_stack = []; - public $extend_body = false; + public bool $extend_body = false; /** * Parent template * @var Template */ - public $parent; + public ?Template $parent; /** * Template PHP code * @var string */ - private $_body; - private $_compile_stage = 0; + private string $_body = ""; + private int $_compile_stage = 0; /** * Call stack * @var Tag[] */ - private $_stack = array(); + private array $_stack = []; /** * Template source * @var string */ - private $_src; + private string $_src; /** * @var int */ - private $_line = 1; - private $_post = array(); + private int $_line = 1; /** - * @var bool|string + * @var callable[] */ - private $_ignore = false; + private array $_post = []; + /** + * @var string|null + */ + private ?string $_ignore = null; - private $_before = array(); + /** + * @var string[] + */ + private array $_before = []; - private $_filters = array(); + private array $_filters = []; /** * @var int crc32 of the template name */ - private $_crc = 0; + private int $_crc = 0; + /** + * @var callable[] + */ + private array $_tag_filters; /** * @param Fenom $fenom Template storage @@ -142,16 +152,16 @@ class Template extends Render * Get tag stack size * @return int */ - public function getStackSize() + public function getStackSize(): int { return count($this->_stack); } /** * @param string $tag - * @return bool|\Fenom\Tag + * @return Tag|null */ - public function getParentScope($tag) + public function getParentScope(string $tag): ?Tag { for ($i = count($this->_stack) - 1; $i >= 0; $i--) { if ($this->_stack[$i]->name == $tag) { @@ -159,7 +169,7 @@ class Template extends Render } } - return false; + return null; } /** @@ -167,8 +177,9 @@ class Template extends Render * @param string $name * @param bool $compile * @return self + * @throws CompileException */ - public function load($name, $compile = true) + public function load(string $name, bool $compile = true): static { $this->_name = $name; $this->_crc = crc32($this->_name); @@ -193,8 +204,9 @@ class Template extends Render * @param string $src template source * @param bool $compile * @return \Fenom\Template + * @throws CompileException */ - public function source($name, $src, $compile = true) + public function source(string $name, string $src, bool $compile = true): static { $this->_name = $name; $this->_src = $src; @@ -309,7 +321,8 @@ class Template extends Render $this->_compile_stage = self::COMPILE_STAGE_POST_FILTERED; } - public function isStageDone($stage_no) { + public function isStageDone(int $stage_no): bool + { return $this->_compile_stage >= $stage_no; } @@ -318,7 +331,7 @@ class Template extends Render * @param int $option * @param bool $value */ - public function setOption($option, $value) + public function setOption(int $option, bool $value) { if ($value) { $this->_options |= $option; @@ -329,21 +342,21 @@ class Template extends Render /** * Execute some code at loading cache - * @param $code + * @param string $code * @return void */ - public function before($code) + public function before(string $code): void { $this->_before[] = $code; } /** - * Generate name of temporary internal template variable (may be random) + * Generate name of temporary internal template variable (maybe random) * @return string */ - public function tmpVar() + public function tmpVar(): string { - return sprintf('$t%x_%x', $this->_crc ? $this->_crc : mt_rand(0, 0x7FFFFFFF), $this->i++); + return sprintf('$t%x_%x', $this->_crc ?: mt_rand(0, 0x7FFFFFFF), $this->i++); } /** @@ -351,12 +364,12 @@ class Template extends Render * * @param string $text */ - private function _appendText($text) + private function _appendText(string $text) { $this->_line += substr_count($text, "\n"); $strip = $this->_options & Fenom::AUTO_STRIP; if ($this->_filters) { - if (strpos($text, "_filters as $filter) { $text = call_user_func($filter, $this, $text); } @@ -385,9 +398,9 @@ class Template extends Render * Append PHP code to template body * * @param string $code - * @param $source + * @param string $source */ - private function _appendCode($code, $source) + private function _appendCode(string $code, string $source) { if (!$code) { return; @@ -398,17 +411,17 @@ class Template extends Render } /** - * @param $tag_name + * @param string $tag_name */ - public function ignore($tag_name) + public function ignore(string $tag_name) { $this->_ignore = $tag_name; } /** - * @param callable[] $cb + * @param callable $cb */ - public function addPostCompile($cb) + public function addPostCompile(callable $cb) { $this->_post[] = $cb; } @@ -418,7 +431,7 @@ class Template extends Render * * @return string */ - public function getBody() + public function getBody(): string { return $this->_body; } @@ -428,7 +441,7 @@ class Template extends Render * * @return string */ - public function getTemplateCode() + public function getTemplateCode(): string { $before = $this->_before ? implode("\n", $this->_before) . "\n" : ""; return "macros) { $macros = array(); @@ -468,7 +481,7 @@ class Template extends Render * Return closure code * @return string */ - private function _getClosureSource() + private function _getClosureSource(): string { return "function (\$var, \$tpl) {\n?>{$this->_body}_code) { + if (!$this->_code) { // TODO: remove // evaluate template's code eval("\$this->_code = " . $this->_getClosureSource() . ";\n\$this->_macros = " . $this->_getMacrosArray() . ';'); if (!$this->_code) { @@ -506,10 +519,10 @@ class Template extends Render * Output the value * * @param string $data - * @param null|bool $escape + * @param bool|null $escape * @return string */ - public function out($data, $escape = null) + public function out(string $data, ?bool $escape = null): string { if ($escape === null) { $escape = $this->_options & Fenom::AUTO_ESCAPE; @@ -524,8 +537,9 @@ class Template extends Render /** * Import block from another template * @param string $tpl + * @throws CompileException */ - public function importBlocks($tpl) + public function importBlocks(string $tpl) { $donor = $this->_fenom->compile($tpl, false); foreach ($donor->blocks as $name => $block) { @@ -541,8 +555,9 @@ class Template extends Render * Extends the template * @param string $tpl * @return \Fenom\Template parent + * @throws CompileException */ - public function extend($tpl) + public function extend(string $tpl): Template { if (!$this->isStageDone(self::COMPILE_STAGE_PARSED)) { $this->compile(); @@ -573,7 +588,7 @@ class Template extends Render * @throws CompileException * @return string executable PHP code */ - public function parseTag(Tokenizer $tokens) + public function parseTag(Tokenizer $tokens): string { try { if ($tokens->is(Tokenizer::MACRO_STRING)) { @@ -601,7 +616,7 @@ class Template extends Render * @return string * @throws TokenizeException */ - public function parseEndTag(Tokenizer $tokens) + public function parseEndTag(Tokenizer $tokens): string { $name = $tokens->getNext(Tokenizer::MACRO_STRING); $tokens->next(); @@ -626,12 +641,12 @@ class Template extends Render * @throws Error\TokenizeException * @return string */ - public function parseAct(Tokenizer $tokens) + public function parseAct(Tokenizer $tokens): string { $action = $tokens->get(Tokenizer::MACRO_STRING); $tokens->next(); - if ($tokens->is("(", T_DOUBLE_COLON, T_NS_SEPARATOR) && !$tokens->isWhiteSpaced() - ) { // just invoke function or static method + if ($tokens->is("(", T_DOUBLE_COLON, T_NS_SEPARATOR) && !$tokens->isWhiteSpaced()) { + // just invoke function or static method $tokens->back(); return $this->out($this->parseExpr($tokens)); } elseif ($tokens->is('.')) { @@ -652,7 +667,7 @@ class Template extends Render if ($tag->isClosed()) { $tag->restoreAll(); } else { - array_push($this->_stack, $tag); + $this->_stack[] = $tag; } return $code; } @@ -678,7 +693,7 @@ class Template extends Render * Get current template line * @return int */ - public function getLine() + public function getLine(): int { return $this->_line; } @@ -688,10 +703,9 @@ class Template extends Render * * @param Tokenizer $tokens * @param bool $is_var - * @throws \Exception * @return string */ - public function parseExpr(Tokenizer $tokens, &$is_var = false) + public function parseExpr(Tokenizer $tokens, bool &$is_var = false): string { $exp = array(); $var = false; // last term was: true - variable, false - mixed @@ -801,10 +815,9 @@ class Template extends Render * @param Tokenizer $tokens * @param bool $is_var is parsed term - plain variable * @param int $allows - * @throws \Exception - * @return bool|string + * @return string */ - public function parseTerm(Tokenizer $tokens, &$is_var = false, $allows = -1) + public function parseTerm(Tokenizer $tokens, ?bool &$is_var = false, int $allows = -1): string { $is_var = false; if ($tokens->is(Tokenizer::MACRO_UNARY)) { @@ -941,7 +954,7 @@ class Template extends Render * @param string $code start point (it is $var) * @return string */ - public function parseChain(Tokenizer $tokens, $code) + public function parseChain(Tokenizer $tokens, string $code): string { do { if ($tokens->is('(')) { @@ -962,11 +975,11 @@ class Template extends Render /** * Parse variable name: $a, $a.b, $a.b['c'], $a:index * @param Tokenizer $tokens - * @param $var - * @return string - * @throws Error\UnexpectedTokenException + * @param string|null $var + * @return string|null + * @throws CompileException */ - public function parseVariable(Tokenizer $tokens, $var = null) + public function parseVariable(Tokenizer $tokens, ?string $var = null): ?string { if (!$var) { if ($tokens->isNext('@')) { @@ -1037,7 +1050,7 @@ class Template extends Render * @param bool $is_var * @return string */ - public function parseAccessor(Tokenizer $tokens, &$is_var = false) + public function parseAccessor(Tokenizer $tokens, bool &$is_var = false): string { $accessor = $tokens->need('$')->next()->need('.')->next()->current(); $parser = $this->getStorage()->getAccessor($accessor); @@ -1050,16 +1063,16 @@ class Template extends Render ', "callback"), ' . var_export($accessor, true) . ', $tpl, $var)'; } else { return call_user_func_array( - $parser['parser'], array( - $parser['accessor'], - $tokens->next(), - $this, - &$is_var - ) + $parser['parser'], [ + $parser['accessor'], + $tokens->next(), + $this, + &$is_var + ] ); } } else { - return call_user_func_array($parser, array($tokens->next(), $this, &$is_var)); + return call_user_func_array($parser, [$tokens->next(), $this, &$is_var]); } } else { throw new \RuntimeException("Unknown accessor '\$.$accessor'"); @@ -1075,7 +1088,7 @@ class Template extends Render * @return string * @throws UnexpectedTokenException */ - public function parseTernary(Tokenizer $tokens, $var, $is_var) + public function parseTernary(Tokenizer $tokens, $var, $is_var): string { $empty = $tokens->is('?'); $tokens->next(); @@ -1094,12 +1107,7 @@ class Template extends Render return '((' . $var . ' !== null) ? ' . $var . ' : (' . $this->parseExpr($tokens) . '))'; } } - } elseif ($tokens->is( - Tokenizer::MACRO_BINARY, - Tokenizer::MACRO_BOOLEAN, - Tokenizer::MACRO_MATH - ) || !$tokens->valid() - ) { + } elseif ($tokens->is(Tokenizer::MACRO_BINARY, Tokenizer::MACRO_BOOLEAN, Tokenizer::MACRO_MATH ) || !$tokens->valid()) { if ($empty) { if ($is_var) { return '!empty(' . $var . ')'; @@ -1135,14 +1143,14 @@ class Template extends Render /** * Parse 'is' and 'is not' operators - * @see _tests * @param Tokenizer $tokens * @param string $value * @param bool $variable - * @throws InvalidUsageException * @return string + * @throws InvalidUsageException + * @see _tests */ - public function parseIs(Tokenizer $tokens, $value, $variable = false) + public function parseIs(Tokenizer $tokens, string $value, bool $variable = false): string { $tokens->next(); if ($tokens->current() == 'not') { @@ -1180,11 +1188,11 @@ class Template extends Render * Parse 'in' and 'not in' operators * @param Tokenizer $tokens * @param string $value - * @throws InvalidUsageException - * @throws UnexpectedTokenException * @return string + * @throws UnexpectedTokenException + * @throws InvalidUsageException */ - public function parseIn(Tokenizer $tokens, $value) + public function parseIn(Tokenizer $tokens, string $value): string { $checkers = array( "string" => 'is_int(strpos(%2$s, %1$s))', @@ -1239,7 +1247,7 @@ class Template extends Render * @param Tokenizer $tokens * @return string */ - public function parseName(Tokenizer $tokens) + public function parseName(Tokenizer $tokens): string { $tokens->skipIf(T_NS_SEPARATOR); $name = ""; @@ -1260,7 +1268,7 @@ class Template extends Render * @throws Error\UnexpectedTokenException * @return string */ - public function parseScalar(Tokenizer $tokens) + public function parseScalar(Tokenizer $tokens): string { $token = $tokens->key(); switch ($token) { @@ -1284,7 +1292,7 @@ class Template extends Render * @throws UnexpectedTokenException * @return string */ - public function parseQuote(Tokenizer $tokens) + public function parseQuote(Tokenizer $tokens): string { if ($tokens->is('"')) { $stop = $tokens->current(); @@ -1352,7 +1360,7 @@ class Template extends Render * @throws \Exception * @return string */ - public function parseModifier(Tokenizer $tokens, $value) + public function parseModifier(Tokenizer $tokens, $value): string { while ($tokens->is("|")) { $modifier = $tokens->getNext(Tokenizer::MACRO_STRING); @@ -1392,11 +1400,11 @@ class Template extends Render * [1, 2.3, 5+7/$var, 'string', "str {$var+3} ing", $var2, []] * * @param Tokenizer $tokens - * @param int $count amount of elements - * @throws Error\UnexpectedTokenException + * @param int $count number of elements * @return string + * @throws Error\UnexpectedTokenException */ - public function parseArray(Tokenizer $tokens, &$count = 0) + public function parseArray(Tokenizer $tokens, int &$count = 0): string { if ($tokens->is("[")) { $arr = array(); @@ -1433,7 +1441,7 @@ class Template extends Render * @return string * @throws InvalidUsageException */ - public function parseMacroCall(Tokenizer $tokens, $name) + public function parseMacroCall(Tokenizer $tokens, $name): string { $recursive = false; $macro = false; @@ -1481,9 +1489,9 @@ class Template extends Render * @param Tokenizer $tokens * @throws \LogicException * @throws \RuntimeException - * @return string + * @return callable */ - public function parseStatic(Tokenizer $tokens) + public function parseStatic(Tokenizer $tokens): callable { if ($this->_options & Fenom::DENY_STATICS) { throw new \LogicException("Static methods are disabled"); @@ -1512,7 +1520,7 @@ class Template extends Render * @param Tokenizer $tokens * @return string */ - public function parseArgs(Tokenizer $tokens) + public function parseArgs(Tokenizer $tokens): string { $_args = "("; $tokens->next(); @@ -1558,7 +1566,7 @@ class Template extends Render * @param string $static * @return mixed|string */ - public function parsePlainArg(Tokenizer $tokens, &$static) + public function parsePlainArg(Tokenizer $tokens, string &$static): mixed { if ($tokens->is(T_CONSTANT_ENCAPSED_STRING)) { if ($tokens->isNext('|')) { @@ -1578,10 +1586,8 @@ class Template extends Render * Parse parameters as $key=$value * param1=$var param2=3 ... * - * @static * @param Tokenizer $tokens - * @param array $defaults - * @throws \Exception + * @param array|null $defaults * @return array */ public function parseParams(Tokenizer $tokens, array $defaults = null) diff --git a/src/Fenom/Tokenizer.php b/src/Fenom/Tokenizer.php index 834dcdf..a073ed4 100644 --- a/src/Fenom/Tokenizer.php +++ b/src/Fenom/Tokenizer.php @@ -92,6 +92,7 @@ class Tokenizer \T_INCLUDE => 1, \T_INCLUDE_ONCE => 1, \T_INSTANCEOF => 1, \T_INSTEADOF => 1, \T_INTERFACE => 1, \T_ISSET => 1, \T_LINE => 1, \T_LIST => 1, \T_LOGICAL_AND => 1, \T_LOGICAL_OR => 1, \T_LOGICAL_XOR => 1, \T_METHOD_C => 1, + \T_MATCH => 1, \T_NAMESPACE => 1, \T_NS_C => 1, \T_NEW => 1, \T_PRINT => 1, \T_PRIVATE => 1, \T_PUBLIC => 1, \T_PROTECTED => 1, \T_REQUIRE => 1, \T_REQUIRE_ONCE => 1, \T_RETURN => 1, \T_STRING => 1, From a4fbc2a6aaeede0b276ecc21342dbd10fd4b7a0f Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Sun, 19 Feb 2023 22:14:08 +0100 Subject: [PATCH 04/11] migrate to php8 --- src/Fenom.php | 46 +++-- src/Fenom/Accessor.php | 4 +- src/Fenom/Compiler.php | 244 +++++++---------------- src/Fenom/Provider.php | 42 ++-- src/Fenom/ProviderInterface.php | 16 +- src/Fenom/RangeIterator.php | 12 +- src/Fenom/Tag.php | 2 +- src/Fenom/Template.php | 28 +-- src/Fenom/Tokenizer.php | 29 ++- tests/TestCase.php | 21 +- tests/cases/Fenom/AccessorTest.php | 27 ++- tests/cases/Fenom/CustomProviderTest.php | 2 +- tests/cases/Fenom/FunctionsTest.php | 2 +- tests/cases/Fenom/MacrosTest.php | 8 +- tests/cases/Fenom/ProviderTest.php | 11 +- tests/cases/Fenom/RenderTest.php | 4 +- tests/cases/Fenom/SandboxTest.php | 35 ---- tests/cases/Fenom/ScopeTest.php | 36 ---- tests/cases/Fenom/TagOptionTest.php | 14 -- tests/cases/Fenom/TemplateTest.php | 2 +- tests/cases/Fenom/TokenizerTest.php | 19 ++ 21 files changed, 239 insertions(+), 365 deletions(-) delete mode 100644 tests/cases/Fenom/SandboxTest.php delete mode 100644 tests/cases/Fenom/ScopeTest.php delete mode 100644 tests/cases/Fenom/TagOptionTest.php diff --git a/src/Fenom.php b/src/Fenom.php index 328542f..cbc5e17 100644 --- a/src/Fenom.php +++ b/src/Fenom.php @@ -21,8 +21,8 @@ use Fenom\Template; */ class Fenom { - const VERSION = '2.12'; - const REV = 1; + const VERSION = '3.0'; + const REV = 2; /* Actions */ const INLINE_COMPILER = 1; const BLOCK_COMPILER = 5; @@ -64,18 +64,18 @@ class Fenom const ACCESSOR_METHOD = 'Fenom\Accessor::parserMethod'; const ACCESSOR_CHAIN = 'Fenom\Accessor::parserChain'; - public static $charset = "UTF-8"; + public static string $charset = "UTF-8"; /** * @var int maximum length of compiled filename (use sha1 of name if bigger) */ - public static $filename_length = 200; + public static int $filename_length = 200; /** * @var int[] of possible options, as associative array * @see setOptions */ - private static $_options_list = [ + private static array $_options_list = [ "disable_accessor" => self::DENY_ACCESSOR, "disable_methods" => self::DENY_METHODS, "disable_native_funcs" => self::DENY_NATIVE_FUNCS, @@ -94,27 +94,27 @@ class Fenom /** * @var callable[] */ - public array $pre_filters = []; + protected array $pre_filters = []; /** * @var callable[] */ - public array $filters = []; + protected array $filters = []; /** * @var callable[] */ - public array $tag_filters = []; + protected array $tag_filters = []; /** * @var string[] */ - public array $call_filters = []; + protected array $call_filters = []; /** * @var callable[] */ - public array $post_filters = []; + protected array $post_filters = []; /** * @var Fenom\Render[] Templates storage @@ -129,7 +129,7 @@ class Fenom /** * @var string compile prefix ID template */ - protected string $_compile_id; + protected string $_compile_id = ""; /** * @var string[] compile directory for custom provider @@ -749,9 +749,9 @@ class Fenom * * @param string $modifier * @param Template|null $template - * @return mixed + * @return callable|null */ - public function getModifier(string $modifier, Fenom\Template $template = null): string + public function getModifier(string $modifier, Fenom\Template $template = null): ?callable { if (isset($this->_modifiers[$modifier])) { return $this->_modifiers[$modifier]; @@ -937,9 +937,9 @@ class Fenom * Get an accessor * @param string $name * @param string|null $key - * @return callable|null + * @return callable|array|null */ - public function getAccessor(string $name,string $key = null): ?callable + public function getAccessor(string $name,string $key = null): mixed { if(isset($this->_accessors[$name])) { if($key) { @@ -998,10 +998,10 @@ class Fenom * @param string|array $template name of template. * If it is array of names of templates they will be extended from left to right. * @param array $vars array of data for template - * @return Fenom\Render + * @return array * @throws CompileException */ - public function display(string|array $template, array $vars = array()): Fenom\Render + public function display(string|array $template, array $vars = array()): array { return $this->getTemplate($template)->display($vars); } @@ -1093,12 +1093,12 @@ class Fenom /** * Load template from cache or create cache if it doesn't exists. * - * @param string $template + * @param string[]|string $template * @param int $opts * @return Fenom\Render * @throws CompileException */ - protected function _load(string $template, int $opts): Render + protected function _load(array|string $template, int $opts): Render { $file_name = $this->getCompileName($template, $opts); if (is_file($this->_compile_dir . "/" . $file_name)) { @@ -1229,4 +1229,12 @@ class Fenom } return $mask; } + + /** + * @return array + */ + public function getCallFilters(): array + { + return $this->call_filters; + } } diff --git a/src/Fenom/Accessor.php b/src/Fenom/Accessor.php index 23e05d5..0dbf535 100644 --- a/src/Fenom/Accessor.php +++ b/src/Fenom/Accessor.php @@ -134,7 +134,7 @@ class Accessor { if($tokens->is(T_DOUBLE_COLON)) { $const .= '::'.$tokens->next()->need(Tokenizer::MACRO_STRING)->getAndNext(); } - return '@constant('.var_export($const, true).')'; + return '(defined('.var_export($const, true).') ? constant('.var_export($const, true).') : "")'; } @@ -153,7 +153,7 @@ class Accessor { if($tokens->is(T_DOUBLE_COLON)) { $callable .= '::'.$tokens->next()->need(Tokenizer::MACRO_STRING)->getAndNext(); } - $call_filter = $tpl->getStorage()->call_filters; + $call_filter = $tpl->getStorage()->getCallFilters(); if($call_filter) { foreach($call_filter as $filter) { if(!fnmatch(addslashes($filter), $callable)) { diff --git a/src/Fenom/Compiler.php b/src/Fenom/Compiler.php index 082db5a..35f228a 100644 --- a/src/Fenom/Compiler.php +++ b/src/Fenom/Compiler.php @@ -24,7 +24,6 @@ class Compiler /** * Tag {include ...} * - * @static * @param Tokenizer $tokens * @param Tag $tag * @throws \LogicException @@ -70,6 +69,7 @@ class Compiler /** * Tag {insert ...} + * * @param Tokenizer $tokens * @param Tag $tag * @return string @@ -91,11 +91,9 @@ class Compiler /** * Open tag {if ...} * - * @static * @param Tokenizer $tokens * @param Tag $scope * @return string - * @throws \Exception */ public static function ifOpen(Tokenizer $tokens, Tag $scope): string { @@ -106,13 +104,12 @@ class Compiler /** * Tag {elseif ...} * - * @static * @param Tokenizer $tokens * @param Tag $scope * @throws InvalidUsageException * @return string */ - public static function tagElseIf(Tokenizer $tokens, Tag $scope) + public static function tagElseIf(Tokenizer $tokens, Tag $scope): string { if ($scope["else"]) { throw new InvalidUsageException('Incorrect use of the tag {elseif}'); @@ -127,7 +124,7 @@ class Compiler * @param Tag $scope * @return string */ - public static function tagElse($tokens, Tag $scope) + public static function tagElse(Tokenizer $tokens, Tag $scope): string { $scope["else"] = true; return '} else {'; @@ -136,14 +133,14 @@ class Compiler /** * Open tag {foreach ...} * - * @static * @param Tokenizer $tokens * @param Tag $scope - * @throws UnexpectedTokenException - * @throws InvalidUsageException * @return string + * @throws InvalidUsageException*@throws CompileException + * @throws UnexpectedTokenException + * @throws CompileException */ - public static function foreachOpen(Tokenizer $tokens, Tag $scope) + public static function foreachOpen(Tokenizer $tokens, Tag $scope): string { $scope["else"] = false; $scope["key"] = null; @@ -201,7 +198,7 @@ class Compiler * @param Tag $scope * @return string */ - public static function foreachElse($tokens, Tag $scope) + public static function foreachElse(Tokenizer $tokens, Tag $scope): string { $scope["no-break"] = $scope["no-continue"] = $scope["else"] = true; $after = $scope["after"] ? implode("; ", $scope["after"]) . ";" : ""; @@ -214,7 +211,8 @@ class Compiler * @return string * @throws CompileException */ - public static function foreachProp(Tag $scope, $prop) { + public static function foreachProp(Tag $scope, string $prop): string + { if(empty($scope["props"][$prop])) { $var_name = $scope["props"][$prop] = $scope->tpl->tmpVar()."_".$prop; switch($prop) { @@ -248,7 +246,7 @@ class Compiler * @param Tag $scope * @return string */ - public static function foreachClose($tokens, Tag $scope) + public static function foreachClose(Tokenizer $tokens, Tag $scope): string { $before = $scope["before"] ? implode("; ", $scope["before"]) . ";" : ""; $head = $scope["body"] ? implode("; ", $scope["body"]) . ";" : ""; @@ -268,119 +266,11 @@ class Compiler } /** - * @static - * @param Tokenizer $tokens - * @param Tag $scope - * @throws Error\UnexpectedTokenException - * @throws Error\InvalidUsageException - * @return string - * @codeCoverageIgnore - */ - public static function forOpen(Tokenizer $tokens, Tag $scope) - { - trigger_error("Fenom: tag {for} deprecated, use {foreach 1..4 as \$value} (in {$scope->tpl->getName()}:{$scope->line})", E_USER_DEPRECATED); - $p = array( - "index" => false, - "first" => false, - "last" => false, - "step" => 1, - "to" => false, -// "max" => false, -// "min" => false - ); - $scope["after"] = $before = $body = array(); - $i = array('', ''); - $c = ""; - $var = $scope->tpl->parseTerm($tokens, $is_var); - if (!$is_var) { - throw new UnexpectedTokenException($tokens); - } - $tokens->get("="); - $tokens->next(); - $val = $scope->tpl->parseExpr($tokens); - $p = $scope->tpl->parseParams($tokens, $p); - - if (is_numeric($p["step"])) { - if ($p["step"] > 0) { - $condition = "$var <= {$p['to']}"; - if ($p["last"]) { - $c = "($var + {$p['step']}) > {$p['to']}"; - } - } elseif ($p["step"] < 0) { - $condition = "$var >= {$p['to']}"; - if ($p["last"]) { - $c = "($var + {$p['step']}) < {$p['to']}"; - } - } else { - throw new InvalidUsageException("Invalid step value"); - } - } else { - $condition = "({$p['step']} > 0 && $var <= {$p['to']} || {$p['step']} < 0 && $var >= {$p['to']})"; - if ($p["last"]) { - $c = "({$p['step']} > 0 && ($var + {$p['step']}) <= {$p['to']} || {$p['step']} < 0 && ($var + {$p['step']}) >= {$p['to']})"; - } - } - - if ($p["first"]) { - $before[] = $p["first"] . ' = true'; - $scope["after"][] = $p["first"] . ' && (' . $p["first"] . ' = false )'; - } - if ($p["last"]) { - $before[] = $p["last"] . ' = false'; - $body[] = "if($c) {$p['last']} = true"; - } - - if ($p["index"]) { - $i[0] .= $p["index"] . ' = 0,'; - $i[1] .= $p["index"] . '++,'; - } - - $scope["else"] = false; - $scope["else_cond"] = "$var==$val"; - $before = $before ? implode("; ", $before) . ";" : ""; - $body = $body ? implode("; ", $body) . ";" : ""; - $scope["after"] = $scope["after"] ? implode("; ", $scope["after"]) . ";" : ""; - - return "$before for({$i[0]} $var=$val; $condition;{$i[1]} $var+={$p['step']}) { $body"; - } - - /** - * @static - * @param Tokenizer $tokens - * @param Tag $scope - * @return string - * @codeCoverageIgnore - */ - public static function forElse($tokens, Tag $scope) - { - $scope["no-break"] = $scope["no-continue"] = true; - $scope["else"] = true; - return " } if({$scope['else_cond']}) {"; - } - - /** - * @static - * @param Tokenizer $tokens - * @param Tag $scope - * @return string - * @codeCoverageIgnore - */ - public static function forClose($tokens, Tag $scope) - { - if ($scope["else"]) { - return '}'; - } else { - return " {$scope['after']} }"; - } - } - - /** - * @static * @param Tokenizer $tokens * @param Tag $scope * @return string */ - public static function whileOpen(Tokenizer $tokens, Tag $scope) + public static function whileOpen(Tokenizer $tokens, Tag $scope): string { return 'while(' . $scope->tpl->parseExpr($tokens) . ') {'; } @@ -388,12 +278,11 @@ class Compiler /** * Open tag {switch} * - * @static * @param Tokenizer $tokens * @param Tag $scope * @return string */ - public static function switchOpen(Tokenizer $tokens, Tag $scope) + public static function switchOpen(Tokenizer $tokens, Tag $scope): string { $expr = $scope->tpl->parseExpr($tokens); $scope["case"] = array(); @@ -409,7 +298,7 @@ class Compiler * Resort cases for {switch} * @param Tag $scope */ - private static function _caseResort(Tag $scope) + private static function _caseResort(Tag $scope): void { $content = $scope->cutContent(); foreach ($scope["last"] as $case) { @@ -428,12 +317,11 @@ class Compiler /** * Tag {case ...} * - * @static * @param Tokenizer $tokens * @param Tag $tag * @return string */ - public static function tagCase(Tokenizer $tokens, Tag $tag) + public static function tagCase(Tokenizer $tokens, Tag $tag): string { self::_caseResort($tag); do { @@ -456,12 +344,11 @@ class Compiler /** * Tag {default} * - * @static * @param Tokenizer $tokens * @param Tag $scope * @return string */ - public static function tagDefault($tokens, Tag $scope) + public static function tagDefault(Tokenizer $tokens, Tag $scope): string { self::_caseResort($scope); $scope["last"][] = false; @@ -471,12 +358,11 @@ class Compiler /** * Close tag {switch} * - * @static * @param Tokenizer $tokens * @param Tag $scope * @return string */ - public static function switchClose($tokens, Tag $scope) + public static function switchClose(Tokenizer $tokens, Tag $scope): string { self::_caseResort($scope); $expr = $scope["var"]; @@ -495,13 +381,12 @@ class Compiler /** * Tag {continue} * - * @static * @param Tokenizer $tokens * @param Tag $scope - * @throws InvalidUsageException * @return string + * @throws InvalidUsageException */ - public static function tagContinue($tokens, Tag $scope) + public static function tagContinue(Tokenizer $tokens, Tag $scope): string { if (empty($scope["no-continue"])) { return 'continue;'; @@ -513,13 +398,12 @@ class Compiler /** * Tag {break} * - * @static * @param Tokenizer $tokens * @param Tag $scope - * @throws InvalidUsageException * @return string + * @throws InvalidUsageException */ - public static function tagBreak($tokens, Tag $scope) + public static function tagBreak(Tokenizer $tokens, Tag $scope): string { if (empty($scope["no-break"])) { return 'break;'; @@ -530,12 +414,13 @@ class Compiler /** * Dispatch {extends} tag + * * @param Tokenizer $tokens * @param Tag $tag * @throws Error\InvalidUsageException * @return string */ - public static function tagExtends(Tokenizer $tokens, Tag $tag) + public static function tagExtends(Tokenizer $tokens, Tag $tag): void { $tpl = $tag->tpl; if ($tpl->extends) { @@ -559,8 +444,9 @@ class Compiler * Post compile action for {extends ...} tag * @param Template $tpl * @param string $body + * @throws CompileException */ - public static function extendBody($tpl, &$body) + public static function extendBody(Template $tpl, string &$body): void { if ($tpl->dynamic_extends) { if (!$tpl->ext_stack) { @@ -586,10 +472,9 @@ class Compiler * Tag {use ...} * @param Tokenizer $tokens * @param Tag $tag - * @throws Error\InvalidUsageException - * @return string + * @throws Error\InvalidUsageException|CompileException */ - public static function tagUse(Tokenizer $tokens, Tag $tag) + public static function tagUse(Tokenizer $tokens, Tag $tag): void { $tpl = $tag->tpl; if ($tpl->getStackSize()) { @@ -608,9 +493,8 @@ class Compiler * @param Tokenizer $tokens * @param Tag $scope * @throws \RuntimeException - * @return string */ - public static function tagBlockOpen(Tokenizer $tokens, Tag $scope) + public static function tagBlockOpen(Tokenizer $tokens, Tag $scope): void { $scope["cname"] = $scope->tpl->parsePlainArg($tokens, $name); if (!$name) { @@ -624,7 +508,7 @@ class Compiler * @param Tokenizer $tokens * @param Tag $scope */ - public static function tagBlockClose($tokens, Tag $scope) + public static function tagBlockClose(Tokenizer $tokens, Tag $scope): void { $tpl = $scope->tpl; $name = $scope["name"]; @@ -658,7 +542,7 @@ class Compiler * @param Tag $scope * @return string */ - public static function tagParent($tokens, Tag $scope) + public static function tagParent(Tokenizer $tokens, Tag $scope): string { $block_scope = $scope->tpl->getParentScope('block'); if (!$block_scope['use_parent']) { @@ -672,7 +556,7 @@ class Compiler * * @return string */ - public static function stdClose() + public static function stdClose(): string { return '}'; } @@ -684,7 +568,7 @@ class Compiler * @param Tag $tag * @return string */ - public static function stdFuncParser(Tokenizer $tokens, Tag $tag) + public static function stdFuncParser(Tokenizer $tokens, Tag $tag): string { if(is_string($tag->callback)) { return $tag->out($tag->callback . "(" . self::toArray($tag->tpl->parseParams($tokens)) . ', $tpl, $var)'); @@ -700,8 +584,9 @@ class Compiler * @param Tokenizer $tokens * @param Tag $tag * @return string + * @throws \ReflectionException */ - public static function smartFuncParser(Tokenizer $tokens, Tag $tag) + public static function smartFuncParser(Tokenizer $tokens, Tag $tag): string { if (strpos($tag->callback, "::") || is_array($tag->callback)) { list($class, $method) = explode("::", $tag->callback, 2); @@ -730,7 +615,7 @@ class Compiler * @param Tag $tag * @return string */ - public static function stdFuncOpen(Tokenizer $tokens, Tag $tag) + public static function stdFuncOpen(Tokenizer $tokens, Tag $tag): string { $tag["params"] = self::toArray($tag->tpl->parseParams($tokens)); $tag->setOption(\Fenom::AUTO_ESCAPE, false); @@ -744,7 +629,7 @@ class Compiler * @param Tag $tag * @return string */ - public static function stdFuncClose($tokens, Tag $tag) + public static function stdFuncClose(Tokenizer $tokens, Tag $tag): string { $tag->restore(\Fenom::AUTO_ESCAPE); if(is_string($tag->callback)) { @@ -757,10 +642,10 @@ class Compiler /** * Convert array of code to string array - * @param $params + * @param array $params * @return string */ - public static function toArray($params) + public static function toArray(array $params): string { $_code = array(); foreach ($params as $k => $v) { @@ -774,8 +659,9 @@ class Compiler * @param Tokenizer $tokens * @param Tag $scope * @return string + * @throws CompileException */ - public static function setOpen(Tokenizer $tokens, Tag $scope) + public static function setOpen(Tokenizer $tokens, Tag $scope): string { if($tokens->is(T_VARIABLE)) { $var = $scope->tpl->parseVariable($tokens); @@ -820,12 +706,12 @@ class Compiler * @param Tag $scope * @return string */ - public static function setClose($tokens, Tag $scope) + public static function setClose(Tokenizer $tokens, Tag $scope): string { return $scope["name"] . '=' . $scope["value"] . ';'; } - public static function tagDo($tokens, Tag $scope) + public static function tagDo(Tokenizer $tokens, Tag $scope): string { return $scope->tpl->parseExpr($tokens).';'; } @@ -835,19 +721,20 @@ class Compiler * @param Tokenizer $tokens * @param Tag $scope * @return string + * @throws CompileException */ - public static function filterOpen($tokens, Tag $scope) + public static function filterOpen(Tokenizer $tokens, Tag $scope): string { $scope["filter"] = $scope->tpl->parseModifier($tokens, "ob_get_clean()"); return "ob_start();"; } /** - * @param $tokens + * @param Tokenizer $tokens * @param Tag $scope * @return string */ - public static function filterClose($tokens, Tag $scope) + public static function filterClose(Tokenizer $tokens, Tag $scope): string { return "echo " . $scope["filter"] . ";"; } @@ -860,7 +747,7 @@ class Compiler * @throws Error\InvalidUsageException * @return string */ - public static function tagCycle(Tokenizer $tokens, Tag $tag) + public static function tagCycle(Tokenizer $tokens, Tag $tag): string { $tpl = $tag->tpl; if ($tokens->is("[")) { @@ -883,11 +770,11 @@ class Compiler /** * Runtime cycle callback - * @param mixed $vals - * @param $index + * @param array $vals + * @param int $index * @return mixed */ - public static function cycle($vals, $index) + public static function cycle(array $vals, int $index): mixed { return $vals[$index % count($vals)]; } @@ -897,11 +784,11 @@ class Compiler * * @param Tokenizer $tokens * @param Tag $tag - * @throws Error\UnexpectedTokenException - * @throws Error\InvalidUsageException * @return string + * @throws Error\InvalidUsageException|CompileException + * @throws Error\UnexpectedTokenException */ - public static function tagImport(Tokenizer $tokens, Tag $tag) + public static function tagImport(Tokenizer $tokens, Tag $tag): string { $tpl = $tag->tpl; $import = array(); @@ -966,7 +853,7 @@ class Compiler * @param Tag $scope * @throws InvalidUsageException */ - public static function macroOpen(Tokenizer $tokens, Tag $scope) + public static function macroOpen(Tokenizer $tokens, Tag $scope): void { $scope["name"] = $tokens->get(Tokenizer::MACRO_STRING); $scope["recursive"] = false; @@ -1011,7 +898,7 @@ class Compiler * @param Tokenizer $tokens * @param Tag $scope */ - public static function macroClose($tokens, Tag $scope) + public static function macroClose(Tokenizer $tokens, Tag $scope): void { if ($scope["recursive"]) { $scope["macro"]["recursive"] = true; @@ -1027,7 +914,7 @@ class Compiler * @param Tag $tag * @return string */ - public static function tagRaw(Tokenizer $tokens, Tag $tag) + public static function tagRaw(Tokenizer $tokens, Tag $tag): string { return 'echo ' . $tag->tpl->parseExpr($tokens); } @@ -1036,9 +923,9 @@ class Compiler * @param Tokenizer $tokens * @param Tag $tag */ - public static function escapeOpen(Tokenizer $tokens, Tag $tag) + public static function escapeOpen(Tokenizer $tokens, Tag $tag): void { - $expected = ($tokens->get(T_STRING) == "true" ? true : false); + $expected = $tokens->get(T_STRING) == "true"; $tokens->next(); $tag->setOption(\Fenom::AUTO_ESCAPE, $expected); } @@ -1046,7 +933,7 @@ class Compiler /** * Do nothing */ - public static function nope() + public static function nope(): void { } @@ -1054,30 +941,33 @@ class Compiler * @param Tokenizer $tokens * @param Tag $tag */ - public static function stripOpen(Tokenizer $tokens, Tag $tag) + public static function stripOpen(Tokenizer $tokens, Tag $tag): void { - $expected = ($tokens->get(T_STRING) == "true" ? true : false); + $expected = $tokens->get(T_STRING) == "true"; $tokens->next(); $tag->setOption(\Fenom::AUTO_STRIP, $expected); } /** * Tag {ignore} + * * @param Tokenizer $tokens * @param Tag $tag */ - public static function ignoreOpen($tokens, Tag $tag) + public static function ignoreOpen(Tokenizer $tokens, Tag $tag): void { $tag->tpl->ignore('ignore'); } /** * Tag {unset ...} + * * @param Tokenizer $tokens * @param Tag $tag * @return string + * @throws CompileException */ - public static function tagUnset(Tokenizer $tokens, Tag $tag) + public static function tagUnset(Tokenizer $tokens, Tag $tag): string { $unset = array(); while($tokens->valid()) { @@ -1086,7 +976,7 @@ class Compiler return 'unset('.implode(", ", $unset).')'; } - public static function tagPaste(Tokenizer $tokens, Tag $tag) + public static function tagPaste(Tokenizer $tokens, Tag $tag): string { $name = str_replace(array('\'', '"'), '', $tokens->get(T_CONSTANT_ENCAPSED_STRING)); $tokens->next(); diff --git a/src/Fenom/Provider.php b/src/Fenom/Provider.php index 905b166..1b7b39c 100644 --- a/src/Fenom/Provider.php +++ b/src/Fenom/Provider.php @@ -15,16 +15,16 @@ namespace Fenom; */ class Provider implements ProviderInterface { - private $_path; + private string $_path; - protected $_clear_cache = false; + protected bool $_clear_cache = false; /** * Clean directory from files * * @param string $path */ - public static function clean($path) + public static function clean(string $path) { if (is_file($path)) { unlink($path); @@ -39,7 +39,7 @@ class Provider implements ProviderInterface foreach ($iterator as $file) { /* @var \splFileInfo $file */ if ($file->isFile()) { - if (strpos($file->getBasename(), ".") !== 0) { + if (!str_starts_with($file->getBasename(), ".")) { unlink($file->getRealPath()); } } elseif ($file->isDir()) { @@ -54,7 +54,7 @@ class Provider implements ProviderInterface * * @param string $path */ - public static function rm($path) + public static function rm(string $path) { self::clean($path); if (is_dir($path)) { @@ -64,9 +64,9 @@ class Provider implements ProviderInterface /** * @param string $template_dir directory of templates - * @throws \LogicException if directory doesn't exists + * @throws \LogicException if directory doesn't exist */ - public function __construct($template_dir) + public function __construct(string $template_dir) { if ($_dir = realpath($template_dir)) { $this->_path = $_dir; @@ -80,17 +80,17 @@ class Provider implements ProviderInterface * @see http://php.net/manual/en/function.clearstatcache.php * @param bool $status */ - public function setClearCachedStats($status = true) { + public function setClearCachedStats(bool $status = true) { $this->_clear_cache = $status; } /** * Get source and mtime of template by name * @param string $tpl - * @param int $time load last modified time + * @param float|null $time load last modified time * @return string */ - public function getSource($tpl, &$time) + public function getSource(string $tpl, ?float &$time): string { $tpl = $this->_getTemplatePath($tpl); if($this->_clear_cache) { @@ -103,24 +103,24 @@ class Provider implements ProviderInterface /** * Get last modified of template by name * @param string $tpl - * @return int + * @return float */ - public function getLastModified($tpl) + public function getLastModified(string $tpl): float { $tpl = $this->_getTemplatePath($tpl); if($this->_clear_cache) { clearstatcache(true, $tpl); } - return filemtime($tpl); + return (float)filemtime($tpl); } /** * Get all names of templates from provider. * * @param string $extension all templates must have this extension, default .tpl - * @return array|\Iterator + * @return iterable */ - public function getList($extension = "tpl") + public function getList(string $extension = "tpl"): iterable { $list = array(); $iterator = new \RecursiveIteratorIterator( @@ -140,14 +140,14 @@ class Provider implements ProviderInterface /** * Get template path - * @param $tpl + * @param string $tpl * @return string * @throws \RuntimeException */ - protected function _getTemplatePath($tpl) + protected function _getTemplatePath(string $tpl): string { $path = realpath($this->_path . "/" . $tpl); - if ($path && strpos($path, $this->_path) === 0) { + if ($path && str_starts_with($path, $this->_path)) { return $path; } else { throw new \RuntimeException("Template $tpl not found"); @@ -158,9 +158,9 @@ class Provider implements ProviderInterface * @param string $tpl * @return bool */ - public function templateExists($tpl) + public function templateExists(string $tpl): bool { - return ($path = realpath($this->_path . "/" . $tpl)) && strpos($path, $this->_path) === 0; + return ($path = realpath($this->_path . "/" . $tpl)) && str_starts_with($path, $this->_path); } /** @@ -169,7 +169,7 @@ class Provider implements ProviderInterface * @param array $templates [template_name => modified, ...] By conversation, you may trust the template's name * @return bool */ - public function verify(array $templates) + public function verify(array $templates): bool { foreach ($templates as $template => $mtime) { $template = $this->_path . '/' . $template; diff --git a/src/Fenom/ProviderInterface.php b/src/Fenom/ProviderInterface.php index c0bbca0..4782f3e 100644 --- a/src/Fenom/ProviderInterface.php +++ b/src/Fenom/ProviderInterface.php @@ -20,20 +20,20 @@ interface ProviderInterface * @param string $tpl * @return bool */ - public function templateExists($tpl); + public function templateExists(string $tpl): bool; /** * @param string $tpl - * @param int $time + * @param float $time seconds with micro * @return string */ - public function getSource($tpl, &$time); + public function getSource(string $tpl, float &$time): string; /** * @param string $tpl - * @return int + * @return float seconds with micro */ - public function getLastModified($tpl); + public function getLastModified(string $tpl): float; /** * Verify templates (check mtime) @@ -41,11 +41,11 @@ interface ProviderInterface * @param array $templates [template_name => modified, ...] By conversation, you may trust the template's name * @return bool if true - all templates are valid else some templates are invalid */ - public function verify(array $templates); + public function verify(array $templates): bool; /** * Get all names of template from provider - * @return array|\Iterator + * @return iterable */ - public function getList(); + public function getList(): iterable; } diff --git a/src/Fenom/RangeIterator.php b/src/Fenom/RangeIterator.php index 82c5656..dd89248 100644 --- a/src/Fenom/RangeIterator.php +++ b/src/Fenom/RangeIterator.php @@ -14,7 +14,7 @@ class RangeIterator implements Iterator, Countable public int $max; public int $step; - public function __construct($min, $max, $step = 1) + public function __construct(int $min, int $max, int $step = 1) { $this->min = $min; $this->max = $max; @@ -42,7 +42,7 @@ class RangeIterator implements Iterator, Countable /** * Return the current element */ - public function current(): int + public function current(): mixed { return $this->current; } @@ -50,7 +50,7 @@ class RangeIterator implements Iterator, Countable /** * Move forward to next element */ - public function next() + public function next(): void { $this->current += $this->step; $this->index++; @@ -58,9 +58,9 @@ class RangeIterator implements Iterator, Countable /** * Return the key of the current element - * @return int + * @return mixed */ - public function key(): int + public function key(): mixed { return $this->index; } @@ -77,7 +77,7 @@ class RangeIterator implements Iterator, Countable /** * Rewind the Iterator to the first element */ - public function rewind() + public function rewind(): void { if($this->step > 0) { $this->current = min($this->min, $this->max); diff --git a/src/Fenom/Tag.php b/src/Fenom/Tag.php index 0456e5c..fac0e8e 100644 --- a/src/Fenom/Tag.php +++ b/src/Fenom/Tag.php @@ -205,7 +205,7 @@ class Tag extends \ArrayObject } $code = call_user_func($this->_close, $tokenizer, $this); $this->restoreAll(); - return $code; + return (string)$code; } else { throw new \LogicException("Can not use a inline tag {$this->name} as a block"); } diff --git a/src/Fenom/Template.php b/src/Fenom/Template.php index 99885c3..3442adb 100644 --- a/src/Fenom/Template.php +++ b/src/Fenom/Template.php @@ -66,7 +66,7 @@ class Template extends Render /** * @var string|null */ - public ?string $extends; + public ?string $extends = null; /** * @var string|null @@ -80,6 +80,7 @@ class Template extends Render public array $ext_stack = []; public bool $extend_body = false; + public string $dynamic_extends = ""; /** * Parent template @@ -483,7 +484,7 @@ class Template extends Render */ private function _getClosureSource(): string { - return "function (\$var, \$tpl) {\n?>{$this->_body}{$this->_body}_stack[] = $tag; } - return $code; + return (string)$code; } for ($j = $i = count($this->_stack) - 1; $i >= 0; $i--) { // call function's internal tag @@ -705,7 +706,7 @@ class Template extends Render * @param bool $is_var * @return string */ - public function parseExpr(Tokenizer $tokens, bool &$is_var = false): string + public function parseExpr(Tokenizer $tokens, ?bool &$is_var = false): string { $exp = array(); $var = false; // last term was: true - variable, false - mixed @@ -714,7 +715,7 @@ class Template extends Render while ($tokens->valid()) { // parse term $term = $this->parseTerm($tokens, $var, -1); // term of the expression - if ($term !== false) { + if ($term !== "") { if ($tokens->is('?', '!')) { if ($cond) { $term = array_pop($exp) . ' ' . $term; @@ -910,7 +911,7 @@ class Template extends Render $args = $this->parseArgs($tokens); $code = $unary . $this->parseChain($tokens, $method . $args); } else { - return false; + return ""; } break; case T_ISSET: @@ -933,7 +934,7 @@ class Template extends Render if ($unary) { throw new UnexpectedTokenException($tokens->back()); } else { - return false; + return ""; } } if (($allows & self::TERM_MODS) && $tokens->is('|')) { @@ -1050,7 +1051,7 @@ class Template extends Render * @param bool $is_var * @return string */ - public function parseAccessor(Tokenizer $tokens, bool &$is_var = false): string + public function parseAccessor(Tokenizer $tokens, ?bool &$is_var = false): string { $accessor = $tokens->need('$')->next()->need('.')->next()->current(); $parser = $this->getStorage()->getAccessor($accessor); @@ -1356,9 +1357,8 @@ class Template extends Render * * @param Tokenizer $tokens * @param $value - * @throws \LogicException - * @throws \Exception * @return string + * @throws CompileException */ public function parseModifier(Tokenizer $tokens, $value): string { @@ -1369,7 +1369,7 @@ class Template extends Render } else { $mods = $this->_fenom->getModifier($modifier, $this); if (!$mods) { - throw new \Exception("Modifier " . $tokens->current() . " not found"); + throw new CompileException("Modifier " . $tokens->current() . " not found"); } $tokens->next(); } @@ -1563,10 +1563,10 @@ class Template extends Render * Parse first unnamed argument * * @param Tokenizer $tokens - * @param string $static - * @return mixed|string + * @param string|null $static + * @return string */ - public function parsePlainArg(Tokenizer $tokens, string &$static): mixed + public function parsePlainArg(Tokenizer $tokens, ?string &$static = null): string { if ($tokens->is(T_CONSTANT_ENCAPSED_STRING)) { if ($tokens->isNext('|')) { diff --git a/src/Fenom/Tokenizer.php b/src/Fenom/Tokenizer.php index a073ed4..aa66ea7 100644 --- a/src/Fenom/Tokenizer.php +++ b/src/Fenom/Tokenizer.php @@ -181,7 +181,7 @@ class Tokenizer $this->_curr = null; $this->_next = null; $this->_prev = null; - $tokens = array(-1 => array(\T_WHITESPACE, '', '', 1)); + $tokens = [-1 => [\T_WHITESPACE, '', '', 1]]; $_tokens = token_get_all("quotes++; } - $token = array( + $token = [ $token, $token, $line, - ); + ]; } elseif ($token[0] === \T_WHITESPACE) { $tokens[$i - 1][2] = $token[1]; continue; + } elseif ($token[0] === \T_NAME_FULLY_QUALIFIED || $token[0] === \T_NAME_QUALIFIED || $token[0] === \T_NAME_RELATIVE) { + $parts = explode("\\", $token[1]); + for ($k = 0; $k < count($parts); $k++) { + if ($parts[$k] !== "") { + $tokens[] = [ + T_STRING, + $parts[$k], + "", + $line = $token[2] + ]; + $i++; + } + if (isset($parts[$k], $parts[$k+1])) { + $tokens[] = [ + "\\", + "\\", + "", + $line = $token[2] + ]; + $i++; + } + } + continue; } elseif ($token[0] === \T_DNUMBER) { // fix .1 and 1. if(str_starts_with($token[1], '.')) { $tokens[] = array( diff --git a/tests/TestCase.php b/tests/TestCase.php index 7c04289..c8509f4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,13 +3,17 @@ namespace Fenom; use Fenom, Fenom\Provider as FS; +class CustomFenom extends Fenom { + public mixed $prop; +} + class TestCase extends \PHPUnit\Framework\TestCase { public $template_path = 'template'; /** - * @var Fenom + * @var CustomFenom */ - public $fenom; + public CustomFenom $fenom; public $values; @@ -61,7 +65,7 @@ class TestCase extends \PHPUnit\Framework\TestCase FS::clean($this->getCompilePath()); } - $this->fenom = Fenom::factory(FENOM_RESOURCES . '/' . $this->template_path, $this->getCompilePath()); + $this->fenom = CustomFenom::factory(FENOM_RESOURCES . '/' . $this->template_path, $this->getCompilePath()); $this->fenom->addProvider('persist', new Provider(FENOM_RESOURCES . '/provider')); $this->fenom->addModifier('dots', __CLASS__ . '::dots'); $this->fenom->addModifier('concat', __CLASS__ . '::concat'); @@ -168,7 +172,7 @@ class TestCase extends \PHPUnit\Framework\TestCase $this->fenom->setOptions($options); try { $this->fenom->compileCode($code, "inline.tpl"); - } catch (\Exception $e) { + } catch (\Throwable $e) { $this->assertSame($exception, get_class($e), "Exception $code"); $this->assertStringStartsWith($message, $e->getMessage()); $this->fenom->setOptions($opt); @@ -180,7 +184,11 @@ class TestCase extends \PHPUnit\Framework\TestCase public function assertRender($tpl, $result, array $vars = array(), $debug = false) { - $template = $this->fenom->compileCode($tpl); + try { + $template = $this->fenom->compileCode($tpl); + } catch (\Throwable $e) { + throw new \RuntimeException("Template failed: $tpl",0 , $e); + } if ($debug) { print_r("\nDEBUG $tpl:\n" . $template->getBody()); } @@ -300,7 +308,8 @@ class Helper const CONSTANT = "helper.class.const"; - public $word = 'helper'; + public string $word = 'helper'; + public Helper $self; public function __construct($word) { diff --git a/tests/cases/Fenom/AccessorTest.php b/tests/cases/Fenom/AccessorTest.php index 2c0684d..d4b3720 100644 --- a/tests/cases/Fenom/AccessorTest.php +++ b/tests/cases/Fenom/AccessorTest.php @@ -132,7 +132,8 @@ class AccessorTest extends TestCase * @group issue260 */ public function testBug260() { - $this->fenom->compileCode('{$.php.Fenom::factory()->addModifier("intval", "intval")}'); + $t = $this->fenom->compileCode('{$.php.Fenom::factory()->addModifier("intval", "intval")}'); + $this->assertInstanceOf(Template::class, $t); } @@ -236,15 +237,28 @@ class AccessorTest extends TestCase $this->execError($tpl, $exception, $message); } - public function getThree() { + public static function getThree(): int + { return 3; } + public static function getThreeArray(): array + { + return ["three" => 3]; + } + + public static function getThreeCb(): callable + { + return fn() => 3; + } + + public static int $three = 3; + public static function providerSmartAccessor() { return array( - array('acc', '$tpl->getStorage()->test->values', \Fenom::ACCESSOR_VAR, '{$.acc.three}', '3'), - array('acc', '$tpl->getStorage()->test->getThree', \Fenom::ACCESSOR_CALL, '{$.acc()}', '3'), - array('acc', 'three', \Fenom::ACCESSOR_PROPERTY, '{$.acc}', '3'), + array('acc', '\Fenom\AccessorTest::getThreeArray()', \Fenom::ACCESSOR_VAR, '{$.acc.three}', '3'), + array('acc', '\Fenom\AccessorTest::getThreeCb()', \Fenom::ACCESSOR_CALL, '{$.acc()}', '3'), + array('acc', 'prop', \Fenom::ACCESSOR_PROPERTY, '{$.acc}', 'something'), array('acc', 'templateExists', \Fenom::ACCESSOR_METHOD, '{$.acc("persist:pipe.tpl")}', '1') ); } @@ -259,8 +273,7 @@ class AccessorTest extends TestCase * @param $result */ public function testSmartAccessor($name, $accessor, $type, $code, $result) { - $this->fenom->test = $this; - $this->fenom->three = 3; + $this->fenom->prop = "something"; $this->fenom->addAccessorSmart($name, $accessor, $type); $this->assertRender($code, $result, $this->getVars()); } diff --git a/tests/cases/Fenom/CustomProviderTest.php b/tests/cases/Fenom/CustomProviderTest.php index 30c9c63..88ba4dd 100644 --- a/tests/cases/Fenom/CustomProviderTest.php +++ b/tests/cases/Fenom/CustomProviderTest.php @@ -6,7 +6,7 @@ namespace Fenom; class CustomProviderTest extends TestCase { - public function setUp() + public function setUp(): void { parent::setUp(); $this->fenom->addProvider("my", new Provider(FENOM_RESOURCES . '/provider')); diff --git a/tests/cases/Fenom/FunctionsTest.php b/tests/cases/Fenom/FunctionsTest.php index ed56f1e..64f27a1 100644 --- a/tests/cases/Fenom/FunctionsTest.php +++ b/tests/cases/Fenom/FunctionsTest.php @@ -21,7 +21,7 @@ class FunctionsTest extends TestCase return $a + $i; } - public function setUp() + public function setUp(): void { parent::setUp(); $this->fenom->addFunctionSmart('sum', __CLASS__ . '::functionSum'); diff --git a/tests/cases/Fenom/MacrosTest.php b/tests/cases/Fenom/MacrosTest.php index 89ff81d..197ad89 100644 --- a/tests/cases/Fenom/MacrosTest.php +++ b/tests/cases/Fenom/MacrosTest.php @@ -4,7 +4,7 @@ namespace Fenom; class MacrosTest extends TestCase { - public function setUp() + public function setUp(): void { parent::setUp(); $this->tpl("math.tpl", @@ -115,12 +115,10 @@ class MacrosTest extends TestCase ); } - /** - * @expectedExceptionMessage Undefined macro 'plus' - * @expectedException \Fenom\Error\CompileException - */ public function testImportMiss() { + $this->expectException(exception: \Fenom\Error\CompileException::class); + $this->expectExceptionMessage("Undefined macro 'plus'"); $tpl = $this->fenom->compile('import_miss.tpl'); $this->assertSame( diff --git a/tests/cases/Fenom/ProviderTest.php b/tests/cases/Fenom/ProviderTest.php index 77d8706..9e9a5af 100644 --- a/tests/cases/Fenom/ProviderTest.php +++ b/tests/cases/Fenom/ProviderTest.php @@ -11,7 +11,7 @@ class ProviderTest extends TestCase */ public $provider; - public function setUp() + public function setUp(): void { parent::setUp(); $this->tpl("template1.tpl", 'Template 1 {$a}'); @@ -30,6 +30,7 @@ class ProviderTest extends TestCase public function testGetSource() { + $time = 0.0; clearstatcache(); $src = $this->provider->getSource("template1.tpl", $time); clearstatcache(); @@ -37,11 +38,9 @@ class ProviderTest extends TestCase $this->assertEquals(filemtime(FENOM_RESOURCES . '/template/template1.tpl'), $time); } - /** - * @expectedException \RuntimeException - */ public function testGetSourceInvalid() { + $this->expectException(\RuntimeException::class); $this->provider->getSource("unexists.tpl", $time); } @@ -52,11 +51,9 @@ class ProviderTest extends TestCase $this->assertEquals(filemtime(FENOM_RESOURCES . '/template/template1.tpl'), $time); } - /** - * @expectedException \RuntimeException - */ public function testGetLastModifiedInvalid() { + $this->expectException(\RuntimeException::class); $this->provider->getLastModified("unexists.tpl"); } diff --git a/tests/cases/Fenom/RenderTest.php b/tests/cases/Fenom/RenderTest.php index 149aa45..aab8ccc 100644 --- a/tests/cases/Fenom/RenderTest.php +++ b/tests/cases/Fenom/RenderTest.php @@ -12,7 +12,7 @@ class RenderTest extends TestCase */ public static $render; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { self::$render = new Render(Fenom::factory("."), function ($tpl) { echo "It is render's function " . $tpl["render"]; @@ -50,6 +50,8 @@ class RenderTest extends TestCase */ public function testFetchException() { + $this->expectException(\RuntimeException::class); + $this->expectExceptionMessage("template error"); $render = new Render(Fenom::factory("."), function () { echo "error"; throw new \RuntimeException("template error"); diff --git a/tests/cases/Fenom/SandboxTest.php b/tests/cases/Fenom/SandboxTest.php deleted file mode 100644 index 6e42360..0000000 --- a/tests/cases/Fenom/SandboxTest.php +++ /dev/null @@ -1,35 +0,0 @@ -fenom->setOptions(\Fenom::FORCE_VERIFY); -// $this->fenom->addAccessorSmart('q', 'Navi::$q', \Fenom::ACCESSOR_VAR); -// $this->assertEquals([1, 2, 4, "as" => 767, "df" => ["qert"]], [1, 2, 4, "as" => 767, "df" => ["qet"]]); -// $this->fenom->addBlockCompiler('php', 'Fenom\Compiler::nope', function ($tokens, Tag $tag) { -// return 'cutContent(); -// }); -// $this->tpl('welcome.tpl', '{$a}'); -// var_dump($this->fenom->compileCode('{set $a=$one|min:0..$three|max:4}')->getBody()); - -// try { -// var_dump($this->fenom->compileCode('{foreach $a as $k}A{$k:first}{foreachelse}B{/foreach}')->getBody()); -// } catch (\Exception $e) { -// print_r($e->getMessage() . "\n" . $e->getTraceAsString()); -// while ($e->getPrevious()) { -// $e = $e->getPrevious(); -// print_r("\n\n" . $e->getMessage() . " in {$e->getFile()}:{$e->getLine()}\n" . $e->getTraceAsString()); -// } -// } -// exit; - } - -} \ No newline at end of file diff --git a/tests/cases/Fenom/ScopeTest.php b/tests/cases/Fenom/ScopeTest.php deleted file mode 100644 index 9b3a7d5..0000000 --- a/tests/cases/Fenom/ScopeTest.php +++ /dev/null @@ -1,36 +0,0 @@ -assertInstanceOf('Fenom\Tokenizer', $tokenizer); - $this->assertInstanceOf('Fenom\Scope', $scope); - $scope["value"] = true; - return "open-tag"; - } - - public function closeTag($tokenizer, $scope) - { - $this->assertInstanceOf('Fenom\Tokenizer', $tokenizer); - $this->assertInstanceOf('Fenom\Scope', $scope); - $this->assertTrue($scope["value"]); - return "close-tag"; - } - - public function testBlock() - { - /*$scope = new Scope($this->fenom, new Template($this->fenom), 1, array( - "open" => array($this, "openTag"), - "close" => array($this, "closeTag") - ), 0); - $tokenizer = new Tokenizer("1+1"); - $this->assertSame("open-tag /*#{$scope->id}#* /", $scope->open($tokenizer)); - $this->assertSame("close-tag", $scope->close($tokenizer)); - - $content = " some ?> content\n\nwith /*#9999999#* / many\n\tlines"; - $scope->tpl->_body = "start open($tokenizer)." ?>".$content; - $this->assertSame($content, $scope->getContent());*/ - } -} diff --git a/tests/cases/Fenom/TagOptionTest.php b/tests/cases/Fenom/TagOptionTest.php deleted file mode 100644 index 71d0854..0000000 --- a/tests/cases/Fenom/TagOptionTest.php +++ /dev/null @@ -1,14 +0,0 @@ -tpl('welcome.tpl', 'Welcome, {$username} ({$email})'); diff --git a/tests/cases/Fenom/TokenizerTest.php b/tests/cases/Fenom/TokenizerTest.php index 15213e7..50124cd 100644 --- a/tests/cases/Fenom/TokenizerTest.php +++ b/tests/cases/Fenom/TokenizerTest.php @@ -80,6 +80,25 @@ class TokenizerTest extends TestCase $this->assertSame('}', $tokens->end()->current()); } + public function testComplexTokens() + { + $text = "one\\two"; + $tokens = new Tokenizer($text); + $this->assertSame("one", $tokens->current()); + $this->assertSame("\\", $tokens->next()->current()); + $this->assertSame("two", $tokens->next()->current()); + $this->assertFalse($tokens->next()->valid()); + + $text = "\\one\\two"; + + $tokens = new Tokenizer($text); + $this->assertSame("\\", $tokens->current()); + $this->assertSame("one", $tokens->next()->current()); + $this->assertSame("\\", $tokens->next()->current()); + $this->assertSame("two", $tokens->next()->current()); + $this->assertFalse($tokens->next()->valid()); + } + public function testSkip() { $text = "1 foo: bar ( 3 + double ) "; From 3af87c3419ea97b637f0f65d94ec66a52f55b3b9 Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Tue, 21 Feb 2023 22:09:00 +0100 Subject: [PATCH 05/11] migrate to php8 --- src/Fenom.php | 4 +--- src/Fenom/Provider.php | 2 +- src/Fenom/Tag.php | 4 ++-- src/Fenom/Template.php | 20 +++++++++++--------- tests/TestCase.php | 2 +- tests/cases/Fenom/TemplateTest.php | 4 ++-- tests/cases/FenomTest.php | 15 +-------------- 7 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/Fenom.php b/src/Fenom.php index cbc5e17..a5bf65a 100644 --- a/src/Fenom.php +++ b/src/Fenom.php @@ -426,10 +426,8 @@ class Fenom { if (is_string($source)) { $provider = new Fenom\Provider($source); - } elseif ($source instanceof ProviderInterface) { - $provider = $source; } else { - throw new InvalidArgumentException("Source must be a valid path or provider object"); + $provider = $source; } $fenom = new static($provider); $fenom->setCompileDir($compile_dir); diff --git a/src/Fenom/Provider.php b/src/Fenom/Provider.php index 1b7b39c..a2c51fd 100644 --- a/src/Fenom/Provider.php +++ b/src/Fenom/Provider.php @@ -176,7 +176,7 @@ class Provider implements ProviderInterface if($this->_clear_cache) { clearstatcache(true, $template); } - if (@filemtime($template) !== $mtime) { + if (@filemtime($template) != $mtime) { return false; } diff --git a/src/Fenom/Tag.php b/src/Fenom/Tag.php index fac0e8e..2f48aa1 100644 --- a/src/Fenom/Tag.php +++ b/src/Fenom/Tag.php @@ -35,8 +35,8 @@ class Tag extends \ArrayObject private bool $_closed = true; private string $_body; private int $_type = 0; - private string $_open; - private string $_close; + private mixed $_open; + private mixed $_close; private array $_tags = []; private array $_floats = []; private array $_changed = []; diff --git a/src/Fenom/Template.php b/src/Fenom/Template.php index 3442adb..c37b105 100644 --- a/src/Fenom/Template.php +++ b/src/Fenom/Template.php @@ -646,7 +646,7 @@ class Template extends Render { $action = $tokens->get(Tokenizer::MACRO_STRING); $tokens->next(); - if ($tokens->is("(", T_DOUBLE_COLON, T_NS_SEPARATOR) && !$tokens->isWhiteSpaced()) { + if ($tokens->is("(", T_DOUBLE_COLON, "\\") && !$tokens->isWhiteSpaced()) { // just invoke function or static method $tokens->back(); return $this->out($this->parseExpr($tokens)); @@ -906,7 +906,7 @@ class Template extends Render $call = $func . $this->parseArgs($tokens->next()); } $code = $unary . $this->parseChain($tokens, $call); - } elseif ($tokens->isNext(T_NS_SEPARATOR, T_DOUBLE_COLON)) { + } elseif ($tokens->isNext("\\", T_DOUBLE_COLON)) { $method = $this->parseStatic($tokens); $args = $this->parseArgs($tokens); $code = $unary . $this->parseChain($tokens, $method . $args); @@ -1178,7 +1178,7 @@ class Template extends Render return $invert . '(' . $value . ' instanceof \\' . $this->parseName($tokens) . ')'; } elseif ($tokens->is(T_VARIABLE, '[', Tokenizer::MACRO_SCALAR, '"')) { return '(' . $value . ' ' . $equal . '= ' . $this->parseTerm($tokens) . ')'; - } elseif ($tokens->is(T_NS_SEPARATOR)) { // + } elseif ($tokens->is("\\")) { // return $invert . '(' . $value . ' instanceof \\' . $this->parseName($tokens) . ')'; } else { throw new InvalidUsageException("Unknown argument"); @@ -1250,11 +1250,11 @@ class Template extends Render */ public function parseName(Tokenizer $tokens): string { - $tokens->skipIf(T_NS_SEPARATOR); + $tokens->skipIf("\\"); $name = ""; if ($tokens->is(T_STRING)) { $name .= $tokens->getAndNext(); - while ($tokens->is(T_NS_SEPARATOR)) { + while ($tokens->is("\\")) { $name .= '\\' . $tokens->next()->get(T_STRING); $tokens->next(); } @@ -1364,7 +1364,7 @@ class Template extends Render { while ($tokens->is("|")) { $modifier = $tokens->getNext(Tokenizer::MACRO_STRING); - if ($tokens->isNext(T_DOUBLE_COLON, T_NS_SEPARATOR)) { + if ($tokens->isNext(T_DOUBLE_COLON, "\\")) { $mods = $this->parseStatic($tokens); } else { $mods = $this->_fenom->getModifier($modifier, $this); @@ -1376,9 +1376,11 @@ class Template extends Render $args = array(); while ($tokens->is(":")) { - if (($args[] = $this->parseTerm($tokens->next(), $is_var, 0)) === false) { + $term = $this->parseTerm($tokens->next(), $is_var, 0); + if ($term === "") { throw new UnexpectedTokenException($tokens); } + $args[] = $term; } if (!is_string($mods)) { // dynamic modifier @@ -1496,11 +1498,11 @@ class Template extends Render if ($this->_options & Fenom::DENY_STATICS) { throw new \LogicException("Static methods are disabled"); } - $tokens->skipIf(T_NS_SEPARATOR); + $tokens->skipIf("\\"); $name = ""; if ($tokens->is(T_STRING)) { $name .= $tokens->getAndNext(); - while ($tokens->is(T_NS_SEPARATOR)) { + while ($tokens->is("\\")) { $name .= '\\' . $tokens->next()->get(T_STRING); $tokens->next(); } diff --git a/tests/TestCase.php b/tests/TestCase.php index c8509f4..76adc5a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -110,7 +110,7 @@ class TestCase extends \PHPUnit\Framework\TestCase } } - public function tpl($name, $code) + public function tpl($name, $code): float { $dir = dirname($name); if ($dir != "." && !is_dir(FENOM_RESOURCES . '/template/' . $dir)) { diff --git a/tests/cases/Fenom/TemplateTest.php b/tests/cases/Fenom/TemplateTest.php index 2c8dd8a..92ef4d7 100644 --- a/tests/cases/Fenom/TemplateTest.php +++ b/tests/cases/Fenom/TemplateTest.php @@ -1202,8 +1202,8 @@ class TemplateTest extends TestCase $this->values = $vars; $this->tpl("insert.tpl", $code); $tpl = $this->fenom->getTemplate('insert.tpl'); - $this->assertSame($result, $tpl->fetch($vars)); - $this->assertTrue($tpl->isValid()); + $this->assertSame($result, $tpl->fetch($vars), $code); + $this->assertTrue($tpl->isValid(), $code); } /** diff --git a/tests/cases/FenomTest.php b/tests/cases/FenomTest.php index e0c45e4..2764350 100644 --- a/tests/cases/FenomTest.php +++ b/tests/cases/FenomTest.php @@ -48,25 +48,12 @@ class FenomTest extends \Fenom\TestCase $fenom->clearAllCompiles(); } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Cache directory /invalid/path is not writable - */ public function testFactoryInvalid() { + $this->expectException(LogicException::class, "Cache directory /invalid/path is not writable"); Fenom::factory(FENOM_RESOURCES . '/template', '/invalid/path'); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Source must be a valid path or provider object - */ - public function testFactoryInvalid2() - { - Fenom::factory(new StdClass); - } - public function testCompileFile() { $a = array( From b04c38a533083a36f0b7325828a6a5ae63801d54 Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Thu, 23 Feb 2023 21:03:19 +0100 Subject: [PATCH 06/11] migrate to php8 --- src/Fenom/Modifier.php | 48 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/Fenom/Modifier.php b/src/Fenom/Modifier.php index 3550ce9..6fb8ad9 100644 --- a/src/Fenom/Modifier.php +++ b/src/Fenom/Modifier.php @@ -23,15 +23,57 @@ class Modifier * @param string $format * @return string */ - public static function dateFormat(int|string $date, string $format = "%b %e, %Y"): string + public static function dateFormat(mixed $date, string $format = "%b %e, %Y"): string { if (!is_numeric($date)) { - $date = strtotime($date); + if ($date instanceof \DateTime) { + $date = $date->getTimestamp(); + } else { + $date = strtotime($date); + } if (!$date) { $date = time(); } } - return strftime($format, $date); + if (str_contains($format, "%")) { + // fallback mode + $from = [ + // Day - no strf eq : S (created one called %O) + '%O', '%d', '%a', '%e', '%A', '%u', '%w', '%j', + // Week - no date eq : %U, %W + '%V', + // Month - no strf eq : n, t + '%B', '%m', '%b', '%-m', + // Year - no strf eq : L; no date eq : %C, %g + '%G', '%Y', '%y', + // Time - no strf eq : B, G, u; no date eq : %r, %R, %T, %X + '%P', '%p', '%l', '%I', '%H', '%M', '%S', + // Timezone - no strf eq : e, I, P, Z + '%z', '%Z', + // Full Date / Time - no strf eq : c, r; no date eq : %c, %D, %F, %x + '%s' + ]; + + $to = [ + 'S', 'd', 'D', 'j', 'l', 'N', 'w', 'z', + 'W', + 'F', 'm', 'M', 'n', + 'o', 'Y', 'y', + 'a', 'A', 'g', 'h', 'H', 'i', 's', + 'O', 'T', + 'U' + ]; + $pattern = array_map( + function ( $s ) { + return '/(? Date: Thu, 23 Feb 2023 21:50:12 +0100 Subject: [PATCH 07/11] migrate to php8 --- src/Fenom.php | 16 ++++++++++++---- src/Fenom/Error/TemplateException.php | 10 ++++++++++ src/Fenom/Render.php | 8 +++++++- tests/TestCase.php | 9 ++++++++- tests/cases/Fenom/RenderTest.php | 7 +------ tests/cases/FenomTest.php | 4 ++-- 6 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 src/Fenom/Error/TemplateException.php diff --git a/src/Fenom.php b/src/Fenom.php index a5bf65a..182ebf5 100644 --- a/src/Fenom.php +++ b/src/Fenom.php @@ -422,7 +422,7 @@ class Fenom string|Fenom\ProviderInterface $source, string $compile_dir = '/tmp', int|array $options = 0 - ): Fenom + ): static { if (is_string($source)) { $provider = new Fenom\Provider($source); @@ -1056,11 +1056,12 @@ class Fenom /** @var Fenom\Template $tpl */ $tpl = $this->_storage[$key]; if (($this->_options & self::AUTO_RELOAD) && !$tpl->isValid()) { - return $this->_storage[$key] = $this->compile($template, true, $options); + $this->compile($template, true, $options); + return $this->_storage[$key] = $this->_load($template, $options); } else { return $tpl; } - } elseif ($this->_options & (self::FORCE_COMPILE | self::DISABLE_CACHE)) { + } elseif ($this->_options & (self::FORCE_COMPILE | self::DISABLE_CACHE)) { return $this->compile($template, !($this->_options & self::DISABLE_CACHE), $options); } else { return $this->_storage[$key] = $this->_load($template, $options); @@ -1099,6 +1100,10 @@ class Fenom protected function _load(array|string $template, int $opts): Render { $file_name = $this->getCompileName($template, $opts); + $tpl = null; + if (!is_file($this->_compile_dir . "/" . $file_name)) { + $tpl = $this->compile($template, true, $opts); + } if (is_file($this->_compile_dir . "/" . $file_name)) { $fenom = $this; // used in template $_tpl = include($this->_compile_dir . "/" . $file_name); @@ -1108,9 +1113,12 @@ class Fenom && $_tpl instanceof Fenom\Render && $_tpl->isValid()) { return $_tpl; + } else if ($tpl) { + return $tpl; } } - return $this->compile($template, true, $opts); + throw new CompileException("failed to store cache of " . var_export($template, true) . + " to {$file_name}"); } /** diff --git a/src/Fenom/Error/TemplateException.php b/src/Fenom/Error/TemplateException.php new file mode 100644 index 0000000..f17cd8f --- /dev/null +++ b/src/Fenom/Error/TemplateException.php @@ -0,0 +1,10 @@ +_code->__invoke($values, $this); + try { + $this->_code->__invoke($values, $this); + } catch (\Throwable $e) { + throw new Fenom\Error\TemplateException("unhandled exception in the template `{$this->getName()}`: {$e->getMessage()}", 0, $e); + } return $values; } diff --git a/tests/TestCase.php b/tests/TestCase.php index 76adc5a..bbc4284 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -241,7 +241,7 @@ class TestCase extends \PHPUnit\Framework\TestCase ); } - public function providerVariables() + public static function providerVariables() { return array( array('$one', 1), @@ -334,6 +334,13 @@ class Helper public function getArray() { return array(1,2,3); } + + /** + * @throws \Exception + */ + public static function throws() { + throw new \Exception("helper exception"); + } } function helper_func($string, $pad = 10) { diff --git a/tests/cases/Fenom/RenderTest.php b/tests/cases/Fenom/RenderTest.php index aab8ccc..c9f3eee 100644 --- a/tests/cases/Fenom/RenderTest.php +++ b/tests/cases/Fenom/RenderTest.php @@ -44,14 +44,9 @@ class RenderTest extends TestCase $this->assertSame("It is render's function fetch", self::$render->fetch(array("render" => "fetch"))); } - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage template error - */ public function testFetchException() { - $this->expectException(\RuntimeException::class); - $this->expectExceptionMessage("template error"); + $this->expectException(Fenom\Error\TemplateException::class); $render = new Render(Fenom::factory("."), function () { echo "error"; throw new \RuntimeException("template error"); diff --git a/tests/cases/FenomTest.php b/tests/cases/FenomTest.php index 2764350..6c9e025 100644 --- a/tests/cases/FenomTest.php +++ b/tests/cases/FenomTest.php @@ -24,7 +24,7 @@ class FenomTest extends \Fenom\TestCase $time = $this->tpl('temp.tpl', 'Template 1 a'); $fenom = new Fenom($provider = new \Fenom\Provider(FENOM_RESOURCES . '/template')); $fenom->setCompileDir(FENOM_RESOURCES . '/compile'); - $this->assertInstanceOf('Fenom\Template', $tpl = $fenom->getTemplate('temp.tpl')); + $this->assertInstanceOf('Fenom\Render', $tpl = $fenom->getTemplate('temp.tpl')); $this->assertSame($provider, $tpl->getProvider()); $this->assertSame('temp.tpl', $tpl->getBaseName()); $this->assertSame('temp.tpl', $tpl->getName()); @@ -40,7 +40,7 @@ class FenomTest extends \Fenom\TestCase FENOM_RESOURCES . '/compile', Fenom::AUTO_ESCAPE ); - $this->assertInstanceOf('Fenom\Template', $tpl = $fenom->getTemplate('temp.tpl')); + $this->assertInstanceOf('Fenom\Render', $tpl = $fenom->getTemplate('temp.tpl')); $this->assertSame($provider, $tpl->getProvider()); $this->assertSame('temp.tpl', $tpl->getBaseName()); $this->assertSame('temp.tpl', $tpl->getName()); From f8863ee0ad8241ea35e3c106ca44f5287528481f Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Thu, 23 Feb 2023 21:53:03 +0100 Subject: [PATCH 08/11] migrate to php8 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38a9b9b..e147973 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ Changelog ========= +## 3.0.0 (2023-02-23) + +- Fenom supported php8+ +- Remove `eval` from template compiler +- `strftime` -> `date` with fallback support. +- update tokenizer +- bugfixes and optimizations ## 2.11.0 (2016-06-09) From 9269c96fc3a005122e16e94ea9aa40c42c8358d7 Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Thu, 23 Feb 2023 22:01:33 +0100 Subject: [PATCH 09/11] migrate to php8 --- .github/workflows/php.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..70caae4 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,31 @@ +name: PHP Composer + +on: push + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run tests + run: vendor/bin/phpunit \ No newline at end of file From 74fbcd1534a43dc10e987b912e46c2d3066dcf27 Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Thu, 23 Feb 2023 22:03:07 +0100 Subject: [PATCH 10/11] migrate to php8 --- composer.lock | 950 +------------------------------------------------- 1 file changed, 1 insertion(+), 949 deletions(-) diff --git a/composer.lock b/composer.lock index 4c4c155..d4cb6e5 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": "dc6a664578936c2f2259ba8657569d9d", + "content-hash": "2114236e7057346a0af8b8d89077f3d7", "packages": [], "packages-dev": [ { @@ -77,106 +77,6 @@ ], "time": "2022-12-30T00:23:10+00:00" }, - { - "name": "guzzle/guzzle", - "version": "v3.9.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle3.git", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", - "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.1" - }, - "replace": { - "guzzle/batch": "self.version", - "guzzle/cache": "self.version", - "guzzle/common": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version", - "guzzle/iterator": "self.version", - "guzzle/log": "self.version", - "guzzle/parser": "self.version", - "guzzle/plugin": "self.version", - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-error-response": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version", - "guzzle/service": "self.version", - "guzzle/stream": "self.version" - }, - "require-dev": { - "doctrine/cache": "~1.3", - "monolog/monolog": "~1.0", - "phpunit/phpunit": "3.7.*", - "psr/log": "~1.0", - "symfony/class-loader": "~2.1", - "zendframework/zend-cache": "2.*,<2.3", - "zendframework/zend-log": "2.*,<2.3" - }, - "suggest": { - "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.9-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle": "src/", - "Guzzle\\Tests": "tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" - } - ], - "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "support": { - "issues": "https://github.com/guzzle/guzzle3/issues", - "source": "https://github.com/guzzle/guzzle3/tree/master" - }, - "abandoned": "guzzlehttp/guzzle", - "time": "2015-03-18T18:23:50+00:00" - }, { "name": "myclabs/deep-copy", "version": "1.11.0", @@ -823,119 +723,6 @@ ], "time": "2023-02-04T13:37:15+00:00" }, - { - "name": "psr/log", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "time": "2021-05-03T11:20:27+00:00" - }, - { - "name": "satooshi/php-coveralls", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/satooshi/php-coveralls.git", - "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/da51d304fe8622bf9a6da39a8446e7afd432115c", - "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-simplexml": "*", - "guzzle/guzzle": "^2.8|^3.0", - "php": ">=5.3.3", - "psr/log": "^1.0", - "symfony/config": "^2.1|^3.0", - "symfony/console": "^2.1|^3.0", - "symfony/stopwatch": "^2.0|^3.0", - "symfony/yaml": "^2.0|^3.0" - }, - "suggest": { - "symfony/http-kernel": "Allows Symfony integration" - }, - "bin": [ - "bin/coveralls" - ], - "type": "library", - "autoload": { - "psr-4": { - "Satooshi\\": "src/Satooshi/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kitamura Satoshi", - "email": "with.no.parachute@gmail.com", - "homepage": "https://www.facebook.com/satooshi.jp" - } - ], - "description": "PHP client library for Coveralls API", - "homepage": "https://github.com/satooshi/php-coveralls", - "keywords": [ - "ci", - "coverage", - "github", - "test" - ], - "support": { - "issues": "https://github.com/satooshi/php-coveralls/issues", - "source": "https://github.com/satooshi/php-coveralls/tree/1.0" - }, - "abandoned": "php-coveralls/php-coveralls", - "time": "2016-01-20T17:35:46+00:00" - }, { "name": "sebastian/cli-parser", "version": "1.0.1", @@ -1900,741 +1687,6 @@ ], "time": "2020-09-28T06:39:44+00:00" }, - { - "name": "symfony/config", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", - "reference": "bc6b3fd3930d4b53a60b42fe2ed6fc466b75f03f", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/config/tree/v3.4.47" - }, - "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": "2020-10-24T10:57:07+00:00" - }, - { - "name": "symfony/console", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81", - "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/console/tree/v3.4.47" - }, - "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": "2020-10-24T10:57:07+00:00" - }, - { - "name": "symfony/debug", - "version": "v4.4.44", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "1a692492190773c5310bc7877cb590c04c2f05be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be", - "reference": "1a692492190773c5310bc7877cb590c04c2f05be", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to ease debugging PHP code", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.44" - }, - "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" - } - ], - "abandoned": "symfony/error-handler", - "time": "2022-07-28T16:29:46+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.8.52", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a77e974a5fecb4398833b0709210e3d5e334ffb0", - "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v2.8.50" - }, - "time": "2018-11-21T14:20:20+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v4.4.42", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5", - "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides basic utilities for the filesystem", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v4.4.42" - }, - "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": "2022-05-20T08:49:14+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "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.27.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": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.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": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.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": "2022-11-03T14:55:06+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/298b81faad4ce60e94466226b2abbb8c9bca7462", - "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/stopwatch/tree/v3.4.47" - }, - "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": "2020-10-24T10:57:07+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "88289caa3c166321883f67fe5130188ebbb47094" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", - "reference": "88289caa3c166321883f67fe5130188ebbb47094", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v3.4.47" - }, - "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": "2020-10-24T10:57:07+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.1", From e1601dce6cd549db0de75dcb896b2d3a49562329 Mon Sep 17 00:00:00 2001 From: ivan shalganov Date: Thu, 23 Feb 2023 22:09:39 +0100 Subject: [PATCH 11/11] migrate to php8 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 70595d8..69caaa2 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Fenom - Template Engine for PHP * **Syntax:** Smarty-like * **Documentation:** **[English](./docs/en/readme.md)**, **[Russian](./docs/ru/readme.md)** * **PHP version:** 8.0+ -* **State:** [![Build Status](https://travis-ci.org/fenom-template/fenom.svg?branch=master)](https://travis-ci.org/fenom-template/fenom) [![Coverage Status](https://coveralls.io/repos/fenom-template/fenom/badge.svg?branch=master)](https://coveralls.io/r/fenom-template/fenom?branch=master) +* **State:** [![PHP Composer](https://github.com/fenom-template/fenom/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/fenom-template/fenom/actions/workflows/php.yml) [![Coverage Status](https://coveralls.io/repos/fenom-template/fenom/badge.svg?branch=master)](https://coveralls.io/r/fenom-template/fenom?branch=master) * **Version:** [![Latest Stable Version](https://poser.pugx.org/fenom/fenom/v/stable.png)](https://packagist.org/packages/fenom/fenom) * **Packagist:** [fenom/fenom](https://packagist.org/packages/fenom/fenom) [![Total Downloads](https://poser.pugx.org/fenom/fenom/downloads.png)](https://packagist.org/packages/fenom/fenom) * **Composer:** `composer require fenom/fenom`