From e8d7ffcf788208a05bf98bb62b4e94ebed7e613c Mon Sep 17 00:00:00 2001 From: SMorteza Ebadi <47121888+smortexa@users.noreply.github.com> Date: Sat, 18 Mar 2023 19:41:35 +0330 Subject: [PATCH] Fix modules namespace (#21) --- .github/workflows/tests.yml | 7 +- composer.json | 2 +- composer.lock | 184 ++++++++++++++++++------------------ src/phparkitect.php | 6 ++ 4 files changed, 100 insertions(+), 99 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b728ce6..7669ec4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,12 +34,9 @@ jobs: strategy: fail-fast: true matrix: - php: [8, 8.1] - laravel: [^8.0, ^9.0] + php: [8.1, 8.2] + laravel: [^9.0, ^10] dependency-version: [prefer-stable, prefer-lowest] - exclude: - - php: 8.1 - laravel: ^8.0 timeout-minutes: 15 steps: - name: Checkout Code diff --git a/composer.json b/composer.json index 1ae42fd..cea0541 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ }, "require-dev": { "laravel/pint": "^1.3", - "orchestra/testbench": "^7.17", + "orchestra/testbench": "^7.17|^8.0", "pestphp/pest": "^1.22", "pestphp/pest-plugin-laravel": "^1.3", "phpunit/phpunit": "^9.5" diff --git a/composer.lock b/composer.lock index 012cb83..4a2b341 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": "f2b0dc804e57037f4f728f22fce4b78f", + "content-hash": "346ae09ce424c12e78176641de5ca67b", "packages": [ { "name": "nikic/php-parser", @@ -2349,20 +2349,21 @@ }, { "name": "laravel/framework", - "version": "v9.52.4", + "version": "v10.4.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "9239128cfb4d22afefb64060dfecf53e82987267" + "reference": "7d15f7eef442633cff108f83d9fe43d8c3b8b76f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/9239128cfb4d22afefb64060dfecf53e82987267", - "reference": "9239128cfb4d22afefb64060dfecf53e82987267", + "url": "https://api.github.com/repos/laravel/framework/zipball/7d15f7eef442633cff108f83d9fe43d8c3b8b76f", + "reference": "7d15f7eef442633cff108f83d9fe43d8c3b8b76f", "shasum": "" }, "require": { "brick/math": "^0.9.3|^0.10.2|^0.11", + "composer-runtime-api": "^2.2", "doctrine/inflector": "^2.0.5", "dragonmantank/cron-expression": "^3.3.2", "egulias/email-validator": "^3.2.1|^4.0", @@ -2375,28 +2376,28 @@ "ext-tokenizer": "*", "fruitcake/php-cors": "^1.2", "guzzlehttp/uri-template": "^1.0", - "laravel/serializable-closure": "^1.2.2", + "laravel/serializable-closure": "^1.3", "league/commonmark": "^2.2.1", "league/flysystem": "^3.8.0", - "monolog/monolog": "^2.0", + "monolog/monolog": "^3.0", "nesbot/carbon": "^2.62.1", "nunomaduro/termwind": "^1.13", - "php": "^8.0.2", + "php": "^8.1", "psr/container": "^1.1.1|^2.0.1", "psr/log": "^1.0|^2.0|^3.0", "psr/simple-cache": "^1.0|^2.0|^3.0", "ramsey/uuid": "^4.7", - "symfony/console": "^6.0.9", - "symfony/error-handler": "^6.0", - "symfony/finder": "^6.0", - "symfony/http-foundation": "^6.0", - "symfony/http-kernel": "^6.0", - "symfony/mailer": "^6.0", - "symfony/mime": "^6.0", - "symfony/process": "^6.0", - "symfony/routing": "^6.0", - "symfony/uid": "^6.0", - "symfony/var-dumper": "^6.0", + "symfony/console": "^6.2", + "symfony/error-handler": "^6.2", + "symfony/finder": "^6.2", + "symfony/http-foundation": "^6.2", + "symfony/http-kernel": "^6.2", + "symfony/mailer": "^6.2", + "symfony/mime": "^6.2", + "symfony/process": "^6.2", + "symfony/routing": "^6.2", + "symfony/uid": "^6.2", + "symfony/var-dumper": "^6.2", "tijsverkoyen/css-to-inline-styles": "^2.2.5", "vlucas/phpdotenv": "^5.4.1", "voku/portable-ascii": "^2.0" @@ -2432,6 +2433,7 @@ "illuminate/notifications": "self.version", "illuminate/pagination": "self.version", "illuminate/pipeline": "self.version", + "illuminate/process": "self.version", "illuminate/queue": "self.version", "illuminate/redis": "self.version", "illuminate/routing": "self.version", @@ -2445,7 +2447,7 @@ "require-dev": { "ably/ably-php": "^1.0", "aws/aws-sdk-php": "^3.235.5", - "doctrine/dbal": "^2.13.3|^3.1.4", + "doctrine/dbal": "^3.5.1", "ext-gmp": "*", "fakerphp/faker": "^1.21", "guzzlehttp/guzzle": "^7.5", @@ -2455,20 +2457,20 @@ "league/flysystem-read-only": "^3.3", "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^7.16", + "orchestra/testbench-core": "^8.1", "pda/pheanstalk": "^4.0", "phpstan/phpdoc-parser": "^1.15", "phpstan/phpstan": "^1.4.7", - "phpunit/phpunit": "^9.5.8", - "predis/predis": "^1.1.9|^2.0.2", - "symfony/cache": "^6.0", - "symfony/http-client": "^6.0" + "phpunit/phpunit": "^10.0.7", + "predis/predis": "^2.0.2", + "symfony/cache": "^6.2", + "symfony/http-client": "^6.2.4" }, "suggest": { "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).", "brianium/paratest": "Required to run tests in parallel (^6.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^3.5.1).", "ext-apcu": "Required to use the APC cache driver.", "ext-fileinfo": "Required to use the Filesystem class.", "ext-ftp": "Required to use the Flysystem FTP driver.", @@ -2490,21 +2492,21 @@ "mockery/mockery": "Required to use mocking (^1.5.1).", "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", - "phpunit/phpunit": "Required to use assertions and run tests (^9.5.8).", - "predis/predis": "Required to use the predis connector (^1.1.9|^2.0.2).", + "phpunit/phpunit": "Required to use assertions and run tests (^9.5.8|^10.0.7).", + "predis/predis": "Required to use the predis connector (^2.0.2).", "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).", - "symfony/cache": "Required to PSR-6 cache bridge (^6.0).", - "symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).", - "symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.0).", - "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).", - "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^6.2).", + "symfony/filesystem": "Required to enable support for relative symbolic links (^6.2).", + "symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.2).", + "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.2).", + "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.2).", "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.x-dev" + "dev-master": "10.x-dev" } }, "autoload": { @@ -2543,7 +2545,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-02-22T14:38:06+00:00" + "time": "2023-03-18T11:34:02+00:00" }, { "name": "laravel/pint", @@ -3080,42 +3082,41 @@ }, { "name": "monolog/monolog", - "version": "2.9.1", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1" + "reference": "9b5daeaffce5b926cac47923798bba91059e60e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/9b5daeaffce5b926cac47923798bba91059e60e2", + "reference": "9b5daeaffce5b926cac47923798bba91059e60e2", "shasum": "" }, "require": { - "php": ">=7.2", - "psr/log": "^1.0.1 || ^2.0 || ^3.0" + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + "psr/log-implementation": "3.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "aws/aws-sdk-php": "^3.0", "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", "ext-json": "*", "graylog2/gelf-php": "^1.4.2 || ^2@dev", - "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1 || ^2.0", - "rollbar/rollbar": "^1.3 || ^2 || ^3", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-strict-rules": "^1.4", + "phpunit/phpunit": "^9.5.26", + "predis/predis": "^1.1 || ^2", "ruflin/elastica": "^7", - "swiftmailer/swiftmailer": "^5.3|^6.0", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -3138,7 +3139,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -3166,7 +3167,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.9.1" + "source": "https://github.com/Seldaek/monolog/tree/3.3.1" }, "funding": [ { @@ -3178,7 +3179,7 @@ "type": "tidelift" } ], - "time": "2023-02-06T13:44:46+00:00" + "time": "2023-02-06T13:46:10+00:00" }, { "name": "myclabs/deep-copy", @@ -3666,36 +3667,32 @@ }, { "name": "orchestra/testbench", - "version": "v7.22.1", + "version": "v8.0.10", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "987f5383f597a54f8d9868f98411899398348c02" + "reference": "c02190defc738fbe20d147a6de48738aed113c19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/987f5383f597a54f8d9868f98411899398348c02", - "reference": "987f5383f597a54f8d9868f98411899398348c02", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/c02190defc738fbe20d147a6de48738aed113c19", + "reference": "c02190defc738fbe20d147a6de48738aed113c19", "shasum": "" }, "require": { + "composer-runtime-api": "^2.2", "fakerphp/faker": "^1.21", - "laravel/framework": "^9.52.4", + "laravel/framework": ">=10.4.1 <10.5.0", "mockery/mockery": "^1.5.1", - "orchestra/testbench-core": "^7.22.1", - "php": "^8.0", - "phpunit/phpunit": "^9.5.10", - "spatie/laravel-ray": "^1.28", - "symfony/process": "^6.0.9", - "symfony/yaml": "^6.0.9", + "orchestra/testbench-core": ">=8.0.5 <8.2.0", + "php": "^8.1", + "phpunit/phpunit": "^9.6 || ^10.0.7", + "spatie/laravel-ray": "^1.32", + "symfony/process": "^6.2", + "symfony/yaml": "^6.2", "vlucas/phpdotenv": "^5.4.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.0-dev" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -3719,50 +3716,51 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v7.22.1" + "source": "https://github.com/orchestral/testbench/tree/v8.0.10" }, - "time": "2023-02-24T01:07:22+00:00" + "time": "2023-03-18T13:08:38+00:00" }, { "name": "orchestra/testbench-core", - "version": "v7.22.1", + "version": "v8.1.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "75b42f9130e7903ffa0ef8dbb466962ca6635261" + "reference": "b7785ad15ff83259457b7b70da21b2b89bddfa7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/75b42f9130e7903ffa0ef8dbb466962ca6635261", - "reference": "75b42f9130e7903ffa0ef8dbb466962ca6635261", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/b7785ad15ff83259457b7b70da21b2b89bddfa7b", + "reference": "b7785ad15ff83259457b7b70da21b2b89bddfa7b", "shasum": "" }, "require": { - "php": "^8.0" + "composer-runtime-api": "^2.2", + "php": "^8.1" }, "require-dev": { "fakerphp/faker": "^1.21", - "laravel/framework": "^9.52.4", - "laravel/pint": "^1.4", + "laravel/framework": "^10.4", + "laravel/pint": "^1.6", "mockery/mockery": "^1.5.1", - "orchestra/canvas": "^7.0", - "phpstan/phpstan": "^1.9.14", - "phpunit/phpunit": "^9.5.10", - "spatie/laravel-ray": "^1.28", - "symfony/process": "^6.0.9", - "symfony/yaml": "^6.0.9", + "orchestra/canvas": "^8.1", + "phpstan/phpstan": "^1.10.7", + "phpunit/phpunit": "^9.6 || ^10.0.7", + "spatie/laravel-ray": "^1.32", + "symfony/process": "^6.2", + "symfony/yaml": "^6.2", "vlucas/phpdotenv": "^5.4.1" }, "suggest": { - "brianium/paratest": "Allow using parallel tresting (^6.4).", + "brianium/paratest": "Allow using parallel tresting (^6.4 || ^7.0).", "fakerphp/faker": "Allow using Faker for testing (^1.21).", - "laravel/framework": "Required for testing (^9.52.4).", + "laravel/framework": "Required for testing (^10.4).", "mockery/mockery": "Allow using Mockery for testing (^1.5.1).", - "nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^6.2).", - "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^7.0).", - "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^7.0).", - "phpunit/phpunit": "Allow using PHPUnit for testing (^9.5.10).", - "symfony/yaml": "Required for CLI Commander (^6.0.9).", + "nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^6.4 || ^7.0).", + "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^8.0).", + "orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^8.0).", + "phpunit/phpunit": "Allow using PHPUnit for testing (^9.6 || ^10.0.7).", + "symfony/yaml": "Required for CLI Commander (^6.2).", "vlucas/phpdotenv": "Required for CLI Commander (^5.4.1)." }, "bin": [ @@ -3771,7 +3769,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "9.0-dev" } }, "autoload": { @@ -3807,7 +3805,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2023-02-23T12:15:23+00:00" + "time": "2023-03-17T23:45:21+00:00" }, { "name": "pestphp/pest", diff --git a/src/phparkitect.php b/src/phparkitect.php index bbff844..fc6df9f 100644 --- a/src/phparkitect.php +++ b/src/phparkitect.php @@ -3,6 +3,7 @@ declare(strict_types=1); use Arkitect\CLI\Config; +use Illuminate\Support\Str; use Mortexa\LaravelArkitect\RuleLoader; use Mortexa\LaravelArkitect\Rules\BaseRule; @@ -19,6 +20,11 @@ $psr4_namespaces = data_get(json_decode(file_get_contents('composer.json'), true), 'autoload.psr-4'); + $psr4_namespaces = array_combine( + array_keys($psr4_namespaces), + array_map(fn ($value) => Str::endsWith($value, '/') ? $value : $value.'/', $psr4_namespaces) + ); + foreach ($psr4_namespaces as $namespace => $path) { BaseRule::$rootNamespace = $namespace; BaseRule::$rootPath = $path;