From ad7e0f96eeef4bb88ccf3d8f362f9ffa7acd70a5 Mon Sep 17 00:00:00 2001 From: AyrtonAndino <60512432+ayrtonandino@users.noreply.github.com> Date: Thu, 30 Apr 2026 10:32:19 -0300 Subject: [PATCH 01/10] Add autogenereted files to gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f631e3f..159c082 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /vendor composer.lock .phpunit* -.idea \ No newline at end of file +.idea +faker_mixin.php +packages.php From 6f7c88501ef7a3921103875693eba9d8b2cee3c1 Mon Sep 17 00:00:00 2001 From: AyrtonAndino <60512432+ayrtonandino@users.noreply.github.com> Date: Thu, 30 Apr 2026 10:49:08 -0300 Subject: [PATCH 02/10] update workflows actions --- .github/workflows/packagist-deploy.yml | 2 +- .github/workflows/tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/packagist-deploy.yml b/.github/workflows/packagist-deploy.yml index 6fea6b5..839045c 100644 --- a/.github/workflows/packagist-deploy.yml +++ b/.github/workflows/packagist-deploy.yml @@ -13,7 +13,7 @@ jobs: packages: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: mnavarrocarter/packagist-update@v1.0.0 with: username: "GautierDele" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9852101..4976e23 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -33,7 +33,7 @@ jobs: - name: Cache Composer packages id: composer-cache - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: vendor key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} From 6569723a2152b0e339bd48fc93c7ab613f327f3e Mon Sep 17 00:00:00 2001 From: AyrtonAndino <60512432+ayrtonandino@users.noreply.github.com> Date: Thu, 30 Apr 2026 11:03:04 -0300 Subject: [PATCH 03/10] allow reflection-docblock ^6.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 44b8615..3a2ffc4 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ ], "require": { "php": ">=8.3 <8.6", - "phpdocumentor/reflection-docblock": "^5.6", + "phpdocumentor/reflection-docblock": "^5.6|^6.0", "psr/container": "^2.0" }, "require-dev": { From 4d3ec80e7590fb0f63809fe243b4e1ed8cad9508 Mon Sep 17 00:00:00 2001 From: AyrtonAndino <60512432+ayrtonandino@users.noreply.github.com> Date: Thu, 30 Apr 2026 11:03:19 -0300 Subject: [PATCH 04/10] Update phpunit --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3a2ffc4..d440cea 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "psr/container": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^11" + "phpunit/phpunit": "^12.5.23" }, "autoload": { "psr-4": { @@ -54,6 +54,9 @@ ], "generate-mixin": [ "php -r 'require \"vendor/autoload.php\"; (new Xefi\\Faker\\Container\\Container());'" + ], + "test": [ + "php vendor/bin/phpunit --colors=always" ] } } From 4763d8635bfec4e7340912407e0efe7a706468d4 Mon Sep 17 00:00:00 2001 From: AyrtonAndino <60512432+ayrtonandino@users.noreply.github.com> Date: Thu, 30 Apr 2026 11:06:58 -0300 Subject: [PATCH 05/10] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d440cea..e5cd667 100644 --- a/composer.json +++ b/composer.json @@ -53,10 +53,10 @@ "composer run generate-mixin" ], "generate-mixin": [ - "php -r 'require \"vendor/autoload.php\"; (new Xefi\\Faker\\Container\\Container());'" + "@php -r 'require \"vendor/autoload.php\"; (new Xefi\\Faker\\Container\\Container());'" ], "test": [ - "php vendor/bin/phpunit --colors=always" + "@php vendor/bin/phpunit --colors=always" ] } } From b5394505d26eb9c62f43caf75ef20ceec29c5efe Mon Sep 17 00:00:00 2001 From: Ayrton Andino Bonazzola <60512432+ayrtonandino@users.noreply.github.com> Date: Thu, 30 Apr 2026 17:20:45 -0300 Subject: [PATCH 06/10] add optimize-autoloader and fix namespaces for psr4 --- README.md | 2 +- composer.json | 3 ++- tests/Unit/Extensions/GeographicalExtensionTest.php | 2 +- tests/Unit/LocaleTest.php | 10 ++++++---- tests/Unit/PackageManifestTest.php | 2 ++ tests/Unit/ProviderRepositoryTest.php | 2 ++ tests/Unit/Strategies/ValidStrategyTest.php | 2 +- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c762598..c810292 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You'll be able to generate fake data for your applications, making your test env Here is a quick look at what you can do: ```php -$faker = new Xefi\Faker\Faker(); +$faker = new \Xefi\Faker\Faker(); $faker->name() // John Doe $faker->name() // Charles Brown diff --git a/composer.json b/composer.json index e5cd667..32302d0 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ } }, "config": { + "optimize-autoloader": true, "sort-packages": true }, "extra": { @@ -53,7 +54,7 @@ "composer run generate-mixin" ], "generate-mixin": [ - "@php -r 'require \"vendor/autoload.php\"; (new Xefi\\Faker\\Container\\Container());'" + "@php -r \"require 'vendor/autoload.php'; (new Xefi\\Faker\\Container\\Container());\"" ], "test": [ "@php vendor/bin/phpunit --colors=always" diff --git a/tests/Unit/Extensions/GeographicalExtensionTest.php b/tests/Unit/Extensions/GeographicalExtensionTest.php index 7084a48..39c7672 100644 --- a/tests/Unit/Extensions/GeographicalExtensionTest.php +++ b/tests/Unit/Extensions/GeographicalExtensionTest.php @@ -1,6 +1,6 @@ assertEquals( 'fr_FR', $faker->returnLocale() @@ -68,7 +70,7 @@ public function testUsingDefaultLocale() public function testResettingLocale() { - $faker = new Xefi\Faker\Faker('fr_FR'); + $faker = new \Xefi\Faker\Faker('fr_FR'); $this->assertEquals( 'fr_FR', $faker->returnLocale() @@ -87,7 +89,7 @@ public function testResettingLocale() public function testUsingNotExistingLocaleFallingBackToNullLocale() { - $faker = new Xefi\Faker\Faker('not-existing-locale'); + $faker = new \Xefi\Faker\Faker('not-existing-locale'); $this->assertEquals( 'default', $faker->returnLocale() @@ -108,7 +110,7 @@ public function testUsingNotExistingLocaleWithoutNullLocale() $this->expectException(\Xefi\Faker\Exceptions\NoExtensionLocaleFound::class); $this->expectExceptionMessage('Locale \'not-existing-locale\' and \'default\' for method \'returnLocale\' was not found'); - $faker = new Xefi\Faker\Faker('not-existing-locale'); + $faker = new \Xefi\Faker\Faker('not-existing-locale'); $faker->returnLocale(); } } diff --git a/tests/Unit/PackageManifestTest.php b/tests/Unit/PackageManifestTest.php index a2b29dc..f3bbf0a 100644 --- a/tests/Unit/PackageManifestTest.php +++ b/tests/Unit/PackageManifestTest.php @@ -2,6 +2,8 @@ declare(strict_types=1); +namespace Xefi\Faker\Tests\Unit; + use Xefi\Faker\Manifests\PackageManifest; use Xefi\Faker\Tests\Unit\TestCase; diff --git a/tests/Unit/ProviderRepositoryTest.php b/tests/Unit/ProviderRepositoryTest.php index 33c73d0..73bf793 100644 --- a/tests/Unit/ProviderRepositoryTest.php +++ b/tests/Unit/ProviderRepositoryTest.php @@ -2,6 +2,8 @@ declare(strict_types=1); +namespace Xefi\Faker\Tests\Unit; + use Xefi\Faker\Tests\Unit\TestCase; final class ProviderRepositoryTest extends TestCase diff --git a/tests/Unit/Strategies/ValidStrategyTest.php b/tests/Unit/Strategies/ValidStrategyTest.php index b8dbd9e..0e44c28 100644 --- a/tests/Unit/Strategies/ValidStrategyTest.php +++ b/tests/Unit/Strategies/ValidStrategyTest.php @@ -1,6 +1,6 @@ Date: Thu, 30 Apr 2026 17:27:28 -0300 Subject: [PATCH 07/10] fix styleci errors --- tests/Unit/Extensions/GeographicalExtensionTest.php | 2 -- tests/Unit/PackageManifestTest.php | 1 - tests/Unit/ProviderRepositoryTest.php | 2 -- 3 files changed, 5 deletions(-) diff --git a/tests/Unit/Extensions/GeographicalExtensionTest.php b/tests/Unit/Extensions/GeographicalExtensionTest.php index 39c7672..6a24e2e 100644 --- a/tests/Unit/Extensions/GeographicalExtensionTest.php +++ b/tests/Unit/Extensions/GeographicalExtensionTest.php @@ -2,8 +2,6 @@ namespace Xefi\Faker\Tests\Unit\Extensions; -use Xefi\Faker\Tests\Unit\Extensions\TestCase; - final class GeographicalExtensionTest extends TestCase { public function testLatitude(): void diff --git a/tests/Unit/PackageManifestTest.php b/tests/Unit/PackageManifestTest.php index f3bbf0a..fc3e1e8 100644 --- a/tests/Unit/PackageManifestTest.php +++ b/tests/Unit/PackageManifestTest.php @@ -5,7 +5,6 @@ namespace Xefi\Faker\Tests\Unit; use Xefi\Faker\Manifests\PackageManifest; -use Xefi\Faker\Tests\Unit\TestCase; final class PackageManifestTest extends TestCase { diff --git a/tests/Unit/ProviderRepositoryTest.php b/tests/Unit/ProviderRepositoryTest.php index 73bf793..ab7cbc8 100644 --- a/tests/Unit/ProviderRepositoryTest.php +++ b/tests/Unit/ProviderRepositoryTest.php @@ -4,8 +4,6 @@ namespace Xefi\Faker\Tests\Unit; -use Xefi\Faker\Tests\Unit\TestCase; - final class ProviderRepositoryTest extends TestCase { public function testCreateProvider() From f54dfc988f9af5d79d5cd5dcb082944cf3193e62 Mon Sep 17 00:00:00 2001 From: AyrtonAndino <60512432+ayrtonandino@users.noreply.github.com> Date: Mon, 4 May 2026 10:20:35 -0300 Subject: [PATCH 08/10] lint workflow and add preferred-install to composer config --- .github/workflows/packagist-deploy.yml | 4 ++-- .github/workflows/tests.yml | 6 +++--- composer.json | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/packagist-deploy.yml b/.github/workflows/packagist-deploy.yml index 839045c..6dac033 100644 --- a/.github/workflows/packagist-deploy.yml +++ b/.github/workflows/packagist-deploy.yml @@ -2,7 +2,7 @@ name: Packagist Deploy on: release: - types: [created] + types: [ created ] jobs: build: @@ -17,4 +17,4 @@ jobs: - uses: mnavarrocarter/packagist-update@v1.0.0 with: username: "GautierDele" - api_token: ${{ secrets.PACKAGIST_TOKEN }} \ No newline at end of file + api_token: ${{ secrets.PACKAGIST_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4976e23..dbcd4ce 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: [ '8.3', '8.4', '8.5' ] + php-version: [ "8.3", "8.4", "8.5" ] name: Tests on PHP ${{ matrix.php-version }} @@ -42,7 +42,7 @@ jobs: - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer i --prefer-dist --no-progress + run: composer i --no-progress - name: Run test suite - run: vendor/bin/phpunit \ No newline at end of file + run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index 32302d0..8b2d81e 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ }, "config": { "optimize-autoloader": true, + "preferred-install": "dist", "sort-packages": true }, "extra": { From c3a69f0cb9aa25099362b0e9834a399a087e505a Mon Sep 17 00:00:00 2001 From: AyrtonAndino <60512432+ayrtonandino@users.noreply.github.com> Date: Mon, 4 May 2026 10:42:18 -0300 Subject: [PATCH 09/10] lint composer.json and add generate-mixin.php --- composer.json | 24 +++++++++++++++--------- scripts/generate-mixin.php | 16 ++++++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 scripts/generate-mixin.php diff --git a/composer.json b/composer.json index 8b2d81e..bb2903f 100644 --- a/composer.json +++ b/composer.json @@ -35,11 +35,6 @@ "Xefi\\Faker\\Tests\\": "tests/" } }, - "config": { - "optimize-autoloader": true, - "preferred-install": "dist", - "sort-packages": true - }, "extra": { "faker": { "providers": [ @@ -49,16 +44,27 @@ }, "scripts": { "post-install-cmd": [ - "composer run generate-mixin" + "@composer run generate-mixin" ], "post-update-cmd": [ - "composer run generate-mixin" + "@composer run generate-mixin" ], "generate-mixin": [ - "@php -r \"require 'vendor/autoload.php'; (new Xefi\\Faker\\Container\\Container());\"" + "@php scripts/generate-mixin.php" ], "test": [ "@php vendor/bin/phpunit --colors=always" ] - } + }, + "scripts-descriptions": { + "test": "Run the PHPUnit tests.", + "generate-mixin": "Generates the IDE mixin during package installation to enable autocompletion support." + }, + "config": { + "optimize-autoloader": true, + "preferred-install": "dist", + "sort-packages": true + }, + "minimum-stability": "stable", + "prefer-stable": true } diff --git a/scripts/generate-mixin.php b/scripts/generate-mixin.php new file mode 100644 index 0000000..cea355e --- /dev/null +++ b/scripts/generate-mixin.php @@ -0,0 +1,16 @@ + Date: Mon, 4 May 2026 10:46:04 -0300 Subject: [PATCH 10/10] fix styleci errors --- scripts/generate-mixin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generate-mixin.php b/scripts/generate-mixin.php index cea355e..9e77556 100644 --- a/scripts/generate-mixin.php +++ b/scripts/generate-mixin.php @@ -11,6 +11,6 @@ * when working with xefi/faker-php in their projects. */ -require __DIR__ . '/../vendor/autoload.php'; +require __DIR__.'/../vendor/autoload.php'; -new \Xefi\Faker\Container\Container; +new \Xefi\Faker\Container\Container();