diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 30c8a49..39b1580 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,4 +9,11 @@ updates: schedule: interval: "weekly" labels: - - "dependencies" \ No newline at end of file + - "dependencies" + + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependencies" diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index eb537d8..c3ad22d 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -8,22 +8,23 @@ permissions: jobs: dependabot: runs-on: ubuntu-latest + timeout-minutes: 5 if: ${{ github.actor == 'dependabot[bot]' }} steps: - + - name: Dependabot metadata id: metadata uses: dependabot/fetch-metadata@v2.2.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - + - name: Auto-merge Dependabot PRs for semver-minor updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Auto-merge Dependabot PRs for semver-patch updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} run: gh pr merge --auto --merge "$PR_URL" diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/fix-php-code-style-issues.yml similarity index 55% rename from .github/workflows/php-cs-fixer.yml rename to .github/workflows/fix-php-code-style-issues.yml index fbec801..56d54d3 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -1,10 +1,17 @@ -name: Check & fix styling +name: Fix PHP code style issues -on: [push] +on: + push: + paths: + - '**.php' + +permissions: + contents: write jobs: - php-cs-fixer: + php-code-styling: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Checkout code @@ -12,10 +19,8 @@ jobs: with: ref: ${{ github.head_ref }} - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php_cs.dist.php --allow-risky=yes + - name: Fix PHP code style issues + uses: aglipanci/laravel-pint-action@2.4 - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 4f3f936..43a82b4 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -5,18 +5,20 @@ on: paths: - '**.php' - 'phpstan.neon.dist' + - '.github/workflows/phpstan.yml' jobs: phpstan: name: phpstan runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.4' coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a2a6c16..04115cf 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,25 +2,28 @@ name: run-tests on: push: - branches: [main] - pull_request: - branches: [main] + paths: + - '**.php' + - '.github/workflows/run-tests.yml' + - 'phpunit.xml.dist' + - 'composer.json' + - 'composer.lock' jobs: test: runs-on: ${{ matrix.os }} + timeout-minutes: 5 strategy: fail-fast: true matrix: - os: [ubuntu-latest, windows-latest] - php: ["8.0", "8.1"] - laravel: [8.*, 9.*] - stability: [prefer-stable] + os: [ubuntu-latest] + php: [8.4, 8.3] + laravel: [11.*] + stability: [prefer-lowest, prefer-stable] include: - - laravel: 9.* - testbench: 7.* - - laravel: 8.* - testbench: 6.* + - laravel: 11.* + testbench: 9.* + carbon: ^2.63 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -42,8 +45,11 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.os == 'windows-latest' && '^^^' || '' }}${{ matrix.carbon }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: List Installed Dependencies + run: composer show -D + - name: Execute tests - run: vendor/bin/pest + run: vendor/bin/pest --ci diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 0cdea23..39de30d 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -4,9 +4,13 @@ on: release: types: [released] +permissions: + contents: write + jobs: update: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Checkout code diff --git a/.gitignore b/.gitignore index 9a43686..958531b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ testbench.yaml vendor node_modules .php-cs-fixer.cache +test-results +.phpunit.cache diff --git a/.php_cs.dist.php b/.php_cs.dist.php deleted file mode 100644 index 8d8a790..0000000 --- a/.php_cs.dist.php +++ /dev/null @@ -1,40 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new PhpCsFixer\Config()) - ->setRules([ - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'method' => 'one', - ], - ], - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => true, - ]) - ->setFinder($finder); diff --git a/LICENSE.md b/LICENSE.md index f2c176e..e689c1e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) Petrobolos Games +Copyright (c) Oliver Earl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index b607181..fe42900 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,7 @@ large sets of data. ## Requirements -Currently, requires PHP 8 or above, but work to backport support for 7.4 is in progress. This package is designed -for Laravel 8 and 9, but might play nicely with older versions, or with Lumen. Let us know. +Currently, requires PHP 8.3 or above, and Laravel 11+. ## Installation @@ -110,9 +109,6 @@ $everything = FixedArray::merge( | toArray | Converts a fixed array into a standard array. | `FixedArray::toArray($array)` | | toCollection | Converts a fixed array into an Illuminate collection. | `FixedArray::toCollection($array)` | -**NB:** Methods `current`, `key`, `next`, `rewind`, and `valid` are legacy alias operations for pointer-based array -methods and simply return `null` currently. They will be implemented in a future version. - ## Testing Tests are run using Pest. You can run the suite like so: diff --git a/composer.json b/composer.json index 2f48d68..eb4bba6 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { "name": "petrobolos/fixed-array-functions", - "description": "This is my package fixed-array-functions", + "description": "Laravel helper methods for working with high performance SPL fixed arrays.", "keywords": [ "laravel", "splfixedarray", "array", "collection" ], - "homepage": "https://github.com/petrobolos/fixed-array-functions", + "homepage": "https://github.com/oliverearl/fixed-array-functions", "license": "MIT", "authors": [ { @@ -17,24 +17,26 @@ } ], "require": { - "php": "^8.0 || ^8.1", - "spatie/laravel-package-tools": "^1.9.2", - "illuminate/contracts": "^8.0 || ^9.0" + "php": "^8.3", + "spatie/laravel-package-tools": "^1.16", + "illuminate/contracts": "^11.0" }, "require-dev": { - "nunomaduro/collision": "^5.0 || ^6.0", - "nunomaduro/larastan": "^1.0.3 || ^2.0.1", - "orchestra/testbench": "^6.0 || ^7.0", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.1", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5" + "laravel/pint": "^1.14", + "nunomaduro/collision": "^8.1.1", + "larastan/larastan": "^2.9", + "orchestra/testbench": "^9.0.0", + "pestphp/pest": "^3.0", + "pestphp/pest-plugin-arch": "^3.0", + "pestphp/pest-plugin-laravel": "^3.0", + "phpstan/extension-installer": "^1.3", + "phpstan/phpstan-deprecation-rules": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "spatie/laravel-ray": "^1.35" }, "autoload": { "psr-4": { - "Petrobolos\\FixedArray\\": "src" + "Petrobolos\\FixedArray\\": "src/" }, "files": [ "src/helpers.php" @@ -42,13 +44,17 @@ }, "autoload-dev": { "psr-4": { - "Petrobolos\\FixedArray\\Tests\\": "tests" + "Petrobolos\\FixedArray\\Tests\\": "tests", + "Workbench\\App\\": "workbench/app/" } }, "scripts": { + "post-autoload-dump": "@composer run prepare", + "prepare": "@php vendor/bin/testbench package:discover --ansi", "analyse": "vendor/bin/phpstan analyse", "test": "vendor/bin/pest", - "test-coverage": "vendor/bin/pest --coverage" + "test-coverage": "vendor/bin/pest --coverage", + "format": "vendor/bin/pint" }, "config": { "sort-packages": true, @@ -61,7 +67,10 @@ "laravel": { "providers": [ "Petrobolos\\FixedArray\\FixedArrayFunctionsServiceProvider" - ] + ], + "aliases": { + "FixedArray": "Petrobolos\\FixedArrayFunctions\\Facades\\FixedArray" + } } }, "minimum-stability": "dev", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 9914a5e..d8fd46c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,11 +2,9 @@ includes: - phpstan-baseline.neon parameters: - level: 4 + level: 5 paths: - src tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 05c300f..cf55f3f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,39 +1,23 @@ - - - - tests - - - - - ./src - - - - - - - - - - + + + + tests + + + + + + + + + + + + + + + ./src + + diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..f9ec356 --- /dev/null +++ b/pint.json @@ -0,0 +1,3 @@ +{ + "preset": "per" +} diff --git a/src/Facades/FixedArray.php b/src/Facades/FixedArray.php new file mode 100644 index 0000000..c1e6e85 --- /dev/null +++ b/src/Facades/FixedArray.php @@ -0,0 +1,19 @@ +current(); - } - /** * Apply a callback to each item in the array without modifying the original array. - * - * @param \SplFixedArray $array - * @param callable $callback - * @return \SplFixedArray */ public static function each(SplFixedArray $array, callable $callback): SplFixedArray { @@ -114,10 +74,6 @@ public static function each(SplFixedArray $array, callable $callback): SplFixedA /** * Apply a filter to a given fixed array. - * - * @param \SplFixedArray $array - * @param callable $callback - * @return \SplFixedArray */ public static function filter(SplFixedArray $array, callable $callback): SplFixedArray { @@ -128,9 +84,6 @@ public static function filter(SplFixedArray $array, callable $callback): SplFixe /** * Returns the first value from a fixed array. - * - * @param \SplFixedArray $array - * @return mixed */ public static function first(SplFixedArray $array): mixed { @@ -139,10 +92,6 @@ public static function first(SplFixedArray $array): mixed /** * Import a PHP array into a fixed array. - * - * @param array $array - * @param bool $preserveKeys - * @return \SplFixedArray */ public static function fromArray(array $array, bool $preserveKeys = true): SplFixedArray { @@ -151,10 +100,6 @@ public static function fromArray(array $array, bool $preserveKeys = true): SplFi /** * Import a collection into a fixed array. - * - * @param \Illuminate\Support\Collection $collection - * @param bool $preserveKeys - * @return \SplFixedArray */ public static function fromCollection(Collection $collection, bool $preserveKeys = true): SplFixedArray { @@ -163,9 +108,6 @@ public static function fromCollection(Collection $collection, bool $preserveKeys /** * Gets the size of the array. - * - * @param \SplFixedArray $array - * @return int */ public static function getSize(SplFixedArray $array): int { @@ -174,36 +116,14 @@ public static function getSize(SplFixedArray $array): int /** * Returns whether a given value is an SplFixedArray. - * - * @param mixed $array - * @return bool */ public static function isFixedArray(mixed $array): bool { return $array instanceof SplFixedArray; } - /** - * Return the current array index. - * Does nothing on PHP 8 or above. - * - * @param \SplFixedArray $array - * @return null|int - */ - public static function key(SplFixedArray $array): ?int - { - if (self::noLegacyMethods()) { - return null; - } - - return $array->key(); - } - /** * Retrieves the last item from the array. - * - * @param \SplFixedArray $array - * @return mixed */ public static function last(SplFixedArray $array): mixed { @@ -212,10 +132,6 @@ public static function last(SplFixedArray $array): mixed /** * Apply a callback to each item in the array and return the new array. - * - * @param \SplFixedArray $array - * @param callable|string $callback - * @return \SplFixedArray */ public static function map(SplFixedArray $array, callable|string $callback): SplFixedArray { @@ -226,10 +142,6 @@ public static function map(SplFixedArray $array, callable|string $callback): Spl /** * Merges multiple fixed arrays, arrays, or collections into a single fixed array. - * - * @param \SplFixedArray $array - * @param \SplFixedArray|array|\Illuminate\Support\Collection ...$arrays - * @return \SplFixedArray */ public static function merge(SplFixedArray $array, SplFixedArray|array|Collection ...$arrays): SplFixedArray { @@ -242,27 +154,8 @@ public static function merge(SplFixedArray $array, SplFixedArray|array|Collectio return $array; } - /** - * Move the internal pointer to the next entry. - * Does nothing on PHP 8 or above. - * - * @param \SplFixedArray $array - * @return void - */ - public static function next(SplFixedArray $array): void - { - if (self::noLegacyMethods()) { - return; - } - - $array->next(); - } - /** * Replaces the contents of a fixed array with nulls. - * - * @param \SplFixedArray $array - * @return void */ public static function nullify(SplFixedArray $array): void { @@ -273,10 +166,6 @@ public static function nullify(SplFixedArray $array): void /** * Return whether the specified index exists. - * - * @param int $index - * @param \SplFixedArray $array - * @return bool */ public static function offsetExists(int $index, SplFixedArray $array): bool { @@ -285,10 +174,6 @@ public static function offsetExists(int $index, SplFixedArray $array): bool /** * Returns the value at the specified index. - * - * @param int $index - * @param \SplFixedArray $array - * @return mixed */ public static function offsetGet(int $index, SplFixedArray $array): mixed { @@ -297,10 +182,6 @@ public static function offsetGet(int $index, SplFixedArray $array): mixed /** * Set a given offset to a null value. - * - * @param int $index - * @param \SplFixedArray $array - * @return void */ public static function offsetNull(int $index, SplFixedArray $array): void { @@ -309,11 +190,6 @@ public static function offsetNull(int $index, SplFixedArray $array): void /** * Sets a new value at a specified index. - * - * @param int $index - * @param mixed $value - * @param \SplFixedArray $array - * @return void */ public static function offsetSet(int $index, mixed $value, SplFixedArray $array): void { @@ -322,9 +198,6 @@ public static function offsetSet(int $index, mixed $value, SplFixedArray $array) /** * Pops the latest value from the array. - * - * @param \SplFixedArray $array - * @return mixed */ public static function pop(SplFixedArray $array): mixed { @@ -343,10 +216,6 @@ public static function pop(SplFixedArray $array): mixed /** * Pushes a given value to the first available space on the array. * If the array is too small, the array size is extended by a single value. - * - * @param mixed $value - * @param \SplFixedArray $array - * @return \SplFixedArray */ public static function push(mixed $value, SplFixedArray $array): SplFixedArray { @@ -364,28 +233,8 @@ public static function push(mixed $value, SplFixedArray $array): SplFixedArray return $array; } - /** - * Rewind iterator back to the start. - * Does nothing on PHP 8 or above. - * - * @param \SplFixedArray $array - * @return void - */ - public static function rewind(SplFixedArray $array): void - { - if (self::noLegacyMethods()) { - return; - } - - $array->rewind(); - } - /** * Alias for setSize. - * - * @param int $size - * @param \SplFixedArray $array - * @return bool */ public static function resize(int $size, SplFixedArray $array): bool { @@ -394,9 +243,6 @@ public static function resize(int $size, SplFixedArray $array): bool /** * Returns the second value from a fixed array. - * - * @param \SplFixedArray $array - * @return mixed */ public static function second(SplFixedArray $array): mixed { @@ -409,10 +255,6 @@ public static function second(SplFixedArray $array): mixed /** * Change the size of an array. - * - * @param int $size - * @param \SplFixedArray $array - * @return bool */ public static function setSize(int $size, SplFixedArray $array): bool { @@ -421,9 +263,6 @@ public static function setSize(int $size, SplFixedArray $array): bool /** * Returns a PHP array from the fixed array. - * - * @param \SplFixedArray $array - * @return array */ public static function toArray(SplFixedArray $array): array { @@ -432,38 +271,9 @@ public static function toArray(SplFixedArray $array): array /** * Returns a collection from the fixed array. - * - * @param \SplFixedArray $array - * @return \Illuminate\Support\Collection */ public static function toCollection(SplFixedArray $array): Collection { return collect($array); } - - /** - * Check whether the array contains more elements. - * Does nothing on PHP 8 or above. - * - * @param \SplFixedArray $array - * @return null|bool - */ - public static function valid(SplFixedArray $array): ?bool - { - if (self::noLegacyMethods()) { - return null; - } - - return $array->valid(); - } - - /** - * Returns true if the current PHP version is 8.0 or above. - * - * @return bool - */ - protected static function noLegacyMethods(): bool - { - return PHP_VERSION_ID >= 80000; - } } diff --git a/src/FixedArrayFunctionsServiceProvider.php b/src/FixedArrayFunctionsServiceProvider.php index 37ff1c2..8015ff0 100644 --- a/src/FixedArrayFunctionsServiceProvider.php +++ b/src/FixedArrayFunctionsServiceProvider.php @@ -1,24 +1,16 @@ assertEquals($count, FixedArray::count($array)); }); -test('current returns the current array entry', function () { - if (PHP_VERSION_ID >= 80000) { - /** @phpstan-ignore-next-line */ - $this->markTestSkipped(LEGACY_SKIP_MSG); - } - - $test = 'test'; - $array = new SplFixedArray(1); - $array[0] = 'test'; - - /** @phpstan-ignore-next-line */ - $this->assertEquals($test, FixedArray::current($array)); -}); - test('from array creates a fixed array from a regular array', function () { $array = ['test']; $count = count($array); @@ -46,31 +30,6 @@ $this->assertEquals($count, FixedArray::getSize($array)); }); -test('key returns the current array index', function () { - if (PHP_VERSION_ID >= 80000) { - /** @phpstan-ignore-next-line */ - $this->markTestSkipped(LEGACY_SKIP_MSG); - } - - $array = new SplFixedArray(5); - - /** @phpstan-ignore-next-line */ - $this->assertEquals(0, FixedArray::key($array)); -}); - -test('next advances the internal pointer', function () { - if (PHP_VERSION_ID >= 80000) { - /** @phpstan-ignore-next-line */ - $this->markTestSkipped(LEGACY_SKIP_MSG); - } - - $array = new SplFixedArray(5); - FixedArray::next($array); - - /** @phpstan-ignore-next-line */ - $this->assertSame(1, FixedArray::key($array)); -}); - test('offset exists returns whether a given index is occupied', function () { $array = new SplFixedArray(5); FixedArray::offsetSet(4, 'test', $array); @@ -104,20 +63,6 @@ $this->assertSame($test, FixedArray::offsetGet($index, $array)); }); -test('rewind resets the internal pointer', function () { - if (PHP_VERSION_ID >= 80000) { - /** @phpstan-ignore-next-line */ - $this->markTestSkipped(LEGACY_SKIP_MSG); - } - - $array = new SplFixedArray(5); - FixedArray::next($array); - FixedArray::rewind($array); - - /** @phpstan-ignore-next-line */ - $this->assertSame(0, FixedArray::key($array)); -}); - test('set size increases the size of a fixed array', function () { $originalSize = 5; $array = new SplFixedArray($originalSize); @@ -145,16 +90,3 @@ /** @phpstan-ignore-next-line */ $this->assertEquals($test, head($convertedArray)); }); - -test('valid determines if there are any more remaining elements', function () { - if (PHP_VERSION_ID >= 80000) { - /** @phpstan-ignore-next-line */ - $this->markTestSkipped(LEGACY_SKIP_MSG); - } - - $array = new SplFixedArray(1); - FixedArray::next($array); - - /** @phpstan-ignore-next-line */ - $this->assertFalse(FixedArray::valid($array)); -}); diff --git a/tests/ArrayMethodTest.php b/tests/ArrayMethodTest.php index 38aaee9..81fd95b 100644 --- a/tests/ArrayMethodTest.php +++ b/tests/ArrayMethodTest.php @@ -65,7 +65,7 @@ test('filter removes items from an array that pass a given test', function () { $values = FixedArray::fromArray([1, 2, 3, 4, 5]); - $filtered = FixedArray::filter($values, static fn (int $value) => $value % 2 === 0); + $filtered = FixedArray::filter($values, static fn(int $value) => $value % 2 === 0); /** @phpstan-ignore-next-line */ $this->assertNotContains(1, $filtered); @@ -120,7 +120,7 @@ test('map applies a function to an array and returns it', function () { $array = FixedArray::fromArray([1, 2, 3, 4, 5]); - $mappedArray = FixedArray::map($array, static fn (int $item) => $item * 2); + $mappedArray = FixedArray::map($array, static fn(int $item) => $item * 2); foreach ($mappedArray as $index => $item) { /** @phpstan-ignore-next-line */ diff --git a/tests/TestCase.php b/tests/TestCase.php index c1a6c89..af5fc9d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,30 +2,22 @@ namespace Petrobolos\FixedArray\Tests; -use Illuminate\Database\Eloquent\Factories\Factory; use Orchestra\Testbench\TestCase as Orchestra; use Petrobolos\FixedArray\FixedArrayFunctionsServiceProvider; class TestCase extends Orchestra { - protected function setUp(): void + /** @inheritDoc */ + public function getEnvironmentSetUp($app): void { - parent::setUp(); - - Factory::guessFactoryNamesUsing( - static fn (string $modelName) => 'Petrobolos\\FixedArrayFunctions\\Database\\Factories\\' . class_basename($modelName).'Factory' - ); + config()->set('database.default', 'testing'); } + /** @inheritDoc */ protected function getPackageProviders($app): array { return [ FixedArrayFunctionsServiceProvider::class, ]; } - - public function getEnvironmentSetUp($app): void - { - config()->set('database.default', 'testing'); - } }