diff --git a/composer.json b/composer.json index bf4dae1..e23db94 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,8 @@ "require": { "php": ">=7.2", "ext-json": "*", - "adbario/php-dot-notation": "^2.2", - "monolog/monolog": "^1.21", + "adbario/php-dot-notation": "~2.2", + "monolog/monolog": "~1.21", "zendframework/zend-diactoros": "1.8.6" }, "autoload": { @@ -42,7 +42,7 @@ ] }, "require-dev": { - "phpunit/phpunit": "^7.1", - "vimeo/psalm": "^3.0" + "phpunit/phpunit": "~8.1", + "vimeo/psalm": "~3.2" } } diff --git a/composer.lock b/composer.lock index 8932d5a..fcbcc60 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": "b366697739be5b8d813ae1889767fdc1", + "content-hash": "8d458f8f19a09bbe906c82e8349ff264", "packages": [ { "name": "adbario/php-dot-notation", @@ -477,27 +477,29 @@ }, { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "a2c590166b2133a4633738648b6b064edae0814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { @@ -522,12 +524,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2019-03-17T17:37:11+00:00" }, { "name": "felixfbecker/advanced-json-rpc", @@ -675,16 +677,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.8.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { @@ -719,7 +721,7 @@ "object", "object graph" ], - "time": "2018-06-11T23:09:50+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "netresearch/jsonmapper", @@ -1072,16 +1074,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", "shasum": "" }, "require": { @@ -1119,7 +1121,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "time": "2019-04-30T17:48:53+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1168,6 +1170,67 @@ ], "time": "2017-07-14T14:27:02+00:00" }, + { + "name": "phpmyadmin/sql-parser", + "version": "v4.3.1", + "source": { + "type": "git", + "url": "https://github.com/phpmyadmin/sql-parser.git", + "reference": "0eb16ef5e3acacbc792be336754e42d98791a33f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/0eb16ef5e3acacbc792be336754e42d98791a33f", + "reference": "0eb16ef5e3acacbc792be336754e42d98791a33f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/polyfill-mbstring": "^1.3" + }, + "conflict": { + "phpmyadmin/motranslator": "<3.0" + }, + "require-dev": { + "phpunit/php-code-coverage": "*", + "phpunit/phpunit": "~4.8 || ~5.7 || ~6.5", + "sami/sami": "^4.0" + }, + "suggest": { + "ext-mbstring": "For best performance", + "phpmyadmin/motranslator": "Translate messages to your favorite locale" + }, + "bin": [ + "bin/highlight-query", + "bin/lint-query" + ], + "type": "library", + "autoload": { + "psr-4": { + "PhpMyAdmin\\SqlParser\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "The phpMyAdmin Team", + "email": "developers@phpmyadmin.net", + "homepage": "https://www.phpmyadmin.net/team/" + } + ], + "description": "A validating SQL lexer and parser with a focus on MySQL dialect.", + "homepage": "https://github.com/phpmyadmin/sql-parser", + "keywords": [ + "analysis", + "lexer", + "parser", + "sql" + ], + "time": "2019-01-05T13:46:38+00:00" + }, { "name": "phpspec/prophecy", "version": "1.8.0", @@ -1233,40 +1296,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0317a769a81845c390e19684d9ba25d7f6aa4707", + "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.0.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.1", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.0" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -1292,7 +1355,7 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "time": "2019-02-26T07:38:26+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1485,16 +1548,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.6", + "version": "8.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9" + "reference": "2a676677982b484ee36b54961f570c02eabbe7e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9", - "reference": "09c85e14994df92e5ff1f5ec0b481bdb7d3d3df9", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2a676677982b484ee36b54961f570c02eabbe7e1", + "reference": "2a676677982b484ee36b54961f570c02eabbe7e1", "shasum": "" }, "require": { @@ -1504,27 +1567,25 @@ "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", + "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.7", "phar-io/manifest": "^1.0.2", "phar-io/version": "^2.0", - "php": "^7.1", + "php": "^7.2", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-code-coverage": "^7.0", "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.0", + "phpunit/php-timer": "^2.1", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", + "sebastian/environment": "^4.1", "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "sebastian/global-state": "^3.0", "sebastian/object-enumerator": "^3.0.3", "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, @@ -1539,7 +1600,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.1-dev" } }, "autoload": { @@ -1565,7 +1626,7 @@ "testing", "xunit" ], - "time": "2019-02-18T09:24:50+00:00" + "time": "2019-04-19T15:52:00+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1734,16 +1795,16 @@ }, { "name": "sebastian/environment", - "version": "4.1.0", + "version": "4.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" + "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", - "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/3095910f0f0fb155ac4021fc51a4a7a39ac04e8a", + "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a", "shasum": "" }, "require": { @@ -1758,7 +1819,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1783,7 +1844,7 @@ "environment", "hhvm" ], - "time": "2019-02-01T05:27:49+00:00" + "time": "2019-04-25T07:55:20+00:00" }, { "name": "sebastian/exporter", @@ -1854,23 +1915,26 @@ }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -1878,7 +1942,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1901,7 +1965,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -2135,21 +2199,21 @@ }, { "name": "symfony/console", - "version": "v3.4.22", + "version": "v4.2.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be" + "reference": "e2840bb38bddad7a0feaf85931e38fdcffdb2f81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/069bf3f0e8f871a2169a06e43d9f3f03f355e9be", - "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be", + "url": "https://api.github.com/repos/symfony/console/zipball/e2840bb38bddad7a0feaf85931e38fdcffdb2f81", + "reference": "e2840bb38bddad7a0feaf85931e38fdcffdb2f81", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", + "php": "^7.1.3", + "symfony/contracts": "^1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { @@ -2161,11 +2225,11 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", + "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "symfony/process": "~3.4|~4.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2176,7 +2240,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -2203,44 +2267,48 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-01-25T10:42:12+00:00" + "time": "2019-04-08T14:23:48+00:00" }, { - "name": "symfony/debug", - "version": "v3.4.22", + "name": "symfony/contracts", + "version": "v1.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8" + "url": "https://github.com/symfony/contracts.git", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8", - "reference": "667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8", + "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "php": "^7.1.3" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "psr/cache": "^1.0", + "psr/container": "^1.0" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "symfony/cache-contracts-implementation": "", + "symfony/service-contracts-implementation": "", + "symfony/translation-contracts-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Contracts\\": "" }, "exclude-from-classmap": [ - "/Tests/" + "**/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2249,30 +2317,38 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "A set of abstractions extracted out of the Symfony components", "homepage": "https://symfony.com", - "time": "2019-01-25T10:19:25+00:00" + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2018-12-05T08:06:11+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + "reference": "82ebae02209c21113908c229e9883c419720738a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", "shasum": "" }, "require": { @@ -2284,7 +2360,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -2317,20 +2393,20 @@ "polyfill", "portable" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2019-02-06T07:57:58+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", "shasum": "" }, "require": { @@ -2342,7 +2418,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -2376,20 +2452,20 @@ "portable", "shim" ], - "time": "2018-09-21T13:07:52+00:00" + "time": "2019-02-06T07:57:58+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8", + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8", "shasum": "" }, "require": { @@ -2416,20 +2492,20 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "time": "2019-04-04T09:56:43+00:00" }, { "name": "vimeo/psalm", - "version": "3.0.17", + "version": "3.2.10", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "f49be31aeb7c2e063ae732521020247e769bf83d" + "reference": "b9bece4cbcb3f342c8412618f73ca02db98064e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/f49be31aeb7c2e063ae732521020247e769bf83d", - "reference": "f49be31aeb7c2e063ae732521020247e769bf83d", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b9bece4cbcb3f342c8412618f73ca02db98064e8", + "reference": "b9bece4cbcb3f342c8412618f73ca02db98064e8", "shasum": "" }, "require": { @@ -2444,7 +2520,8 @@ "openlss/lib-array2xml": "^0.0.10||^0.5.1", "php": "^7.0", "php-cs-fixer/diff": "^1.2", - "symfony/console": "^3.0||^4.0", + "phpmyadmin/sql-parser": "^4.0", + "symfony/console": "^3.3||^4.0", "webmozart/glob": "^4.1", "webmozart/path-util": "^2.3" }, @@ -2454,7 +2531,8 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.2", "phpunit/phpunit": "^6.0 || ^7.0", - "squizlabs/php_codesniffer": "^3.0" + "psalm/plugin-phpunit": "^0.5.5", + "squizlabs/php_codesniffer": "3.4.0" }, "suggest": { "ext-igbinary": "^2.0.5" @@ -2494,7 +2572,7 @@ "inspection", "php" ], - "time": "2019-02-18T21:52:09+00:00" + "time": "2019-04-29T16:19:51+00:00" }, { "name": "webmozart/assert", @@ -2647,11 +2725,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.1.0", + "php": ">=7.2", "ext-json": "*" }, "platform-dev": [], "platform-overrides": { - "php": "7.1" + "php": "7.2" } } diff --git a/src/Arrays.php b/src/Arrays.php index b4f9d1e..0c9b1ba 100644 --- a/src/Arrays.php +++ b/src/Arrays.php @@ -21,7 +21,9 @@ function array_without_keys(array $aArray, ...$aKeys) { */ function array_is_multi(array $aArray):bool { foreach ($aArray as $mValue) { - if (is_array($mValue)) return true; + if (is_array($mValue)) { + return true; + } } return false; } @@ -47,7 +49,7 @@ function array_from_path($sPath, $mValue, $sDelimiter = '.') { * @return bool */ function array_not_associative(array $aArray):bool { - if (count($aArray) == 0) { + if (count($aArray) === 0) { return true; } diff --git a/src/Debugging.php b/src/Debugging.php index 382f0e5..efb10c5 100644 --- a/src/Debugging.php +++ b/src/Debugging.php @@ -6,9 +6,7 @@ */ function _output(string $sMessage): void { if (isCli() || contentTypeIsNotHtml()) { - $sMessage = str_replace('
', "\n", $sMessage); - $sMessage = str_replace('
',  '', $sMessage);
-            $sMessage = str_replace('
', '', $sMessage); + $sMessage = str_replace(['
', '
', '
'], ["\n", '', ''], $sMessage); } echo $sMessage; @@ -21,10 +19,10 @@ function dbg(...$aArgs): void { $sTitle = array_shift($aArgs) . ': '; } - if (strlen($sTitle)) { + if ($sTitle !== '') { if (is_object($aArgs[0]) || is_array($aArgs[0])) { - _output($sTitle . "
"); + _output($sTitle . '
'); } else { _output($sTitle); } @@ -35,7 +33,7 @@ function dbg(...$aArgs): void { || is_array($mArg)) { _output('
' . print_r($mArg, true) . '
'); } else { - _output($mArg . "
"); + _output($mArg . '
'); } } } @@ -59,7 +57,7 @@ function trace(bool $bShort = true, bool $bReturn = false) { } if (isset($oTrace['file'])) { - $sResponse .= ': ' . str_replace(dirname(dirname(dirname(__FILE__))), '', $oTrace['file']); + $sResponse .= ': ' . str_replace(dirname(__FILE__, 3), '', $oTrace['file']); } $sResponse .= ': ' . $oTrace['function']; @@ -68,9 +66,9 @@ function trace(bool $bShort = true, bool $bReturn = false) { if ($bReturn) { return $aResponse; - } else { - dbg($aResponse); } + + dbg($aResponse); } else { foreach ($oBacktrace as &$oTrace) { if (isset($oTrace['object'])) { @@ -84,13 +82,15 @@ function trace(bool $bShort = true, bool $bReturn = false) { $mArg = '[ARRAY]'; } } + unset($mArg); } } + unset($oTrace); if ($bReturn) { return $oBacktrace; - } else { - dbg($oBacktrace); } + + dbg($oBacktrace); } } \ No newline at end of file diff --git a/src/ErrorsToExceptions.php b/src/ErrorsToExceptions.php index ca3b0c0..b7cf170 100644 --- a/src/ErrorsToExceptions.php +++ b/src/ErrorsToExceptions.php @@ -7,7 +7,7 @@ * http://us3.php.net/manual/en/function.set-error-handler.php#112881 * throw exceptions based on E_* error types */ - set_error_handler(function (int $err_severity, string $err_msg, string $err_file, int $err_line, array $err_context): void + set_error_handler(static function (int $err_severity, string $err_msg, string $err_file, int $err_line): void { // error was suppressed with the @-operator if (0 === error_reporting()) { return; } diff --git a/src/Headers.php b/src/Headers.php index b65ab5e..32fe699 100644 --- a/src/Headers.php +++ b/src/Headers.php @@ -7,7 +7,7 @@ function getHeaders() { $aHeaders = []; foreach ($_SERVER as $sName => $sValue) { - if (substr($sName, 0, 5) == 'HTTP_') { + if (strpos($sName, 'HTTP_') === 0) { $aHeaders[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($sName, 5)))))] = $sValue; } } @@ -18,7 +18,7 @@ function getHeaders() { * @return bool */ function isCli() { - return php_sapi_name() == 'cli' + return PHP_SAPI === 'cli' && empty($_SERVER['REMOTE_ADDR']); } @@ -34,18 +34,18 @@ function get_ip() { $sIP = $_SERVER['LOCAL_ADDR']; } else if ($bIsCLI) { $sIP = gethostbyname(gethostname()); - } else if (isset($_SERVER["HTTP_X_REAL_IP"]) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) { - $sIP = $_SERVER["HTTP_X_REAL_IP"]; // explicitly set in nginx load balancer - } else if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) { - $sIP = getenv("HTTP_CLIENT_IP"); - } else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) { - $sIP = getenv("HTTP_X_FORWARDED_FOR"); - } else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) { - $sIP = getenv("REMOTE_ADDR"); - } else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) { + } else if (isset($_SERVER['HTTP_X_REAL_IP']) && $_SERVER['HTTP_X_REAL_IP'] && strcasecmp($_SERVER['HTTP_X_REAL_IP'], 'unknown')) { + $sIP = $_SERVER['HTTP_X_REAL_IP']; // explicitly set in nginx load balancer + } else if (getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) { + $sIP = getenv('HTTP_CLIENT_IP'); + } else if (getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) { + $sIP = getenv('HTTP_X_FORWARDED_FOR'); + } else if (getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) { + $sIP = getenv('REMOTE_ADDR'); + } else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) { $sIP = $_SERVER['REMOTE_ADDR']; } else { - $sIP = "unknown"; + $sIP = 'unknown'; } return $sIP; @@ -59,8 +59,8 @@ function contentTypeIsNotHtml() { if (count($aHeaders)) { foreach($aHeaders as $sHeader) { $aHeader = explode(':', $sHeader); - if (strtolower($aHeader[0]) == 'content-type') { - return $aHeader[1] != 'text/html'; + if (strtolower($aHeader[0]) === 'content-type') { + return $aHeader[1] !== 'text/html'; } } } diff --git a/src/Inflect.php b/src/Inflect.php index e2740d6..523bb56 100644 --- a/src/Inflect.php +++ b/src/Inflect.php @@ -59,62 +59,62 @@ class Inflect { /** @var array */ - static $plural = [ - '/(quiz)$/i' => "$1zes", - '/^(ox)$/i' => "$1en", - '/([m|l])ouse$/i' => "$1ice", - '/(matr|vert|ind)ix|ex$/i' => "$1ices", - '/(x|ch|ss|sh)$/i' => "$1es", - '/([^aeiouy]|qu)y$/i' => "$1ies", - '/(hive)$/i' => "$1s", - '/(?:([^f])fe|([lr])f)$/i' => "$1$2ves", - '/(shea|lea|loa|thie)f$/i' => "$1ves", - '/sis$/i' => "ses", - '/([ti])um$/i' => "$1a", - '/(tomat|potat|ech|her|vet)o$/i' => "$1oes", - '/(bu)s$/i' => "$1ses", - '/(alias)$/i' => "$1es", - '/(octop)us$/i' => "$1i", - '/(ax|test)is$/i' => "$1es", - '/(us)$/i' => "$1es", - '/s$/i' => "s", - '/$/' => "s" + private static $plural = [ + '/(quiz)$/i' => '$1zes', + '/^(ox)$/i' => '$1en', + '/([m|l])ouse$/i' => '$1ice', + '/(matr|vert|ind)ix|ex$/i' => '$1ices', + '/(x|ch|ss|sh)$/i' => '$1es', + '/([^aeiouy]|qu)y$/i' => '$1ies', + '/(hive)$/i' => '$1s', + '/(?:([^f])fe|([lr])f)$/i' => '$1$2ves', + '/(shea|lea|loa|thie)f$/i' => '$1ves', + '/sis$/i' => 'ses', + '/([ti])um$/i' => '$1a', + '/(tomat|potat|ech|her|vet)o$/i' => '$1oes', + '/(bu)s$/i' => '$1ses', + '/(alias)$/i' => '$1es', + '/(octop)us$/i' => '$1i', + '/(ax|test)is$/i' => '$1es', + '/(us)$/i' => '$1es', + '/s$/i' => 's', + '/$/' => 's' ]; /** @var array */ - static $singular = [ - '/(quiz)zes$/i' => "$1", - '/(matr)ices$/i' => "$1ix", - '/(vert|ind)ices$/i' => "$1ex", - '/^(ox)en$/i' => "$1", - '/(alias)es$/i' => "$1", - '/(octop|vir)i$/i' => "$1us", - '/(cris|ax|test)es$/i' => "$1is", - '/(shoe)s$/i' => "$1", - '/(o)es$/i' => "$1", - '/(bus)es$/i' => "$1", - '/([m|l])ice$/i' => "$1ouse", - '/(x|ch|ss|sh)es$/i' => "$1", - '/(m)ovies$/i' => "$1ovie", - '/(s)eries$/i' => "$1eries", - '/([^aeiouy]|qu)ies$/i' => "$1y", - '/([lr])ves$/i' => "$1f", - '/(tive)s$/i' => "$1", - '/(hive)s$/i' => "$1", - '/(li|wi|kni)ves$/i' => "$1fe", - '/(shea|loa|lea|thie)ves$/i' => "$1f", - '/(^analy)ses$/i' => "$1sis", - '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => "$1$2sis", - '/([ti])a$/i' => "$1um", - '/(n)ews$/i' => "$1ews", - '/(h|bl)ouses$/i' => "$1ouse", - '/(corpse)s$/i' => "$1", - '/(us)es$/i' => "$1", - '/s$/i' => "" + private static $singular = [ + '/(quiz)zes$/i' => '$1', + '/(matr)ices$/i' => '$1ix', + '/(vert|ind)ices$/i' => '$1ex', + '/^(ox)en$/i' => '$1', + '/(alias)es$/i' => '$1', + '/(octop|vir)i$/i' => '$1us', + '/(cris|ax|test)es$/i' => '$1is', + '/(shoe)s$/i' => '$1', + '/(o)es$/i' => '$1', + '/(bus)es$/i' => '$1', + '/([m|l])ice$/i' => '$1ouse', + '/(x|ch|ss|sh)es$/i' => '$1', + '/(m)ovies$/i' => '$1ovie', + '/(s)eries$/i' => '$1eries', + '/([^aeiouy]|qu)ies$/i' => '$1y', + '/([lr])ves$/i' => '$1f', + '/(tive)s$/i' => '$1', + '/(hive)s$/i' => '$1', + '/(li|wi|kni)ves$/i' => '$1fe', + '/(shea|loa|lea|thie)ves$/i' => '$1f', + '/(^analy)ses$/i' => '$1sis', + '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '$1$2sis', + '/([ti])a$/i' => '$1um', + '/(n)ews$/i' => '$1ews', + '/(h|bl)ouses$/i' => '$1ouse', + '/(corpse)s$/i' => '$1', + '/(us)es$/i' => '$1', + '/s$/i' => '' ]; /** @var array */ - static $irregular = [ + private static $irregular = [ 'move' => 'moves', 'foot' => 'feet', 'goose' => 'geese', @@ -127,7 +127,7 @@ class Inflect { ]; /** @var array */ - static $uncountable = [ + private static $uncountable = [ 'sheep', 'fish', 'deer', @@ -142,11 +142,10 @@ class Inflect { public static function pluralize(string $string): string { // save some time in the case that singular and plural are the same - if (in_array(strtolower($string), self::$uncountable)) { + if (in_array(strtolower($string), self::$uncountable, true)) { return $string; } - // check for irregular singular forms foreach (self::$irregular as $pattern => $result) { $pattern = '/' . $pattern . '$/i'; @@ -168,7 +167,7 @@ public static function pluralize(string $string): string { public static function singularize(string $string): string { // save some time in the case that singular and plural are the same - if (in_array(strtolower($string), self::$uncountable)) { + if (in_array(strtolower($string), self::$uncountable, true)) { return $string; } @@ -192,10 +191,10 @@ public static function singularize(string $string): string { } public static function pluralize_if(int $count, string $string): string { - if ($count == 1) { + if ($count === 1) { return "1 $string"; - } else { - return $count . " " . self::pluralize($string); } + + return $count . ' ' . self::pluralize($string); } } \ No newline at end of file diff --git a/src/Log.php b/src/Log.php index 7b8eff9..8ca77f6 100644 --- a/src/Log.php +++ b/src/Log.php @@ -11,10 +11,10 @@ class Log { /** @var Monolog\Logger */ - private static $oLog = null; + private static $oLog; /** @var ServerRequestInterface */ - private static $oServerRequest = null; + private static $oServerRequest; /** @var string */ private static $sService = 'Enobrev_Logger_Replace_Me'; @@ -23,7 +23,7 @@ class Log { private static $bJSONLogs = false; /** @var string */ - private static $sThreadHash = null; + private static $sThreadHash; /** @var array */ private static $aSpans = []; @@ -43,16 +43,16 @@ class Log { /** * @return Monolog\Logger */ - private static function initLogger() { + private static function initLogger(): \Monolog\Logger { if (self::$oLog === null) { register_shutdown_function([self::class, 'summary']); self::$oLog = new Monolog\Logger(self::$sService); if (self::$bJSONLogs) { - $oFormatter = new LineFormatter("@cee: %context%"); + $oFormatter = new LineFormatter('@cee: %context%'); } else { - $oFormatter = new LineFormatter("%context%"); + $oFormatter = new LineFormatter('%context%'); } $oSyslog = new SyslogHandler('API'); @@ -102,7 +102,7 @@ private static function prepareContext(string $sMessage, array $aContext = []): if ($aContext && is_array($aContext) && count($aContext)) { foreach ($aContext as $sKey => $mValue) { - if (strncmp($sKey, "--", 2) === 0) { + if (strncmp($sKey, '--', 2) === 0) { if (!is_scalar($mValue)) { $oLog->mergeRecursiveDistinct($sKey, $mValue); } else { @@ -111,7 +111,7 @@ private static function prepareContext(string $sMessage, array $aContext = []): unset($aContext[$sKey]); } - if (strncmp($sKey, "#", 1) === 0) { + if (strncmp($sKey, '#', 1) === 0) { $sStrippedKey = str_replace('#', '', $sKey); $aContext[$sStrippedKey] = $mValue; unset($aContext[$sKey]); @@ -200,7 +200,7 @@ public static function disableDT($bDisabled = true): void { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function d($sMessage, array $aContext = array()) { + public static function d($sMessage, array $aContext = array()): bool { if (self::$aDisabled['d']) { self::justAddContext($aContext); return false; @@ -216,7 +216,7 @@ public static function d($sMessage, array $aContext = array()) { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function i($sMessage, array $aContext = array()) { + public static function i($sMessage, array $aContext = array()): bool { return self::addRecord(Monolog\Logger::INFO, $sMessage, $aContext); } @@ -227,7 +227,7 @@ public static function i($sMessage, array $aContext = array()) { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function n($sMessage, array $aContext = array()) { + public static function n($sMessage, array $aContext = array()): bool { return self::addRecord(Monolog\Logger::NOTICE, $sMessage, $aContext); } @@ -238,7 +238,7 @@ public static function n($sMessage, array $aContext = array()) { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function w($sMessage, array $aContext = array()) { + public static function w($sMessage, array $aContext = array()): bool { return self::addRecord(Monolog\Logger::WARNING, $sMessage, $aContext); } @@ -249,7 +249,7 @@ public static function w($sMessage, array $aContext = array()) { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function e($sMessage, array $aContext = array()) { + public static function e($sMessage, array $aContext = array()): bool { return self::addRecord(Monolog\Logger::ERROR, $sMessage, $aContext); } @@ -260,7 +260,7 @@ public static function e($sMessage, array $aContext = array()) { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function c($sMessage, array $aContext = array()) { + public static function c($sMessage, array $aContext = array()): bool { return self::addRecord(Monolog\Logger::CRITICAL, $sMessage, $aContext); } @@ -271,7 +271,7 @@ public static function c($sMessage, array $aContext = array()) { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function a($sMessage, array $aContext = array()) { + public static function a($sMessage, array $aContext = array()): bool { return self::addRecord(Monolog\Logger::ALERT, $sMessage, $aContext); } @@ -282,7 +282,7 @@ public static function a($sMessage, array $aContext = array()) { * @param array $aContext The log context * @return boolean Whether the record has been processed */ - public static function em($sMessage, array $aContext = array()) { + public static function em($sMessage, array $aContext = array()): bool { return self::addRecord(Monolog\Logger::EMERGENCY, $sMessage, $aContext); } @@ -416,7 +416,7 @@ private static function getThreadHash(): string { private static $aIndices = []; private static $bJSONParsed = false; - private static function parseJSONBodyForIndices() { + private static function parseJSONBodyForIndices(): void { if (self::$bJSONParsed) { return; } @@ -478,11 +478,7 @@ private static function getParentHash(): ?string { } } - if (isset($_REQUEST['--p'])) { - return $_REQUEST['--p']; - } - - return null; + return $_REQUEST['--p'] ?? null; } /** @@ -520,7 +516,7 @@ public static function initSpan(ServerRequestInterface $oRequest, array $aUser = self::$aSpanMetas[$sRequestHash] = new SpanMeta($oStartTime); - if ($sThreadHash = Log::getThreadHash()) { + if ($sThreadHash = self::getThreadHash()) { $aSpan['--t'] = $sThreadHash; } @@ -571,10 +567,10 @@ public static function summary(string $sOverrideName = 'Summary'): void { } class SpanMeta { - const TIMESTAMP_FORMAT = DATE_RFC3339_EXTENDED; + private const TIMESTAMP_FORMAT = DATE_RFC3339_EXTENDED; // const VERSION = 1: included tags, which were not used - const VERSION = 2; + private const VERSION = 2; /** @var string */ private $sName; @@ -611,7 +607,7 @@ public function hasName():bool { return !empty($this->sName); } - public function getMessage(string $sService) { + public function getMessage(string $sService): array { return [ '_format' => 'SSFSpan.DashedTrace', 'version' => self::VERSION, diff --git a/src/Timer.php b/src/Timer.php index f5141e9..9d07db7 100644 --- a/src/Timer.php +++ b/src/Timer.php @@ -11,7 +11,7 @@ class Timer { * @param bool $bReturnTimers * @return array */ - public function stats($bReturnTimers = false) { + public function stats($bReturnTimers = false): array { $aReturn = []; if (count($this->aTimers)) { @@ -31,6 +31,8 @@ public function stats($bReturnTimers = false) { $aStats[] = $aTimerStats; } } + /** @noinspection DisconnectedForeachInstructionInspection */ + unset($oTimer); $aReturn[$sLabel] = [ 'range' => $iTotal, @@ -49,9 +51,9 @@ public function stats($bReturnTimers = false) { /** * @param string $sLabel - * @return TimeKeeper + * @return TimeKeeper|null */ - public function &get(string $sLabel) { + public function &get(string $sLabel): ?TimeKeeper { if (!isset($this->aTimers[$sLabel])) { return $this->start($sLabel); } @@ -62,13 +64,15 @@ public function &get(string $sLabel) { return $oTimer; } + + return null; } /** * @param string $sLabel * @return TimeKeeper */ - public function &start(string $sLabel) { + public function &start(string $sLabel): TimeKeeper { if (!isset($this->aTimers[$sLabel])) { $this->aTimers[$sLabel] = []; } @@ -85,10 +89,12 @@ public function &start(string $sLabel) { * @param string $sLabel * @return float|null */ - public function stop(string $sLabel) { + public function stop(string $sLabel): ?float { $oTimeKeeper = &$this->get($sLabel); if ($oTimeKeeper) { return $oTimeKeeper->stop(); } + + return null; } } \ No newline at end of file diff --git a/tests/DepluralizeTest.php b/tests/DepluralizeTest.php index cd0c3c7..bc36531 100644 --- a/tests/DepluralizeTest.php +++ b/tests/DepluralizeTest.php @@ -8,7 +8,7 @@ class DepluralizeTest extends TestCase { private $aWords; - public function setUp() { + public function setUp():void { $this->aWords = [ 'addresses' => 'address', 'cities' => 'city', @@ -25,13 +25,15 @@ public function setUp() { ]; } - public function testDepluralize() { + public function testDepluralize(): void + { foreach($this->aWords as $sPlural => $sSingular) { $this->assertEquals($sSingular, depluralize($sPlural)); } } - public function testPluralize() { + public function testPluralize(): void + { foreach ($this->aWords as $sPlural => $sSingular) { $this->assertEquals($sPlural, pluralize($sSingular)); } diff --git a/tests/MinuteTest.php b/tests/MinuteTest.php index 3834460..a7f7b2f 100644 --- a/tests/MinuteTest.php +++ b/tests/MinuteTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase; class MinuteTest extends TestCase { - public function testMinutes() { + public function testMinutes(): void { $oNow = new DateTime(); $oThen = new DateTime('-10 minutes'); $oLater = new DateTime('+10 minutes'); @@ -23,7 +23,7 @@ public function testMinutes() { $this->assertEquals(1, minutes($oNow, $oLater1)); } - public function testMinutesAgo() { + public function testMinutesAgo(): void { $oNow = new DateTime(); $oThen = new DateTime('-10 minutes'); $oLater = new DateTime('+10 minutes');