diff --git a/.gitattributes b/.gitattributes index d1c9623..5ece37b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,12 @@ .gitattributes export-ignore .gitignore export-ignore +.github/ export-ignore tests/ export-ignore vendor/ export-ignore .travis.yml export-ignore composer.* export-ignore phpunit.xml export-ignore +phpstan.neon export-ignore README.* export-ignore +LICENSE export-ignore +stubs/ export-ignore diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e39ff97 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events + push: + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # Composer config validation + composer: + name: "Composer config validation" + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v3" + - name: "Validate composer.json" + run: "composer validate --strict" + + # PHP syntax validation + php: + name: "PHP syntax validation" + runs-on: "ubuntu-latest" + strategy: + matrix: + php_version: [ 8.0, 8.1, 8.2 ] + steps: + - uses: "actions/checkout@v3" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php_version }}" + - name: "Check PHP syntax of plugin code" + run: | + php -l Lib/ + php -l tests/ + + phpunit: + name: "PHPUnit tests" + runs-on: "ubuntu-latest" + strategy: + matrix: + php_version: [ 8.0, 8.1, 8.2 ] + steps: + - uses: "actions/checkout@v3" + - uses: "php-actions/composer@v6" + with: + php_version: "${{ matrix.php_version }}" + - run: "vendor/bin/phpunit --coverage-clover clover.xml" + + # phpstan for several php versions + phpstan: + runs-on: "ubuntu-latest" + strategy: + matrix: + php_version: [ 8.0, 8.1, 8.2 ] + steps: + - uses: "actions/checkout@v3" + - uses: "php-actions/composer@v6" + with: + php_version: "${{ matrix.php_version }}" + - name: "PHPStan Static Analysis" + uses: "php-actions/phpstan@v3" + with: + php_version: "${{ matrix.php_version }}" diff --git a/.gitignore b/.gitignore index 57872d0..4fbb073 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /vendor/ +/composer.lock diff --git a/Lib/Log/Engine/GraylogLog.php b/Lib/Log/Engine/GraylogLog.php index a0bdf13..6e5b5d9 100644 --- a/Lib/Log/Engine/GraylogLog.php +++ b/Lib/Log/Engine/GraylogLog.php @@ -6,6 +6,7 @@ use Gelf\Transport\SslOptions; use Gelf\Transport\TcpTransport; use Gelf\Transport\TransportInterface; +use Gelf\Transport\AbstractTransport; use Gelf\Transport\UdpTransport; use kbATeam\GraylogUtilities\LogTypes; use kbATeam\GraylogUtilities\Obfuscator; @@ -29,7 +30,7 @@ class GraylogLog extends BaseLog private $loop = false; /** - * @var array Configuration array containing sane defaults. + * @var array Configuration array containing sane defaults. */ protected $_config = [ 'scheme' => 'udp', @@ -39,7 +40,6 @@ class GraylogLog extends BaseLog 'chunk_size' => UdpTransport::CHUNK_SIZE_LAN, 'ssl_options' => null, 'facility' => 'CakePHP', - 'add_file_and_line' => true, 'append_backtrace' => false, 'append_session' => false, 'append_post' => false, @@ -162,7 +162,7 @@ public function write($type, $message) * @throws \LogicException * @throws \InvalidArgumentException */ - protected function getPublisher() + protected function getPublisher(): Publisher { if ($this->publisher === null) { $this->publisher = new Publisher($this->getTransport()); @@ -175,7 +175,7 @@ protected function getPublisher() * @throws \LogicException * @throws \InvalidArgumentException */ - protected function getTransport() + protected function getTransport(): TransportInterface { if ($this->transport === null) { $this->transport = $this->initTransport(); @@ -191,7 +191,7 @@ protected function getTransport() * @throws InvalidArgumentException * @throws LogicException */ - private function initTransport() + private function initTransport(): TransportInterface { if ($this->_config['ignore_transport_errors'] === false) { return $this->buildTransport(); @@ -201,11 +201,11 @@ private function initTransport() /** * Initialize the transport class for sending greylog messages. - * @return TransportInterface + * @return AbstractTransport * @throws \LogicException Connection scheme configuration error. * @throws \InvalidArgumentException UdpTransport or TcpTransport config errors. */ - private function buildTransport() + private function buildTransport(): AbstractTransport { if ($this->_config['scheme'] === 'udp') { return new UdpTransport( @@ -221,7 +221,7 @@ private function buildTransport() $this->_config['ssl_options'] ); } - throw new LogicException('Unkown transport scheme for GreyLog!'); + throw new LogicException('Unknown transport scheme for GreyLog!'); } /** @@ -231,7 +231,7 @@ private function buildTransport() * @return GelfMessage * @throws \RuntimeException */ - protected function createMessage($type, $message) + protected function createMessage(string $type, string $message): GelfMessage { $gelfMessage = (new GelfMessage()) ->setVersion('1.1') @@ -244,7 +244,6 @@ protected function createMessage($type, $message) } $gelfMessage->setAdditional('request_uri', $request->url); } - $add_file_and_line = $this->_config['add_file_and_line'] === true; /** * Append backtrace in case it's not already in the message. */ @@ -253,22 +252,14 @@ protected function createMessage($type, $message) /** * Create a debug backtrace. */ - if ($add_file_and_line || $append_backtrace) { + $trace = null; + if ($append_backtrace) { $trace = new ClassicBacktrace( $this->_config['trace_level_offset'], $this->_config['file_root_dir'] ); } - /** - * In case the log didn't happen in memory (like with reflections), add - * the filename and line to the message. - */ - if ($add_file_and_line && $trace->lastStep('file') !== null) { - $gelfMessage->setFile($trace->lastStep('file')); - $gelfMessage->setLine($trace->lastStep('line')); - } - /** * Append function output to the message. */ @@ -285,7 +276,7 @@ protected function createMessage($type, $message) /** * Append backtrace in case it's not already in the message. */ - if ($append_backtrace) { + if ($append_backtrace && (null !== $trace)) { /** * Append backtrace to message. */ diff --git a/composer.json b/composer.json index 10c1ec1..5300528 100644 --- a/composer.json +++ b/composer.json @@ -1,32 +1,37 @@ { - "name": "kba-team/cakephp-graylog", - "description": "Graylog engine for CakePHP", - "type": "cakephp-plugin", - "license": "MIT", - "minimum-stability": "stable", - "require": { - "php": "^7.2", - "ext-json": "*", - "cakephp/cakephp": "^2.4", - "graylog2/gelf-php": "^1.6", - "composer/installers": "^1.9", - "kba-team/php-backtrace": "^1.0", - "kba-team/graylog-utilities": "^1.0" - }, - "extra": { - "installer-name": "Graylog" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "autoload-dev": { - "classmap": [ - "vendor/cakephp/cakephp/lib/Cake/Core/App.php", - "vendor/cakephp/cakephp/lib/Cake/Log/CakeLogInterface.php", - "vendor/cakephp/cakephp/lib/Cake/Log/Engine/BaseLog.php", - "vendor/cakephp/cakephp/lib/Cake/Utility/Hash.php", - "Lib/Log/Engine/GraylogLog.php", - "tests/PublicGraylogLog.php" - ] + "name": "kba-team/cakephp-graylog", + "description": "Graylog engine for CakePHP", + "type": "cakephp-plugin", + "license": "MIT", + "minimum-stability": "stable", + "require": { + "php": "^8.0", + "ext-json": "*", + "kba-team/cakephp": "^2.11", + "graylog2/gelf-php": "^1.6", + "composer/installers": "^1.9", + "kba-team/php-backtrace": "^1.0", + "kba-team/graylog-utilities": "^2.0" + }, + "extra": { + "installer-name": "Graylog" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "autoload-dev": { + "classmap": [ + "vendor/kba-team/cakephp/lib/Cake/Core/App.php", + "vendor/kba-team/cakephp/lib/Cake/Log/CakeLogInterface.php", + "vendor/kba-team/cakephp/lib/Cake/Log/Engine/BaseLog.php", + "vendor/kba-team/cakephp/lib/Cake/Utility/Hash.php", + "Lib/Log/Engine/GraylogLog.php", + "tests/PublicGraylogLog.php" + ] + }, + "config": { + "allow-plugins": { + "composer/installers": true } + } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 7349cab..0000000 --- a/composer.lock +++ /dev/null @@ -1,1789 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "31d839d7c07f0af6593448a483ed6cb5", - "packages": [ - { - "name": "cakephp/cakephp", - "version": "2.10.24", - "source": { - "type": "git", - "url": "https://github.com/cakephp/cakephp.git", - "reference": "cf14e6546ec44e3369e3531add11fdb946656280" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cakephp/cakephp/zipball/cf14e6546ec44e3369e3531add11fdb946656280", - "reference": "cf14e6546ec44e3369e3531add11fdb946656280", - "shasum": "" - }, - "require": { - "php": ">=5.3.0,<8.0.0" - }, - "require-dev": { - "cakephp/cakephp-codesniffer": "^1.0.0", - "phpunit/phpunit": "^3.7" - }, - "suggest": { - "ext-mcrypt": "You need to install ext-openssl or ext-mcrypt to use AES-256 encryption", - "ext-openssl": "You need to install ext-openssl or ext-mcrypt to use AES-256 encryption" - }, - "bin": [ - "lib/Cake/Console/cake" - ], - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "CakePHP Community", - "homepage": "https://github.com/cakephp/cakephp/graphs/contributors" - } - ], - "description": "The CakePHP framework", - "homepage": "https://cakephp.org", - "keywords": [ - "framework" - ], - "support": { - "forum": "https://stackoverflow.com/tags/cakephp", - "irc": "irc://irc.freenode.org/cakephp", - "issues": "https://github.com/cakephp/cakephp/issues", - "source": "https://github.com/cakephp/cakephp" - }, - "time": "2020-12-16T02:47:53+00:00" - }, - { - "name": "composer/installers", - "version": "v1.12.0", - "source": { - "type": "git", - "url": "https://github.com/composer/installers.git", - "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", - "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0 || ^2.0" - }, - "replace": { - "roundcube/plugin-installer": "*", - "shama/baton": "*" - }, - "require-dev": { - "composer/composer": "1.6.* || ^2.0", - "composer/semver": "^1 || ^3", - "phpstan/phpstan": "^0.12.55", - "phpstan/phpstan-phpunit": "^0.12.16", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.3" - }, - "type": "composer-plugin", - "extra": { - "class": "Composer\\Installers\\Plugin", - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Installers\\": "src/Composer/Installers" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kyle Robinson Young", - "email": "kyle@dontkry.com", - "homepage": "https://github.com/shama" - } - ], - "description": "A multi-framework Composer library installer", - "homepage": "https://composer.github.io/installers/", - "keywords": [ - "Craft", - "Dolibarr", - "Eliasis", - "Hurad", - "ImageCMS", - "Kanboard", - "Lan Management System", - "MODX Evo", - "MantisBT", - "Mautic", - "Maya", - "OXID", - "Plentymarkets", - "Porto", - "RadPHP", - "SMF", - "Starbug", - "Thelia", - "Whmcs", - "WolfCMS", - "agl", - "aimeos", - "annotatecms", - "attogram", - "bitrix", - "cakephp", - "chef", - "cockpit", - "codeigniter", - "concrete5", - "croogo", - "dokuwiki", - "drupal", - "eZ Platform", - "elgg", - "expressionengine", - "fuelphp", - "grav", - "installer", - "itop", - "joomla", - "known", - "kohana", - "laravel", - "lavalite", - "lithium", - "magento", - "majima", - "mako", - "mediawiki", - "miaoxing", - "modulework", - "modx", - "moodle", - "osclass", - "pantheon", - "phpbb", - "piwik", - "ppi", - "processwire", - "puppet", - "pxcms", - "reindex", - "roundcube", - "shopware", - "silverstripe", - "sydes", - "sylius", - "symfony", - "tastyigniter", - "typo3", - "wordpress", - "yawik", - "zend", - "zikula" - ], - "support": { - "issues": "https://github.com/composer/installers/issues", - "source": "https://github.com/composer/installers/tree/v1.12.0" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-09-13T08:19:44+00:00" - }, - { - "name": "graylog2/gelf-php", - "version": "1.7.1", - "source": { - "type": "git", - "url": "https://github.com/bzikarsky/gelf-php.git", - "reference": "8dceab86227c184725479cc36ab5cae4da940f6e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bzikarsky/gelf-php/zipball/8dceab86227c184725479cc36ab5cae4da940f6e", - "reference": "8dceab86227c184725479cc36ab5cae4da940f6e", - "shasum": "" - }, - "require": { - "paragonie/constant_time_encoding": "^1|^2", - "php": ">=5.6", - "psr/log": "^1.0|^2.0" - }, - "provide": { - "psr/log-implementation": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7|^6.5|^7.5", - "squizlabs/php_codesniffer": "^3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-4": { - "Gelf\\": "src/Gelf" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Benjamin Zikarsky", - "email": "benjamin@zikarsky.de" - }, - { - "name": "gelf-php contributors", - "homepage": "https://github.com/bzikarsky/gelf-php/contributors" - } - ], - "description": "A php implementation to send log-messages to a GELF compatible backend like Graylog2.", - "support": { - "issues": "https://github.com/bzikarsky/gelf-php/issues", - "source": "https://github.com/bzikarsky/gelf-php/tree/1.7.1" - }, - "time": "2021-08-20T09:39:08+00:00" - }, - { - "name": "kba-team/graylog-utilities", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/the-kbA-team/GraylogUtilities.git", - "reference": "342fc7be4166d3b3132b424a9b7f12ff32c73de8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/the-kbA-team/GraylogUtilities/zipball/342fc7be4166d3b3132b424a9b7f12ff32c73de8", - "reference": "342fc7be4166d3b3132b424a9b7f12ff32c73de8", - "shasum": "" - }, - "require": { - "php": "^5.5|^7.0", - "psr/log": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "kbATeam\\GraylogUtilities\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Utilities for logging", - "support": { - "issues": "https://github.com/the-kbA-team/GraylogUtilities/issues", - "source": "https://github.com/the-kbA-team/GraylogUtilities/tree/v1.0.0" - }, - "time": "2020-06-25T16:33:14+00:00" - }, - { - "name": "kba-team/php-backtrace", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/the-kbA-team/php_backtrace.git", - "reference": "4ebd5f2f34a7270fafdab5fb1bbadc5f6b4152e0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/the-kbA-team/php_backtrace/zipball/4ebd5f2f34a7270fafdab5fb1bbadc5f6b4152e0", - "reference": "4ebd5f2f34a7270fafdab5fb1bbadc5f6b4152e0", - "shasum": "" - }, - "require": { - "php": "^5.5|7.*" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "kbATeam\\PhpBacktrace\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Extendable class holding the PHP backtrace minus the last n steps to avoid showing the traces of logging.", - "support": { - "issues": "https://github.com/the-kbA-team/php_backtrace/issues", - "source": "https://github.com/the-kbA-team/php_backtrace/tree/v1.0.1" - }, - "time": "2020-06-09T11:05:09+00:00" - }, - { - "name": "paragonie/constant_time_encoding", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", - "shasum": "" - }, - "require": { - "php": "^7|^8" - }, - "require-dev": { - "phpunit/phpunit": "^6|^7|^8|^9", - "vimeo/psalm": "^1|^2|^3|^4" - }, - "type": "library", - "autoload": { - "psr-4": { - "ParagonIE\\ConstantTime\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com", - "role": "Maintainer" - }, - { - "name": "Steve 'Sc00bz' Thomas", - "email": "steve@tobtu.com", - "homepage": "https://www.tobtu.com", - "role": "Original Developer" - } - ], - "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", - "keywords": [ - "base16", - "base32", - "base32_decode", - "base32_encode", - "base64", - "base64_decode", - "base64_encode", - "bin2hex", - "encoding", - "hex", - "hex2bin", - "rfc4648" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/constant_time_encoding/issues", - "source": "https://github.com/paragonie/constant_time_encoding" - }, - "time": "2020-12-06T15:14:20+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" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2020-11-10T18:47:58+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" - }, - "time": "2021-10-02T14:08:47+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.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": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" - }, - "time": "2020-03-05T15:02:03+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "irc": "irc://irc.freenode.net/phpunit", - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.2" - }, - "time": "2015-10-06T15:47:00+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "irc": "irc://irc.freenode.net/phpunit", - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5" - }, - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" - }, - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "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": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/master" - }, - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.12", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4" - }, - "abandoned": true, - "time": "2017-12-04T08:55:13+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.36", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-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": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/4.8.36" - }, - "time": "2017-06-21T08:07:12+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "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" - ], - "support": { - "irc": "irc://irc.freenode.net/phpunit", - "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", - "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/2.3" - }, - "abandoned": true, - "time": "2015-10-02T06:51:40+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "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", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/1.2" - }, - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/1.4" - }, - "time": "2017-05-22T07:24:03+00:00" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/1.3" - }, - "time": "2016-08-18T05:49:44+00:00" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "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" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/master" - }, - "time": "2016-06-17T09:04:28+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "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" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1" - }, - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" - }, - "time": "2016-10-03T07:41:43+00:00" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "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 that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/1.0.6" - }, - "time": "2015-06-21T13:59:46+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "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": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^7.2", - "ext-json": "*" - }, - "platform-dev": [], - "plugin-api-version": "2.1.0" -} diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..29fd0c2 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,16 @@ +parameters: + level: 9 + ignoreErrors: + - message: '{Parameter #\d+ \$.+ of class .+ constructor expects .+,.+ given.}' + path: Lib/Log/Engine/GraylogLog.php + - message: '{Argument of an invalid type mixed supplied for foreach, only iterables are supported.}' + path: Lib/Log/Engine/GraylogLog.php + - message: '{Property Gelf\\Publisher::\$transport \(Gelf\\Transport\\TransportInterface\) does not accept Gelf\\Transport\\TransportInterface\|null.}' + path: tests/GraylogWriteTest.php + stubFiles: + - stubs/BaseLog.stub + scanDirectories: + - vendor + paths: + - Lib/ + - tests/ diff --git a/phpunit.xml b/phpunit.xml index 00ae156..a683cc7 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,22 +1,22 @@ - + + + Lib/ + + tests/ - - - Lib/ - - diff --git a/stubs/BaseLog.stub b/stubs/BaseLog.stub new file mode 100644 index 0000000..d202e5b --- /dev/null +++ b/stubs/BaseLog.stub @@ -0,0 +1,25 @@ + + */ + protected $_config = array(); + + /** + * @param array $config + */ + public function __construct($config = []) + { + + } +} diff --git a/tests/GraylogLogTest.php b/tests/GraylogLogTest.php index 24a94ef..e4623e1 100644 --- a/tests/GraylogLogTest.php +++ b/tests/GraylogLogTest.php @@ -6,15 +6,17 @@ use Gelf\Transport\SslOptions; use Gelf\Transport\TcpTransport; use Gelf\Transport\UdpTransport; +use PHPUnit\Framework\TestCase; use Psr\Log\LogLevel; /** * Class GraylogLogTest */ -class GraylogLogTest extends PHPUnit_Framework_TestCase +class GraylogLogTest extends TestCase { /** * Test inheritance chain to ensure this test deals with the correct class. + * @return void */ public function testInheritance() { @@ -26,6 +28,7 @@ public function testInheritance() /** * Test default config settings to ensure that later settings are different. + * @return void */ public function testDefaultConfig() { @@ -36,9 +39,9 @@ public function testDefaultConfig() static::assertSame(UdpTransport::CHUNK_SIZE_LAN, $log->getConfig('chunk_size')); static::assertNull($log->getConfig('ssl_options')); static::assertSame('CakePHP', $log->getConfig('facility')); - static::assertFalse($log->getConfig('append_backtrace')); - static::assertFalse($log->getConfig('append_session')); - static::assertFalse($log->getConfig('append_post')); + static::assertFalse((bool)$log->getConfig('append_backtrace')); + static::assertFalse((bool)$log->getConfig('append_session')); + static::assertFalse((bool)$log->getConfig('append_post')); static::assertSame([ 'password', 'new_password', @@ -59,6 +62,7 @@ public function testDefaultConfig() /** * Test that valid ssl options are being added to the configuration. + * @return void */ public function testValidSslOptions() { @@ -68,7 +72,7 @@ public function testValidSslOptions() /** * Provide invalid values for ssl options. - * @return array + * @return array */ public static function provideInvalidSslOptions() { @@ -87,6 +91,7 @@ public static function provideInvalidSslOptions() /** * Test that invalid ssl options will always result in null. * @param mixed $option + * @return void * @dataProvider provideInvalidSslOptions */ public function testInvalidSslOptions($option) @@ -97,7 +102,7 @@ public function testInvalidSslOptions($option) /** * Data provider for connection URLs and their parsed values. - * @return array + * @return array */ public static function provideConnectionUrl() { @@ -115,6 +120,7 @@ public static function provideConnectionUrl() * @param string $scheme * @param string $host * @param int $port + * @return void * @dataProvider provideConnectionUrl */ public function testConnectionUrl($url, $scheme, $host, $port) @@ -127,6 +133,7 @@ public function testConnectionUrl($url, $scheme, $host, $port) /** * Test setting only certain log types. + * @return void */ public function testSettingLogTypes() { @@ -136,29 +143,42 @@ public function testSettingLogTypes() /** * Data provider of invalid log types. - * @return array + * @return array */ public static function provideInvalidLogTypes() { return [ - [['vUBTx40Vjr', 'WLWCTyCihX', 152, 4.256, true, false, null, ['debug'], new stdClass()]], - ['68KNtGxwon'], - [4391], - [87.7], - [true], - [false], - [null], - [new stdClass()] + [['vUBTx40Vjr', 'WLWCTyCihX', 152, 4.256, true, false, null, ['debug'], new stdClass()], 'add'], + ['68KNtGxwon', 'construct'], + [4391, 'construct'], + [87.7, 'construct'], + [true, 'construct'], + [false, 'construct'], + [null, 'construct'], + [new stdClass(), 'construct'], ]; } /** * Test setting only invalid log types resulting in enabling all log types. * @param mixed $types + * @param string $exceptionType + * @return void * @dataProvider provideInvalidLogTypes */ - public function testInvalidLogTypes($types) + public function testInvalidLogTypes($types, $exceptionType) { + self::expectException("TypeError"); + + switch($exceptionType) { + case 'add': + self::expectExceptionMessage("kbATeam\GraylogUtilities\LogTypes::add(): Argument #1 (\$type) must be of type string"); + break; + case 'construct': + self::expectExceptionMessage("kbATeam\GraylogUtilities\LogTypes::__construct(): Argument #1 (\$types) must be of type array"); + break; + } + $log = new PublicGraylogLog(['types' => $types]); static::assertSame([ LogLevel::EMERGENCY, @@ -174,8 +194,9 @@ public function testInvalidLogTypes($types) /** * Test creating a GELF message with all flags enabled. + * @return void */ - public function testCreatingLongMessage() + public function testCreatingLongMessage(): void { $_POST = [ 'PAYy2EKmuW' => 'E8RUOjsjAn' @@ -196,15 +217,17 @@ public function testCreatingLongMessage() static::assertSame(LogLevel::DEBUG, $message->getLevel()); static::assertSame('mnfiXQoolR', $message->getShortMessage()); static::assertSame([], $message->getAllAdditionals()); - static::assertContains('POST:', $message->getFullMessage()); - static::assertContains('Session:', $message->getFullMessage()); - static::assertContains('Trace:', $message->getFullMessage()); + static::assertStringContainsString('POST:', $message->getFullMessage()); + static::assertStringContainsString('Session:', $message->getFullMessage()); + static::assertStringContainsString('Trace:', $message->getFullMessage()); + unset($_POST); } /** * Test creating a GELF message without any appended debug information. + * @return void */ - public function testShortMessage() + public function testShortMessage(): void { $log = new PublicGraylogLog(); $message = $log->createMessage(LogLevel::ALERT, 'oIEUMcF1Ce'); @@ -215,8 +238,9 @@ public function testShortMessage() /** * Test getting a UDP transport class from default configuration. + * @return void */ - public function testUdpTransport() + public function testUdpTransport(): void { $log = new PublicGraylogLog(['ignore_transport_errors' => false]); $transport = $log->getTransport(); @@ -229,8 +253,9 @@ public function testUdpTransport() /** * Test getting a TCP transport class from default configuration. + * @return void */ - public function testTcpTransport() + public function testTcpTransport(): void { $log = new PublicGraylogLog(['scheme' => 'tcp', 'ignore_transport_errors' => false]); $transport = $log->getTransport(); @@ -239,8 +264,9 @@ public function testTcpTransport() /** * Test getting a UDP transport class from default configuration. + * @return void */ - public function testTransportWrapper() + public function testTransportWrapper(): void { $log = new PublicGraylogLog(); $transport = $log->getTransport(); @@ -249,19 +275,22 @@ public function testTransportWrapper() /** * Test getting an exception from an invalid scheme. - * @expectedException \LogicException - * @expectedExceptionMessage Unkown transport scheme for GreyLog! + * @return void */ - public function testInvalidScheme() + public function testInvalidScheme(): void { + + self::expectException('LogicException'); + self::expectExceptionMessage('Unknown transport scheme for GreyLog!'); $log = new PublicGraylogLog(['scheme' => 'http']); $log->getTransport(); } /** * Test getting a publisher class from default configuration. + * @return void */ - public function testPublisher() + public function testPublisher(): void { $log = new PublicGraylogLog(); $publisher = $log->getPublisher(); @@ -274,8 +303,9 @@ public function testPublisher() /** * Test adding additional field. + * @return void */ - public function testAddingAdditionalFields() + public function testAddingAdditionalFields(): void { $log = new PublicGraylogLog([ 'additional' => [ @@ -293,8 +323,9 @@ public function testAddingAdditionalFields() /** * Test creating a GELF message with all flags enabled. + * @return void */ - public function testNoEmptyPostInLongMessage() + public function testNoEmptyPostInLongMessage(): void { $_SESSION = [ 'edjjLLLg14' => 'G78eIm8UbE' diff --git a/tests/GraylogWriteTest.php b/tests/GraylogWriteTest.php index c184d09..b1fa818 100644 --- a/tests/GraylogWriteTest.php +++ b/tests/GraylogWriteTest.php @@ -2,7 +2,7 @@ /** * In order to perform a write test, we simply overwrite the class \Gelf\Publisher - * with a fake one, that will not actually publish anyting. + * with a fake one, that will not actually publish anything. * Yes it's dirty. Yes it's probably a bug in PHP. But it's so handy ... ^^ * @noinspection PhpIllegalPsrClassPathInspection * @noinspection PhpMultipleClassesDeclarationsInOneFile @@ -34,7 +34,9 @@ public function __construct($transport = null) /** * @param \Gelf\MessageInterface $message + * @return void */ + public function publish($message) { $this->message = $message; @@ -46,16 +48,18 @@ public function publish($message) use Gelf\Message as GelfMessage; use Gelf\Transport\UdpTransport; + use PHPUnit\Framework\TestCase; /** * Class GraylogWriteTest */ - class GraylogWriteTest extends PHPUnit_Framework_TestCase + class GraylogWriteTest extends TestCase { /** * Test writing a message using a fake publisher class. + * @return void */ - public function testWriteUsingFakePublisher() + public function testWriteUsingFakePublisher(): void { $log = new PublicGraylogLog([ 'append_backtrace' => false, diff --git a/tests/PublicGraylogLog.php b/tests/PublicGraylogLog.php index e3744eb..ec96364 100644 --- a/tests/PublicGraylogLog.php +++ b/tests/PublicGraylogLog.php @@ -1,5 +1,9 @@ _config; @@ -22,7 +26,7 @@ public function getConfig($key = null) /** * @inheritDoc */ - public function getPublisher() + public function getPublisher(): Publisher { return parent::getPublisher(); } @@ -30,7 +34,7 @@ public function getPublisher() /** * @inheritDoc */ - public function getTransport() + public function getTransport(): TransportInterface { return parent::getTransport(); } @@ -38,7 +42,7 @@ public function getTransport() /** * @inheritDoc */ - public function createMessage($type, $message) + public function createMessage(string $type, string $message): GelfMessage { return parent::createMessage($type, $message); }