From b2b221ff8c6e8c3a64153e9bb71479e813ff9f25 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 02:16:32 +0200 Subject: [PATCH 01/44] Set working dir for `build` service explicitly --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 82cc099..dc71485 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -58,6 +58,7 @@ services: PHP_BUILD_VERSION: $PHP_BUILD_VERSION BUILD_ROOT_PATH: $BUILD_ROOT_PATH container_name: "${PROJECT_NAME}_build" + working_dir: ${BUILD_ROOT_PATH} volumes: - ${BASE_PATH}:${BUILD_ROOT_PATH} From 6805a78e82f3b5315e97ac1088e8979f97336ec2 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 02:21:49 +0200 Subject: [PATCH 02/44] Add PHPUnit --- .idea/php-test-framework.xml | 14 + .idea/php.xml | 30 +- .idea/phpunit.xml | 10 + .idea/plugin.iml | 29 + README.md | 14 + composer.json | 3 + composer.lock | 1506 ++++++++++++++++++++++++++++++++- phpunit.xml.dist | 23 + tests/bootstrap.php | 10 + tests/functional/FuncTest.php | 11 + 10 files changed, 1647 insertions(+), 3 deletions(-) create mode 100644 .idea/php-test-framework.xml create mode 100644 .idea/phpunit.xml create mode 100644 phpunit.xml.dist create mode 100644 tests/bootstrap.php create mode 100644 tests/functional/FuncTest.php diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml new file mode 100644 index 0000000..613906f --- /dev/null +++ b/.idea/php-test-framework.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index 5681ecc..8cf9987 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -3,6 +3,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -69,7 +97,7 @@ - + \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml new file mode 100644 index 0000000..5ba64b9 --- /dev/null +++ b/.idea/phpunit.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/plugin.iml b/.idea/plugin.iml index 2d6ad0e..eb0a272 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -2,7 +2,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 9fd18fc..8f543c8 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,20 @@ is already configured for this. Any changes to the project folder are immediately reflected in the dev environment, and this includes the `vendor` folder and `composer.lock` file. This is because the project's folder is mounted into the correct place in the WordPress container. + +#### Testing Code +This bootstrap includes PHPUnit. It is already configured, and you can test +that it's working by running the sample tests: + +```bash +docker-compose run --rm build vendor/bin/phpunit +``` + +If you use PHPStorm, you can use its PHPUnit integration: right-click on any +test or folder inside the `tests` directory, and choose "Run". This will do +the same as the above command. Because the `build` service is used for tests, +they will be run with its PHP version, which should correspond to your project's +minimal requirements. [Docker Machine]: https://github.com/docker/machine [WP-CLI]: https://wp-cli.org/ diff --git a/composer.json b/composer.json index 70b1fb0..03b760c 100644 --- a/composer.json +++ b/composer.json @@ -12,5 +12,8 @@ ], "require": { "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0" } } diff --git a/composer.lock b/composer.lock index 70d245f..3e255c4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,1511 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "63186eb28c8ea0b5620ecb02c48114a6", + "content-hash": "edb00bb0ae05396b52f195980f30fdd8", "packages": [], - "packages-dev": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "3e7a22aed197e9333cc929e7f6b4300bdae91fcc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/3e7a22aed197e9333cc929e7f6b4300bdae91fcc", + "reference": "3e7a22aed197e9333cc929e7f6b4300bdae91fcc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "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": "http://ocramius.github.com/" + } + ], + "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" + ], + "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-06-15T18:51:04+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.x-dev", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-06-29T13:22:24+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "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": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "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" + ], + "time": "2018-08-07T13:53:10+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.0.0-alpha5", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8fcadfe5f85c38705151c9ab23b4781f23e6a70e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8fcadfe5f85c38705151c9ab23b4781f23e6a70e", + "reference": "8fcadfe5f85c38705151c9ab23b4781f23e6a70e", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "phpdocumentor/type-resolver": "^0", + "webmozart/assert": "^1" + }, + "require-dev": { + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2019-06-15T20:45:01+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.7.x-dev", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e424cdf9bbab5bccdede5f123f706083b11bcef9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e424cdf9bbab5bccdede5f123f706083b11bcef9", + "reference": "e424cdf9bbab5bccdede5f123f706083b11bcef9", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "phpdocumentor/reflection-common": "~2.0.0-beta1" + }, + "require-dev": { + "mockery/mockery": "~1", + "phpunit/phpunit": "~6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-12-20T14:34:12+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "dev-master", + "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" + ], + "time": "2020-03-05T15:02:03+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "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" + ], + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.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" + ], + "time": "2018-09-13T20:33:42+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" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-06-07T04:22:29+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2019-09-17T06:23:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.20", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.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": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-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" + ], + "time": "2020-01-08T08:45:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "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": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-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" + ], + "time": "2019-11-20T08:46:58+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "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", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\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" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-06-06T08:46:27+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "9dc4f203e36f2b486149058bade43c851dd97451" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", + "reference": "9dc4f203e36f2b486149058bade43c851dd97451", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "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" + ], + "time": "2020-06-16T10:16:42+00:00" + } + ], "aliases": [], "minimum-stability": "dev", "stability-flags": [], diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..0017811 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,23 @@ + + + + + + + + + ./tests/unit/ + + + ./tests/functional/ + + + + + src + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..b4dbe69 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,10 @@ +assertTrue(true); + } +} From b31e225c742399ed8952a4651b506e6b44dca81f Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 02:25:35 +0200 Subject: [PATCH 03/44] Correct name of PHP interpreter --- .idea/php.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index 8cf9987..3c51fcb 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -35,7 +35,7 @@ - + @@ -48,7 +48,7 @@ - + /usr/local/etc/php/php.ini From 0324414b09a8027eb832714aedfe32e7f42db417 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 02:34:34 +0200 Subject: [PATCH 04/44] Add `test` service --- .idea/php.xml | 59 +++++++++++++++++++++++++++++++++++++-- .idea/remote-mappings.xml | 7 +++++ docker-compose.yml | 13 +++++++++ docker/Dockerfile_wp | 10 +++++++ 4 files changed, 86 insertions(+), 3 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index 3c51fcb..a2e8bf4 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -35,7 +35,7 @@ - + @@ -44,11 +44,64 @@ + + + + + + + + + - + + + + /usr/local/etc/php/php.ini + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /usr/local/etc/php/php.ini @@ -97,7 +150,7 @@ - + \ No newline at end of file diff --git a/.idea/remote-mappings.xml b/.idea/remote-mappings.xml index d9f6e9d..3ca66a6 100644 --- a/.idea/remote-mappings.xml +++ b/.idea/remote-mappings.xml @@ -10,6 +10,13 @@ + + + + + + + diff --git a/docker-compose.yml b/docker-compose.yml index dc71485..071edae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -62,6 +62,19 @@ services: volumes: - ${BASE_PATH}:${BUILD_ROOT_PATH} + test: + build: + context: ./ + dockerfile: docker/Dockerfile_wp + target: test + args: + BUILD_ROOT_PATH: $BUILD_ROOT_PATH + PHP_BUILD_VERSION: $PHP_BUILD_VERSION + container_name: "${PROJECT_NAME}_test" + working_dir: ${BUILD_ROOT_PATH} + volumes: + - ${BASE_PATH}:${BUILD_ROOT_PATH} + volumes: wordpress: db: diff --git a/docker/Dockerfile_wp b/docker/Dockerfile_wp index dca98ad..e69930b 100644 --- a/docker/Dockerfile_wp +++ b/docker/Dockerfile_wp @@ -17,6 +17,16 @@ WORKDIR ${BUILD_ROOT_PATH} COPY . ./ +FROM php:${PHP_BUILD_VERSION}-cli as test + +ARG BUILD_ROOT_PATH + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +WORKDIR ${BUILD_ROOT_PATH} +COPY --from=build ${BUILD_ROOT_PATH} ${BUILD_ROOT_PATH} + + # Install PHP dev dependencies FROM build as vendor-dev From 68a82fd4622288d59b276fe5209ca737dbd88e7e Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 02:57:24 +0200 Subject: [PATCH 05/44] Remove `.env` file from repo It was never supposed to be committed anyhow --- .env | 21 --------------------- .gitignore | 1 + 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index fd57cda..0000000 --- a/.env +++ /dev/null @@ -1,21 +0,0 @@ -PLUGIN_NAME=plugin -BASE_PATH=/opt/projects/wp-oop/plugin -PROJECT_MOUNT_PATH=/var/www/html/wp-content/plugins/plugin -DOCROOT_PATH=/var/www/html -BUILD_ROOT_PATH=/app/ -PROJECT_NAME=me_plugin - -PHP_BUILD_VERSION=7.1 -PHP_TEST_VERSION=7.4 - -DB_ROOT_PASSWORD=am@n0fData -DB_NAME=wordpress -DB_USER_NAME=wordpress -DB_USER_PASSWORD=UDG@F!oy8g37921f - -WP_DOMAIN=plugin.myhost -WP_TITLE=plugin Test - -ADMIN_USER=admin -ADMIN_PASS=admin -ADMIN_EMAIL=me@my.com diff --git a/.gitignore b/.gitignore index 5c0eb49..f72d218 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /.idea/codeStyles/ /.idea/inspectionProfiles/ /.idea/misc.xml +/.env From b110edd1616ff65445ae06ccbdb46886fcca766d Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 03:10:29 +0200 Subject: [PATCH 06/44] Add database service and PHPStorm configuration --- .idea/dataSources.xml | 11 +++++++++++ .idea/php-test-framework.xml | 1 + .idea/php.xml | 1 + README.md | 31 ++++++++++++++++++++++++++++--- docker-compose.yml | 14 ++++++++++++++ 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .idea/dataSources.xml diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..8327928 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,11 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://plugin.myhost:3306/wordpress + + + \ No newline at end of file diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml index 613906f..096cfc5 100644 --- a/.idea/php-test-framework.xml +++ b/.idea/php-test-framework.xml @@ -6,6 +6,7 @@ + diff --git a/.idea/php.xml b/.idea/php.xml index a2e8bf4..d86cdbd 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -151,6 +151,7 @@ + \ No newline at end of file diff --git a/README.md b/README.md index 8f543c8..9004319 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,12 @@ Use Composer to bootstrap your project. to the WordPress database. Change these if you want to secure your deployed application. * `WP_DOMAIN`* - The domain name of the WordPress application, which contains your plugin. Among other things, used to set up the local dev image. Corresponds to the alias - used in the `hosts` file, if local. + used in the `hosts` file, if local. This value is also used in the PHPStorm's DB integration. + If this value is changed, PHPStorm's configuration must be updated. * `WP_TITLE`* - The title of the WordPress application, which contains your plugin. - No quotes, because Docker does not expand variables in this file. Used during automatic - installation of WordPress inside the local dev image. + No quotes, because Docker does not expand variables in this file. It is used during automatic + installation of WordPress inside the local dev image. This value is also used in the + PHPStorm's DB integration. If this value is changed, PHPStorm's configuration must be updated. * `ADMIN_USER`* - This and other `ADMIN_*` variables are used to determine WordPress admin details during automatic WordPress installation with [WP-CLI][]. @@ -138,12 +140,35 @@ test or folder inside the `tests` directory, and choose "Run". This will do the same as the above command. Because the `build` service is used for tests, they will be run with its PHP version, which should correspond to your project's minimal requirements. + +#### Database UI +This bootstrap includes [phpMyAdmin][], which provides a GUI for your database. +To start working with it, you must first bring up the related container, +as it is not brought up together with the dev environment: + +```bash +docker-compose up +``` + +You can now head over to the application's domain, defined usually by the +`WP_DOMAIN` value from the `.env` file, but access it on port `1234`, e.g. +`http://plugin.myhost:1234`. The username is `root`, and password is the one +specified by the `DB_ROOT_PASSWORD` variable in the `.env` file. + +This bootstrap comes ready with configuration for PHPStorm's [database integration][]. +With it, it's possible to completely avoid bringing up the `db_admin` service. +To use it, its settings must be up to date from the value of `DB_USER_PASSWORD`. +Using it is highly recommended, as it is an integrated DB client, and will +provide assistance during coding. + [Docker Machine]: https://github.com/docker/machine [WP-CLI]: https://wp-cli.org/ +[phpMyAdmin]: https://www.phpmyadmin.net/ [hosts file]: https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ [your machine's IP address]: https://www.whatismybrowser.com/detect/what-is-my-local-ip-address [composer integration]: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html#updating-dependencies +[database integration]: https://www.jetbrains.com/help/phpstorm/configuring-database-connections.html [`container_name`]: https://docs.docker.com/compose/compose-file/#container_name [`php`]: https://hub.docker.com/_/php [`wordpress`]: https://hub.docker.com/_/wordpress diff --git a/docker-compose.yml b/docker-compose.yml index 071edae..aed0053 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,6 +49,19 @@ services: volumes: - db:/var/lib/mysql + db_admin: + image: phpmyadmin/phpmyadmin:latest + container_name: "${PROJECT_NAME}_db_admin" + restart: unless-stopped + environment: + MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD + depends_on: + - db + ports: + - 1234:80 +# volumes: +# - db_admin + build: build: context: ./ @@ -78,3 +91,4 @@ services: volumes: wordpress: db: + db_admin: From aa5c4671d243ea3c1a0cb617e2415fc4244d4558 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 05:34:42 +0200 Subject: [PATCH 07/44] Add xDebug support --- .idea/deployment.xml | 14 ++++++++++++++ .idea/php.xml | 12 ++++++++++-- .idea/webServers.xml | 10 ++++++++++ README.md | 14 ++++++++++++++ docker/Dockerfile_wp | 1 + 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .idea/deployment.xml create mode 100644 .idea/webServers.xml diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..e570866 --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index d86cdbd..0cbf3e9 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -44,7 +44,10 @@ - + + + + @@ -64,7 +67,11 @@ - + + + + + @@ -94,6 +101,7 @@ + diff --git a/.idea/webServers.xml b/.idea/webServers.xml new file mode 100644 index 0000000..c0d65dd --- /dev/null +++ b/.idea/webServers.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 9004319..c3ee142 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,19 @@ the same as the above command. Because the `build` service is used for tests, they will be run with its PHP version, which should correspond to your project's minimal requirements. +#### Debugging +The bootstrap includes xDebug in the `test` service of the Docker environment, +and PHPStorm configuration. To use it, right click on any test or folder within +the `tests` directory, and choose "Debug". This will run the tests with xDebug +enabled. If you receive the error about [`xdebug.remote_host`][] being set +incorrectly and suggesting to fix the error, fix it by setting that variable +to [your machine's IP address][] on the local network in the window that +pops up. After this, breakpoints in any code reachable by PHPUnit tests, +including the code of tests themselves, will cause execution to pause, +allowing inspection of code. + +At this time, inspection of code that runs _during a web request_ is not available. + #### Database UI This bootstrap includes [phpMyAdmin][], which provides a GUI for your database. To start working with it, you must first bring up the related container, @@ -174,3 +187,4 @@ provide assistance during coding. [`wordpress`]: https://hub.docker.com/_/wordpress [`docker-machine start`]: https://docs.docker.com/machine/reference/start/] [`docker-machine env`]: https://docs.docker.com/machine/reference/env/ +[`xdebug.remote_host`]: https://xdebug.org/docs/all_settings#remote_host diff --git a/docker/Dockerfile_wp b/docker/Dockerfile_wp index e69930b..e4514a9 100644 --- a/docker/Dockerfile_wp +++ b/docker/Dockerfile_wp @@ -22,6 +22,7 @@ FROM php:${PHP_BUILD_VERSION}-cli as test ARG BUILD_ROOT_PATH RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" +RUN pecl install xdebug-2.6.0 WORKDIR ${BUILD_ROOT_PATH} COPY --from=build ${BUILD_ROOT_PATH} ${BUILD_ROOT_PATH} From 68a060d480b2872675e7a6ceefc3fb8459d6b117 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 05:45:35 +0200 Subject: [PATCH 08/44] Add WP dep --- .idea/php.xml | 1 + .idea/plugin.iml | 1 + composer.json | 3 ++- composer.lock | 43 ++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index 0cbf3e9..7c0343a 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -31,6 +31,7 @@ + diff --git a/.idea/plugin.iml b/.idea/plugin.iml index eb0a272..f524bbf 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -5,6 +5,7 @@ + diff --git a/composer.json b/composer.json index 03b760c..98f36bb 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0 | ^8.0" + "phpunit/phpunit": "^7.0 | ^8.0", + "johnpbloch/wordpress-core": "^5.0" } } diff --git a/composer.lock b/composer.lock index 3e255c4..7d811c1 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": "edb00bb0ae05396b52f195980f30fdd8", + "content-hash": "6d2364bbddee45262bd63ab5dff63a5a", "packages": [], "packages-dev": [ { @@ -77,6 +77,47 @@ ], "time": "2020-06-15T18:51:04+00:00" }, + { + "name": "johnpbloch/wordpress-core", + "version": "5.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/johnpbloch/wordpress-core.git", + "reference": "b15f01456c1c0d26f66a57f736fd6d01ef1b4ac3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/b15f01456c1c0d26f66a57f736fd6d01ef1b4ac3", + "reference": "b15f01456c1c0d26f66a57f736fd6d01ef1b4ac3", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.6.20" + }, + "provide": { + "wordpress/core-implementation": "5.4.x-dev" + }, + "type": "wordpress-core", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "WordPress Community", + "homepage": "https://wordpress.org/about/" + } + ], + "description": "WordPress is open source software you can use to create a beautiful website, blog, or app.", + "homepage": "https://wordpress.org/", + "keywords": [ + "blog", + "cms", + "wordpress" + ], + "time": "2020-07-01T09:47:31+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.x-dev", From d354ded673d73455911b9c3f81f26dc1bcebdbe0 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 05:58:07 +0200 Subject: [PATCH 09/44] Add description of PHPStorm features --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index c3ee142..30acd34 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,15 @@ Use this project as a starter for your modular WordPress plugin! a Docker image containing a complete WordPress installation with your plugin and all pre-requisites. +- **PHPStorm** - Configuration for integrations of arguably the best PHP + IDE out there, including: + + * **Database client** - View and manipulate the database from PHPStorm. + * **Composer** - Install and manage PHP dependencies on the correct version of PHP without leaving the IDE. + * **PHPUnit** - Run tests and get reports directly in PHPStorm. + * **xDebug** - Set breakpoints and inspect your code in PHPStorm. + * **Code coverage** - See what has not been tested yet in a friendly GUI. + ### Usage #### Getting Started From cc2c4b4c3b3ed55d42e48ea79d17eb8a6292a4bf Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 05:58:25 +0200 Subject: [PATCH 10/44] Update PHPStorm config --- .idea/plugin.iml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.idea/plugin.iml b/.idea/plugin.iml index f524bbf..12895af 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -2,6 +2,8 @@ + + From 3054915ce7abf6dec5d5ab5f808f2a2e7e206a7e Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 06:01:38 +0200 Subject: [PATCH 11/44] Add autoload path for test dir --- .idea/plugin.iml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/plugin.iml b/.idea/plugin.iml index 12895af..d08d115 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -2,7 +2,7 @@ - + From 4c9abbbb6fb3714dff95e1137b04c6be5c8b0bef Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 06:01:38 +0200 Subject: [PATCH 12/44] Add autoload path for test dir --- .idea/plugin.iml | 2 +- composer.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.idea/plugin.iml b/.idea/plugin.iml index 12895af..d08d115 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -2,7 +2,7 @@ - + diff --git a/composer.json b/composer.json index 98f36bb..3a61c0b 100644 --- a/composer.json +++ b/composer.json @@ -16,5 +16,10 @@ "require-dev": { "phpunit/phpunit": "^7.0 | ^8.0", "johnpbloch/wordpress-core": "^5.0" + }, + "autoload-dev": { + "psr-4": { + "Me\\Plugin\\Test\\": "tests" + } } } From 271ee36128159e9d6e1547b3df8edb22729a4548 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 06:11:40 +0200 Subject: [PATCH 13/44] Increase stability of WordPress dev-dependency --- composer.json | 2 +- composer.lock | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 3a61c0b..f9e72ee 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ }, "require-dev": { "phpunit/phpunit": "^7.0 | ^8.0", - "johnpbloch/wordpress-core": "^5.0" + "johnpbloch/wordpress-core": "^5.0@stable" }, "autoload-dev": { "psr-4": { diff --git a/composer.lock b/composer.lock index 7d811c1..081303e 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": "6d2364bbddee45262bd63ab5dff63a5a", + "content-hash": "40af7cb44850c515c32b58172a4747d5", "packages": [], "packages-dev": [ { @@ -79,16 +79,16 @@ }, { "name": "johnpbloch/wordpress-core", - "version": "5.4.x-dev", + "version": "5.4.2", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "b15f01456c1c0d26f66a57f736fd6d01ef1b4ac3" + "reference": "3e67d8b6ee6c11e8ce404da4627117fb7fbf9266" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/b15f01456c1c0d26f66a57f736fd6d01ef1b4ac3", - "reference": "b15f01456c1c0d26f66a57f736fd6d01ef1b4ac3", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/3e67d8b6ee6c11e8ce404da4627117fb7fbf9266", + "reference": "3e67d8b6ee6c11e8ce404da4627117fb7fbf9266", "shasum": "" }, "require": { @@ -96,7 +96,7 @@ "php": ">=5.6.20" }, "provide": { - "wordpress/core-implementation": "5.4.x-dev" + "wordpress/core-implementation": "5.4.2" }, "type": "wordpress-core", "notification-url": "https://packagist.org/downloads/", @@ -116,7 +116,7 @@ "cms", "wordpress" ], - "time": "2020-07-01T09:47:31+00:00" + "time": "2020-06-10T22:05:38+00:00" }, { "name": "myclabs/deep-copy", @@ -1552,7 +1552,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "johnpbloch/wordpress-core": 0 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From 984f722e3d07a59febb168fbf533f1581970dad9 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 06:13:42 +0200 Subject: [PATCH 14/44] Add CI instructions --- .github/workflows/continuous-integration.yml | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/continuous-integration.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..71312a5 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,28 @@ +name: Continuous Integration +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.1', '7.2', '7.3', '7.4'] + + steps: + - uses: actions/checkout@v2 + - + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Analysing source code + run: find ./src/ ./inc/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: PhpUnit + run: ./vendor/bin/phpunit From 906a83337c78d74829d4ce0be819742aa5446180 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 06:15:28 +0200 Subject: [PATCH 15/44] Fix error in workflow --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 71312a5..da08a2a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v2 - - + - name: Setup PHP uses: shivammathur/setup-php@v2 with: From b89fa0376eba68d9e327e80c08f460907d333f09 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 06:55:31 +0200 Subject: [PATCH 16/44] Add Psalm --- .github/workflows/continuous-integration.yml | 3 + .idea/php.xml | 18 + .idea/plugin.iml | 18 + README.md | 11 + composer.json | 3 +- composer.lock | 1357 +++++++++++++++++- docker/Dockerfile_wp | 2 + psalm.xml.dist | 160 +++ 8 files changed, 1508 insertions(+), 64 deletions(-) create mode 100644 psalm.xml.dist diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index da08a2a..f8ed84f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -26,3 +26,6 @@ jobs: - name: PhpUnit run: ./vendor/bin/phpunit + + - name: Psalm + run: ./vendor/bin/psalm --show-info=false --threads=8 diff --git a/.idea/php.xml b/.idea/php.xml index 7c0343a..cb8a33b 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -32,6 +32,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/.idea/plugin.iml b/.idea/plugin.iml index d08d115..8df3b70 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -5,10 +5,18 @@ + + + + + + + + @@ -21,6 +29,8 @@ + + @@ -32,9 +42,17 @@ + + + + + + + + diff --git a/README.md b/README.md index 30acd34..cabae4d 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,17 @@ To use it, its settings must be up to date from the value of `DB_USER_PASSWORD`. Using it is highly recommended, as it is an integrated DB client, and will provide assistance during coding. +#### Static Analysis +- **Psalm** + + Run Psalm in project root: + + ```bash + docker-compose run --rm test vendor/bin/psalm + ``` + + Will also be run automatically on CI. + [Docker Machine]: https://github.com/docker/machine [WP-CLI]: https://wp-cli.org/ diff --git a/composer.json b/composer.json index f9e72ee..a523bea 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ }, "require-dev": { "phpunit/phpunit": "^7.0 | ^8.0", - "johnpbloch/wordpress-core": "^5.0@stable" + "johnpbloch/wordpress-core": "^5.0@stable", + "vimeo/psalm": "^3.11.7" }, "autoload-dev": { "psr-4": { diff --git a/composer.lock b/composer.lock index 081303e..2667dd8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,287 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "40af7cb44850c515c32b58172a4747d5", + "content-hash": "3beb7af2ac404589570aac23ac6f1374", "packages": [], "packages-dev": [ + { + "name": "amphp/amp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/amphp/amp.git", + "reference": "e2c63c83eb8394306ca39a0790a22aebe2248da1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/amp/zipball/e2c63c83eb8394306ca39a0790a22aebe2248da1", + "reference": "e2c63c83eb8394306ca39a0790a22aebe2248da1", + "shasum": "" + }, + "require": { + "php": ">=7" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6.0.9 | ^7", + "react/promise": "^2", + "vimeo/psalm": "^3.11@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\": "lib" + }, + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "http://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "time": "2020-05-06T16:57:29+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/f0c20cf598a958ba2aa8c6e5a71c697d652c7088", + "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.4", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "psalm/phar": "^3.11.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\ByteStream\\": "lib" + }, + "files": [ + "lib/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "http://amphp.org/byte-stream", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "time": "2020-06-29T18:35:05+00:00" + }, + { + "name": "composer/semver", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "00915994bb1de62e750ae279669c9c5a57379957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/00915994bb1de62e750ae279669c9c5a57379957", + "reference": "00915994bb1de62e750ae279669c9c5a57379957", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.19", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "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": "2020-05-31T11:44:06+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "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": "2020-06-04T11:16:35+00:00" + }, { "name": "doctrine/instantiator", "version": "dev-master", @@ -77,6 +355,94 @@ ], "time": "2020-06-15T18:51:04+00:00" }, + { + "name": "felixfbecker/advanced-json-rpc", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", + "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/0ed363f8de17d284d479ec813c9ad3f6834b5c40", + "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40", + "shasum": "" + }, + "require": { + "netresearch/jsonmapper": "^1.0 || ^2.0", + "php": ">=7.0", + "phpdocumentor/reflection-docblock": "^4.0.0 || ^5.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "A more advanced JSONRPC implementation", + "time": "2020-03-11T15:21:41+00:00" + }, + { + "name": "felixfbecker/language-server-protocol", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-language-server-protocol.git", + "reference": "378801f6139bb74ac215d81cca1272af61df9a9f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/378801f6139bb74ac215d81cca1272af61df9a9f", + "reference": "378801f6139bb74ac215d81cca1272af61df9a9f", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpstan/phpstan": "*", + "phpunit/phpunit": "^6.3", + "squizlabs/php_codesniffer": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "LanguageServerProtocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "PHP classes for the Language Server Protocol", + "keywords": [ + "language", + "microsoft", + "php", + "server" + ], + "time": "2019-06-23T21:03:50+00:00" + }, { "name": "johnpbloch/wordpress-core", "version": "5.4.2", @@ -172,6 +538,203 @@ ], "time": "2020-06-29T13:22:24+00:00" }, + { + "name": "netresearch/jsonmapper", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e0f1e33a71587aca81be5cffbb9746510e1fe04e", + "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "squizlabs/php_codesniffer": "~3.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "time": "2020-04-16T18:48:43+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.5.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53c2753d756f5adb586dca79c2ec0e2654dd9463", + "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "0.0.5", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2020-06-03T07:24:19+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" + }, + "require-dev": { + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", + "ext-zip": "*", + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.5.17" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2019-11-15T16:17:10+00:00" + }, + { + "name": "openlss/lib-array2xml", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nullivex/lib-array2xml.git", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "LSS": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Bryan Tong", + "email": "bryan@nullivex.com", + "homepage": "https://www.nullivex.com" + }, + { + "name": "Tony Butler", + "email": "spudz76@gmail.com", + "homepage": "https://www.nullivex.com" + } + ], + "description": "Array2XML conversion library credit to lalit.org", + "homepage": "https://www.nullivex.com", + "keywords": [ + "array", + "array conversion", + "xml", + "xml conversion" + ], + "time": "2019-03-29T20:06:56+00:00" + }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -776,47 +1339,143 @@ "conflict": { "phpunit/phpunit-mock-objects": "*" }, - "require-dev": { - "ext-pdo": "*" + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-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" + ], + "time": "2020-01-08T08:45:45+00:00" + }, + { + "name": "psr/container", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/fc1bc363ecf887921e3897c7b1dad3587ae154eb", + "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2019-10-04T14:07:35+00:00" + }, + { + "name": "psr/log", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "shasum": "" }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "require": { + "php": ">=5.3.0" }, - "bin": [ - "phpunit" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "phpunit", - "testing", - "xunit" + "log", + "psr", + "psr-3" ], - "time": "2020-01-08T08:45:45+00:00" + "time": "2020-03-23T09:12:05+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1323,86 +1982,403 @@ } }, "autoload": { - "classmap": [ - "src/" + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "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", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/console", + "version": "4.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "087861c07733156f690b517c5103de5759a6fcf3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/087861c07733156f690b517c5103de5759a6fcf3", + "reference": "087861c07733156f690b517c5103de5759a6fcf3", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-06-30T17:40:09+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\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" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-06-06T08:46:27+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7110338d81ce1cbc3e273136e4574663627037a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7110338d81ce1cbc3e273136e4574663627037a7", + "reference": "7110338d81ce1cbc3e273136e4574663627037a7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-06-06T08:46:27+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "symfony/polyfill-php73", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "fa0837fe02d617d31fbb25f990655861bb27bd1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fa0837fe02d617d31fbb25f990655861bb27bd1a", + "reference": "fa0837fe02d617d31fbb25f990655861bb27bd1a", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.17-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], "classmap": [ - "src/" + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-06-06T08:46:27+00:00" }, { - "name": "symfony/polyfill-ctype", + "name": "symfony/polyfill-php80", "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4a5b6bba3259902e386eb80dd1956181ee90b5b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", - "reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4a5b6bba3259902e386eb80dd1956181ee90b5b2", + "reference": "4a5b6bba3259902e386eb80dd1956181ee90b5b2", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" + "php": ">=7.0.8" }, "type": "library", "extra": { @@ -1416,10 +2392,13 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" + "Symfony\\Polyfill\\Php80\\": "" }, "files": [ "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1428,21 +2407,25 @@ ], "authors": [ { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for ctype functions", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "ctype", "polyfill", - "portable" + "portable", + "shim" ], "funding": [ { @@ -1460,6 +2443,64 @@ ], "time": "2020-06-06T08:46:27+00:00" }, + { + "name": "symfony/service-contracts", + "version": "v1.1.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-10-14T12:27:06+00:00" + }, { "name": "theseer/tokenizer", "version": "1.1.3", @@ -1500,6 +2541,103 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "time": "2019-06-13T22:48:21+00:00" }, + { + "name": "vimeo/psalm", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/vimeo/psalm.git", + "reference": "ae7c5b095b6cd1d3013bb32e738008f1a842f02b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/ae7c5b095b6cd1d3013bb32e738008f1a842f02b", + "reference": "ae7c5b095b6cd1d3013bb32e738008f1a842f02b", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.1", + "amphp/byte-stream": "^1.5", + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "felixfbecker/advanced-json-rpc": "^3.0.3", + "felixfbecker/language-server-protocol": "^1.4", + "netresearch/jsonmapper": "^1.0 || ^2.0", + "nikic/php-parser": "^4.3", + "ocramius/package-versions": "^1.2", + "openlss/lib-array2xml": "^1.0", + "php": "^7.1.3|^8", + "sebastian/diff": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "webmozart/glob": "^4.1", + "webmozart/path-util": "^2.3" + }, + "provide": { + "psalm/psalm": "self.version" + }, + "require-dev": { + "amphp/amp": "^2.4.2", + "bamarni/composer-bin-plugin": "^1.2", + "brianium/paratest": "^4.0.0", + "ext-curl": "*", + "php-coveralls/php-coveralls": "^2.2", + "phpmyadmin/sql-parser": "5.1.0", + "phpspec/prophecy": ">=1.9.0", + "phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0", + "psalm/plugin-phpunit": "^0.10", + "slevomat/coding-standard": "^5.0", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.3" + }, + "suggest": { + "ext-igbinary": "^2.0.5" + }, + "bin": [ + "psalm", + "psalm-language-server", + "psalm-plugin", + "psalm-refactor", + "psalter" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev", + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psalm\\": "src/Psalm/" + }, + "files": [ + "src/functions.php", + "src/spl_object_id.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthew Brown" + } + ], + "description": "A static analysis tool for finding errors in PHP applications", + "keywords": [ + "code", + "inspection", + "php" + ], + "time": "2020-07-02T03:23:45+00:00" + }, { "name": "webmozart/assert", "version": "1.9.0", @@ -1548,6 +2686,99 @@ "validate" ], "time": "2020-06-16T10:16:42+00:00" + }, + { + "name": "webmozart/glob", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/webmozart/glob.git", + "reference": "8da14867b709e8776d9f6272faaf844aefc695e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/glob/zipball/8da14867b709e8776d9f6272faaf844aefc695e3", + "reference": "8da14867b709e8776d9f6272faaf844aefc695e3", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0", + "webmozart/path-util": "^2.2" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1", + "symfony/filesystem": "^2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Glob\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A PHP implementation of Ant's glob.", + "time": "2016-08-15T15:31:26+00:00" + }, + { + "name": "webmozart/path-util", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/webmozart/path-util.git", + "reference": "95a8f7ad150c2a3773ff3c3d04f557a24c99cfd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/95a8f7ad150c2a3773ff3c3d04f557a24c99cfd2", + "reference": "95a8f7ad150c2a3773ff3c3d04f557a24c99cfd2", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0", + "webmozart/assert": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\PathUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "time": "2016-08-15T15:31:42+00:00" } ], "aliases": [], diff --git a/docker/Dockerfile_wp b/docker/Dockerfile_wp index e4514a9..c26b4c9 100644 --- a/docker/Dockerfile_wp +++ b/docker/Dockerfile_wp @@ -23,6 +23,8 @@ ARG BUILD_ROOT_PATH RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" RUN pecl install xdebug-2.6.0 +RUN docker-php-ext-install pcntl +RUN docker-php-ext-install posix WORKDIR ${BUILD_ROOT_PATH} COPY --from=build ${BUILD_ROOT_PATH} ${BUILD_ROOT_PATH} diff --git a/psalm.xml.dist b/psalm.xml.dist new file mode 100644 index 0000000..51ea1ff --- /dev/null +++ b/psalm.xml.dist @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From cb3efd605a3e1c4709201f4cd34f68c83569a1b3 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 07:11:52 +0200 Subject: [PATCH 17/44] Add PHPCS --- .github/workflows/continuous-integration.yml | 3 + .idea/php.xml | 4 + .idea/plugin.iml | 4 + README.md | 15 ++ composer.json | 3 +- composer.lock | 233 ++++++++++++++++++- phpcs.xml.dist | 48 ++++ 7 files changed, 304 insertions(+), 6 deletions(-) create mode 100644 phpcs.xml.dist diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f8ed84f..ec5488d 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -29,3 +29,6 @@ jobs: - name: Psalm run: ./vendor/bin/psalm --show-info=false --threads=8 + + - name: PHPCS + run: ./vendor/bin/phpcs -s --report-source --runtime-set ignore_warnings_on_exit 1 diff --git a/.idea/php.xml b/.idea/php.xml index cb8a33b..ad165a2 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -50,6 +50,10 @@ + + + + diff --git a/.idea/plugin.iml b/.idea/plugin.iml index 8df3b70..e82b21a 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -8,6 +8,7 @@ + @@ -23,6 +24,7 @@ + @@ -42,6 +44,8 @@ + + diff --git a/README.md b/README.md index cabae4d..6010952 100644 --- a/README.md +++ b/README.md @@ -193,11 +193,26 @@ provide assistance during coding. ``` Will also be run automatically on CI. + +- **PHPCS** + + Run PHPCS/PHPCBF in project root: + + ```bash + docker-compose run --rm test vendor/bin/phpcs -s --report-source --runtime-set ignore_warnings_on_exit 1 + docker-compose run --rm test vendor/bin/phpcbf + ``` + + By default, uses [PSR-12][] and some rules from the [Slevomat Coding Standard][]. + + Will also be run automatically on CI. [Docker Machine]: https://github.com/docker/machine [WP-CLI]: https://wp-cli.org/ [phpMyAdmin]: https://www.phpmyadmin.net/ +[PSR-12]: https://www.php-fig.org/psr/psr-12/ +[Slevomat Coding Standard]: https://github.com/slevomat/coding-standard [hosts file]: https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ [your machine's IP address]: https://www.whatismybrowser.com/detect/what-is-my-local-ip-address [composer integration]: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html#updating-dependencies diff --git a/composer.json b/composer.json index a523bea..294cb2d 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "require-dev": { "phpunit/phpunit": "^7.0 | ^8.0", "johnpbloch/wordpress-core": "^5.0@stable", - "vimeo/psalm": "^3.11.7" + "vimeo/psalm": "^3.11.7", + "slevomat/coding-standard": "^6.0" }, "autoload-dev": { "psr-4": { diff --git a/composer.lock b/composer.lock index 2667dd8..c1a765a 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": "3beb7af2ac404589570aac23ac6f1374", + "content-hash": "f9336623989bd2521d70e51b36493705", "packages": [], "packages-dev": [ { @@ -285,6 +285,72 @@ ], "time": "2020-06-04T11:16:35+00:00" }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.0", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "e8d808670b8f882188368faaf1144448c169c0b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7", + "reference": "e8d808670b8f882188368faaf1144448c169c0b7", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev" + }, + "require-dev": { + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "time": "2020-06-25T14:57:39+00:00" + }, { "name": "doctrine/instantiator", "version": "dev-master", @@ -1045,6 +1111,55 @@ ], "time": "2020-03-05T15:02:03+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "0.4.8", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "1948aa842a94170b408963a9768a102f19cbf1b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1948aa842a94170b408963a9768a102f19cbf1b7", + "reference": "1948aa842a94170b408963a9768a102f19cbf1b7", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "require-dev": { + "consistence/coding-standard": "^3.5", + "ergebnis/composer-normalize": "^2.0.2", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.26", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^6.3", + "slevomat/coding-standard": "^4.7.2", + "symfony/process": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.4-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "time": "2020-06-10T05:04:41+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "6.1.4", @@ -2043,6 +2158,114 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "85399de612702d8fd30a05ff6242030f8c2dceb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/85399de612702d8fd30a05ff6242030f8c2dceb4", + "reference": "85399de612702d8fd30a05ff6242030f8c2dceb4", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", + "php": "^7.1", + "phpstan/phpdoc-parser": "0.4.5 - 0.4.8", + "squizlabs/php_codesniffer": "^3.5.5" + }, + "require-dev": { + "phing/phing": "2.16.3", + "php-parallel-lint/php-parallel-lint": "1.2.0", + "phpstan/phpstan": "0.12.32", + "phpstan/phpstan-deprecation-rules": "0.12.4", + "phpstan/phpstan-phpunit": "0.12.11", + "phpstan/phpstan-strict-rules": "0.12.2", + "phpunit/phpunit": "7.5.20|8.5.2|9.2.5" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2020-07-01T12:31:03+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "a957a73e3533353451eb9fd62ee58bd0aba2773c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/a957a73e3533353451eb9fd62ee58bd0aba2773c", + "reference": "a957a73e3533353451eb9fd62ee58bd0aba2773c", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2020-06-22T05:29:29+00:00" + }, { "name": "symfony/console", "version": "4.4.x-dev", @@ -2547,12 +2770,12 @@ "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "ae7c5b095b6cd1d3013bb32e738008f1a842f02b" + "reference": "fa0f43f0cf56e03eed7f4194db0e421236010b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/ae7c5b095b6cd1d3013bb32e738008f1a842f02b", - "reference": "ae7c5b095b6cd1d3013bb32e738008f1a842f02b", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/fa0f43f0cf56e03eed7f4194db0e421236010b72", + "reference": "fa0f43f0cf56e03eed7f4194db0e421236010b72", "shasum": "" }, "require": { @@ -2636,7 +2859,7 @@ "inspection", "php" ], - "time": "2020-07-02T03:23:45+00:00" + "time": "2020-07-02T04:22:14+00:00" }, { "name": "webmozart/assert", diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..1ac4cda --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,48 @@ + + + + ./src + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 4e7b940802d509a944fba5821da03aed7b3e1487 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 07:15:49 +0200 Subject: [PATCH 18/44] Add static code analysis to feature description --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 6010952..7db4621 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,11 @@ Use this project as a starter for your modular WordPress plugin! * **xDebug** - Set breakpoints and inspect your code in PHPStorm. * **Code coverage** - See what has not been tested yet in a friendly GUI. +- **Static Code Analysis** - Maintain a consistent coding style, and catch problems early. + + * **[Psalm][]** - Inspects your code for problems. + * **[PHPCS][]** - Checks your code style. [PHPCBF][] can fix some of them automatically. + ### Usage #### Getting Started @@ -213,6 +218,9 @@ provide assistance during coding. [phpMyAdmin]: https://www.phpmyadmin.net/ [PSR-12]: https://www.php-fig.org/psr/psr-12/ [Slevomat Coding Standard]: https://github.com/slevomat/coding-standard +[Psalm]: https://psalm.dev/ +[PHPCS]: https://github.com/squizlabs/PHP_CodeSniffer +[PHPCBF]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [hosts file]: https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ [your machine's IP address]: https://www.whatismybrowser.com/detect/what-is-my-local-ip-address [composer integration]: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html#updating-dependencies From b9bb1662409768558b9a2e8c293983024c7eab9a Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 07:20:10 +0200 Subject: [PATCH 19/44] Add dummy source and autoload mapping Deps updated --- .idea/plugin.iml | 1 + composer.json | 5 +++++ composer.lock | 8 ++++---- src/Module.php | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/Module.php diff --git a/.idea/plugin.iml b/.idea/plugin.iml index e82b21a..aafdf04 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -4,6 +4,7 @@ + diff --git a/composer.json b/composer.json index 294cb2d..d6780f5 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,11 @@ "vimeo/psalm": "^3.11.7", "slevomat/coding-standard": "^6.0" }, + "autoload": { + "psr-4": { + "Me\\Plugin\\": "src" + } + }, "autoload-dev": { "psr-4": { "Me\\Plugin\\Test\\": "tests" diff --git a/composer.lock b/composer.lock index c1a765a..30a8b0b 100644 --- a/composer.lock +++ b/composer.lock @@ -2770,12 +2770,12 @@ "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "fa0f43f0cf56e03eed7f4194db0e421236010b72" + "reference": "ea82cdc6ea1b7af058a0cdd1c207f99ec1c3dc7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/fa0f43f0cf56e03eed7f4194db0e421236010b72", - "reference": "fa0f43f0cf56e03eed7f4194db0e421236010b72", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/ea82cdc6ea1b7af058a0cdd1c207f99ec1c3dc7a", + "reference": "ea82cdc6ea1b7af058a0cdd1c207f99ec1c3dc7a", "shasum": "" }, "require": { @@ -2859,7 +2859,7 @@ "inspection", "php" ], - "time": "2020-07-02T04:22:14+00:00" + "time": "2020-07-02T05:11:46+00:00" }, { "name": "webmozart/assert", diff --git a/src/Module.php b/src/Module.php new file mode 100644 index 0000000..9474aa7 --- /dev/null +++ b/src/Module.php @@ -0,0 +1,16 @@ + Date: Thu, 2 Jul 2020 07:23:30 +0200 Subject: [PATCH 20/44] Add CI description to features --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7db4621..507c7ef 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ Use this project as a starter for your modular WordPress plugin! * **[Psalm][]** - Inspects your code for problems. * **[PHPCS][]** - Checks your code style. [PHPCBF][] can fix some of them automatically. +- **Continuous Integration** - Automatically verify that all contributions comply with + project standards with [GitHub Actions][]. + ### Usage #### Getting Started @@ -221,6 +224,7 @@ provide assistance during coding. [Psalm]: https://psalm.dev/ [PHPCS]: https://github.com/squizlabs/PHP_CodeSniffer [PHPCBF]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically +[GitHub Actions]: https://github.com/features/actions [hosts file]: https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ [your machine's IP address]: https://www.whatismybrowser.com/detect/what-is-my-local-ip-address [composer integration]: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html#updating-dependencies From 2fc6004fdc13c8a74718e22f8847ec1a3c21faec Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 07:24:26 +0200 Subject: [PATCH 21/44] Try to make Psalm faster Not sure if this will work, because I don't know how Actions cache works yet. --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ec5488d..d4fe57c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -28,7 +28,7 @@ jobs: run: ./vendor/bin/phpunit - name: Psalm - run: ./vendor/bin/psalm --show-info=false --threads=8 + run: ./vendor/bin/psalm --show-info=false --threads=8 --diff --diff-methods - name: PHPCS run: ./vendor/bin/phpcs -s --report-source --runtime-set ignore_warnings_on_exit 1 From 762bab58945200943ee068764d4af1ba23bbe7ed Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 07:28:01 +0200 Subject: [PATCH 22/44] Add changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..942d8be --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Change log +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [[*next-version*]] - YYYY-MM-DD +Initial version. From 378bf2cab4f81e6e51dc90351a13a2673655dcc9 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 2 Jul 2020 07:28:52 +0200 Subject: [PATCH 23/44] Add license file --- LICENSE | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. From deb59f89f4413d4517bb4833b745bc6560f6a232 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 7 Jul 2020 10:03:46 +0200 Subject: [PATCH 24/44] Add deps - `dhii/module-interface` - For module interface. - `psr/container` - For DI container interface. - `dhii/containers` - For container implementations etc. --- .idea/php.xml | 7 + .idea/plugin.iml | 7 + composer.json | 5 +- composer.lock | 462 ++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 412 insertions(+), 69 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index ad165a2..decfa99 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -54,6 +54,13 @@ + + + + + + + diff --git a/.idea/plugin.iml b/.idea/plugin.iml index aafdf04..12b9898 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -9,7 +9,14 @@ + + + + + + + diff --git a/composer.json b/composer.json index d6780f5..18f72a2 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,10 @@ } ], "require": { - "php": "^7.1" + "php": "^7.1", + "dhii/module-interface": "^0.2", + "psr/container": "^1.0", + "dhii/containers": "^0.1" }, "require-dev": { "phpunit/phpunit": "^7.0 | ^8.0", diff --git a/composer.lock b/composer.lock index 30a8b0b..99109eb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,383 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f9336623989bd2521d70e51b36493705", - "packages": [], + "content-hash": "68fa2226994ff3af711d34e4b7d636a1", + "packages": [ + { + "name": "container-interop/service-provider", + "version": "v0.4.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/service-provider.git", + "reference": "4969b9e49460690b7430b3f1a87cab07be61418a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/service-provider/zipball/4969b9e49460690b7430b3f1a87cab07be61418a", + "reference": "4969b9e49460690b7430b3f1a87cab07be61418a", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting container interoperability through standard service providers", + "homepage": "https://github.com/container-interop/service-provider", + "time": "2017-09-20T14:13:36+00:00" + }, + { + "name": "dhii/containers", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/Dhii/containers.git", + "reference": "3dd6e407e86cf19f7a40989eeb802cf751082902" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/containers/zipball/3dd6e407e86cf19f7a40989eeb802cf751082902", + "reference": "3dd6e407e86cf19f7a40989eeb802cf751082902", + "shasum": "" + }, + "require": { + "container-interop/service-provider": "^0.4", + "dhii/data-container-interface": "^0.2", + "php": "^7.0 | ^8.0" + }, + "require-dev": { + "gmazzap/andrew": "^1.1", + "phpunit/phpunit": "^6", + "psr/container": "^1.0", + "slevomat/coding-standard": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "A selection of PSR-11 containers for utility, simplicity, and ease.", + "keywords": [ + "PSR-11", + "container" + ], + "time": "2020-03-18T17:36:56+00:00" + }, + { + "name": "dhii/data-container-interface", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/Dhii/data-container-interface.git", + "reference": "f3b36758e236784a8c70c34e149f26982b2539d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/data-container-interface/zipball/f3b36758e236784a8c70c34e149f26982b2539d7", + "reference": "f3b36758e236784a8c70c34e149f26982b2539d7", + "shasum": "" + }, + "require": { + "dhii/exception-interface": "^0.1 | ^0.2", + "dhii/factory-interface": "^0.1-alpha1", + "php": "^5.3 | ^7.0", + "psr/container": "^1.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "dhii/stringable-interface": "^0.1", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" + }, + "suggest": { + "dhii/stringable-interface": "To be able to pass Stringables as keys" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.2.1-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Data\\Container\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interfaces for working with data containers", + "abandoned": "dhii/collections-interface", + "time": "2020-03-11T12:42:43+00:00" + }, + { + "name": "dhii/exception-interface", + "version": "v0.2", + "source": { + "type": "git", + "url": "https://github.com/Dhii/exception-interface.git", + "reference": "b69feebf7cb2879cd43977a03342e2393b73f7fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/exception-interface/zipball/b69feebf7cb2879cd43977a03342e2393b73f7fb", + "reference": "b69feebf7cb2879cd43977a03342e2393b73f7fb", + "shasum": "" + }, + "require": { + "dhii/stringable-interface": "^0.1", + "php": "^5.3 | ^7.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Exception\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interfaces for most common exceptions", + "time": "2018-08-29T10:42:04+00:00" + }, + { + "name": "dhii/factory-interface", + "version": "v0.1", + "source": { + "type": "git", + "url": "https://github.com/Dhii/factory-interface.git", + "reference": "b8d217aec8838e64ccaa770cb03dc164bf6f0515" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/factory-interface/zipball/b8d217aec8838e64ccaa770cb03dc164bf6f0515", + "reference": "b8d217aec8838e64ccaa770cb03dc164bf6f0515", + "shasum": "" + }, + "require": { + "dhii/exception-interface": "^0.1|^0.2", + "php": "^5.3 | ^7.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "dhii/stringable-interface": "^0.1", + "phpunit/phpunit": "^4.8", + "psr/container": "^1.0", + "ptrofimov/xpmock": "^1.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Factory\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interfaces for working with factories.", + "time": "2018-08-29T11:15:09+00:00" + }, + { + "name": "dhii/module-interface", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/Dhii/module-interface.git", + "reference": "cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/module-interface/zipball/cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52", + "reference": "cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52", + "shasum": "" + }, + "require": { + "container-interop/service-provider": "^0.4", + "php": "^7.1", + "psr/container": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0 | ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Modular\\Module\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interfaces for modules", + "time": "2020-04-10T14:27:05+00:00" + }, + { + "name": "dhii/stringable-interface", + "version": "v0.1", + "source": { + "type": "git", + "url": "https://github.com/Dhii/stringable-interface.git", + "reference": "b6653905eef2ebf377749feb80a6d18abbe913ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/stringable-interface/zipball/b6653905eef2ebf377749feb80a6d18abbe913ef", + "reference": "b6653905eef2ebf377749feb80a6d18abbe913ef", + "shasum": "" + }, + "require": { + "php": "^5.3 | ^7.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dhii\\Util\\String\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interoperability interface for objects that can be cast to string", + "time": "2017-01-23T15:08:20+00:00" + }, + { + "name": "psr/container", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/fc1bc363ecf887921e3897c7b1dad3587ae154eb", + "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2019-10-04T14:07:35+00:00" + } + ], "packages-dev": [ { "name": "amphp/amp", @@ -652,16 +1027,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.5.0", + "version": "v4.6.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463" + "reference": "c346bbfafe2ff60680258b631afb730d186ed864" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53c2753d756f5adb586dca79c2ec0e2654dd9463", - "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c346bbfafe2ff60680258b631afb730d186ed864", + "reference": "c346bbfafe2ff60680258b631afb730d186ed864", "shasum": "" }, "require": { @@ -700,7 +1075,7 @@ "parser", "php" ], - "time": "2020-06-03T07:24:19+00:00" + "time": "2020-07-02T17:12:47+00:00" }, { "name": "ocramius/package-versions", @@ -1054,12 +1429,12 @@ "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" + "reference": "69782012a282be8cc263fd56a8b19341b88cc4b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/69782012a282be8cc263fd56a8b19341b88cc4b4", + "reference": "69782012a282be8cc263fd56a8b19341b88cc4b4", "shasum": "" }, "require": { @@ -1109,7 +1484,7 @@ "spy", "stub" ], - "time": "2020-03-05T15:02:03+00:00" + "time": "2020-07-02T09:43:19+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -1496,55 +1871,6 @@ ], "time": "2020-01-08T08:45:45+00:00" }, - { - "name": "psr/container", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/fc1bc363ecf887921e3897c7b1dad3587ae154eb", - "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2019-10-04T14:07:35+00:00" - }, { "name": "psr/log", "version": "dev-master", @@ -2272,12 +2598,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "087861c07733156f690b517c5103de5759a6fcf3" + "reference": "fb6d83b2d873c93b71a031db5680c1566d97d0bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/087861c07733156f690b517c5103de5759a6fcf3", - "reference": "087861c07733156f690b517c5103de5759a6fcf3", + "url": "https://api.github.com/repos/symfony/console/zipball/fb6d83b2d873c93b71a031db5680c1566d97d0bb", + "reference": "fb6d83b2d873c93b71a031db5680c1566d97d0bb", "shasum": "" }, "require": { @@ -2355,7 +2681,7 @@ "type": "tidelift" } ], - "time": "2020-06-30T17:40:09+00:00" + "time": "2020-07-01T17:14:21+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2770,12 +3096,12 @@ "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "ea82cdc6ea1b7af058a0cdd1c207f99ec1c3dc7a" + "reference": "6419788a496c18815abecbc81fe187a276abab86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/ea82cdc6ea1b7af058a0cdd1c207f99ec1c3dc7a", - "reference": "ea82cdc6ea1b7af058a0cdd1c207f99ec1c3dc7a", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/6419788a496c18815abecbc81fe187a276abab86", + "reference": "6419788a496c18815abecbc81fe187a276abab86", "shasum": "" }, "require": { @@ -2859,7 +3185,7 @@ "inspection", "php" ], - "time": "2020-07-02T05:11:46+00:00" + "time": "2020-07-03T05:07:50+00:00" }, { "name": "webmozart/assert", From e5cd2efcacab764b6882740971971cf8e420b435 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 7 Jul 2020 10:05:02 +0200 Subject: [PATCH 25/44] Add `ModularModule` Test included. --- src/ModularModule.php | 54 ++++++++++ src/Module.php | 16 --- tests/functional/FuncTest.php | 11 -- tests/functional/ModularModuleTest.php | 136 +++++++++++++++++++++++++ 4 files changed, 190 insertions(+), 27 deletions(-) create mode 100644 src/ModularModule.php delete mode 100644 src/Module.php delete mode 100644 tests/functional/FuncTest.php create mode 100644 tests/functional/ModularModuleTest.php diff --git a/src/ModularModule.php b/src/ModularModule.php new file mode 100644 index 0000000..6ba0a5f --- /dev/null +++ b/src/ModularModule.php @@ -0,0 +1,54 @@ +modules = $modules; + } + + /** + * @inheritDoc + */ + public function setup(): ServiceProviderInterface + { + $providers = []; + foreach ($this->modules as $module) { + assert($module instanceof ModuleInterface); + $providers[] = $module->setup(); + } + + return new CompositeCachingServiceProvider($providers); + } + + /** + * @inheritDoc + */ + public function run(ContainerInterface $c) + { + foreach ($this->modules as $module) { + assert($module instanceof ModuleInterface); + $module->run($c); + } + } +} diff --git a/src/Module.php b/src/Module.php deleted file mode 100644 index 9474aa7..0000000 --- a/src/Module.php +++ /dev/null @@ -1,16 +0,0 @@ -assertTrue(true); - } -} diff --git a/tests/functional/ModularModuleTest.php b/tests/functional/ModularModuleTest.php new file mode 100644 index 0000000..12ada85 --- /dev/null +++ b/tests/functional/ModularModuleTest.php @@ -0,0 +1,136 @@ +createModule( + [ + $service1Name => function (): string { + return uniqid('service1-1'); + } + ], + [], + function () use ($output1): void { + echo $output1; + } + ); + $module2 = $this->createModule( + [ + $service1Name => function () use ($service1Value): string { + return $service1Value; + } + ], + [], + function () use ($output2): void { + echo $output2; + } + ); + $module3 = $this->createModule( + [ + $service2Name => function () use ($service2Value): string { + return $service2Value; + } + ], + [ + $service1Name => function (ContainerInterface $c, string $prev) use ($extension1Value): string { + return $prev . $extension1Value; + }, + ], + function () use ($output3): void { + echo $output3; + } + ); + + $subject = $this->createSubject([$module1, $module2, $module3]); + } + + { + $this->expectOutputString(implode('', [$output1, $output2, $output3])); + } + + { + $provider = $subject->setup(); + $container = $this->createContainer($provider); + $subject->run($container); + + $this->assertEquals($service1Value . $extension1Value, $container->get($service1Name)); + $this->assertEquals($service2Value, $container->get($service2Name)); + } + } + + /** + * @param iterable|ModuleInterface[] $modules The modules to load. + * + * @return Subject|MockObject + */ + protected function createSubject(iterable $modules): Subject + { + $mock = $this->getMockBuilder(Subject::class) + ->setConstructorArgs([$modules]) + ->enableProxyingToOriginalMethods() + ->getMock(); + + return $mock; + } + + /** + * @return ContainerInterface|MockObject + */ + protected function createContainer(ServiceProviderInterface $provider): ContainerInterface + { + $mock = $this->getMockBuilder(DelegatingContainer::class) + ->enableProxyingToOriginalMethods() + ->setConstructorArgs([$provider]) + ->getMock(); + + return $mock; + } + + /** + * @param array $factories + * @param array $extensions + * @param callable $action + * + * @return ModuleInterface|MockObject + */ + protected function createModule(array $factories, array $extensions, callable $action): ModuleInterface + { + $module = $this->getMockBuilder(ModuleInterface::class) + ->setMethods(['setup', 'run']) + ->getMock(); + $provider = $this->getMockBuilder(ServiceProviderInterface::class) + ->setMethods(['getFactories', 'getExtensions']) + ->getMock(); + + $provider->method('getFactories') + ->will($this->returnValue($factories)); + $provider->method('getExtensions') + ->will($this->returnValue($extensions)); + + $module->method('setup') + ->will($this->returnValue($provider)); + $module->method('run') + ->will($this->returnCallback($action)); + + return $module; + } +} From 12efa2f8ec9431c78b6156b7161516fbb5521c68 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 7 Jul 2020 16:47:36 +0200 Subject: [PATCH 26/44] Main file now includes Composer autoload --- plugin.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin.php b/plugin.php index 406c64a..e0b3a3e 100644 --- a/plugin.php +++ b/plugin.php @@ -13,3 +13,12 @@ * Text Domain: plugin * Domain Path: /languages */ + +(function (string $mainFile): void { + $rootDir = dirname($mainFile); + $autoload = "$rootDir/vendor/composer/autoload.php"; + + if (file_exists($autoload)) { + require $autoload; + } +})(__FILE__); From 04f2c337a4a33ba1b3b7587a81fe4cd1b60d2ab9 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 7 Jul 2020 17:09:23 +0200 Subject: [PATCH 27/44] Correct test directive and namespace --- tests/functional/ModularModuleTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/functional/ModularModuleTest.php b/tests/functional/ModularModuleTest.php index 12ada85..1f993f9 100644 --- a/tests/functional/ModularModuleTest.php +++ b/tests/functional/ModularModuleTest.php @@ -1,5 +1,9 @@ Date: Tue, 7 Jul 2020 17:10:52 +0200 Subject: [PATCH 28/44] Correct func test folder name --- tests/{functional => Func}/ModularModuleTest.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{functional => Func}/ModularModuleTest.php (100%) diff --git a/tests/functional/ModularModuleTest.php b/tests/Func/ModularModuleTest.php similarity index 100% rename from tests/functional/ModularModuleTest.php rename to tests/Func/ModularModuleTest.php From a56f66d439d66e7769d11eb1f398150235d94dfc Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 7 Jul 2020 17:20:37 +0200 Subject: [PATCH 29/44] New `ROOT_DIR` constant now available in tests --- tests/bootstrap.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b4dbe69..90ba2aa 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,8 +1,11 @@ Date: Tue, 7 Jul 2020 17:24:32 +0200 Subject: [PATCH 30/44] Add module declaration This includes a modules list file, an application bootstrap file, and a basic test. --- inc/bootstrap.php | 24 ++++++++++++++++++++++++ inc/modules.php | 11 +++++++++++ module.php | 13 +++++++++++++ tests/Func/MainModuleTest.php | 28 ++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 inc/bootstrap.php create mode 100644 inc/modules.php create mode 100644 module.php create mode 100644 tests/Func/MainModuleTest.php diff --git a/inc/bootstrap.php b/inc/bootstrap.php new file mode 100644 index 0000000..58f22b5 --- /dev/null +++ b/inc/bootstrap.php @@ -0,0 +1,24 @@ +setup(); + + $proxyContainer = new ProxyContainer(); + $container = new DelegatingContainer($provider, $proxyContainer); + $appContainer = new CompositeContainer([ + $container + ]); + $proxyContainer->setInnerContainer($appContainer); + + $module->run($appContainer); + + return $appContainer; +}; diff --git a/inc/modules.php b/inc/modules.php new file mode 100644 index 0000000..48668b0 --- /dev/null +++ b/inc/modules.php @@ -0,0 +1,11 @@ +bootstrapModule(); + $this->assertInstanceOf(ContainerInterface::class, $appContainer); + $this->assertFalse($appContainer->has(uniqid('non-existing-service'))); + } + + protected function bootstrapModule(): ContainerInterface + { + $rootDir = ROOT_DIR; + $mainFile = "$rootDir/plugin.php"; + $bootstrap = require ("$rootDir/inc/bootstrap.php"); + $appContainer = $bootstrap($rootDir, $mainFile); + + return $appContainer; + } +} From bae10ee77cdb899f82214e4e804fd8e1bb3fd4a2 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 7 Jul 2020 17:49:04 +0200 Subject: [PATCH 31/44] Add core local module --- .idea/php.xml | 6 + .idea/plugin.iml | 8 +- README.md | 22 ++ composer.json | 10 +- composer.lock | 341 ++++++++++++++++++++++++-- inc/modules.php | 1 + modules.local/core/composer.json | 27 ++ modules.local/core/inc/extensions.php | 8 + modules.local/core/inc/factories.php | 8 + modules.local/core/module.php | 17 ++ modules.local/core/src/Module.php | 37 +++ plugin.php | 7 + 12 files changed, 470 insertions(+), 22 deletions(-) create mode 100644 modules.local/core/composer.json create mode 100644 modules.local/core/inc/extensions.php create mode 100644 modules.local/core/inc/factories.php create mode 100644 modules.local/core/module.php create mode 100644 modules.local/core/src/Module.php diff --git a/.idea/php.xml b/.idea/php.xml index decfa99..de1e2c9 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -61,6 +61,12 @@ + + + + + + diff --git a/.idea/plugin.iml b/.idea/plugin.iml index 12b9898..6872f69 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -5,7 +5,7 @@ - + @@ -15,8 +15,12 @@ + + + + @@ -65,6 +69,8 @@ + + diff --git a/README.md b/README.md index 507c7ef..c25fcfb 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ Use this project as a starter for your modular WordPress plugin! - **Continuous Integration** - Automatically verify that all contributions comply with project standards with [GitHub Actions][]. +- **Modularity** - Keep concerns separated into modules, which can be freely + moved out of the package at any time thanks to the [`composer-merge-plugin`][]. + ### Usage #### Getting Started @@ -102,6 +105,17 @@ Use Composer to bootstrap your project. the plugin _does_ actually require other plugins, but they should not be shipped with the plugin. Otherwise, completely Composer-managed WordPress installations will not automatically install other required plugins. + + - Module `composer.json`: + This bootstrap uses the awesome [`composer-merge-plugin`][] to keep module depedencies + together with modules. This allows keeping track of which dependencies belong to which + modules, detect dependency incompatibilities, and moving modules out of the package + into packages of their own when necessary. + + Modules can be installed from other packages, or included in the package. In the latter + case, they should be added to the directory `modules.local`. One such module, the `core` + module of the plugin, is already included in the package. Its `composer.json` should + also be personalized, just like the `composer.json` of this package. 3. Spin up the dev environment @@ -140,6 +154,13 @@ docker-compose run --rm build composer update If you use PHPStorm, you can use the [composer integration][], as the project is already configured for this. +If you have changed the `composer.json` of one of the local modules, the +[`composer-merge-plugin`][] that is used to manage local module dependencies +needs to be instructed to include module "sub-package" changes in the update. +To do this, first run `composer update --lock` before running `composer update`. +**Do not run `composer update` for the modules' `composer.json` file!** +All Composer operations must be performed on the root package's `composer.json` file. + Any changes to the project folder are immediately reflected in the dev environment, and this includes the `vendor` folder and `composer.lock` file. This is because the project's folder is mounted into the correct place in the WordPress container. @@ -230,6 +251,7 @@ provide assistance during coding. [composer integration]: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html#updating-dependencies [database integration]: https://www.jetbrains.com/help/phpstorm/configuring-database-connections.html [`container_name`]: https://docs.docker.com/compose/compose-file/#container_name +[`composer-merge-plugin`]: https://github.com/wikimedia/composer-merge-plugin [`php`]: https://hub.docker.com/_/php [`wordpress`]: https://hub.docker.com/_/wordpress [`docker-machine start`]: https://docs.docker.com/machine/reference/start/] diff --git a/composer.json b/composer.json index 18f72a2..bfe2213 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "php": "^7.1", "dhii/module-interface": "^0.2", "psr/container": "^1.0", - "dhii/containers": "^0.1" + "dhii/containers": "^0.1", + "wikimedia/composer-merge-plugin": "^1.4" }, "require-dev": { "phpunit/phpunit": "^7.0 | ^8.0", @@ -31,5 +32,12 @@ "psr-4": { "Me\\Plugin\\Test\\": "tests" } + }, + "extra": { + "merge-plugin": { + "include": [ + "modules.local/*/composer.json" + ] + } } } diff --git a/composer.lock b/composer.lock index 99109eb..9f9b14d 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": "68fa2226994ff3af711d34e4b7d636a1", + "content-hash": "5ef280e58ea7cb46f0a6a29b5ac8bf14", "packages": [ { "name": "container-interop/service-provider", @@ -243,6 +243,57 @@ "description": "Interfaces for working with factories.", "time": "2018-08-29T11:15:09+00:00" }, + { + "name": "dhii/human-readable-interface", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/Dhii/human-readable-interface.git", + "reference": "a892c35394eebc627ff81f5112b09ab9da727754" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/human-readable-interface/zipball/a892c35394eebc627ff81f5112b09ab9da727754", + "reference": "a892c35394eebc627ff81f5112b09ab9da727754", + "shasum": "" + }, + "require": { + "php": "^5.3 | ^7.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "dhii/stringable-interface": "^0.1.0", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" + }, + "suggest": { + "dhii/i18n-interface": "For internationalizing and translating human readable strings." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Util\\String\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interfaces for human readable string interoperation.", + "time": "2020-05-14T18:39:55+00:00" + }, { "name": "dhii/module-interface", "version": "dev-develop", @@ -289,6 +340,52 @@ "description": "Interfaces for modules", "time": "2020-04-10T14:27:05+00:00" }, + { + "name": "dhii/package-interface", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/Dhii/package-interface.git", + "reference": "8169f4f08d7709ba850d8a2befeff5f1d208ca54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/package-interface/zipball/8169f4f08d7709ba850d8a2befeff5f1d208ca54", + "reference": "8169f4f08d7709ba850d8a2befeff5f1d208ca54", + "shasum": "" + }, + "require": { + "dhii/stringable-interface": "^0.1", + "dhii/validation-interface": "^0.3-alpha1", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Package\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Interfaces for package-related interop", + "time": "2020-05-14T19:54:39+00:00" + }, { "name": "dhii/stringable-interface", "version": "v0.1", @@ -331,6 +428,97 @@ "description": "Interoperability interface for objects that can be cast to string", "time": "2017-01-23T15:08:20+00:00" }, + { + "name": "dhii/validation-interface", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/Dhii/validation-interface.git", + "reference": "f5c15606b1387df2381134e4fc6e1971cbc284a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/validation-interface/zipball/f5c15606b1387df2381134e4fc6e1971cbc284a0", + "reference": "f5c15606b1387df2381134e4fc6e1971cbc284a0", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "dhii/stringable-interface": "^0.1", + "phpunit/phpunit": "^7.0 | ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Validation\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "A base interface for validators", + "time": "2020-05-14T00:22:48+00:00" + }, + { + "name": "dhii/versions", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/Dhii/versions.git", + "reference": "40933debe1d77f26a381a47abfb256e0e974e439" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/versions/zipball/40933debe1d77f26a381a47abfb256e0e974e439", + "reference": "40933debe1d77f26a381a47abfb256e0e974e439", + "shasum": "" + }, + "require": { + "dhii/package-interface": "^0.1", + "dhii/stringable-interface": "^0.1", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Versions\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Implementation for dealing with SemVer-compliant versions", + "time": "2020-05-14T19:25:38+00:00" + }, { "name": "psr/container", "version": "dev-master", @@ -379,6 +567,101 @@ "psr" ], "time": "2019-10-04T14:07:35+00:00" + }, + { + "name": "wikimedia/composer-merge-plugin", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/composer-merge-plugin.git", + "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/81c6ac72a24a67383419c7eb9aa2b3437f2ab100", + "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": ">=5.3.2" + }, + "require-dev": { + "composer/composer": "~1.0.0", + "jakub-onderka/php-parallel-lint": "~0.8", + "phpunit/phpunit": "~4.8|~5.0", + "squizlabs/php_codesniffer": "~2.1.0" + }, + "type": "composer-plugin", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + }, + "class": "Wikimedia\\Composer\\MergePlugin" + }, + "autoload": { + "psr-4": { + "Wikimedia\\Composer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bryan Davis", + "email": "bd808@wikimedia.org" + } + ], + "description": "Composer plugin to merge multiple composer.json files", + "time": "2017-04-25T02:31:25+00:00" + }, + { + "name": "wp-oop/wordpress-interface", + "version": "dev-task/initial-interfaces", + "source": { + "type": "git", + "url": "https://github.com/wp-oop/wordpress-interface.git", + "reference": "a5062fd9f3e48b63d659c5dd1db32207c1a628b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-oop/wordpress-interface/zipball/a5062fd9f3e48b63d659c5dd1db32207c1a628b9", + "reference": "a5062fd9f3e48b63d659c5dd1db32207c1a628b9", + "shasum": "" + }, + "require": { + "dhii/human-readable-interface": "^0.1", + "dhii/package-interface": "^0.1-alpha1", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-task/initial-interfaces": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "WpOop\\WordPress\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Interfaces for interop within WordPress", + "time": "2020-05-20T13:24:44+00:00" } ], "packages-dev": [ @@ -1425,16 +1708,16 @@ }, { "name": "phpspec/prophecy", - "version": "dev-master", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "69782012a282be8cc263fd56a8b19341b88cc4b4" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/69782012a282be8cc263fd56a8b19341b88cc4b4", - "reference": "69782012a282be8cc263fd56a8b19341b88cc4b4", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { @@ -1484,7 +1767,7 @@ "spy", "stub" ], - "time": "2020-07-02T09:43:19+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -2598,12 +2881,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fb6d83b2d873c93b71a031db5680c1566d97d0bb" + "reference": "55d07021da933dd0d633ffdab6f45d5b230c7e02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fb6d83b2d873c93b71a031db5680c1566d97d0bb", - "reference": "fb6d83b2d873c93b71a031db5680c1566d97d0bb", + "url": "https://api.github.com/repos/symfony/console/zipball/55d07021da933dd0d633ffdab6f45d5b230c7e02", + "reference": "55d07021da933dd0d633ffdab6f45d5b230c7e02", "shasum": "" }, "require": { @@ -2681,7 +2964,7 @@ "type": "tidelift" } ], - "time": "2020-07-01T17:14:21+00:00" + "time": "2020-07-06T13:18:39+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2994,20 +3277,20 @@ }, { "name": "symfony/service-contracts", - "version": "v1.1.8", + "version": "v1.1.9", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" + "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b776d18b303a39f56c63747bcb977ad4b27aca26", + "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": ">=7.1.3", "psr/container": "^1.0" }, "suggest": { @@ -3017,6 +3300,10 @@ "extra": { "branch-alias": { "dev-master": "1.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3048,7 +3335,21 @@ "interoperability", "standards" ], - "time": "2019-10-14T12:27:06+00:00" + "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-07-06T13:19:58+00:00" }, { "name": "theseer/tokenizer", @@ -3096,12 +3397,12 @@ "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "6419788a496c18815abecbc81fe187a276abab86" + "reference": "82a85791f2a86c14a6c438e44e0ff48ebed31084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/6419788a496c18815abecbc81fe187a276abab86", - "reference": "6419788a496c18815abecbc81fe187a276abab86", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/82a85791f2a86c14a6c438e44e0ff48ebed31084", + "reference": "82a85791f2a86c14a6c438e44e0ff48ebed31084", "shasum": "" }, "require": { @@ -3185,7 +3486,7 @@ "inspection", "php" ], - "time": "2020-07-03T05:07:50+00:00" + "time": "2020-07-07T13:31:43+00:00" }, { "name": "webmozart/assert", diff --git a/inc/modules.php b/inc/modules.php index 48668b0..6439890 100644 --- a/inc/modules.php +++ b/inc/modules.php @@ -5,6 +5,7 @@ $localModulesDir = "$rootDir/modules.local"; $modules = [ + (require "$localModulesDir/core/module.php")($rootDir, $mainFile), ]; return $modules; diff --git a/modules.local/core/composer.json b/modules.local/core/composer.json new file mode 100644 index 0000000..cfcc73d --- /dev/null +++ b/modules.local/core/composer.json @@ -0,0 +1,27 @@ +{ + "name": "me/plugin-core", + "description": "The core module of the plugin", + "minimum-stability": "dev", + "license": "MIT", + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com", + "role": "Developer" + } + ], + "require": { + "php": "^7.1", + "wp-oop/wordpress-interface": "^0.1.0-alpha1", + "dhii/module-interface": "^0.2-alpha1", + "dhii/package-interface": "^0.1.0-alpha2", + "dhii/stringable-interface": "^0.1", + "dhii/versions": "^0.1.0-alpha1", + "dhii/containers": "^0.1" + }, + "autoload": { + "psr-4": { + "Me\\Plugin\\Core\\": "src" + } + } +} diff --git a/modules.local/core/inc/extensions.php b/modules.local/core/inc/extensions.php new file mode 100644 index 0000000..5fd488c --- /dev/null +++ b/modules.local/core/inc/extensions.php @@ -0,0 +1,8 @@ +serviceProvider = $serviceProvider; + } + + /** + * @inheritDoc + */ + public function setup(): ServiceProviderInterface + { + return $this->serviceProvider; + } + + /** + * @inheritDoc + */ + public function run(ContainerInterface $c) + { + // Nothing to do + } +} diff --git a/plugin.php b/plugin.php index e0b3a3e..c1253ce 100644 --- a/plugin.php +++ b/plugin.php @@ -21,4 +21,11 @@ if (file_exists($autoload)) { require $autoload; } + + add_action('plugins_loaded', function () use ($mainFile, $rootDir) { + $incDir = "$rootDir/inc"; + $bootstrap = require "$incDir/bootstrap.php"; + + $bootstrap($mainFile, $rootDir); + }); })(__FILE__); From 8a010ed622dfdad56d396a62d5fbc8cbe02f2776 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Tue, 7 Jul 2020 19:41:47 +0200 Subject: [PATCH 32/44] Add missing return type to `run()` --- modules.local/core/src/Module.php | 2 +- src/ModularModule.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules.local/core/src/Module.php b/modules.local/core/src/Module.php index 85d65ef..9d2bd36 100644 --- a/modules.local/core/src/Module.php +++ b/modules.local/core/src/Module.php @@ -30,7 +30,7 @@ public function setup(): ServiceProviderInterface /** * @inheritDoc */ - public function run(ContainerInterface $c) + public function run(ContainerInterface $c): void { // Nothing to do } diff --git a/src/ModularModule.php b/src/ModularModule.php index 6ba0a5f..57b2531 100644 --- a/src/ModularModule.php +++ b/src/ModularModule.php @@ -44,7 +44,7 @@ public function setup(): ServiceProviderInterface /** * @inheritDoc */ - public function run(ContainerInterface $c) + public function run(ContainerInterface $c): void { foreach ($this->modules as $module) { assert($module instanceof ModuleInterface); From 186b7a810004a2050aec9072eeeff4aa1c721163 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 16:41:31 +0200 Subject: [PATCH 33/44] Using value of bootstrap, for ease of understanding --- plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index c1253ce..483e94b 100644 --- a/plugin.php +++ b/plugin.php @@ -26,6 +26,6 @@ $incDir = "$rootDir/inc"; $bootstrap = require "$incDir/bootstrap.php"; - $bootstrap($mainFile, $rootDir); + $appContainer = $bootstrap($mainFile, $rootDir); }); })(__FILE__); From 172e5020bce4fe22dd227f79c3f4e5975b42b644 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 16:42:48 +0200 Subject: [PATCH 34/44] Add basic plugin services --- .idea/plugin.iml | 2 +- modules.local/core/inc/factories.php | 28 +++- .../core/src/FilePathPluginFactory.php | 110 +++++++++++++ modules.local/core/src/Plugin.php | 155 ++++++++++++++++++ tests/Func/MainModuleTest.php | 1 + 5 files changed, 294 insertions(+), 2 deletions(-) create mode 100644 modules.local/core/src/FilePathPluginFactory.php create mode 100644 modules.local/core/src/Plugin.php diff --git a/.idea/plugin.iml b/.idea/plugin.iml index 6872f69..b5be0b4 100644 --- a/.idea/plugin.iml +++ b/.idea/plugin.iml @@ -5,7 +5,7 @@ - + diff --git a/modules.local/core/inc/factories.php b/modules.local/core/inc/factories.php index 5fd488c..8955028 100644 --- a/modules.local/core/inc/factories.php +++ b/modules.local/core/inc/factories.php @@ -2,7 +2,33 @@ declare(strict_types=1); -return function (string $rootPath): array { +use Dhii\Package\Version\StringVersionFactoryInterface; +use Dhii\Versions\StringVersionFactory; +use Me\Plugin\Core\FilePathPluginFactory; +use Psr\Container\ContainerInterface; +use WpOop\WordPress\Plugin\FilePathPluginFactoryInterface; +use WpOop\WordPress\Plugin\PluginInterface; + +return function (string $rootDir, string $mainFile): array { return [ + 'me/plugin/plugin' => function (ContainerInterface $c) use ($mainFile): PluginInterface { + $f = $c->get('wordpress/plugin_factory'); + assert($f instanceof FilePathPluginFactoryInterface); + $plugin = $f->createPluginFromFilePath($mainFile); + + return $plugin; + }, + 'me/plugin/plugin_factory' => function (ContainerInterface $c): FilePathPluginFactoryInterface { + return $c->get('wordpress/plugin_factory'); + }, + 'wordpress/plugin_factory' => function (ContainerInterface $c): FilePathPluginFactoryInterface { + return new FilePathPluginFactory($c->get('package/version_factory')); + }, + 'me/plugin/version_factory' => function (ContainerInterface $c): StringVersionFactoryInterface { + return $c->get('package/version_factory'); + }, + 'package/version_factory' => function (): StringVersionFactoryInterface { + return new StringVersionFactory(); + }, ]; }; diff --git a/modules.local/core/src/FilePathPluginFactory.php b/modules.local/core/src/FilePathPluginFactory.php new file mode 100644 index 0000000..17ffbd9 --- /dev/null +++ b/modules.local/core/src/FilePathPluginFactory.php @@ -0,0 +1,110 @@ +versionFactory = $versionFactory; + } + + /** + * @inheritDoc + */ + public function createPluginFromFilePath(string $filePath): PluginInterface + { + if (!is_readable($filePath)) { + throw new RuntimeException(sprintf('Plugin file "%1$s" does not exist or is not readable', $filePath)); + } + + $pluginData = get_plugin_data($filePath); + if (empty($pluginData)) { + throw new UnexpectedValueException(sprintf('Plugin file "%1$s" does not have a valid plugin header', $filePath)); + } + + $pluginData = array_merge([ + 'Name' => '', + 'Version' => '0.1.0-alpha1+default', + 'Title' => '', + 'Description' => '', + 'TextDomain' => '', + 'RequiresWP' => '5.0', + 'RequiresPHP' => '5.6', + ], $pluginData); + + $baseDir = dirname($filePath); + $baseName = plugin_basename($filePath); + $slug = $this->getPluginSlug($baseName); + $textDomain = !empty($pluginData['TextDomain']) ? $pluginData['TextDomain'] : $slug; + + return new Plugin( + $pluginData['Name'], + $this->createVersion($pluginData['Version']), + $baseDir, + $baseName, + $pluginData['Title'], + $pluginData['Description'], + $textDomain, + $this->createVersion($pluginData['RequiresPHP']), + $this->createVersion($pluginData['RequiresWP']) + ); + } + + /** + * Creates a new version from a version string. + * + * @param string $versionString The SemVer-compliant version string. + * + * @return VersionInterface The new version. + * + * @throws DomainException If version string is malformed. + */ + protected function createVersion(string $versionString): VersionInterface + { + return $this->versionFactory->createVersionFromString($versionString); + } + + /** + * Retrieves a plugin slug from its basename. + * + * @param string $baseName The plugin's basename. + * + * @return string The plugin's slug. + */ + protected function getPluginSlug(string $baseName): string + { + $directorySeparator = '/'; + + // If plugin is in a directory, use directory name + if (strstr($baseName, $directorySeparator) !== false) { + $parts = explode($directorySeparator, $baseName); + return $parts[0]; + } + + // If plugin is not in a directory, return plugin file basename + return basename($baseName); + } +} diff --git a/modules.local/core/src/Plugin.php b/modules.local/core/src/Plugin.php new file mode 100644 index 0000000..a33e4db --- /dev/null +++ b/modules.local/core/src/Plugin.php @@ -0,0 +1,155 @@ +name = $name; + $this->description = $description; + $this->version = $version; + $this->baseDir = $baseDir; + $this->baseName = $baseName; + $this->title = $title; + $this->textDomain = $textDomain; + $this->minPhpVersion = $minPhpVersion; + $this->minWpVersion = $minWpVersion; + } + + /** + * @inheritDoc + */ + public function getName(): string + { + return $this->name; + } + + /** + * @inheritDoc + */ + public function getDescription() + { + return $this->description; + } + + /** + * @inheritDoc + */ + public function getVersion(): VersionInterface + { + return $this->version; + } + + /** + * @inheritDoc + */ + public function getBaseDir(): string + { + return $this->baseDir; + } + + /** + * @inheritDoc + */ + public function getBaseName(): string + { + return $this->baseName; + } + + /** + * @inheritDoc + */ + public function getTextDomain(): string + { + return $this->textDomain; + } + + /** + * @inheritDoc + */ + public function getTitle() + { + return $this->title; + } + + /** + * @inheritDoc + */ + public function getMinPhpVersion(): VersionInterface + { + return $this->minPhpVersion; + } + + /** + * @inheritDoc + */ + public function getMinWpVersion(): VersionInterface + { + return $this->minWpVersion; + } +} diff --git a/tests/Func/MainModuleTest.php b/tests/Func/MainModuleTest.php index ee8f449..a865466 100644 --- a/tests/Func/MainModuleTest.php +++ b/tests/Func/MainModuleTest.php @@ -13,6 +13,7 @@ public function testMainModuleLoads() { $appContainer = $this->bootstrapModule(); $this->assertInstanceOf(ContainerInterface::class, $appContainer); + $this->assertTrue($appContainer->has('me/plugin/plugin')); $this->assertFalse($appContainer->has(uniqid('non-existing-service'))); } From 9b40255eefe6044a74f38e6313b2c8e8e9157e12 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 16:49:53 +0200 Subject: [PATCH 35/44] Correct letter case --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c25fcfb..54d42c5 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Use Composer to bootstrap your project. installed and active, and no other plugins should be installed. If this is not the case, inspect the output you got from `docker-compose up`. -#### Updating dependencies +#### Updating Dependencies Composer is installed into the `build` service's image. To run composer commands, use `docker-compose run`. For example, to update dependencies you can run the following: From bd06d5890a27126acc61123d8089ef2024714bbf Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 17:12:29 +0200 Subject: [PATCH 36/44] Fix formatting --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 54d42c5..ea5f017 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ Use Composer to bootstrap your project. the value of `WP_DOMAIN` from the `.env` file. The IP would be Docker machine's IP address. On Linux, this is the same as [your machine's IP address][] on the local network, and usually `127.0.0.1` (localhost) works. If you are using Docker - Machine (in a non-Linux environment), use [`docker-machine ip`] to find it. + Machine (in a non-Linux environment), use `docker-machine ip` to find it. Now you should be able to visit that domain, and see the website. The admin username and password are both `admin` by default, and are determined by the `ADMIN_USER` From ebade73d4a8a363adca8b9cfc95d8498c9abd741 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 17:12:52 +0200 Subject: [PATCH 37/44] Add doc on adding modules --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/README.md b/README.md index ea5f017..d4c2f85 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,55 @@ Any changes to the project folder are immediately reflected in the dev environme and this includes the `vendor` folder and `composer.lock` file. This is because the project's folder is mounted into the correct place in the WordPress container. +#### Adding Modules +This boilerplate promotes modularity, and supports [Dhii modules][] out of the box. +Any such module that exposes a [`ModuleInterface`][] implementation can be loaded, +allowing it to run in the application, and making its services available. + +The list of modules returned by `inc/modules.php` is the authoritative source +of modules in the application. Because it is PHP code, modules can be loaded +in any required way, including: + +- Simple instantiation of a module class that will be autoloaded. + + If your module class is on one of the autoload paths registered with e.g. Composer, + you can just instantiate it as you would any other class. This is a + very quick and simple way to load some modules. + + +- Usage of a factory class or file. + + In order to make modules de-coupled from the application, but to still be able + to provide dependencies from the application to the module, it is sometimes + desirable to use a "padding" between the application and the module's + initialization. In this project, as well as in some others, we use a + `module.php` file. This file returns a function which, given some parameters + like the root project path, will return a `ModuleInterface` instance. + Another approach could be to use a named constructor, or even a dedicated + factory class. + +- Scanning certain paths. + + If modules do not conflict in any way, the module load order may be irrelevant. + In this case, it is possible to auto-discover modules by, for example, scanning + certain folders for some entrypoints or config files. Implement whatever + auto-discovery mechanism you wish, as long as the module instances + end up in the authoritative list. + +##### External Modules +To add a module from another package, require that package with Composer +and add the `ModuleInterface` instance to the list. + +##### Local Modules +To add a local module, add the module to the `modules.local` folder, +and do the same as for any other module. Local modules may also declare their own +dependencies by adding a `composer.json` file to their root folder. +These files will be picked up by Composer when updating dependencies in +the project root, thanks to the [`composer-merge-plugin`][], provided +that `composer update --lock` is run before `composer update`. This is +a great way to separate module dependencies from other dependencies. +Consult that Composer plugin's documentation for more information. + #### Testing Code This bootstrap includes PHPUnit. It is already configured, and you can test that it's working by running the sample tests: @@ -246,6 +295,7 @@ provide assistance during coding. [PHPCS]: https://github.com/squizlabs/PHP_CodeSniffer [PHPCBF]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically [GitHub Actions]: https://github.com/features/actions +[Dhii modules]: https://github.com/Dhii/module-interface [hosts file]: https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ [your machine's IP address]: https://www.whatismybrowser.com/detect/what-is-my-local-ip-address [composer integration]: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html#updating-dependencies @@ -257,3 +307,4 @@ provide assistance during coding. [`docker-machine start`]: https://docs.docker.com/machine/reference/start/] [`docker-machine env`]: https://docs.docker.com/machine/reference/env/ [`xdebug.remote_host`]: https://xdebug.org/docs/all_settings#remote_host +[`ModuleInterface`]: https://github.com/Dhii/module-interface/blob/develop/src/ModuleInterface.php From 24227dc40c1c735afe2dd74a72244d7840ed45d3 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 17:15:34 +0200 Subject: [PATCH 38/44] Feature banch now aliased to `0.1.x-dev` Deps upated --- composer.json | 3 +++ composer.lock | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index bfe2213..b298dc6 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,9 @@ "include": [ "modules.local/*/composer.json" ] + }, + "branch-alias": { + "dev-initial": "0.1.x-dev" } } } diff --git a/composer.lock b/composer.lock index 9f9b14d..57002c0 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": "5ef280e58ea7cb46f0a6a29b5ac8bf14", + "content-hash": "7905bc395184339ed3d4662fd6cf4596", "packages": [ { "name": "container-interop/service-provider", @@ -3397,12 +3397,12 @@ "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "82a85791f2a86c14a6c438e44e0ff48ebed31084" + "reference": "0119cd09c11ea1630d4fe2c99f9b5c52d8063272" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/82a85791f2a86c14a6c438e44e0ff48ebed31084", - "reference": "82a85791f2a86c14a6c438e44e0ff48ebed31084", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/0119cd09c11ea1630d4fe2c99f9b5c52d8063272", + "reference": "0119cd09c11ea1630d4fe2c99f9b5c52d8063272", "shasum": "" }, "require": { @@ -3486,24 +3486,24 @@ "inspection", "php" ], - "time": "2020-07-07T13:31:43+00:00" + "time": "2020-07-08T21:42:51+00:00" }, { "name": "webmozart/assert", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -3535,7 +3535,7 @@ "check", "validate" ], - "time": "2020-06-16T10:16:42+00:00" + "time": "2020-07-08T17:02:28+00:00" }, { "name": "webmozart/glob", From 9d776b3e21f2b374e213bfc9c7437cd6223e0539 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 17:27:32 +0200 Subject: [PATCH 39/44] A PHP 7.4 rule message is now a warning --- phpcs.xml.dist | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 1ac4cda..44d9489 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -10,7 +10,9 @@ - + + warning + From 500f83249eba2998499ee1569f612622aec4af8a Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 17:31:42 +0200 Subject: [PATCH 40/44] Update package name - `me` didn't reflect the actual vendor. - `plugin` is not sufficient, and may lead to conflicts in the future. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b298dc6..1cc4609 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "me/plugin", - "description": "A project skeleton useful for starting a new WordPress plugin", + "name": "wp-oop/plugin-boilerplate", + "description": "A project boilerplate useful for starting a new WordPress plugin", "minimum-stability": "dev", "license": "GPL-2.0-or-later", "authors": [ From 24140fb9279b3524f7172af0ce44e417d302b102 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 17:34:50 +0200 Subject: [PATCH 41/44] Correct CLI command in doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4c2f85..450e6cd 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,7 @@ To start working with it, you must first bring up the related container, as it is not brought up together with the dev environment: ```bash -docker-compose up +docker-compose up db_admin ``` You can now head over to the application's domain, defined usually by the From 1a09de12de6afad384520fdc2ed639d440482026 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Thu, 9 Jul 2020 18:55:05 +0200 Subject: [PATCH 42/44] Fix bootstrap invocation --- plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index 483e94b..824bc32 100644 --- a/plugin.php +++ b/plugin.php @@ -26,6 +26,6 @@ $incDir = "$rootDir/inc"; $bootstrap = require "$incDir/bootstrap.php"; - $appContainer = $bootstrap($mainFile, $rootDir); + $appContainer = $bootstrap($rootDir, $mainFile); }); })(__FILE__); From 00de100605abd33db58900f4302f9c8e64575cf2 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Fri, 10 Jul 2020 16:33:22 +0200 Subject: [PATCH 43/44] Update lockfile --- composer.lock | 1111 ++++++++++++++++++++++++------------------------- 1 file changed, 554 insertions(+), 557 deletions(-) diff --git a/composer.lock b/composer.lock index 57002c0..347e234 100644 --- a/composer.lock +++ b/composer.lock @@ -4,74 +4,48 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7905bc395184339ed3d4662fd6cf4596", + "content-hash": "a7fea5668b70082f4530e82bd66b4fc3", "packages": [ { - "name": "container-interop/service-provider", - "version": "v0.4.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/service-provider.git", - "reference": "4969b9e49460690b7430b3f1a87cab07be61418a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/service-provider/zipball/4969b9e49460690b7430b3f1a87cab07be61418a", - "reference": "4969b9e49460690b7430b3f1a87cab07be61418a", - "shasum": "" - }, - "require": { - "psr/container": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting container interoperability through standard service providers", - "homepage": "https://github.com/container-interop/service-provider", - "time": "2017-09-20T14:13:36+00:00" - }, - { - "name": "dhii/containers", - "version": "dev-develop", + "name": "amphp/amp", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/Dhii/containers.git", - "reference": "3dd6e407e86cf19f7a40989eeb802cf751082902" + "url": "https://github.com/amphp/amp.git", + "reference": "e2c63c83eb8394306ca39a0790a22aebe2248da1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/containers/zipball/3dd6e407e86cf19f7a40989eeb802cf751082902", - "reference": "3dd6e407e86cf19f7a40989eeb802cf751082902", + "url": "https://api.github.com/repos/amphp/amp/zipball/e2c63c83eb8394306ca39a0790a22aebe2248da1", + "reference": "e2c63c83eb8394306ca39a0790a22aebe2248da1", "shasum": "" }, "require": { - "container-interop/service-provider": "^0.4", - "dhii/data-container-interface": "^0.2", - "php": "^7.0 | ^8.0" + "php": ">=7" }, "require-dev": { - "gmazzap/andrew": "^1.1", - "phpunit/phpunit": "^6", - "psr/container": "^1.0", - "slevomat/coding-standard": "~4.0" + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6.0.9 | ^7", + "react/promise": "^2", + "vimeo/psalm": "^3.11@dev" }, "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.1.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "Dhii\\Container\\": "src/" - } + "Amp\\": "lib" + }, + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -79,57 +53,76 @@ ], "authors": [ { - "name": "Dhii Team", - "email": "development@dhii.co" + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "A selection of PSR-11 containers for utility, simplicity, and ease.", + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "http://amphp.org/amp", "keywords": [ - "PSR-11", - "container" + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" ], - "time": "2020-03-18T17:36:56+00:00" + "time": "2020-05-06T16:57:29+00:00" }, { - "name": "dhii/data-container-interface", - "version": "dev-develop", + "name": "amphp/byte-stream", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/Dhii/data-container-interface.git", - "reference": "f3b36758e236784a8c70c34e149f26982b2539d7" + "url": "https://github.com/amphp/byte-stream.git", + "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/data-container-interface/zipball/f3b36758e236784a8c70c34e149f26982b2539d7", - "reference": "f3b36758e236784a8c70c34e149f26982b2539d7", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/f0c20cf598a958ba2aa8c6e5a71c697d652c7088", + "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088", "shasum": "" }, "require": { - "dhii/exception-interface": "^0.1 | ^0.2", - "dhii/factory-interface": "^0.1-alpha1", - "php": "^5.3 | ^7.0", - "psr/container": "^1.0" + "amphp/amp": "^2", + "php": ">=7.1" }, "require-dev": { - "codeclimate/php-test-reporter": "<=0.3.2", - "dhii/php-cs-fixer-config": "dev-php-5.3", - "dhii/stringable-interface": "^0.1", - "phpunit/phpunit": "^4.8", - "ptrofimov/xpmock": "^1.1" - }, - "suggest": { - "dhii/stringable-interface": "To be able to pass Stringables as keys" + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.4", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "psalm/phar": "^3.11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.2.1-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "Dhii\\Data\\Container\\": "src" - } + "Amp\\ByteStream\\": "lib" + }, + "files": [ + "lib/functions.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -137,97 +130,56 @@ ], "authors": [ { - "name": "Dhii Team", - "email": "development@dhii.co" - } - ], - "description": "Interfaces for working with data containers", - "abandoned": "dhii/collections-interface", - "time": "2020-03-11T12:42:43+00:00" - }, - { - "name": "dhii/exception-interface", - "version": "v0.2", - "source": { - "type": "git", - "url": "https://github.com/Dhii/exception-interface.git", - "reference": "b69feebf7cb2879cd43977a03342e2393b73f7fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Dhii/exception-interface/zipball/b69feebf7cb2879cd43977a03342e2393b73f7fb", - "reference": "b69feebf7cb2879cd43977a03342e2393b73f7fb", - "shasum": "" - }, - "require": { - "dhii/stringable-interface": "^0.1", - "php": "^5.3 | ^7.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "<=0.3.2", - "dhii/php-cs-fixer-config": "dev-php-5.3", - "phpunit/phpunit": "^4.8", - "ptrofimov/xpmock": "^1.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Dhii\\Exception\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, { - "name": "Dhii Team", - "email": "development@dhii.co" + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "Interfaces for most common exceptions", - "time": "2018-08-29T10:42:04+00:00" + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "http://amphp.org/byte-stream", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "time": "2020-06-29T18:35:05+00:00" }, { - "name": "dhii/factory-interface", - "version": "v0.1", + "name": "composer/semver", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/Dhii/factory-interface.git", - "reference": "b8d217aec8838e64ccaa770cb03dc164bf6f0515" + "url": "https://github.com/composer/semver.git", + "reference": "00915994bb1de62e750ae279669c9c5a57379957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/factory-interface/zipball/b8d217aec8838e64ccaa770cb03dc164bf6f0515", - "reference": "b8d217aec8838e64ccaa770cb03dc164bf6f0515", + "url": "https://api.github.com/repos/composer/semver/zipball/00915994bb1de62e750ae279669c9c5a57379957", + "reference": "00915994bb1de62e750ae279669c9c5a57379957", "shasum": "" }, "require": { - "dhii/exception-interface": "^0.1|^0.2", - "php": "^5.3 | ^7.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "codeclimate/php-test-reporter": "<=0.3.2", - "dhii/php-cs-fixer-config": "dev-php-5.3", - "dhii/stringable-interface": "^0.1", - "phpunit/phpunit": "^4.8", - "psr/container": "^1.0", - "ptrofimov/xpmock": "^1.1" + "phpstan/phpstan": "^0.12.19", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Dhii\\Factory\\": "src" + "Composer\\Semver\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -236,95 +188,69 @@ ], "authors": [ { - "name": "Dhii Team", - "email": "development@dhii.co" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "Interfaces for working with factories.", - "time": "2018-08-29T11:15:09+00:00" - }, - { - "name": "dhii/human-readable-interface", - "version": "dev-develop", - "source": { - "type": "git", - "url": "https://github.com/Dhii/human-readable-interface.git", - "reference": "a892c35394eebc627ff81f5112b09ab9da727754" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Dhii/human-readable-interface/zipball/a892c35394eebc627ff81f5112b09ab9da727754", - "reference": "a892c35394eebc627ff81f5112b09ab9da727754", - "shasum": "" - }, - "require": { - "php": "^5.3 | ^7.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "<=0.3.2", - "dhii/php-cs-fixer-config": "dev-php-5.3", - "dhii/stringable-interface": "^0.1.0", - "phpunit/phpunit": "^4.8", - "ptrofimov/xpmock": "^1.1" - }, - "suggest": { - "dhii/i18n-interface": "For internationalizing and translating human readable strings." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Dhii\\Util\\String\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" ], - "authors": [ + "funding": [ { - "name": "Dhii Team", - "email": "development@dhii.co" + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "description": "Interfaces for human readable string interoperation.", - "time": "2020-05-14T18:39:55+00:00" + "time": "2020-05-31T11:44:06+00:00" }, { - "name": "dhii/module-interface", - "version": "dev-develop", + "name": "composer/xdebug-handler", + "version": "1.4.2", "source": { "type": "git", - "url": "https://github.com/Dhii/module-interface.git", - "reference": "cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/module-interface/zipball/cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52", - "reference": "cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", "shasum": "" }, "require": { - "container-interop/service-provider": "^0.4", - "php": "^7.1", - "psr/container": "^1.0" + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^6.0 | ^7.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.2.x-dev" - } - }, "autoload": { "psr-4": { - "Dhii\\Modular\\Module\\": "src" + "Composer\\XdebugHandler\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -333,86 +259,93 @@ ], "authors": [ { - "name": "Dhii Team", - "email": "development@dhii.co" + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "Interfaces for modules", - "time": "2020-04-10T14:27:05+00:00" + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "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": "2020-06-04T11:16:35+00:00" }, { - "name": "dhii/package-interface", - "version": "dev-develop", + "name": "container-interop/service-provider", + "version": "v0.4.0", "source": { "type": "git", - "url": "https://github.com/Dhii/package-interface.git", - "reference": "8169f4f08d7709ba850d8a2befeff5f1d208ca54" + "url": "https://github.com/container-interop/service-provider.git", + "reference": "4969b9e49460690b7430b3f1a87cab07be61418a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/package-interface/zipball/8169f4f08d7709ba850d8a2befeff5f1d208ca54", - "reference": "8169f4f08d7709ba850d8a2befeff5f1d208ca54", + "url": "https://api.github.com/repos/container-interop/service-provider/zipball/4969b9e49460690b7430b3f1a87cab07be61418a", + "reference": "4969b9e49460690b7430b3f1a87cab07be61418a", "shasum": "" }, "require": { - "dhii/stringable-interface": "^0.1", - "dhii/validation-interface": "^0.3-alpha1", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 | ^8.0" + "psr/container": "^1.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.1.x-dev" - } - }, "autoload": { "psr-4": { - "Dhii\\Package\\": "src" + "Interop\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Anton Ukhanev", - "email": "xedin.unknown@gmail.com" - } - ], - "description": "Interfaces for package-related interop", - "time": "2020-05-14T19:54:39+00:00" + "description": "Promoting container interoperability through standard service providers", + "homepage": "https://github.com/container-interop/service-provider", + "time": "2017-09-20T14:13:36+00:00" }, { - "name": "dhii/stringable-interface", - "version": "v0.1", + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.0", "source": { "type": "git", - "url": "https://github.com/Dhii/stringable-interface.git", - "reference": "b6653905eef2ebf377749feb80a6d18abbe913ef" + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "e8d808670b8f882188368faaf1144448c169c0b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/stringable-interface/zipball/b6653905eef2ebf377749feb80a6d18abbe913ef", - "reference": "b6653905eef2ebf377749feb80a6d18abbe913ef", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7", + "reference": "e8d808670b8f882188368faaf1144448c169c0b7", "shasum": "" }, "require": { - "php": "^5.3 | ^7.0" + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev" }, "require-dev": { - "codeclimate/php-test-reporter": "<=0.3.2", - "dhii/php-cs-fixer-config": "dev-php-5.3", - "phpunit/phpunit": "^4.8", - "ptrofimov/xpmock": "^1.1" + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, - "type": "library", "autoload": { "psr-4": { - "Dhii\\Util\\String\\": "src/" + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -421,43 +354,67 @@ ], "authors": [ { - "name": "Dhii Team", - "email": "development@dhii.co" + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" } ], - "description": "Interoperability interface for objects that can be cast to string", - "time": "2017-01-23T15:08:20+00:00" + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "time": "2020-06-25T14:57:39+00:00" }, { - "name": "dhii/validation-interface", + "name": "dhii/containers", "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/Dhii/validation-interface.git", - "reference": "f5c15606b1387df2381134e4fc6e1971cbc284a0" + "url": "https://github.com/Dhii/containers.git", + "reference": "3dd6e407e86cf19f7a40989eeb802cf751082902" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/validation-interface/zipball/f5c15606b1387df2381134e4fc6e1971cbc284a0", - "reference": "f5c15606b1387df2381134e4fc6e1971cbc284a0", + "url": "https://api.github.com/repos/Dhii/containers/zipball/3dd6e407e86cf19f7a40989eeb802cf751082902", + "reference": "3dd6e407e86cf19f7a40989eeb802cf751082902", "shasum": "" }, "require": { - "php": "^7.1" + "container-interop/service-provider": "^0.4", + "dhii/data-container-interface": "^0.2", + "php": "^7.0 | ^8.0" }, "require-dev": { - "dhii/stringable-interface": "^0.1", - "phpunit/phpunit": "^7.0 | ^8.0" + "gmazzap/andrew": "^1.1", + "phpunit/phpunit": "^6", + "psr/container": "^1.0", + "slevomat/coding-standard": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.3.x-dev" + "dev-develop": "0.1.x-dev" } }, "autoload": { "psr-4": { - "Dhii\\Validation\\": "src/" + "Dhii\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -466,44 +423,56 @@ ], "authors": [ { - "name": "Anton Ukhanev", - "email": "xedin.unknown@gmail.com" + "name": "Dhii Team", + "email": "development@dhii.co" } ], - "description": "A base interface for validators", - "time": "2020-05-14T00:22:48+00:00" + "description": "A selection of PSR-11 containers for utility, simplicity, and ease.", + "keywords": [ + "PSR-11", + "container" + ], + "time": "2020-03-18T17:36:56+00:00" }, { - "name": "dhii/versions", + "name": "dhii/data-container-interface", "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/Dhii/versions.git", - "reference": "40933debe1d77f26a381a47abfb256e0e974e439" + "url": "https://github.com/Dhii/data-container-interface.git", + "reference": "f3b36758e236784a8c70c34e149f26982b2539d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dhii/versions/zipball/40933debe1d77f26a381a47abfb256e0e974e439", - "reference": "40933debe1d77f26a381a47abfb256e0e974e439", + "url": "https://api.github.com/repos/Dhii/data-container-interface/zipball/f3b36758e236784a8c70c34e149f26982b2539d7", + "reference": "f3b36758e236784a8c70c34e149f26982b2539d7", "shasum": "" }, "require": { - "dhii/package-interface": "^0.1", - "dhii/stringable-interface": "^0.1", - "php": "^7.1" + "dhii/exception-interface": "^0.1 | ^0.2", + "dhii/factory-interface": "^0.1-alpha1", + "php": "^5.3 | ^7.0", + "psr/container": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^7.0 | ^8.0" + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "dhii/stringable-interface": "^0.1", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" + }, + "suggest": { + "dhii/stringable-interface": "To be able to pass Stringables as keys" }, "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.1.x-dev" + "dev-develop": "0.2.1-dev" } }, "autoload": { "psr-4": { - "Dhii\\Versions\\": "src" + "Dhii\\Data\\Container\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -512,39 +481,47 @@ ], "authors": [ { - "name": "Anton Ukhanev", - "email": "xedin.unknown@gmail.com" + "name": "Dhii Team", + "email": "development@dhii.co" } ], - "description": "Implementation for dealing with SemVer-compliant versions", - "time": "2020-05-14T19:25:38+00:00" + "description": "Interfaces for working with data containers", + "abandoned": "dhii/collections-interface", + "time": "2020-03-11T12:42:43+00:00" }, { - "name": "psr/container", - "version": "dev-master", + "name": "dhii/exception-interface", + "version": "v0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb" + "url": "https://github.com/Dhii/exception-interface.git", + "reference": "b69feebf7cb2879cd43977a03342e2393b73f7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/fc1bc363ecf887921e3897c7b1dad3587ae154eb", - "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb", + "url": "https://api.github.com/repos/Dhii/exception-interface/zipball/b69feebf7cb2879cd43977a03342e2393b73f7fb", + "reference": "b69feebf7cb2879cd43977a03342e2393b73f7fb", "shasum": "" }, "require": { - "php": ">=5.3.0" + "dhii/stringable-interface": "^0.1", + "php": "^5.3 | ^7.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-develop": "0.2.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Dhii\\Exception\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -553,55 +530,48 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Dhii Team", + "email": "development@dhii.co" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2019-10-04T14:07:35+00:00" + "description": "Interfaces for most common exceptions", + "time": "2018-08-29T10:42:04+00:00" }, { - "name": "wikimedia/composer-merge-plugin", - "version": "v1.4.1", + "name": "dhii/factory-interface", + "version": "v0.1", "source": { "type": "git", - "url": "https://github.com/wikimedia/composer-merge-plugin.git", - "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100" + "url": "https://github.com/Dhii/factory-interface.git", + "reference": "b8d217aec8838e64ccaa770cb03dc164bf6f0515" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/81c6ac72a24a67383419c7eb9aa2b3437f2ab100", - "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100", + "url": "https://api.github.com/repos/Dhii/factory-interface/zipball/b8d217aec8838e64ccaa770cb03dc164bf6f0515", + "reference": "b8d217aec8838e64ccaa770cb03dc164bf6f0515", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0", - "php": ">=5.3.2" + "dhii/exception-interface": "^0.1|^0.2", + "php": "^5.3 | ^7.0" }, "require-dev": { - "composer/composer": "~1.0.0", - "jakub-onderka/php-parallel-lint": "~0.8", - "phpunit/phpunit": "~4.8|~5.0", - "squizlabs/php_codesniffer": "~2.1.0" + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "dhii/stringable-interface": "^0.1", + "phpunit/phpunit": "^4.8", + "psr/container": "^1.0", + "ptrofimov/xpmock": "^1.1" }, - "type": "composer-plugin", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" - }, - "class": "Wikimedia\\Composer\\MergePlugin" + "dev-develop": "0.1.x-dev" + } }, "autoload": { "psr-4": { - "Wikimedia\\Composer\\": "src/" + "Dhii\\Factory\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -610,44 +580,49 @@ ], "authors": [ { - "name": "Bryan Davis", - "email": "bd808@wikimedia.org" + "name": "Dhii Team", + "email": "development@dhii.co" } ], - "description": "Composer plugin to merge multiple composer.json files", - "time": "2017-04-25T02:31:25+00:00" + "description": "Interfaces for working with factories.", + "time": "2018-08-29T11:15:09+00:00" }, { - "name": "wp-oop/wordpress-interface", - "version": "dev-task/initial-interfaces", + "name": "dhii/human-readable-interface", + "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/wp-oop/wordpress-interface.git", - "reference": "a5062fd9f3e48b63d659c5dd1db32207c1a628b9" + "url": "https://github.com/Dhii/human-readable-interface.git", + "reference": "a892c35394eebc627ff81f5112b09ab9da727754" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-oop/wordpress-interface/zipball/a5062fd9f3e48b63d659c5dd1db32207c1a628b9", - "reference": "a5062fd9f3e48b63d659c5dd1db32207c1a628b9", + "url": "https://api.github.com/repos/Dhii/human-readable-interface/zipball/a892c35394eebc627ff81f5112b09ab9da727754", + "reference": "a892c35394eebc627ff81f5112b09ab9da727754", "shasum": "" }, "require": { - "dhii/human-readable-interface": "^0.1", - "dhii/package-interface": "^0.1-alpha1", - "php": "^7.1" + "php": "^5.3 | ^7.0" }, "require-dev": { - "phpunit/phpunit": "^7.0 | ^8.0" + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "dhii/stringable-interface": "^0.1.0", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" + }, + "suggest": { + "dhii/i18n-interface": "For internationalizing and translating human readable strings." }, "type": "library", "extra": { "branch-alias": { - "dev-task/initial-interfaces": "0.1.x-dev" + "dev-develop": "0.1.x-dev" } }, "autoload": { "psr-4": { - "WpOop\\WordPress\\": "src" + "Dhii\\Util\\String\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -656,55 +631,45 @@ ], "authors": [ { - "name": "Anton Ukhanev", - "email": "xedin.unknown@gmail.com" + "name": "Dhii Team", + "email": "development@dhii.co" } ], - "description": "Interfaces for interop within WordPress", - "time": "2020-05-20T13:24:44+00:00" - } - ], - "packages-dev": [ + "description": "Interfaces for human readable string interoperation.", + "time": "2020-05-14T18:39:55+00:00" + }, { - "name": "amphp/amp", - "version": "dev-master", + "name": "dhii/module-interface", + "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/amphp/amp.git", - "reference": "e2c63c83eb8394306ca39a0790a22aebe2248da1" + "url": "https://github.com/Dhii/module-interface.git", + "reference": "cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/e2c63c83eb8394306ca39a0790a22aebe2248da1", - "reference": "e2c63c83eb8394306ca39a0790a22aebe2248da1", + "url": "https://api.github.com/repos/Dhii/module-interface/zipball/cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52", + "reference": "cb2eaaac0fa4bd4a82bc2b38c10e3a794ce32d52", "shasum": "" }, "require": { - "php": ">=7" + "container-interop/service-provider": "^0.4", + "php": "^7.1", + "psr/container": "^1.0" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "ext-json": "*", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6.0.9 | ^7", - "react/promise": "^2", - "vimeo/psalm": "^3.11@dev" + "phpunit/phpunit": "^6.0 | ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-develop": "0.2.x-dev" } }, "autoload": { "psr-4": { - "Amp\\": "lib" - }, - "files": [ - "lib/functions.php", - "lib/Internal/functions.php" - ] + "Dhii\\Modular\\Module\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -712,76 +677,45 @@ ], "authors": [ { - "name": "Daniel Lowrey", - "email": "rdlowrey@php.net" - }, - { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Bob Weinand", - "email": "bobwei9@hotmail.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" + "name": "Dhii Team", + "email": "development@dhii.co" } ], - "description": "A non-blocking concurrency framework for PHP applications.", - "homepage": "http://amphp.org/amp", - "keywords": [ - "async", - "asynchronous", - "awaitable", - "concurrency", - "event", - "event-loop", - "future", - "non-blocking", - "promise" - ], - "time": "2020-05-06T16:57:29+00:00" + "description": "Interfaces for modules", + "time": "2020-04-10T14:27:05+00:00" }, { - "name": "amphp/byte-stream", - "version": "dev-master", + "name": "dhii/package-interface", + "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/amphp/byte-stream.git", - "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088" + "url": "https://github.com/Dhii/package-interface.git", + "reference": "8169f4f08d7709ba850d8a2befeff5f1d208ca54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/f0c20cf598a958ba2aa8c6e5a71c697d652c7088", - "reference": "f0c20cf598a958ba2aa8c6e5a71c697d652c7088", + "url": "https://api.github.com/repos/Dhii/package-interface/zipball/8169f4f08d7709ba850d8a2befeff5f1d208ca54", + "reference": "8169f4f08d7709ba850d8a2befeff5f1d208ca54", "shasum": "" }, "require": { - "amphp/amp": "^2", - "php": ">=7.1" + "dhii/stringable-interface": "^0.1", + "dhii/validation-interface": "^0.3-alpha1", + "php": "^7.1" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.4", - "friendsofphp/php-cs-fixer": "^2.3", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6 || ^7 || ^8", - "psalm/phar": "^3.11.4" + "phpunit/phpunit": "^7.0 | ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-develop": "0.1.x-dev" } }, "autoload": { "psr-4": { - "Amp\\ByteStream\\": "lib" - }, - "files": [ - "lib/functions.php" - ] + "Dhii\\Package\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -789,56 +723,40 @@ ], "authors": [ { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" } ], - "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "http://amphp.org/byte-stream", - "keywords": [ - "amp", - "amphp", - "async", - "io", - "non-blocking", - "stream" - ], - "time": "2020-06-29T18:35:05+00:00" + "description": "Interfaces for package-related interop", + "time": "2020-05-14T19:54:39+00:00" }, { - "name": "composer/semver", - "version": "dev-master", + "name": "dhii/stringable-interface", + "version": "v0.1", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "00915994bb1de62e750ae279669c9c5a57379957" + "url": "https://github.com/Dhii/stringable-interface.git", + "reference": "b6653905eef2ebf377749feb80a6d18abbe913ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/00915994bb1de62e750ae279669c9c5a57379957", - "reference": "00915994bb1de62e750ae279669c9c5a57379957", + "url": "https://api.github.com/repos/Dhii/stringable-interface/zipball/b6653905eef2ebf377749feb80a6d18abbe913ef", + "reference": "b6653905eef2ebf377749feb80a6d18abbe913ef", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^5.3 | ^7.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.19", - "symfony/phpunit-bridge": "^4.2 || ^5" + "codeclimate/php-test-reporter": "<=0.3.2", + "dhii/php-cs-fixer-config": "dev-php-5.3", + "phpunit/phpunit": "^4.8", + "ptrofimov/xpmock": "^1.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "autoload": { "psr-4": { - "Composer\\Semver\\": "src" + "Dhii\\Util\\String\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -847,69 +765,43 @@ ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "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" + "name": "Dhii Team", + "email": "development@dhii.co" } ], - "time": "2020-05-31T11:44:06+00:00" + "description": "Interoperability interface for objects that can be cast to string", + "time": "2017-01-23T15:08:20+00:00" }, { - "name": "composer/xdebug-handler", - "version": "1.4.2", + "name": "dhii/validation-interface", + "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" + "url": "https://github.com/Dhii/validation-interface.git", + "reference": "f5c15606b1387df2381134e4fc6e1971cbc284a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "url": "https://api.github.com/repos/Dhii/validation-interface/zipball/f5c15606b1387df2381134e4fc6e1971cbc284a0", + "reference": "f5c15606b1387df2381134e4fc6e1971cbc284a0", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "dhii/stringable-interface": "^0.1", + "phpunit/phpunit": "^7.0 | ^8.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.3.x-dev" + } + }, "autoload": { "psr-4": { - "Composer\\XdebugHandler\\": "src" + "Dhii\\Validation\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -918,62 +810,44 @@ ], "authors": [ { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "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" + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" } ], - "time": "2020-06-04T11:16:35+00:00" + "description": "A base interface for validators", + "time": "2020-05-14T00:22:48+00:00" }, { - "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.0", + "name": "dhii/versions", + "version": "dev-develop", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "e8d808670b8f882188368faaf1144448c169c0b7" + "url": "https://github.com/Dhii/versions.git", + "reference": "40933debe1d77f26a381a47abfb256e0e974e439" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7", - "reference": "e8d808670b8f882188368faaf1144448c169c0b7", + "url": "https://api.github.com/repos/Dhii/versions/zipball/40933debe1d77f26a381a47abfb256e0e974e439", + "reference": "40933debe1d77f26a381a47abfb256e0e974e439", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev" + "dhii/package-interface": "^0.1", + "dhii/stringable-interface": "^0.1", + "php": "^7.1" }, "require-dev": { - "composer/composer": "*", - "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "phpunit/phpunit": "^7.0 | ^8.0" }, - "type": "composer-plugin", + "type": "library", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "branch-alias": { + "dev-develop": "0.1.x-dev" + } }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "Dhii\\Versions\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -982,32 +856,12 @@ ], "authors": [ { - "name": "Franck Nijhof", - "email": "franck.nijhof@dealerdirect.com", - "homepage": "http://www.frenck.nl", - "role": "Developer / IT Manager" + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" } ], - "description": "PHP_CodeSniffer Standards Composer Installer Plugin", - "homepage": "http://www.dealerdirect.com", - "keywords": [ - "PHPCodeSniffer", - "PHP_CodeSniffer", - "code quality", - "codesniffer", - "composer", - "installer", - "phpcs", - "plugin", - "qa", - "quality", - "standard", - "standards", - "style guide", - "stylecheck", - "tests" - ], - "time": "2020-06-25T14:57:39+00:00" + "description": "Implementation for dealing with SemVer-compliant versions", + "time": "2020-05-14T19:25:38+00:00" }, { "name": "doctrine/instantiator", @@ -2154,6 +2008,55 @@ ], "time": "2020-01-08T08:45:45+00:00" }, + { + "name": "psr/container", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/fc1bc363ecf887921e3897c7b1dad3587ae154eb", + "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2019-10-04T14:07:35+00:00" + }, { "name": "psr/log", "version": "dev-master", @@ -3629,13 +3532,107 @@ ], "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", "time": "2016-08-15T15:31:42+00:00" + }, + { + "name": "wikimedia/composer-merge-plugin", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/composer-merge-plugin.git", + "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/81c6ac72a24a67383419c7eb9aa2b3437f2ab100", + "reference": "81c6ac72a24a67383419c7eb9aa2b3437f2ab100", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": ">=5.3.2" + }, + "require-dev": { + "composer/composer": "~1.0.0", + "jakub-onderka/php-parallel-lint": "~0.8", + "phpunit/phpunit": "~4.8|~5.0", + "squizlabs/php_codesniffer": "~2.1.0" + }, + "type": "composer-plugin", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + }, + "class": "Wikimedia\\Composer\\MergePlugin" + }, + "autoload": { + "psr-4": { + "Wikimedia\\Composer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bryan Davis", + "email": "bd808@wikimedia.org" + } + ], + "description": "Composer plugin to merge multiple composer.json files", + "time": "2017-04-25T02:31:25+00:00" + }, + { + "name": "wp-oop/wordpress-interface", + "version": "dev-task/initial-interfaces", + "source": { + "type": "git", + "url": "https://github.com/wp-oop/wordpress-interface.git", + "reference": "a5062fd9f3e48b63d659c5dd1db32207c1a628b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-oop/wordpress-interface/zipball/a5062fd9f3e48b63d659c5dd1db32207c1a628b9", + "reference": "a5062fd9f3e48b63d659c5dd1db32207c1a628b9", + "shasum": "" + }, + "require": { + "dhii/human-readable-interface": "^0.1", + "dhii/package-interface": "^0.1-alpha1", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-task/initial-interfaces": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "WpOop\\WordPress\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Interfaces for interop within WordPress", + "time": "2020-05-20T13:24:44+00:00" } ], + "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "johnpbloch/wordpress-core": 0 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 773bd8e5b28904d7c8af5f6cd8fcb823cf05a676 Mon Sep 17 00:00:00 2001 From: Anton Ukhanev Date: Fri, 10 Jul 2020 16:41:57 +0200 Subject: [PATCH 44/44] Document composer-merge-plugin usage better --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 450e6cd..7318f33 100644 --- a/README.md +++ b/README.md @@ -148,16 +148,17 @@ Composer is installed into the `build` service's image. To run composer commands use `docker-compose run`. For example, to update dependencies you can run the following: ```bash -docker-compose run --rm build composer update +docker-compose run --rm build composer update ``` -If you use PHPStorm, you can use the [composer integration][], as the project -is already configured for this. +~~If you use PHPStorm, you can use the [composer integration][], as the project +is already configured for this.~~ + +Currently, it is not possible to use PHPStorm's [composer integration][] because +managing local modules with the [`composer-merge-plugin`][] require running +`composer update --lock` instead of simply `composer update`. This is currently +unsupported by PHPStorm, but a [feature request][WI-54242] has been submitted. -If you have changed the `composer.json` of one of the local modules, the -[`composer-merge-plugin`][] that is used to manage local module dependencies -needs to be instructed to include module "sub-package" changes in the update. -To do this, first run `composer update --lock` before running `composer update`. **Do not run `composer update` for the modules' `composer.json` file!** All Composer operations must be performed on the root package's `composer.json` file. @@ -308,3 +309,4 @@ provide assistance during coding. [`docker-machine env`]: https://docs.docker.com/machine/reference/env/ [`xdebug.remote_host`]: https://xdebug.org/docs/all_settings#remote_host [`ModuleInterface`]: https://github.com/Dhii/module-interface/blob/develop/src/ModuleInterface.php +[WI-54242]: https://youtrack.jetbrains.com/issue/WI-54242