From 08bd97a83ce482d1a72aa775ff848f292ee6da2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Mon, 24 Feb 2025 07:58:28 +0100 Subject: [PATCH] Enhancement: Synchronize with ergebnis/php-package-template --- .gitattributes | 2 - .github/CONTRIBUTING.md | 10 +- .github/dependabot.yaml | 4 +- .github/workflows/integrate.yaml | 3 - Makefile | 10 +- README.md | 1 - phpstan-baseline.neon | 77 +---- phpstan.neon | 2 + psalm-baseline.xml | 445 ---------------------------- psalm.xml | 28 -- src/FieldDefinition.php | 54 +--- src/FieldDefinition/Reference.php | 17 +- src/FieldDefinition/References.php | 17 +- src/FieldDefinition/Value.php | 14 +- src/FixtureFactory.php | 41 +-- test/DataProvider/ValueProvider.php | 2 +- test/Double/Faker/TrueGenerator.php | 7 + 17 files changed, 58 insertions(+), 676 deletions(-) delete mode 100644 psalm-baseline.xml delete mode 100644 psalm.xml diff --git a/.gitattributes b/.gitattributes index e690ab46..5cbe64ea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,6 +14,4 @@ /Makefile export-ignore /phpstan-baseline.neon export-ignore /phpstan.neon export-ignore -/psalm-baseline.xml export-ignore -/psalm.xml export-ignore /rector.php export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6b945639..bf512f36 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# CONTRIBUTING +# Contributing We use [GitHub Actions](https://github.com/features/actions) as a continuous integration system. @@ -96,7 +96,7 @@ to run a security analysis. ## Static Code Analysis -We use [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code. +We use [`phpstan/phpstan`](https://github.com/phpstan/phpstan) to statically analyze the code. Run @@ -106,7 +106,7 @@ make static-code-analysis to run a static code analysis. -We also use the baseline features of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline) and [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file). +We also use the baseline feature of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline). Run @@ -114,9 +114,9 @@ Run make static-code-analysis-baseline ``` -to regenerate the baselines in [`../phpstan-baseline.neon`](../phpstan-baseline.neon) and [`../psalm-baseline.xml`](../psalm-baseline.xml). +to regenerate the baseline in [`../phpstan-baseline.neon`](../phpstan-baseline.neon). -:exclamation: Ideally, the baselines should shrink over time. +:exclamation: Ideally, the baseline should shrink over time. ## Tests diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index fdebab6f..25218a77 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -14,7 +14,7 @@ updates: open-pull-requests-limit: 10 package-ecosystem: "composer" schedule: - interval: "daily" + interval: "weekly" versioning-strategy: "increase" - commit-message: @@ -26,4 +26,4 @@ updates: open-pull-requests-limit: 10 package-ecosystem: "github-actions" schedule: - interval: "daily" + interval: "weekly" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index d274a288..f0cd6b82 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -461,9 +461,6 @@ jobs: - name: "Run phpstan/phpstan" run: "vendor/bin/phpstan --ansi --configuration=phpstan.neon --memory-limit=-1" - - name: "Run vimeo/psalm" - run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4" - tests: name: "Tests" diff --git a/Makefile b/Makefile index fd22476d..28b46726 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY: it -it: refactoring coding-standards security-analysis static-code-analysis tests tests-example ## Runs the refactoring, coding-standards, security-analysis, static-code-analysis, tests, and tests-example targets +it: refactoring coding-standards security-analysis static-code-analysis-baseline tests tests-example ## Runs the refactoring, coding-standards, security-analysis, static-code-analysis, tests, and tests-example targets .PHONY: backward-compatibility-analysis backward-compatibility-analysis: vendor ## Runs a backward-compatibility analysis with roave/backward-compatibility-check @@ -46,18 +46,14 @@ security-analysis: vendor ## Runs a security analysis with composer composer audit .PHONY: static-code-analysis -static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm +static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon vendor/bin/phpstan --configuration=phpstan.neon --memory-limit=-1 - vendor/bin/psalm --config=psalm.xml --clear-cache - vendor/bin/psalm --config=psalm.xml --show-info=false --stats --threads=4 .PHONY: static-code-analysis-baseline -static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan and vimeo/psalm +static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon vendor/bin/phpstan --allow-empty-baseline --configuration=phpstan.neon --generate-baseline=phpstan-baseline.neon --memory-limit=-1 - vendor/bin/psalm --config=psalm.xml --clear-cache - vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml .PHONY: tests tests: vendor ## Runs unit and integration tests with phpunit/phpunit diff --git a/README.md b/README.md index 49a85cca..be9ff5e9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ [![Renew](https://github.com/ergebnis/factory-bot/workflows/Renew/badge.svg)](https://github.com/ergebnis/factory-bot/actions) [![Code Coverage](https://codecov.io/gh/ergebnis/factory-bot/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/factory-bot) -[![Type Coverage](https://shepherd.dev/github/ergebnis/factory-bot/coverage.svg)](https://shepherd.dev/github/ergebnis/factory-bot) [![Latest Stable Version](https://poser.pugx.org/ergebnis/factory-bot/v/stable)](https://packagist.org/packages/ergebnis/factory-bot) [![Total Downloads](https://poser.pugx.org/ergebnis/factory-bot/downloads)](https://packagist.org/packages/ergebnis/factory-bot) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 3b481925..1dd5ddee 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -119,7 +119,7 @@ parameters: path: example/src/Entity/User.php - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with array\\ will always evaluate to true\\.$#" + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with array will always evaluate to true\\.$#" count: 1 path: example/test/AutoReview/FixtureTest.php @@ -133,11 +133,6 @@ parameters: count: 1 path: src/EntityDefinition.php - - - message: "#^Strict comparison using \\!\\=\\= between array\\{\\} and array\\{\\} will always evaluate to false\\.$#" - count: 1 - path: src/EntityDefinition.php - - message: "#^Constructor in Ergebnis\\\\FactoryBot\\\\FieldDefinition\\\\Reference has parameter \\$fieldDefinitionOverrides with default value\\.$#" count: 1 @@ -149,7 +144,7 @@ parameters: path: src/FieldDefinition/References.php - - message: "#^Call to function is_array\\(\\) with array\\{cache\\?\\: array, cascade\\: array\\, declared\\?\\: class\\-string, fetch\\: mixed, fieldName\\: string, id\\?\\: bool, inherited\\?\\: class\\-string, indexBy\\?\\: string, \\.\\.\\.\\} will always evaluate to true\\.$#" + message: "#^Class Doctrine\\\\ORM\\\\Mapping\\\\AssociationMapping not found\\.$#" count: 1 path: src/FixtureFactory.php @@ -163,11 +158,6 @@ parameters: count: 1 path: src/FixtureFactory.php - - - message: "#^Method Ergebnis\\\\FactoryBot\\\\FixtureFactory\\:\\:createOne\\(\\) should return T but returns object\\.$#" - count: 1 - path: src/FixtureFactory.php - - message: "#^Method Ergebnis\\\\FactoryBot\\\\FixtureFactory\\:\\:define\\(\\) has parameter \\$afterCreate with a nullable type declaration\\.$#" count: 1 @@ -183,43 +173,18 @@ parameters: count: 1 path: src/FixtureFactory.php - - - message: "#^Parameter \\#1 \\$className of method Doctrine\\\\Instantiator\\\\Instantiator\\:\\:instantiate\\(\\) expects class\\-string\\, class\\-string\\ given\\.$#" - count: 2 - path: src/FixtureFactory.php - - - - message: "#^Parameter \\#1 \\$className of method Doctrine\\\\ORM\\\\EntityManagerInterface\\:\\:getClassMetadata\\(\\) expects class\\-string\\, class\\-string\\ given\\.$#" - count: 1 - path: src/FixtureFactory.php - - - - message: "#^Unable to resolve the template type T in call to method Doctrine\\\\Instantiator\\\\Instantiator\\:\\:instantiate\\(\\)$#" - count: 2 - path: src/FixtureFactory.php - - - - message: "#^Unable to resolve the template type T in call to method Doctrine\\\\ORM\\\\EntityManagerInterface\\:\\:getClassMetadata\\(\\)$#" - count: 1 - path: src/FixtureFactory.php - - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: src/FixtureFactory.php - - message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\DataProvider\\\\IntProvider\\:\\:faker\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 path: test/DataProvider/IntProvider.php - - message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\DataProvider\\\\ValueProvider\\:\\:faker\\(\\) is protected, but since the containing class is final, it can be private\\.$#" + message: "#^Generator expects value type array\\\\|bool\\|float\\|int\\|resource\\|stdClass\\|string, array\\ given\\.$#" count: 1 path: test/DataProvider/ValueProvider.php - - message: "#^PHPDoc tag @return contains unresolvable type\\.$#" + message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\DataProvider\\\\ValueProvider\\:\\:faker\\(\\) is protected, but since the containing class is final, it can be private\\.$#" count: 1 path: test/DataProvider/ValueProvider.php @@ -259,17 +224,12 @@ parameters: path: test/Double/Faker/MinimumGenerator.php - - message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\Double\\\\Faker\\\\TrueGenerator\\:\\:boolean\\(\\) has parameter \\$chanceOfGettingTrue with no type specified\\.$#" + message: "#^Parameter \\#1 \\$min \\(int\\) of method Ergebnis\\\\FactoryBot\\\\Test\\\\Double\\\\Faker\\\\TrueGenerator\\:\\:numberBetween\\(\\) should be contravariant with parameter \\$int1 \\(mixed\\) of method Faker\\\\Generator\\:\\:numberBetween\\(\\)$#" count: 1 path: test/Double/Faker/TrueGenerator.php - - message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\Double\\\\Faker\\\\TrueGenerator\\:\\:numberBetween\\(\\) has parameter \\$max with no type specified\\.$#" - count: 1 - path: test/Double/Faker/TrueGenerator.php - - - - message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\Double\\\\Faker\\\\TrueGenerator\\:\\:numberBetween\\(\\) has parameter \\$min with no type specified\\.$#" + message: "#^Parameter \\#2 \\$max \\(int\\) of method Ergebnis\\\\FactoryBot\\\\Test\\\\Double\\\\Faker\\\\TrueGenerator\\:\\:numberBetween\\(\\) should be contravariant with parameter \\$int2 \\(mixed\\) of method Faker\\\\Generator\\:\\:numberBetween\\(\\)$#" count: 1 path: test/Double/Faker/TrueGenerator.php @@ -514,12 +474,7 @@ parameters: path: test/Unit/Exception/InvalidSequenceTest.php - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Example\\\\\\\\Entity\\\\\\\\User' and Example\\\\Entity\\\\User will always evaluate to true\\.$#" - count: 2 - path: test/Unit/FieldDefinition/ReferenceTest.php - - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with array\\ will always evaluate to true\\.$#" + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with array will always evaluate to true\\.$#" count: 2 path: test/Unit/FieldDefinition/ReferencesTest.php @@ -530,31 +485,15 @@ parameters: - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Example\\\\\\\\Entity\\\\\\\\Organization' and Example\\\\Entity\\\\Organization will always evaluate to true\\.$#" - count: 3 - path: test/Unit/FixtureFactoryTest.php - - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Example\\\\\\\\Entity\\\\\\\\Project' and Example\\\\Entity\\\\Project will always evaluate to true\\.$#" count: 1 path: test/Unit/FixtureFactoryTest.php - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Example\\\\\\\\Entity\\\\\\\\Repository' and Example\\\\Entity\\\\Repository will always evaluate to true\\.$#" - count: 3 - path: test/Unit/FixtureFactoryTest.php - - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Example\\\\\\\\Entity\\\\\\\\User' and Example\\\\Entity\\\\User will always evaluate to true\\.$#" - count: 3 - path: test/Unit/FixtureFactoryTest.php - - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with Example\\\\Entity\\\\Organization will always evaluate to true\\.$#" - count: 2 + count: 1 path: test/Unit/FixtureFactoryTest.php - message: "#^Parameter \\#1 \\$className of method Ergebnis\\\\FactoryBot\\\\FixtureFactory\\:\\:define\\(\\) expects class\\-string\\, string given\\.$#" count: 1 path: test/Unit/FixtureFactoryTest.php - diff --git a/phpstan.neon b/phpstan.neon index 613e6a6c..76fccff1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -29,3 +29,5 @@ parameters: - rector.php tmpDir: .build/phpstan/ + + treatPhpDocTypesAsCertain: false diff --git a/psalm-baseline.xml b/psalm-baseline.xml deleted file mode 100644 index b8af2b00..00000000 --- a/psalm-baseline.xml +++ /dev/null @@ -1,445 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - members->toArray()]]> - repositories->toArray()]]> - ]]> - ]]> - - - - - - - - - - - - - - - - - - - - - - - - organizations->toArray()]]> - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - createOne( - $className, - $fieldDefinitionOverrides, - ); - }]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index ae7930c5..00000000 --- a/psalm.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/FieldDefinition.php b/src/FieldDefinition.php index cb608212..93a3e569 100644 --- a/src/FieldDefinition.php +++ b/src/FieldDefinition.php @@ -26,21 +26,12 @@ public static function optionalClosure(\Closure $closure): FieldDefinition\Optio } /** - * @phpstan-param class-string $className - * @phpstan-param array $fieldDefinitionOverrides - * - * @phpstan-return FieldDefinition\Reference - * - * @phpstan-template T - * - * @psalm-param class-string $className - * @psalm-param array $fieldDefinitionOverrides - * - * @psalm-return FieldDefinition\Reference - * - * @psalm-template T + * @template T of object * + * @param class-string $className * @param array $fieldDefinitionOverrides + * + * @return FieldDefinition\Reference */ public static function reference( string $className, @@ -53,12 +44,9 @@ public static function reference( } /** - * @phpstan-param class-string $className - * @phpstan-param array $fieldDefinitionOverrides - * - * @psalm-param class-string $className - * @psalm-param array $fieldDefinitionOverrides + * @template T of object * + * @param class-string $className * @param array $fieldDefinitionOverrides */ public static function optionalReference( @@ -72,22 +60,12 @@ public static function optionalReference( } /** - * @phpstan-param class-string $className - * - * @phpstan-return FieldDefinition\References - * - * @phpstan-param array $fieldDefinitionOverrides - * - * @phpstan-template T - * - * @psalm-param class-string $className - * @psalm-param array $fieldDefinitionOverrides - * - * @psalm-return FieldDefinition\References - * - * @psalm-template T + * @template T of object * + * @param class-string $className * @param array $fieldDefinitionOverrides + * + * @return FieldDefinition\References */ public static function references( string $className, @@ -125,17 +103,11 @@ public static function optionalSequence( } /** - * @phpstan-param T $value - * - * @phpstan-return FieldDefinition\Value - * - * @phpstan-template T - * - * @psalm-param T $value + * @template T of mixed * - * @psalm-return FieldDefinition\Value + * @param T $value * - * @psalm-template T + * @return FieldDefinition\Value */ public static function value(mixed $value): FieldDefinition\Value { diff --git a/src/FieldDefinition/Reference.php b/src/FieldDefinition/Reference.php index 9f909d1b..c967d149 100644 --- a/src/FieldDefinition/Reference.php +++ b/src/FieldDefinition/Reference.php @@ -19,19 +19,12 @@ /** * @internal * - * @phpstan-template T - * - * @psalm-template T + * @template T of object */ final class Reference implements Resolvable { /** - * @phpstan-param class-string $className - * @phpstan-param array $fieldDefinitionOverrides - * - * @psalm-param class-string $className - * @psalm-param array $fieldDefinitionOverrides - * + * @param class-string $className * @param array $fieldDefinitionOverrides */ public function __construct( @@ -41,11 +34,7 @@ public function __construct( } /** - * @phpstan-return T - * - * @psalm-return T - * - * @return object + * @return T */ public function resolve( Generator $faker, diff --git a/src/FieldDefinition/References.php b/src/FieldDefinition/References.php index 89db6748..7881e872 100644 --- a/src/FieldDefinition/References.php +++ b/src/FieldDefinition/References.php @@ -20,19 +20,12 @@ /** * @internal * - * @phpstan-template T - * - * @psalm-template T + * @template T of object */ final class References implements Resolvable { /** - * @phpstan-param class-string $className - * @phpstan-param array $fieldDefinitionOverrides - * - * @psalm-param class-string $className - * @psalm-param array $fieldDefinitionOverrides - * + * @param class-string $className * @param array $fieldDefinitionOverrides */ public function __construct( @@ -43,11 +36,7 @@ public function __construct( } /** - * @phpstan-return array - * - * @psalm-return list - * - * @return array + * @return list */ public function resolve( Generator $faker, diff --git a/src/FieldDefinition/Value.php b/src/FieldDefinition/Value.php index 1c307ea1..97bcb978 100644 --- a/src/FieldDefinition/Value.php +++ b/src/FieldDefinition/Value.php @@ -19,27 +19,19 @@ /** * @internal * - * @phpstan-template T - * - * @psalm-template T + * @template T of mixed */ final class Value implements Resolvable { /** - * @phpstan-param T $value - * - * @psalm-param T $value + * @param T $value */ public function __construct(private mixed $value) { } /** - * @phpstan-return T - * - * @psalm-return T - * - * @return mixed + * @return T */ public function resolve( Generator $faker, diff --git a/src/FixtureFactory.php b/src/FixtureFactory.php index e1699b81..0f271c0a 100644 --- a/src/FixtureFactory.php +++ b/src/FixtureFactory.php @@ -43,14 +43,9 @@ public function __construct( /** * Creates a definition for populating an entity with fake data. * - * @phpstan-param class-string $className - * - * @phpstan-template T - * - * @psalm-param class-string $className - * - * @psalm-template T + * @template T of object * + * @param class-string $className * @param array $fieldDefinitions * * @throws Exception\ClassMetadataNotFound @@ -190,24 +185,15 @@ public function register(EntityDefinitionProvider ...$providers): void /** * Creates a single entity with all of its dependencies. * - * @phpstan-param class-string $className - * - * @phpstan-return T - * - * @phpstan-template T - * - * @psalm-param class-string $className - * - * @psalm-return T - * - * @psalm-template T + * @template T of object * + * @param class-string $className * @param array $fieldDefinitionOverrides * * @throws Exception\EntityDefinitionNotRegistered * @throws Exception\InvalidFieldNames * - * @return object + * @return T */ public function createOne( string $className, @@ -277,23 +263,12 @@ public function createOne( /** * Creates an array of entities with all of their dependencies. * - * @phpstan-param class-string $className - * - * @phpstan-return array - * - * @phpstan-template T - * - * @psalm-param class-string $className - * - * @psalm-return list - * - * @psalm-template T + * @template T of object * + * @param class-string $className * @param array $fieldDefinitionOverrides * - * @throws Exception\EntityDefinitionNotRegistered - * - * @return array + * @return list */ public function createMany( string $className, diff --git a/test/DataProvider/ValueProvider.php b/test/DataProvider/ValueProvider.php index eb3f5376..18ab7f7b 100644 --- a/test/DataProvider/ValueProvider.php +++ b/test/DataProvider/ValueProvider.php @@ -20,7 +20,7 @@ final class ValueProvider use Test\Util\Helper; /** - * @return \Generator, bool, float, int, object, \stdClass, string>> + * @return \Generator|resource|\stdClass|string> */ public static function arbitrary(): \Generator { diff --git a/test/Double/Faker/TrueGenerator.php b/test/Double/Faker/TrueGenerator.php index 9965c665..35ae6c51 100644 --- a/test/Double/Faker/TrueGenerator.php +++ b/test/Double/Faker/TrueGenerator.php @@ -17,11 +17,18 @@ final class TrueGenerator extends Generator { + /** + * @param int $chanceOfGettingTrue + */ public function boolean($chanceOfGettingTrue = 50): bool { return true; } + /** + * @param int $min + * @param int $max + */ public function numberBetween($min = 0, $max = 2147483647): int { return \mt_rand(