From 012bc4afe74d6f6a15483730c6d07ac4ad5fc5fa Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 16:47:13 +0800 Subject: [PATCH 1/7] wip Signed-off-by: Mior Muhammad Zaki --- .coveralls.yml | 1 - .gitattributes | 5 +---- .php_cs | 28 ---------------------------- composer.json | 3 +++ phpstan-baseline.neon | 11 +++++++++++ phpstan.neon.dist | 1 + src/CodeGenerator.php | 1 - src/Commands/Command.php | 1 - src/Commands/Generator.php | 4 ++-- src/Presets/Preset.php | 3 +-- 10 files changed, 19 insertions(+), 39 deletions(-) delete mode 100644 .coveralls.yml delete mode 100644 .php_cs create mode 100644 phpstan-baseline.neon diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 9160059..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1 +0,0 @@ -service_name: travis-ci diff --git a/.gitattributes b/.gitattributes index 960f009..2aa4a89 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,12 +3,9 @@ # Ignore following folder/file. /.github export-ignore /tests export-ignore -/.coveralls.yml export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.php_cs export-ignore -/.travis.yml export-ignore -/canvas.yaml export-ignore +/phpstan-baseline.neon export-ignore /phpstan.neon.dist export-ignore /phpunit.xml export-ignore /sync.sh export-ignore diff --git a/.php_cs b/.php_cs deleted file mode 100644 index b961703..0000000 --- a/.php_cs +++ /dev/null @@ -1,28 +0,0 @@ -in(__DIR__.'/src') - ->in(__DIR__.'/tests'); - -return PhpCsFixer\Config::create() - ->setRiskyAllowed(false) - ->setRules([ - '@Symfony' => true, - 'array_syntax' => ['syntax' => 'short'], - 'binary_operator_spaces' => ['align_double_arrow' => false, 'align_equals' => false], - 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true], - 'no_extra_blank_lines' => false, - 'no_empty_comment' => false, - 'no_extra_consecutive_blank_lines' => false, - 'no_unneeded_control_parentheses' => false, - 'not_operator_with_successor_space' => true, - 'ordered_imports' => ['sortAlgorithm' => 'alpha'], - 'phpdoc_align' => false, - 'phpdoc_no_empty_return' => false, - 'phpdoc_order' => true, - 'php_unit_method_casing' => false, - 'pre_increment' => false, - 'single_trait_insert_per_statement' => false, - 'yoda_style' => false, - ]) - ->setFinder($finder); diff --git a/composer.json b/composer.json index 4eb8153..0934ace 100644 --- a/composer.json +++ b/composer.json @@ -48,5 +48,8 @@ ] } }, + "scripts": { + "lint": "vendor/bin/phpstan analyse" + }, "minimum-stability": "dev" } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..12c7d01 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,11 @@ +parameters: + ignoreErrors: + - + message: "#^Access to private property \\$description of parent class Symfony\\\\Component\\\\Console\\\\Command\\\\Command\\.$#" + count: 1 + path: src/Commands/Generator.php + + - + message: "#^Access to private property \\$name of parent class Symfony\\\\Component\\\\Console\\\\Command\\\\Command\\.$#" + count: 1 + path: src/Commands/Generator.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index dcaf9ec..52008e3 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,6 @@ includes: - ./vendor/nunomaduro/larastan/extension.neon + - ./phpstan-baseline.neon parameters: diff --git a/src/CodeGenerator.php b/src/CodeGenerator.php index 955b7a9..73a2379 100644 --- a/src/CodeGenerator.php +++ b/src/CodeGenerator.php @@ -15,7 +15,6 @@ trait CodeGenerator * Set Preset for generator. * * @param \Orchestra\Canvas\Core\Presets\Preset $preset - * * @return $this */ public function setPreset(Presets\Preset $preset) diff --git a/src/Commands/Command.php b/src/Commands/Command.php index e43dbe0..36a1fd5 100644 --- a/src/Commands/Command.php +++ b/src/Commands/Command.php @@ -54,7 +54,6 @@ public function run(InputInterface $input, OutputInterface $output) * Resolve the console command instance for the given command. * * @param \Symfony\Component\Console\Command\Command|string $command - * * @return \Symfony\Component\Console\Command\Command */ protected function resolveCommand($command) diff --git a/src/Commands/Generator.php b/src/Commands/Generator.php index eb9a51a..469419a 100644 --- a/src/Commands/Generator.php +++ b/src/Commands/Generator.php @@ -73,9 +73,9 @@ protected function configure() /** * Execute the command. * - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - * * @return int 0 if everything went fine, or an exit code + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/src/Presets/Preset.php b/src/Presets/Preset.php index 09f92ae..1a47887 100644 --- a/src/Presets/Preset.php +++ b/src/Presets/Preset.php @@ -51,10 +51,9 @@ public function is(string $name): bool * Get configuration. * * @param mixed|null $default - * * @return mixed */ - public function config(?string $key = null, $default = null) + public function config(string $key = null, $default = null) { if (\is_null($key)) { return $this->config; From 7246b0e2d249560047c2f3d4c30c1d175f3fe9e9 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 16:49:05 +0800 Subject: [PATCH 2/7] wip Signed-off-by: Mior Muhammad Zaki --- src/Testing/TestCase.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/Testing/TestCase.php b/src/Testing/TestCase.php index deba928..28411cb 100644 --- a/src/Testing/TestCase.php +++ b/src/Testing/TestCase.php @@ -12,24 +12,4 @@ class TestCase extends \Orchestra\Testbench\TestCase * @var array|null */ protected $files = []; - - /** - * Setup the test environment. - */ - protected function setUp(): void - { - parent::setUp(); - - $this->setUpInteractsWithPublishedFiles(); - } - - /** - * Teardown the test environment. - */ - protected function tearDown(): void - { - $this->tearDownInteractsWithPublishedFiles(); - - parent::tearDown(); - } } From 0d1b8dd09446d20970b8b3f0830c073f31eccf34 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 16:56:30 +0800 Subject: [PATCH 3/7] wip Signed-off-by: Mior Muhammad Zaki --- phpstan-baseline.neon | 11 ----------- phpstan.neon.dist | 1 - src/Commands/Generator.php | 4 ++-- 3 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon deleted file mode 100644 index 12c7d01..0000000 --- a/phpstan-baseline.neon +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Access to private property \\$description of parent class Symfony\\\\Component\\\\Console\\\\Command\\\\Command\\.$#" - count: 1 - path: src/Commands/Generator.php - - - - message: "#^Access to private property \\$name of parent class Symfony\\\\Component\\\\Console\\\\Command\\\\Command\\.$#" - count: 1 - path: src/Commands/Generator.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 52008e3..dcaf9ec 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,6 +1,5 @@ includes: - ./vendor/nunomaduro/larastan/extension.neon - - ./phpstan-baseline.neon parameters: diff --git a/src/Commands/Generator.php b/src/Commands/Generator.php index 469419a..8e4d4a9 100644 --- a/src/Commands/Generator.php +++ b/src/Commands/Generator.php @@ -65,8 +65,8 @@ protected function configure() { $this->ignoreValidationErrors(); - $this->setName($this->name) - ->setDescription($this->description) + $this->setName($this->getName()) + ->setDescription($this->getDescription()) ->addArgument('name', InputArgument::REQUIRED, "The name of the {$this->fileType}"); } From 4870984c7589427ad810b721e06e551bce830e08 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 17:01:58 +0800 Subject: [PATCH 4/7] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0934ace..6dfcf65 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,10 @@ } }, "scripts": { - "lint": "vendor/bin/phpstan analyse" + "post-autoload-dump": "@prepare", + "prepare": "@php vendor/bin/testbench package:discover --ansi", + "lint": "@php vendor/bin/phpstan analyse", + "test": "@php vendor/bin/phpunit -c ./ --color" }, "minimum-stability": "dev" } From 59e4a4ced817a72b6a7d443692fdb6ae82853497 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 17:03:01 +0800 Subject: [PATCH 5/7] wip Signed-off-by: Mior Muhammad Zaki --- src/Commands/Generator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/Generator.php b/src/Commands/Generator.php index 8e4d4a9..469419a 100644 --- a/src/Commands/Generator.php +++ b/src/Commands/Generator.php @@ -65,8 +65,8 @@ protected function configure() { $this->ignoreValidationErrors(); - $this->setName($this->getName()) - ->setDescription($this->getDescription()) + $this->setName($this->name) + ->setDescription($this->description) ->addArgument('name', InputArgument::REQUIRED, "The name of the {$this->fileType}"); } From 8d01a234d669ffe2115291b061643285353a374f Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 17:04:34 +0800 Subject: [PATCH 6/7] wip Signed-off-by: Mior Muhammad Zaki --- .../workflows/{analyse.yml => analyse.yaml} | 6 +-- .../{coveralls.yml => coveralls.yaml} | 6 +-- .github/workflows/experimental-tests.yml | 42 ------------------- .github/workflows/{tests.yml => tests.yaml} | 8 ++-- 4 files changed, 10 insertions(+), 52 deletions(-) rename .github/workflows/{analyse.yml => analyse.yaml} (90%) rename .github/workflows/{coveralls.yml => coveralls.yaml} (92%) delete mode 100644 .github/workflows/experimental-tests.yml rename .github/workflows/{tests.yml => tests.yaml} (93%) diff --git a/.github/workflows/analyse.yml b/.github/workflows/analyse.yaml similarity index 90% rename from .github/workflows/analyse.yml rename to .github/workflows/analyse.yaml index 5880cc2..682f248 100644 --- a/.github/workflows/analyse.yml +++ b/.github/workflows/analyse.yaml @@ -13,7 +13,7 @@ jobs: os: - "ubuntu-latest" php: - - "8.0" + - 8.1 dependencies: - "locked" experimental: @@ -23,7 +23,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -33,7 +33,7 @@ jobs: coverage: none - name: Install dependencies - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v2" with: dependency-versions: "${{ matrix.dependencies }}" composer-options: "--prefer-dist --no-cache" diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yaml similarity index 92% rename from .github/workflows/coveralls.yml rename to .github/workflows/coveralls.yaml index a4b9984..c48fa97 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yaml @@ -13,7 +13,7 @@ jobs: os: - "ubuntu-latest" php: - - "7.3" + - 8.1 dependencies: - "locked" laravel: @@ -25,7 +25,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -35,7 +35,7 @@ jobs: coverage: xdebug - name: Install dependencies - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v2" with: dependency-versions: "${{ matrix.dependencies }}" composer-options: "--prefer-dist" diff --git a/.github/workflows/experimental-tests.yml b/.github/workflows/experimental-tests.yml deleted file mode 100644 index fd7cdcf..0000000 --- a/.github/workflows/experimental-tests.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: experimental-tests - -on: - push: - -jobs: - experimental-php-test: - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - strategy: - matrix: - os: - - "ubuntu-latest" - php: - - "8.2" - dependencies: - - "highest" - - "locked" - experimental: - - true - - name: PHP${{ matrix.php }} on ${{ matrix.os }} (${{ matrix.dependencies }}) - - steps: - - name: Checkout code - uses: actions/checkout@v1 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, intl, fileinfo - coverage: none - - - name: Install dependencies - uses: "ramsey/composer-install@v1" - with: - dependency-versions: "${{ matrix.dependencies }}" - composer-options: "--prefer-dist --no-cache" - - - name: Execute tests - run: vendor/bin/phpunit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yaml similarity index 93% rename from .github/workflows/tests.yml rename to .github/workflows/tests.yaml index 0370ef1..1957190 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yaml @@ -15,10 +15,10 @@ jobs: os: - "ubuntu-latest" php: - - "7.3" - - "7.4" - - "8.0" - - "8.1" + - 7.3 + - 7.4 + - '8.0' + - 8.1 dependencies: - "locked" - "lowest" From be92116375d3266cf07d9ee0af44fbf516bbd09f Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 21 Aug 2023 17:19:17 +0800 Subject: [PATCH 7/7] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 6dfcf65..26267c4 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,9 @@ "nunomaduro/larastan": "^1.0.1", "orchestra/testbench": "^6.22" }, + "conflict": { + "orchestra/testbench-core": "<6.32.0" + }, "config": { "sort-packages": true },