diff --git a/.gitignore b/.gitignore index 17e07e7..13b7173 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ bin/ !bin/dcv !bin/entrypoint.sh .cache/ +.php_cs.cache diff --git a/.php_cs b/.php_cs index 29fd36a..ed09307 100644 --- a/.php_cs +++ b/.php_cs @@ -1,12 +1,15 @@ exclude('somedir') +use PhpCsFixer as CS; + +$finder = CS\Finder::create() ->in(__DIR__.DIRECTORY_SEPARATOR.'src') ->in(__DIR__.DIRECTORY_SEPARATOR.'spec') ; -return Symfony\CS\Config\Config::create() - ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) - ->finder($finder) +return CS\Config::create() + ->setRules([ + '@Symfony' => true, + ]) + ->setFinder($finder) ; diff --git a/.travis.yml b/.travis.yml index f31ce34..887534f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,12 +8,14 @@ services: php: - 7.0 - 7.1 + - 7.2 - nightly env: matrix: - COMPOSERFLAGS= - COMPOSERFLAGS=--prefer-lowest + - COMPOSERFLAGS=--prefer-stable global: # DOCKER_EMAIL @@ -29,6 +31,8 @@ matrix: env: COMPOSERFLAGS= - php: 7.1 env: COMPOSERFLAGS=--prefer-lowest + - php: 7.2 + env: COMPOSERFLAGS=--prefer-lowest - php: nightly env: COMPOSERFLAGS=--prefer-lowest allow_failures: diff --git a/composer.json b/composer.json index 1b6589f..03e7e03 100644 --- a/composer.json +++ b/composer.json @@ -2,14 +2,15 @@ "name": "pmsipilot/docker-compose-viz", "description": "Docker compose graph visualization", "require": { - "symfony/yaml": "^3.1 || ^4@dev", + "php": "^7", + "symfony/yaml": "^3.1 || ^4", "symfony/console": "^3.1", "clue/graph": "^0.9", "graphp/graphviz": "^0.2" }, "require-dev": { "crysalead/kahlan": "^2.5.4", - "friendsofphp/php-cs-fixer": "^1.11" + "friendsofphp/php-cs-fixer": "^2" }, "license": "MIT", "authors": [ diff --git a/composer.lock b/composer.lock index a6bbcb3..1d7b126 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "0d62100317a058684fbda02b5b1a8b28", - "content-hash": "2a9cfe4bb29738f0495cc645b6ed6c65", + "content-hash": "e5370b9d4f890699543b1dbd6ba801de", "packages": [ { "name": "clue/graph", @@ -50,7 +49,7 @@ "network", "vertex" ], - "time": "2015-03-07 18:11:31" + "time": "2015-03-07T18:11:31+00:00" }, { "name": "graphp/algorithms", @@ -100,7 +99,7 @@ "prim", "shortest path" ], - "time": "2015-03-08 10:12:01" + "time": "2015-03-08T10:12:01+00:00" }, { "name": "graphp/graphviz", @@ -142,7 +141,7 @@ "graph image", "graphviz" ], - "time": "2015-03-08 10:30:28" + "time": "2015-03-08T10:30:28+00:00" }, { "name": "psr/log", @@ -189,48 +188,49 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "symfony/console", - "version": "v3.3.0", + "version": "v3.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c80e63f3f5e3a331bfc25e6e9332b10422eb9b05" + "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c80e63f3f5e3a331bfc25e6e9332b10422eb9b05", - "reference": "c80e63f3f5e3a331bfc25e6e9332b10422eb9b05", + "url": "https://api.github.com/repos/symfony/console/zipball/8394c8ef121949e8f858f13bc1e34f05169e4e7d", + "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/debug": "~2.8|~3.0", + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -257,36 +257,36 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-05-28 14:08:56" + "time": "2018-01-03T07:37:34+00:00" }, { "name": "symfony/debug", - "version": "v3.3.0", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "ef5f19a7a68075a0bd05969a329ead3b0776fb7a" + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/ef5f19a7a68075a0bd05969a329ead3b0776fb7a", - "reference": "ef5f19a7a68075a0bd05969a329ead3b0776fb7a", + "url": "https://api.github.com/repos/symfony/debug/zipball/9ae4223a661b56a9abdce144de4886cca37f198f", + "reference": "9ae4223a661b56a9abdce144de4886cca37f198f", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^7.1.3", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "symfony/http-kernel": "<3.4" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "symfony/http-kernel": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -313,20 +313,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-05-27 16:02:27" + "time": "2018-01-03T17:15:19+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { @@ -338,7 +338,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -372,25 +372,28 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/yaml", - "version": "dev-master", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "5037d791db10d60b23385b64374ee9f29b945945" + "reference": "b84f646b9490d2101e2c25ddeec77ceefbda2eee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/5037d791db10d60b23385b64374ee9f29b945945", - "reference": "5037d791db10d60b23385b64374ee9f29b945945", + "url": "https://api.github.com/repos/symfony/yaml/zipball/b84f646b9490d2101e2c25ddeec77ceefbda2eee", + "reference": "b84f646b9490d2101e2c25ddeec77ceefbda2eee", "shasum": "" }, "require": { "php": "^7.1.3" }, + "conflict": { + "symfony/console": "<3.4" + }, "require-dev": { "symfony/console": "~3.4|~4.0" }, @@ -427,10 +430,72 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-28 11:01:50" + "time": "2018-01-03T07:38:00+00:00" } ], "packages-dev": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.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" + ], + "time": "2016-08-30T16:08:34+00:00" + }, { "name": "crysalead/kahlan", "version": "2.5.6", @@ -481,48 +546,201 @@ "unit test" ], "abandoned": "kahlan/kahlan", - "time": "2016-08-18 13:29:17" + "time": "2016-08-18T13:29:17+00:00" }, { - "name": "friendsofphp/php-cs-fixer", - "version": "v1.13.1", + "name": "doctrine/annotations", + "version": "v1.6.0", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "0ea4f7ed06ca55da1d8fc45da26ff87f261c4088" + "url": "https://github.com/doctrine/annotations.git", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/0ea4f7ed06ca55da1d8fc45da26ff87f261c4088", - "reference": "0ea4f7ed06ca55da1d8fc45da26ff87f261c4088", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": "^5.3.6 || >=7.0 <7.2", - "sebastian/diff": "^1.1", - "symfony/console": "^2.3 || ^3.0", - "symfony/event-dispatcher": "^2.1 || ^3.0", - "symfony/filesystem": "^2.1 || ^3.0", - "symfony/finder": "^2.1 || ^3.0", - "symfony/process": "^2.3 || ^3.0", - "symfony/stopwatch": "^2.5 || ^3.0" - }, - "conflict": { - "hhvm": "<3.9" + "doctrine/lexer": "1.*", + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.5|^5", - "satooshi/php-coveralls": "^1.0" + "doctrine/cache": "1.*", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-12-06T07:11:42+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.10.0", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "513a3765b56dd029175f9f32995566657ee89dda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/513a3765b56dd029175f9f32995566657ee89dda", + "reference": "513a3765b56dd029175f9f32995566657ee89dda", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4", + "doctrine/annotations": "^1.2", + "ext-json": "*", + "ext-tokenizer": "*", + "gecko-packages/gecko-php-unit": "^2.0 || ^3.0", + "php": "^5.6 || >=7.0 <7.3", + "php-cs-fixer/diff": "^1.2", + "symfony/console": "^3.2 || ^4.0", + "symfony/event-dispatcher": "^3.0 || ^4.0", + "symfony/filesystem": "^3.0 || ^4.0", + "symfony/finder": "^3.0 || ^4.0", + "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0 || ^4.0", + "symfony/stopwatch": "^3.0 || ^4.0" + }, + "conflict": { + "hhvm": "*" + }, + "require-dev": { + "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev", + "justinrainbow/json-schema": "^5.0", + "keradus/cli-executor": "^1.0", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.0", + "php-cs-fixer/accessible-object": "^1.0", + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "phpunitgoodpractices/traits": "^1.0", + "symfony/phpunit-bridge": "^3.2.2 || ^4.0" + }, + "suggest": { + "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." }, "bin": [ "php-cs-fixer" ], "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.10-dev" + } + }, "autoload": { "psr-4": { - "Symfony\\CS\\": "Symfony/CS/" - } + "PhpCsFixer\\": "src/" + }, + "classmap": [ + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php", + "tests/TestCase.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -539,43 +757,133 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2016-12-01 00:05:05" + "time": "2018-01-10T17:16:15+00:00" }, { - "name": "sebastian/diff", - "version": "1.4.3", + "name": "gecko-packages/gecko-php-unit", + "version": "v3.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", + "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/6a866551dffc2154c1b091bae3a7877d39c25ca3", + "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-dom": "When testing with xml.", + "ext-libxml": "When testing with xml.", + "phpunit/phpunit": "This is an extension for it so make sure you have it some way." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, + "autoload": { + "psr-4": { + "GeckoPackages\\PHPUnit\\": "src/PHPUnit" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Additional PHPUnit asserts and constraints.", + "homepage": "https://github.com/GeckoPackages", + "keywords": [ + "extension", + "filesystem", + "phpunit" + ], + "time": "2017-08-23T07:46:41+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-09-27T21:40:39+00:00" + }, + { + "name": "php-cs-fixer/diff", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/f0ef6133d674137e902fdf8a6f2e8e97e14a087b", + "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.4.3", + "symfony/process": "^3.3" + }, + "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], "authors": [ { "name": "Kore Nordmann", @@ -584,41 +892,44 @@ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "SpacePossum" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", + "description": "sebastian/diff v2 backport support for PHP5.6", + "homepage": "https://github.com/PHP-CS-Fixer", "keywords": [ "diff" ], - "time": "2017-05-22 07:24:03" + "time": "2017-10-19T09:58:18+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.3.0", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a9f8b02b0ef07302eca92cd4bba73200b7980e9c" + "reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a9f8b02b0ef07302eca92cd4bba73200b7980e9c", - "reference": "a9f8b02b0ef07302eca92cd4bba73200b7980e9c", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74d33aac36208c4d6757807d9f598f0133a3a4eb", + "reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.1.3" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -627,7 +938,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -654,29 +965,29 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-05-04 12:23:07" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/filesystem", - "version": "v3.3.0", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c709670bf64721202ddbe4162846f250735842c0" + "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c709670bf64721202ddbe4162846f250735842c0", - "reference": "c709670bf64721202ddbe4162846f250735842c0", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/760e47a4ee64b4c48f4b30017011e09d4c0f05ed", + "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -703,29 +1014,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-05-28 14:08:56" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/finder", - "version": "v3.3.0", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "30cb2a2c09627823a7243638dd456de4e2748fed" + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/30cb2a2c09627823a7243638dd456de4e2748fed", - "reference": "30cb2a2c09627823a7243638dd456de4e2748fed", + "url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601", + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -752,29 +1063,197 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-05-25 23:10:31" + "time": "2018-01-03T07:38:00+00:00" }, { - "name": "symfony/process", - "version": "v3.3.0", + "name": "symfony/options-resolver", + "version": "v4.0.3", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf" + "url": "https://github.com/symfony/options-resolver.git", + "reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/30d9240b30696a69e893534c9fc4a5c72ab6689b", + "reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "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 OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2018-01-03T07:38:00+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/6de4f4884b97abbbed9f0a84a95ff2ff77254254", + "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/process", + "version": "v4.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "2145b3e8137e463b1051b79440a59b38220944f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/2145b3e8137e463b1051b79440a59b38220944f0", + "reference": "2145b3e8137e463b1051b79440a59b38220944f0", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { @@ -801,29 +1280,29 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-22 12:32:03" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.3.0", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "602a15299dc01556013b07167d4f5d3a60e90d15" + "reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/602a15299dc01556013b07167d4f5d3a60e90d15", - "reference": "602a15299dc01556013b07167d4f5d3a60e90d15", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d52321f0e2b596bd03b5d1dd6eebe71caa925704", + "reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -850,16 +1329,16 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:14:56" + "time": "2018-01-03T07:38:00+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "symfony/yaml": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": "^7" + }, "platform-dev": [] } diff --git a/src/application.php b/src/application.php index db3dbb2..2f19fc4 100644 --- a/src/application.php +++ b/src/application.php @@ -26,7 +26,7 @@ $application->register('render') ->setCode(function (Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $backgroundColor = $input->getOption('background'); - if (preg_match('/^#[a-fA-F0-9]{6}|transparent$/', $backgroundColor) === 0) { + if (0 === preg_match('/^#[a-fA-F0-9]{6}|transparent$/', $backgroundColor)) { throw new Console\Exception\InvalidArgumentException(sprintf('Invalid background color "%s". It must be a valid hex color or "transparent".', $backgroundColor)); } @@ -36,19 +36,19 @@ $application->register('render') $overrideFile = dirname($inputFile).DIRECTORY_SEPARATOR.basename($inputFile, '.'.$inputFileExtension).'.'.$input->getOption('override').'.'.$inputFileExtension; $outputFormat = $input->getOption('output-format'); - $outputFile = $input->getOption('output-file') ?: getcwd().DIRECTORY_SEPARATOR.'docker-compose.'.($outputFormat === 'dot' ? $outputFormat : 'png'); + $outputFile = $input->getOption('output-file') ?: getcwd().DIRECTORY_SEPARATOR.'docker-compose.'.('dot' === $outputFormat ? $outputFormat : 'png'); $onlyServices = $input->getOption('only'); - if (in_array($outputFormat, ['dot', 'image', 'display']) === false) { + if (false === in_array($outputFormat, ['dot', 'image', 'display'])) { throw new Console\Exception\InvalidArgumentException(sprintf('Invalid output format "%s". It must be one of "dot", "image" or "display".', $outputFormat)); } - if ($outputFormat === 'display') { + if ('display' === $outputFormat) { if ($input->getOption('force') || $input->getOption('output-file')) { $output->writeln('The following options are ignored with the "display" output format: "--force", "--output-file"'); } } else { - if (file_exists($outputFile) === true && $input->getOption('force') === false) { + if (true === file_exists($outputFile) && false === $input->getOption('force')) { throw new Console\Exception\InvalidArgumentException(sprintf('File "%s" already exists. Use the "--force" option to overwrite it.', $outputFile)); } } @@ -103,19 +103,19 @@ $application->register('render') } $flags = 0; - if ($input->getOption('no-volumes') === true) { + if (true === $input->getOption('no-volumes')) { $logger('Volumes will not be displayed'); $flags |= WITHOUT_VOLUMES; } - if ($input->getOption('no-networks') === true) { + if (true === $input->getOption('no-networks')) { $logger('Networks will not be displayed'); $flags |= WITHOUT_NETWORKS; } - if ($input->getOption('no-ports') === true) { + if (true === $input->getOption('no-ports')) { $logger('Ports will not be displayed'); $flags |= WITHOUT_PORTS; diff --git a/src/functions.php b/src/functions.php index 6ca659f..7f6c481 100644 --- a/src/functions.php +++ b/src/functions.php @@ -20,7 +20,7 @@ const WITHOUT_PORTS = 4; * * @return callable */ -function logger(OutputInterface $output) : callable +function logger(OutputInterface $output): callable { return function (string $message, int $verbosity = null) use ($output) { $output->writeln(sprintf('[%s] %s', date(DATE_ISO8601), $message), $verbosity ?: OutputInterface::VERBOSITY_VERBOSE); @@ -34,9 +34,9 @@ function logger(OutputInterface $output) : callable * * @return array */ -function readConfiguration(string $path) : array +function readConfiguration(string $path): array { - if (file_exists($path) === false) { + if (false === file_exists($path)) { throw new \InvalidArgumentException(sprintf('File "%s" does not exist', $path)); } @@ -54,9 +54,9 @@ function readConfiguration(string $path) : array * * @return array List of service definitions exctracted from the configuration */ -function fetchServices(array $configuration) : array +function fetchServices(array $configuration): array { - if (isset($configuration['version']) === false || (int) $configuration['version'] === 1) { + if (false === isset($configuration['version']) || 1 === (int) $configuration['version']) { return $configuration; } @@ -70,9 +70,9 @@ function fetchServices(array $configuration) : array * * @return array List of service definitions exctracted from the configuration */ -function fetchVolumes(array $configuration) : array +function fetchVolumes(array $configuration): array { - if (isset($configuration['version']) === false || (int) $configuration['version'] === 1) { + if (false === isset($configuration['version']) || 1 === (int) $configuration['version']) { return []; } @@ -86,9 +86,9 @@ function fetchVolumes(array $configuration) : array * * @return array List of service definitions exctracted from the configuration */ -function fetchNetworks(array $configuration) : array +function fetchNetworks(array $configuration): array { - if (isset($configuration['version']) === false || (int) $configuration['version'] === 1) { + if (false === isset($configuration['version']) || 1 === (int) $configuration['version']) { return []; } @@ -106,7 +106,7 @@ function fetchNetworks(array $configuration) : array * * @return Graph The complete graph for the given list of services */ -function createGraph(array $services, array $volumes, array $networks, string $path, int $flags) : Graph +function createGraph(array $services, array $volumes, array $networks, string $path, int $flags): Graph { return makeVerticesAndEdges(new Graph(), $services, $volumes, $networks, $path, $flags); } @@ -120,14 +120,14 @@ function createGraph(array $services, array $volumes, array $networks, string $p * * @return Graph A copy of the input graph with style attributes */ -function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background) : Graph +function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background): Graph { $graph = $graph->createGraphClone(); $graph->setAttribute('graphviz.graph.bgcolor', $background); $graph->setAttribute('graphviz.graph.pad', '0.5'); $graph->setAttribute('graphviz.graph.ratio', 'fill'); - if ($horizontal === true) { + if (true === $horizontal) { $graph->setAttribute('graphviz.graph.rankdir', 'LR'); } @@ -158,7 +158,7 @@ function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background) case 'port': $vertex->setAttribute('graphviz.shape', 'circle'); - if (($proto = $vertex->getAttribute('docker_compose.proto')) === 'udp') { + if ('udp' === ($proto = $vertex->getAttribute('docker_compose.proto'))) { $vertex->setAttribute('graphviz.style', 'dashed'); } break; @@ -193,10 +193,10 @@ function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background) break; } - if (($alias = $edge->getAttribute('docker_compose.alias')) !== null) { + if (null !== ($alias = $edge->getAttribute('docker_compose.alias'))) { $edge->setAttribute('graphviz.label', $alias); - if ($edge->getAttribute('docker_compose.condition') !== null) { + if (null !== $edge->getAttribute('docker_compose.condition')) { $edge->setAttribute('graphviz.fontsize', '10'); } } @@ -220,19 +220,19 @@ function applyGraphvizStyle(Graph $graph, bool $horizontal, string $background) * * @return Graph A copy of the input graph with vertices and edges for services */ -function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, array $networks, string $path, int $flags) : Graph +function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, array $networks, string $path, int $flags): Graph { - if (((bool) ($flags & WITHOUT_VOLUMES)) === false) { + if (false === ((bool) ($flags & WITHOUT_VOLUMES))) { foreach (array_keys($volumes) as $volume) { addVolume($graph, 'named: '.$volume); } } - if (((bool) ($flags & WITHOUT_NETWORKS)) === false) { + if (false === ((bool) ($flags & WITHOUT_NETWORKS))) { foreach ($networks as $network => $definition) { addNetwork( $graph, 'net: '.$network, - isset($definition['external']) && $definition['external'] === true ? 'external_network' : 'network' + isset($definition['external']) && true === $definition['external'] ? 'external_network' : 'network' ); } } @@ -302,7 +302,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr ); } - if (((bool) ($flags & WITHOUT_VOLUMES)) === false) { + if (false === ((bool) ($flags & WITHOUT_VOLUMES))) { $serviceVolumes = []; foreach ($definition['volumes'] ?? [] as $volume) { @@ -314,7 +314,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr foreach ($serviceVolumes as $container => $volume) { list($host, $attr) = $volume; - if ($host[0] !== '.' && $host[0] !== DIRECTORY_SEPARATOR) { + if ('.' !== $host[0] && DIRECTORY_SEPARATOR !== $host[0]) { $host = 'named: '.$host; } @@ -323,12 +323,12 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr $graph->getVertex($service), 'volumes', $host !== $container ? $container : null, - $attr !== 'ro' + 'ro' !== $attr ); } } - if (((bool) ($flags & WITHOUT_PORTS)) === false) { + if (false === ((bool) ($flags & WITHOUT_PORTS))) { foreach ($definition['ports'] ?? [] as $port) { list($host, $container, $proto) = explodeMapping($port); @@ -341,7 +341,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr } } - if (((bool) ($flags & WITHOUT_NETWORKS)) === false) { + if (false === ((bool) ($flags & WITHOUT_NETWORKS))) { foreach ($definition['networks'] ?? [] as $network => $config) { $network = is_int($network) ? $config : $network; $config = is_int($network) ? [] : $config; @@ -371,7 +371,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr */ function addService(Graph $graph, string $service, string $type = null) { - if ($graph->hasVertex($service) === true) { + if (true === $graph->hasVertex($service)) { return $graph->getVertex($service); } @@ -392,7 +392,7 @@ function addService(Graph $graph, string $service, string $type = null) */ function addPort(Graph $graph, int $port, string $proto = null) { - if ($graph->hasVertex($port) === true) { + if (true === $graph->hasVertex($port)) { return $graph->getVertex($port); } @@ -413,7 +413,7 @@ function addPort(Graph $graph, int $port, string $proto = null) */ function addVolume(Graph $graph, string $path) { - if ($graph->hasVertex($path) === true) { + if (true === $graph->hasVertex($path)) { return $graph->getVertex($path); } @@ -434,7 +434,7 @@ function addVolume(Graph $graph, string $path) */ function addNetwork(Graph $graph, string $name, string $type = null) { - if ($graph->hasVertex($name) === true) { + if (true === $graph->hasVertex($name)) { return $graph->getVertex($name); } @@ -456,7 +456,7 @@ function addNetwork(Graph $graph, string $name, string $type = null) * * @return Edge\Directed */ -function addRelation(Vertex $from, Vertex $to, string $type, string $alias = null, bool $bidirectional = false, bool $condition = false) : Edge\Directed +function addRelation(Vertex $from, Vertex $to, string $type, string $alias = null, bool $bidirectional = false, bool $condition = false): Edge\Directed { $edge = null; @@ -476,7 +476,7 @@ function addRelation(Vertex $from, Vertex $to, string $type, string $alias = nul $edge->setAttribute('docker_compose.type', $type); - if ($alias !== null) { + if (null !== $alias) { $edge->setAttribute('docker_compose.alias', $alias); } @@ -497,7 +497,7 @@ function addRelation(Vertex $from, Vertex $to, string $type, string $alias = nul * @return array An 2 items array containing the parts of the mapping. * If the mapping does not specify a second part, the first one will be repeated */ -function explodeMapping($mapping) : array +function explodeMapping($mapping): array { $parts = explode(':', $mapping); $parts[1] = $parts[1] ?? $parts[0];