From a7252a8fb086ea80c0dcba5be639f2933a7acb9f Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 17:55:02 +0100 Subject: [PATCH 01/18] feat: Replace Travis CI with GitHub Actions --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d5543f9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: PHP Test and Coverage + +on: + pull_request: + push: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + php: [ 7.2, 7.3 ] + include: + - php: 7.2 + coverage: yes + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, xml + coverage: ${{ matrix.coverage == 'yes' }} + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.composer/cache + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --prefer-source + + - name: Prepare test coverage (if applicable) + if: ${{ matrix.coverage == 'yes' }} + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + + - name: Run tests without coverage + if: ${{ matrix.coverage != 'yes' }} + run: composer test + + - name: Run tests with coverage + if: ${{ matrix.coverage == 'yes' }} + run: composer testc + + - name: Code checks + if: ${{ matrix.coverage == 'yes' }} + run: composer check-code + + - name: Upload test coverage (if applicable) + if: ${{ matrix.coverage == 'yes' }} + run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code ${{ steps.test.outcome }} From 1136b7d64bd830a1610fd34fd5cfba43ea5cd31c Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 18:00:00 +0100 Subject: [PATCH 02/18] feat: replace travis badge to GH Action --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d66eca..2b4a27a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # PHP Functional -[![Build Status](https://travis-ci.org/widmogrod/php-functional.svg)](https://travis-ci.org/widmogrod/php-functional) +![Build Status](https://github.com/widmogrod/php-functional/actions/workflows/ci.yml/badge.svg) [![Test Coverage](https://api.codeclimate.com/v1/badges/895bddc952aefca0d82a/test_coverage)](https://codeclimate.com/github/widmogrod/php-functional/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/895bddc952aefca0d82a/maintainability)](https://codeclimate.com/github/widmogrod/php-functional/maintainability) ## Introduction From 123608ab83bce7200bf08869652201bc2d5d490e Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:05:25 +0100 Subject: [PATCH 03/18] chore: update tests to newest version of PHPUnit and use Attribute --- example/ComplexErrorDrivenDevelopmentTest.php | 31 +++-- example/FreeBddStyleDSLTest.php | 4 +- example/FreeCalculatorTest.php | 41 +++---- example/FreeMonadTest.php | 11 +- example/FreeUnionTypeGeneratorTest.php | 2 - example/MaybeMonadAndCollectionTest.php | 15 +-- example/MaybeMonoidTest.php | 29 ++--- example/ParserTest.php | 57 ++++----- example/StateMonadTest.php | 11 +- test/Functional/ApplicatorTest.php | 24 ++-- test/Functional/ComposeTest.php | 16 +-- test/Functional/ConcatTest.php | 27 ++--- test/Functional/CurryNTest.php | 74 ++++++------ test/Functional/CurryTest.php | 57 ++++----- test/Functional/DropTest.php | 45 +++---- test/Functional/DropWhileTest.php | 31 +++-- test/Functional/FilterMTest.php | 19 ++- test/Functional/FilterTest.php | 19 ++- test/Functional/FlipTest.php | 33 +++--- test/Functional/FoldMTest.php | 23 ++-- test/Functional/HeadTest.php | 21 ++-- test/Functional/IdentityTest.php | 15 ++- test/Functional/InvokeTest.php | 12 +- test/Functional/JoinTest.php | 25 ++-- test/Functional/LengthTest.php | 15 ++- test/Functional/LiftM2Test.php | 11 +- test/Functional/PipeTest.php | 16 +-- test/Functional/PipelineTest.php | 16 +-- test/Functional/PushTest.php | 31 +++-- test/Functional/ReverseTest.php | 23 ++-- test/Functional/SpanTest.php | 57 +++++---- test/Functional/TailTest.php | 21 ++-- test/Functional/TakeTest.php | 43 ++++--- test/Functional/TeeTest.php | 21 ++-- test/Functional/UnzipTest.php | 16 ++- test/Functional/ValueOfTest.php | 35 +++--- test/Functional/ZipTest.php | 37 +++--- test/Monad/EitherTest.php | 71 ++++++----- test/Monad/FreeTest.php | 49 ++++---- test/Monad/IOTest.php | 53 ++++----- test/Monad/IdentityTest.php | 55 ++++----- test/Monad/MaybeTest.php | 111 +++++++++--------- test/Monad/ReaderTest.php | 59 +++++----- test/Monad/StateTest.php | 61 +++++----- test/Monad/WriterTest.php | 51 ++++---- test/Primitive/ListtTest.php | 57 ++++----- test/Primitive/ProductTest.php | 6 +- test/Primitive/StringgTest.php | 6 +- test/Primitive/SumTest.php | 7 +- test/Useful/MatchTest.php | 81 +++++++------ 50 files changed, 774 insertions(+), 877 deletions(-) diff --git a/example/ComplexErrorDrivenDevelopmentTest.php b/example/ComplexErrorDrivenDevelopmentTest.php index fb7aa2f..f678989 100644 --- a/example/ComplexErrorDrivenDevelopmentTest.php +++ b/example/ComplexErrorDrivenDevelopmentTest.php @@ -3,6 +3,7 @@ declare(strict_types=1); require_once 'vendor/autoload.php'; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; use Widmogrod\Monad\Either as E; @@ -89,9 +90,7 @@ function handleRequest(array $request) class ComplexErrorDrivenDevelopmentTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_be_prepared_of_errors(array $request, $isError, $expected) { $result = handleRequest($request); @@ -104,40 +103,40 @@ public function test_it_should_be_prepared_of_errors(array $request, $isError, $ $this->assertEquals($expected, f\valueOf($result)); } - public function provideData() + public static function provideData() { return [ 'success case' => [ - '$request' => [ + [ 'name' => 'Jone Doe', 'email' => 'test@example.com' ], - '$isError' => false, - '$expected' => ['status' => 200], + false, + ['status' => 200], ], 'username to short' => [ - '$request' => [ + [ 'name' => '', 'email' => 'test@example.com' ], - '$isError' => true, - '$expected' => ['error' => 'Request name is empty'], + true, + ['error' => 'Request name is empty'], ], 'username to long' => [ - '$request' => [ + [ 'name' => 'asd asdasdlaks askl djalskd jalskdjaslkdjasldjadsa asd', 'email' => 'test@example.com' ], - '$isError' => true, - '$expected' => ['error' => 'Request name is to long'], + true, + ['error' => 'Request name is to long'], ], 'email empty' => [ - '$request' => [ + [ 'name' => 'Jone Doe', 'email' => '' ], - '$isError' => true, - '$expected' => ['error' => 'Request e-mail is empty'], + true, + ['error' => 'Request e-mail is empty'], ], ]; } diff --git a/example/FreeBddStyleDSLTest.php b/example/FreeBddStyleDSLTest.php index f76a92d..8314a10 100644 --- a/example/FreeBddStyleDSLTest.php +++ b/example/FreeBddStyleDSLTest.php @@ -111,7 +111,6 @@ function then_(string $assertion): MonadFree return liftF(new Then($assertion, Pure::of('-then-'))); } - class Scenario { private $free; @@ -265,7 +264,8 @@ public function test_it_should_interpret_bdd_scenario() }, ]); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); + $this->assertArrayHasKey('productsCount', $result); $this->assertArrayHasKey('products', $result); diff --git a/example/FreeCalculatorTest.php b/example/FreeCalculatorTest.php index ca5c746..d8aad65 100644 --- a/example/FreeCalculatorTest.php +++ b/example/FreeCalculatorTest.php @@ -5,13 +5,14 @@ namespace example; use FunctionalPHP\FantasyLand\Functor; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Free\MonadFree; use Widmogrod\Monad\Free\Pure; use Widmogrod\Monad\Identity; use Widmogrod\Primitive\Stringg; use Widmogrod\Useful\PatternMatcher; -use function Widmogrod\Functional\compose; use function Widmogrod\Functional\bindM2; +use function Widmogrod\Functional\compose; use function Widmogrod\Monad\Free\foldFree; use function Widmogrod\Monad\Free\liftF; use function Widmogrod\Useful\matchPatterns; @@ -126,7 +127,6 @@ public function patternMatched(callable $fn) } } - class Square implements ExpF { private $a; @@ -279,55 +279,52 @@ function optimizeCalc(ExpF $f) class FreeCalculatorTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideCalculations - */ + #[DataProvider('provideCalculations')] public function test_example_with_do_notation($calc, $expected) { $result = foldFree(interpretInt, $calc, Identity::of); $this->assertEquals(Identity::of($expected), $result); } - public function provideCalculations() + public static function provideCalculations() { return [ '1' => [ - '$calc' => int(1), - '$expected' => 1, + int(1), + 1, ], '1 + 1' => [ - '$calc' => sum( + sum( int(1), int(1) ), - '$expected' => 2, + 2, ], '2 * 3' => [ - '$calc' => mul( + mul( int(2), int(3) ), - '$expected' => 6, + 6, ], '(1 + 1) * (2 * 3)' => [ - '$calc' => mul( + mul( sum(int(1), int(1)), mul( int(2), int(3) ) ), - '$expected' => 12, + 12, ], '(2 * 3) ^ 2' => [ - '$calc' => - square( - mul( - int(2), - int(3) - ) - ), - '$expected' => 36, + square( + mul( + int(2), + int(3) + ) + ), + 36, ], ]; } diff --git a/example/FreeMonadTest.php b/example/FreeMonadTest.php index 03ee04e..c1d110a 100644 --- a/example/FreeMonadTest.php +++ b/example/FreeMonadTest.php @@ -5,6 +5,7 @@ namespace example2; use FunctionalPHP\FantasyLand\Functor; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; use Widmogrod\Monad\Free as ff; use Widmogrod\Monad\Free\MonadFree; @@ -181,9 +182,7 @@ function echo_composition_() class FreeMonadTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideEchoImplementation - */ + #[DataProvider('provideEchoImplementation')] public function test_it_should_allow_to_interpret_as_a_state_monad(MonadFree $echo) { $result = ff\foldFree(interpretState, $echo, value); @@ -197,9 +196,7 @@ public function test_it_should_allow_to_interpret_as_a_state_monad(MonadFree $ec ])); } - /** - * @dataProvider provideEchoImplementation - */ + #[DataProvider('provideEchoImplementation')] public function test_it_should_allow_to_interpret_as_IO(MonadFree $echo) { $result = ff\foldFree(interpretIO, $echo, pure); @@ -210,7 +207,7 @@ public function test_it_should_allow_to_interpret_as_IO(MonadFree $echo) // $result->run(); } - public function provideEchoImplementation() + public static function provideEchoImplementation() { return [ 'echo implementation via explicit chaining (bind)' => [echo_chaining_()], diff --git a/example/FreeUnionTypeGeneratorTest.php b/example/FreeUnionTypeGeneratorTest.php index d31743b..da9c9ca 100644 --- a/example/FreeUnionTypeGeneratorTest.php +++ b/example/FreeUnionTypeGeneratorTest.php @@ -101,7 +101,6 @@ public function patternMatched(callable $fn) } } - class Derived_ implements UnionF { private $a; @@ -233,7 +232,6 @@ public function __construct(%s) { $constructorWithProps = count($args) ? $constructorWithProps : ''; - return Stringg::of(sprintf( "class %s implements %s { %s diff --git a/example/MaybeMonadAndCollectionTest.php b/example/MaybeMonadAndCollectionTest.php index fd35930..c0aa458 100644 --- a/example/MaybeMonadAndCollectionTest.php +++ b/example/MaybeMonadAndCollectionTest.php @@ -4,17 +4,16 @@ namespace example; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe; -use const Widmogrod\Monad\Maybe\maybeNull; use function Widmogrod\Monad\Maybe\just; use function Widmogrod\Monad\Maybe\nothing; +use const Widmogrod\Monad\Maybe\maybeNull; class MaybeMonadAndCollectionTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_extract_elements_which_exists($data) { // $get :: String a -> [b] -> Maybe b @@ -40,9 +39,7 @@ public function test_it_should_extract_elements_which_exists($data) ); } - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_extract_elements_which_exists_alternative_solution($data) { // $get :: String a -> Maybe [b] -> Maybe b @@ -66,11 +63,11 @@ public function test_it_should_extract_elements_which_exists_alternative_solutio ); } - public function provideData() + public static function provideData() { return [ 'default' => [ - '$data' => [ + [ ['id' => 1, 'meta' => ['images' => ['//first.jpg', '//second.jpg']]], ['id' => 2, 'meta' => ['images' => ['//third.jpg']]], ['id' => 3], diff --git a/example/MaybeMonoidTest.php b/example/MaybeMonoidTest.php index f75455e..d7dae04 100644 --- a/example/MaybeMonoidTest.php +++ b/example/MaybeMonoidTest.php @@ -2,20 +2,19 @@ declare(strict_types=1); +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Maybe; use Widmogrod\Primitive\Stringg; -use const Widmogrod\Monad\Maybe\maybeNull; use function Widmogrod\Functional\map; use function Widmogrod\Monad\Maybe\just; use function Widmogrod\Monad\Maybe\maybeNull; +use const Widmogrod\Monad\Maybe\maybeNull; class MaybeMonoidTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_concat_only_strings_and_skip_nulls(array $data, array $expected, string $asString) { $fullName = f\fromIterable($data) @@ -27,9 +26,7 @@ public function test_it_should_concat_only_strings_and_skip_nulls(array $data, a $this->assertEquals($fullName, just(Stringg::of($asString))); } - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_concat_only_just_values_naive_string_implementation(array $data, array $expected, string $asString) { // $makeMaybeMonoid :: string -> Maybe Stringg @@ -52,9 +49,7 @@ public function test_it_should_concat_only_just_values_naive_string_implementati $this->assertEquals($fullName, just(Stringg::of($asString))); } - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_concat_only_just_values_list_naive_implementation2(array $data, array $expected) { // $makeMaybeMonoid :: string -> Maybe Listt string @@ -77,26 +72,26 @@ public function test_it_should_concat_only_just_values_list_naive_implementation $this->assertEquals($fullName, just(f\fromIterable($expected))); } - public function provideData() + public static function provideData() { return [ 'array with null values' => [ - '$data' => [ + [ 'firstName' => 'First', 'middleName' => null, 'lastName' => 'Last' ], - '$expected' => ['First', 'Last'], - '$asString' => 'FirstLast', + ['First', 'Last'], + 'FirstLast', ], 'array with strings' => [ - '$data' => [ + [ 'firstName' => 'First', 'middleName' => 'Middle', 'lastName' => 'Last' ], - '$expected' => ['First', 'Middle', 'Last'], - '$asString' => 'FirstMiddleLast', + ['First', 'Middle', 'Last'], + 'FirstMiddleLast', ] ]; } diff --git a/example/ParserTest.php b/example/ParserTest.php index 4c749ff..669ce79 100644 --- a/example/ParserTest.php +++ b/example/ParserTest.php @@ -4,6 +4,7 @@ namespace example; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Identity; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Maybe; @@ -33,7 +34,6 @@ require_once __DIR__ . '/FreeCalculatorTest.php'; require_once __DIR__ . '/FreeUnionTypeGeneratorTest.php'; - /** * match :: Monoid a, Semigroup a, Setoid a => (a -> Bool) -> [a] -> Maybe (a, [a]) * numbers :: [a] -> Maybe (a, [a]) @@ -60,7 +60,7 @@ */ // match :: Monoid a, Semigroup a, Setoid a => (a -> a -> Bool) -> [a] -> Maybe (a, [a]) -function matchP(callable $predicate, Listt $a = null) +function matchP(callable $predicate, ?Listt $a = null) { return curryN(2, function (callable $predicate, Listt $a) { try { @@ -102,7 +102,7 @@ function numbersP(Listt $a) } // char :: Char -> [a] -> Maybe (a, [a]) -function charP(string $char, Listt $a = null) +function charP(string $char, ?Listt $a = null) { return curryN(2, function (string $char, Listt $a) { try { @@ -131,7 +131,7 @@ function maybeMapFirst(callable $fn) } // tokenize' :: ([a] -> Maybe (a, [a])) -> (a -> b) -> [a] -> Maybe (b, [a]) -function tokenizeP(callable $matcher, callable $transform = null, Listt $a = null) +function tokenizeP(callable $matcher, ?callable $transform = null, ?Listt $a = null) { return curryN(3, function (callable $matcher, callable $transform, Listt $a) { return bind(maybeMapFirst($transform), $matcher($a)); @@ -139,7 +139,7 @@ function tokenizeP(callable $matcher, callable $transform = null, Listt $a = nul } // allof' :: ([([a] -> Maybe (b, [a]))] -> ([b] -> b) -> [a] -> Maybe (b, [a]) -function allOfP(Listt $matchers, callable $transform = null, Listt $a = null) +function allOfP(Listt $matchers, ?callable $transform = null, ?Listt $a = null) { return curryN(3, function (Listt $matchers, callable $transform, Listt $a) { $result = reduce(function (?Maybe $b, callable $matcher) use ($a) { @@ -162,10 +162,9 @@ function allOfP(Listt $matchers, callable $transform = null, Listt $a = null) })(...func_get_args()); } - // many' :: ([([a] -> Maybe (b, [a]))] -> ([b] -> b) -> [a] -> Maybe (b, [a]) // Zero or more. -function manyP(Listt $matchers, callable $transform = null, Listt $a = null) +function manyP(Listt $matchers, ?callable $transform = null, ?Listt $a = null) { return curryN(3, function (Listt $matchers, callable $transform, Listt $a) { $res = fromNil(); @@ -192,7 +191,7 @@ function manyP(Listt $matchers, callable $transform = null, Listt $a = null) } // oneof' :: ([([a] -> Maybe b)] -> [a] -> Maybe b -function oneOfP(Listt $matchers, Listt $a = null) +function oneOfP(Listt $matchers, ?Listt $a = null) { return curryN(2, function (Listt $matchers, Listt $a) { $result = reduce(function (?Maybe $b, callable $matcher) use ($a) { @@ -208,7 +207,7 @@ function oneOfP(Listt $matchers, Listt $a = null) } // endByP :: ([a] -> Maybe b) -> ([a] -> Maybe b) -> [a] -> Maybe [b] -function endByP(callable $matcher, callable $matcherEnd = null, callable $transform = null, Listt $a = null) +function endByP(?callable $matcher, ?callable $matcherEnd = null, ?callable $transform = null, ?Listt $a = null) { return curryN(4, function (callable $matcher, callable $matcherEnd, callable $transform, Listt $a): Maybe { $before = fromNil(); @@ -250,7 +249,7 @@ function endByP(callable $matcher, callable $matcherEnd = null, callable $transf })(...func_get_args()); } -function maybeP(callable $matcher, Listt $a = null) +function maybeP(callable $matcher, ?Listt $a = null) { return curryN(2, function (callable $matcher, Listt $a) { $r = $matcher($a); @@ -261,9 +260,8 @@ function maybeP(callable $matcher, Listt $a = null) })(...func_get_args()); } - // lazyP :: ([a] -> Maybe b) -> [a] -> Maybe [b] -function lazyP(callable $fn, Listt $a = null) +function lazyP(callable $fn, ?Listt $a = null) { return curryN(2, function (callable $fn, Listt $a) { return $fn($a); @@ -456,7 +454,7 @@ public function test_integration_with_free_calc() public function test_generate_data_types_as_array() { // lexeme :: ([a] -> Maybe (a, [a])) -> [a] -> Maybe (a, [a]) - $lexeme = function (callable $fn, Listt $a = null) { + $lexeme = function (callable $fn, ?Listt $a = null) { return curryN(2, function (callable $fn, Listt $a) { // TODO Not optimal, for test only $trimNil = dropWhile(function (Stringg $s) { @@ -468,7 +466,7 @@ public function test_generate_data_types_as_array() }; // lexeme :: ([a] -> Maybe (a, [a])) -> [a] -> Maybe (a, [a]) - $lexeme2 = function (callable $fn, Listt $a = null) { + $lexeme2 = function (callable $fn, ?Listt $a = null) { return curryN(2, function (callable $fn, Listt $a) { $trimNil = dropWhile(function (Stringg $s) { return trim($s->extract(), " ") === ""; @@ -479,7 +477,7 @@ public function test_generate_data_types_as_array() }; // lexeme :: ([a] -> Maybe (a, [a])) -> [a] -> Maybe (a, [a]) - $lexemeOr = function (callable $fn, Listt $a = null) { + $lexemeOr = function (callable $fn, ?Listt $a = null) { return curryN(2, function (callable $fn, Listt $a) { $trimNil = dropWhile(function (Stringg $s) { return trim($s->extract(), " \0\n\t\r|") === ""; @@ -632,7 +630,7 @@ public function test_generate_data_types_as_array() public function buildParserForDataTypes() { // lexeme :: ([a] -> Maybe (a, [a])) -> [a] -> Maybe (a, [a]) - $lexeme = function (callable $fn, Listt $a = null) { + $lexeme = function (callable $fn, ?Listt $a = null) { return curryN(2, function (callable $fn, Listt $a) { // TODO Not optimal, for test only $trimNil = dropWhile(function (Stringg $s) { @@ -644,7 +642,7 @@ public function buildParserForDataTypes() }; // lexeme :: ([a] -> Maybe (a, [a])) -> [a] -> Maybe (a, [a]) - $lexeme2 = function (callable $fn, Listt $a = null) { + $lexeme2 = function (callable $fn, ?Listt $a = null) { return curryN(2, function (callable $fn, Listt $a) { $trimNil = dropWhile(function (Stringg $s) { return trim($s->extract(), " ") === ""; @@ -655,7 +653,7 @@ public function buildParserForDataTypes() }; // lexeme :: ([a] -> Maybe (a, [a])) -> [a] -> Maybe (a, [a]) - $lexemeOr = function (callable $fn, Listt $a = null) { + $lexemeOr = function (callable $fn, ?Listt $a = null) { return curryN(2, function (callable $fn, Listt $a) { $trimNil = dropWhile(function (Stringg $s) { return trim($s->extract(), " \0\n\t\r|") === ""; @@ -765,7 +763,6 @@ public function buildParserForDataTypes() return declaree($declaration, fromValue($derived)); }); - $expression = manyP(fromIterable([ $declarationDerived, $declaration, @@ -776,9 +773,7 @@ public function buildParserForDataTypes() return $expression; } - /** - * @dataProvider provideGeneratedCode - */ + #[DataProvider('provideGeneratedCode')] public function test_generate_data_types_as_free_string(string $input, string $expectedFileContents) { $tokens = tokens($input); @@ -794,24 +789,24 @@ public function test_generate_data_types_as_free_string(string $input, string $e $this->assertEquals($expected, $generated); } - public function provideGeneratedCode() + public static function provideGeneratedCode() { return [ 'data A = B deriving (Show)' => [ - '$declaration' => 'data A = B deriving (Show)', - '$toImplementation' => 'A.txt', + 'data A = B deriving (Show)', + 'A.txt', ], 'data Maybe a = Just a | Nothing' => [ - '$declaration' => 'data Maybe a = Just a | Nothing', - '$toImplementation' => 'Maybe.txt', + 'data Maybe a = Just a | Nothing', + 'Maybe.txt', ], 'data Either a b = Left a | Right b' => [ - '$declaration' => 'data Either a b = Left a | Right b', - '$toImplementation' => 'Either.txt', + 'data Either a b = Left a | Right b', + 'Either.txt', ], 'data FreeT f a = Pure a | Free f (FreeT f a)' => [ - '$declaration' => 'data FreeT f a = Pure a | Free f (FreeT f a)', - '$toImplementation' => 'FreeT.txt', + 'data FreeT f a = Pure a | Free f (FreeT f a)', + 'FreeT.txt', ], ]; } diff --git a/example/StateMonadTest.php b/example/StateMonadTest.php index db5b779..d7366fa 100644 --- a/example/StateMonadTest.php +++ b/example/StateMonadTest.php @@ -4,6 +4,7 @@ namespace example; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Maybe; use Widmogrod\Monad\State as S; @@ -21,7 +22,7 @@ public function get($key); /** * @param string $key - * @param mixed $value + * @param mixed $value * * @return self */ @@ -90,9 +91,7 @@ function retrieveRelated($productName) class StateMonadTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_demonstrate_state_monad($expectedProducts) { $initialState = new InMemoryCache([]); @@ -113,11 +112,11 @@ public function test_demonstrate_state_monad($expectedProducts) $this->assertSame($outputState1, $outputState2); } - public function provideData() + public static function provideData() { return [ 'default' => [ - '$expectedProducts' => ['iPhone 5', 'iPhone 6s'], + ['iPhone 5', 'iPhone 6s'], ], ]; } diff --git a/test/Functional/ApplicatorTest.php b/test/Functional/ApplicatorTest.php index a2142ff..d09869b 100644 --- a/test/Functional/ApplicatorTest.php +++ b/test/Functional/ApplicatorTest.php @@ -4,44 +4,42 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use function Widmogrod\Functional\applicator; class ApplicatorTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_apply_value_as_a_argument_to_a_function( $value, callable $fn, $expected - ) { + ) + { $this->assertSame( $expected, applicator($value, $fn) ); } - /** - * @expectedException \ArgumentCountError - * @expectedExceptionMessage Too few arguments to function - */ - public function test_it_should_fail_when_function_requires_more_argumetns() + public function test_it_should_fail_when_function_requires_more_arguments() { + $this->expectException(\ArgumentCountError::class); + $this->expectExceptionMessage('Too few arguments to function'); applicator(1, function (int $i, string $a): int { return 10 + $i; }); } - public function provideData() + public static function provideData() { return [ 'Single value function' => [ - '$value' => 133, - '$fn' => function (int $i): int { + 133, + function (int $i): int { return 10 + $i; }, - '$expected' => 143, + 143, ], ]; } diff --git a/test/Functional/ComposeTest.php b/test/Functional/ComposeTest.php index 4108e6f..13c5365 100644 --- a/test/Functional/ComposeTest.php +++ b/test/Functional/ComposeTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class ComposeTest extends \PHPUnit\Framework\TestCase @@ -13,14 +14,13 @@ public function test_it_should_retun_function_accepting_arguments() $this->assertInstanceOf(\Closure::class, f\compose('strtolower', 'strtoupper')); } - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_be_curried( $functions, $value, $expected - ) { + ) + { $fn = f\compose(...$functions); $this->assertEquals( $expected, @@ -28,13 +28,13 @@ public function test_it_should_be_curried( ); } - public function provideData() + public static function provideData() { return [ 'two function' => [ - '$functions' => ['strtolower', 'strtoupper'], - '$value' => 'aBcD', - '$expected' => 'abcd' + ['strtolower', 'strtoupper'], + 'aBcD', + 'abcd' ], ]; } diff --git a/test/Functional/ConcatTest.php b/test/Functional/ConcatTest.php index 3e652cb..7d40482 100644 --- a/test/Functional/ConcatTest.php +++ b/test/Functional/ConcatTest.php @@ -4,15 +4,14 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Nothing; class ConcatTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_concat_values_to_array( $value, $expected @@ -20,18 +19,18 @@ public function test_it_should_concat_values_to_array( $this->assertEquals($expected, f\concat($value)); } - public function provideData() + public static function provideData() { return [ 'list of lists' => [ - '$array' => f\fromIterable([ + f\fromIterable([ f\fromIterable(['a', 1, 3]), f\fromIterable(['b', 2, 4]) ]), - '$expected' => f\fromIterable(['a', 1, 3, 'b', 2, 4]), + f\fromIterable(['a', 1, 3, 'b', 2, 4]), ], 'list of lists of lists' => [ - '$array' => f\fromIterable([ + f\fromIterable([ f\fromIterable([ f\fromIterable(['a', 1]), f\fromIterable(['b', 2]) @@ -40,21 +39,21 @@ public function provideData() f\fromIterable(['c', 3]) ]), ]), - '$expected' => f\fromIterable([ + f\fromIterable([ f\fromIterable(['a', 1]), f\fromIterable(['b', 2]), f\fromIterable(['c', 3]) ]), ], 'list of lists of lists with some noregulatives' => [ - '$array' => f\fromIterable([ + f\fromIterable([ f\fromIterable([ f\fromIterable(['a', 1]), f\fromIterable(['b', 2]), ]), f\fromIterable(['c', 3]) ]), - '$expected' => f\fromIterable([ + f\fromIterable([ f\fromIterable(['a', 1]), f\fromIterable(['b', 2]), 'c', @@ -62,12 +61,12 @@ public function provideData() ]), ], 'Just of lists' => [ - '$array' => Just::of(f\fromIterable(['a', 1, 3])), - '$expected' => f\fromIterable(['a', 1, 3]), + Just::of(f\fromIterable(['a', 1, 3])), + f\fromIterable(['a', 1, 3]), ], 'Nothing of lists' => [ - '$array' => Nothing::mempty(), - '$expected' => f\fromNil() + Nothing::mempty(), + f\fromNil() ], ]; } diff --git a/test/Functional/CurryNTest.php b/test/Functional/CurryNTest.php index 7980c6d..886cebb 100644 --- a/test/Functional/CurryNTest.php +++ b/test/Functional/CurryNTest.php @@ -4,22 +4,22 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class CurryNTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideArgumentsWithFunctions - */ + #[DataProvider('provideArgumentsWithFunctions')] public function test_it_should_return_function_event_if_function_not_accept_arguments( $numberOfArguments, $function, $default - ) { - $this->assertInternalType('callable', f\curryN($numberOfArguments, $function, $default)); + ) + { + $this->assertIsCallable( f\curryN($numberOfArguments, $function, $default)); } - public function provideArgumentsWithFunctions() + public static function provideArgumentsWithFunctions() { $function = function ($a, $b, $c) { return sprintf('should not return value (%s, %s, %s)', $a, $b, $c); @@ -27,55 +27,52 @@ public function provideArgumentsWithFunctions() return [ 'curry N = 0' => [ - '$numberOfArguments' => 0, - '$function' => $function, - '$default' => [], + 0, + $function, + [], ], 'curry with default arguments for non argument curry' => [ - '$numberOfArguments' => 0, - '$function' => $function, - '$default' => ['test'], + 0, + $function, + ['test'], ], 'curry one' => [ - '$numberOfArguments' => 1, - '$function' => $function, - '$default' => [], + 1, + $function, + [], ], 'curry with one argument binded' => [ - '$numberOfArguments' => 1, - '$function' => $function, - '$default' => ['test'], + 1, + $function, + ['test'], ], ]; } - /** - * @dataProvider provideCurriedSumFunction - */ + #[DataProvider('provideCurriedSumFunction')] public function test_it_should_evaluate_curried_function_if_number_of_arguments_is_fulfilled( callable $curriedSum - ) { + ) + { $this->assertSame(3, $curriedSum(1, 2)); } - /** - * @dataProvider provideCurriedSumFunction - */ + #[DataProvider('provideCurriedSumFunction')] public function test_it_should_be_able_to_curry_multiple_times( callable $curriedSum - ) { + ) + { $addOne = $curriedSum(1); $this->assertSame(2, $addOne(1)); $this->assertSame(3, $addOne(2)); $this->assertSame(4, $addOne(3)); } - /** - * @dataProvider provideCurriedSumFunction - */ + #[DataProvider('provideCurriedSumFunction')] public function test_it_should_be_able_to_curry_few_variants_and_evaluate_them( callable $curriedSum - ) { + ) + { $addOne = $curriedSum(1); $addTwo = $curriedSum(2); @@ -86,36 +83,35 @@ public function test_it_should_be_able_to_curry_few_variants_and_evaluate_them( $this->assertSame(7, $addTwo(5)); } - public function provideCurriedSumFunction() + public static function provideCurriedSumFunction() { return [ 'curried sum' => [ - '$curriedSum' => f\curryN(2, function ($a, $b) { + f\curryN(2, function ($a, $b) { return $a + $b; }) ], 'curried sum with predefined value' => [ - '$curriedSum' => f\curryN(2, function ($x, $y, $a, $b) { + f\curryN(2, function ($x, $y, $a, $b) { return ($a - $x) - ($y - $b); }, [1, -1]) ] ]; } - /** - * @dataProvider provideCurriedReturnArgsFunction - */ + #[DataProvider('provideCurriedReturnArgsFunction')] public function test_it_should_be_able_to_curry_even_if_more_arguments_is_applied( callable $returnArgs - ) { + ) + { $this->assertSame([1, 2, 3], $returnArgs(1, 2, 3)); } - public function provideCurriedReturnArgsFunction() + public static function provideCurriedReturnArgsFunction() { return [ 'curried' => [ - '$returnArgs' => f\curryN(2, function () { + f\curryN(2, function () { return func_get_args(); }) ] diff --git a/test/Functional/CurryTest.php b/test/Functional/CurryTest.php index 58b9811..aa8b852 100644 --- a/test/Functional/CurryTest.php +++ b/test/Functional/CurryTest.php @@ -4,13 +4,12 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class CurryTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideFunctionToCurry - */ + #[DataProvider('provideFunctionToCurry')] public function test_it_should_detect_automatically_number_of_arguments_to_curry( $fn, $resultAfterCurries @@ -32,35 +31,33 @@ public function test_it_should_detect_automatically_number_of_arguments_to_curry ); } - public function provideFunctionToCurry() + public static function provideFunctionToCurry() { return [ 'args = 0' => [ - '$fn' => function () { + function () { }, - '$resultAfterCurries' => 1, + 1, ], 'args = 1' => [ - '$fn' => function ($a) { + function ($a) { }, - '$resultAfterCurries' => 1, + 1, ], 'args = 2' => [ - '$fn' => function ($a, $b) { + function ($a, $b) { }, - '$resultAfterCurries' => 2, + 2, ], 'args = 2 with default' => [ - '$fn' => function ($a, $b = null) { + function ($a, $b = null) { }, - '$resultAfterCurries' => 2, + 2, ], ]; } - /** - * @dataProvider provideFunctionsToCurry - */ + #[DataProvider('provideFunctionsToCurry')] public function test_it_curry_with_lest_arguments_if_defaults_are_provided( $result, $function @@ -71,44 +68,42 @@ public function test_it_curry_with_lest_arguments_if_defaults_are_provided( ); } - public function provideFunctionsToCurry() + public static function provideFunctionsToCurry() { return [ 'curry args = 0 and default = 0' => [ - '$result' => null, - '$function' => f\curry(function () { + null, + f\curry(function () { }, []) ], 'curry args = 1 and default = 1' => [ - '$result' => [1], - '$function' => f\curry(function ($a) { + [1], + f\curry(function ($a) { return [$a]; }, [1]) ], 'curry args = 2 and default = 2' => [ - '$result' => [1, 2], - '$function' => f\curry(function ($a, $b) { + [1, 2], + f\curry(function ($a, $b) { return [$a, $b]; }, [1, 2]) ], 'curry args = 2 and default = 3' => [ - '$result' => [1, 2, 3], - '$function' => f\curry(function ($a) { + [1, 2, 3], + f\curry(function ($a) { return func_get_args(); }, [1, 2, 3]) ], 'curry args = 2 and default = 4' => [ - '$result' => [1, 2], - '$function' => f\curry(function ($a, $b) { + [1, 2], + f\curry(function ($a, $b) { return [$a, $b]; }, [1, 2, 3, 4]) ], ]; } - /** - * @dataProvider provideCallablesToTest - */ + #[DataProvider('provideCallablesToTest')] public function test_it_curry_every_type_of_callable(callable $callable) { $curried = f\curry($callable); @@ -118,7 +113,7 @@ public function test_it_curry_every_type_of_callable(callable $callable) $this->assertSame([1, 2], $curried(1)(2)); } - public function provideCallablesToTest() + public static function provideCallablesToTest() { return [ 'closure' => [ @@ -153,7 +148,7 @@ public static function staticMethod($a, $b) } } -namespace test\Functional\inner; +namespace test\Functional\inner; function my_named_function($a, $b) { diff --git a/test/Functional/DropTest.php b/test/Functional/DropTest.php index e0f75fe..d9889a2 100644 --- a/test/Functional/DropTest.php +++ b/test/Functional/DropTest.php @@ -4,21 +4,22 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\drop; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; -class DropTest extends \PHPUnit\Framework\TestCase +class DropTest extends TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it( Listt $a, - int $n, + int $n, Listt $expected - ) { + ) + { $result = drop($n, $a); $r = print_r($result->extract(), true); @@ -30,33 +31,33 @@ public function test_it( ); } - public function provideData() + public static function provideData() { return [ 'should return empty list from when input is empty list' => [ - '$a' => fromNil(), - '$n' => 1, - '$expected' => fromNil(), + fromNil(), + 1, + fromNil(), ], 'should provided list when n is zero' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => 0, - '$expected' => fromIterable([1, 2, 3, 4, 5]), + fromIterable([1, 2, 3, 4, 5]), + 0, + fromIterable([1, 2, 3, 4, 5]), ], 'should provided list when n is negative' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => random_int(-1000, -1), - '$expected' => fromIterable([1, 2, 3, 4, 5]), + fromIterable([1, 2, 3, 4, 5]), + random_int(-1000, -1), + fromIterable([1, 2, 3, 4, 5]), ], 'should return part of finite list' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => 3, - '$expected' => fromIterable([4, 5]), + fromIterable([1, 2, 3, 4, 5]), + 3, + fromIterable([4, 5]), ], 'should return nil list when drop more than in the list' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => 3000, - '$expected' => fromNil(), + fromIterable([1, 2, 3, 4, 5]), + 3000, + fromNil(), ], ]; } diff --git a/test/Functional/DropWhileTest.php b/test/Functional/DropWhileTest.php index 8b7471e..de9a934 100644 --- a/test/Functional/DropWhileTest.php +++ b/test/Functional/DropWhileTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\dropWhile; use function Widmogrod\Functional\fromIterable; @@ -12,9 +13,7 @@ class DropWhileTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it( Listt $a, callable $fn, @@ -31,28 +30,28 @@ public function test_it( ); } - public function provideData() + public static function provideData() { return [ 'should return empty list from when input is empty list' => [ - '$a' => fromNil(), - '$fn' => lt(3), - '$expected' => fromNil(), + fromNil(), + lt(3), + fromNil(), ], 'should provided list when < 100' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$fn' => lt(100), - '$expected' => fromIterable([]), + fromIterable([1, 2, 3, 4, 5]), + lt(100), + fromIterable([]), ], 'should return part of finite list' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$fn' => lt(4), - '$expected' => fromIterable([4, 5]), + fromIterable([1, 2, 3, 4, 5]), + lt(4), + fromIterable([4, 5]), ], 'should return nil list when drop more than in the list' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$fn' => lt(400), - '$expected' => fromNil(), + fromIterable([1, 2, 3, 4, 5]), + lt(400), + fromNil(), ], ]; } diff --git a/test/Functional/FilterMTest.php b/test/Functional/FilterMTest.php index 7727dc8..77723b5 100644 --- a/test/Functional/FilterMTest.php +++ b/test/Functional/FilterMTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use function Widmogrod\Functional\filterM; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; @@ -11,9 +12,7 @@ class FilterMTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_filter_with_maybe( $list, $expected @@ -28,20 +27,20 @@ public function test_it_should_filter_with_maybe( ); } - public function provideData() + public static function provideData() { return [ 'simple list' => [ - '$list' => fromIterable([1, 2, 3, 4, 5]), - '$expected' => just(fromIterable([1, 3, 5])) + fromIterable([1, 2, 3, 4, 5]), + just(fromIterable([1, 3, 5])) ], 'empty list' => [ - '$list' => fromNil(), - '$expected' => fromNil() + fromNil(), + fromNil() ], 'traversable' => [ - '$list' => fromIterable(new \ArrayIterator([1, 2, 3, 4, 5])), - '$expected' => just(fromIterable([1, 3, 5])), + fromIterable(new \ArrayIterator([1, 2, 3, 4, 5])), + just(fromIterable([1, 3, 5])), ], ]; } diff --git a/test/Functional/FilterTest.php b/test/Functional/FilterTest.php index 1f21dcf..205f18f 100644 --- a/test/Functional/FilterTest.php +++ b/test/Functional/FilterTest.php @@ -4,15 +4,14 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use function Widmogrod\Functional\filter; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; class FilterTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_filter_with_maybe( $list, $expected @@ -27,20 +26,20 @@ public function test_it_should_filter_with_maybe( ); } - public function provideData() + public static function provideData() { return [ 'simple list' => [ - '$list' => fromIterable([1, 2, 3, 4, 5]), - '$expected' => fromIterable([1, 3, 5]) + fromIterable([1, 2, 3, 4, 5]), + fromIterable([1, 3, 5]) ], 'empty list' => [ - '$list' => fromNil(), - '$expected' => fromNil() + fromNil(), + fromNil() ], 'traversable' => [ - '$list' => fromIterable(new \ArrayIterator([1, 2, 3, 4, 5])), - '$expected' => fromIterable([1, 3, 5]), + fromIterable(new \ArrayIterator([1, 2, 3, 4, 5])), + fromIterable([1, 3, 5]), ], ]; } diff --git a/test/Functional/FlipTest.php b/test/Functional/FlipTest.php index 297ab1a..8369591 100644 --- a/test/Functional/FlipTest.php +++ b/test/Functional/FlipTest.php @@ -4,13 +4,12 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class FlipTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideFunctions - */ + #[DataProvider('provideFunctions')] public function test_it_should_flip_func_arguments( callable $func, array $args, @@ -24,29 +23,27 @@ public function test_it_should_flip_func_arguments( ); } - public function provideFunctions() + public static function provideFunctions() { return [ 'two arguments' => [ - '$func' => function ($a, $b) { + function ($a, $b) { return [$a, $b]; }, - '$args' => [1, 2], - '$expected' => [2, 1] + [1, 2], + [2, 1] ], 'three arguments' => [ - '$func' => function ($a, $b, $c) { + function ($a, $b, $c) { return [$a, $b, $c]; }, - '$args' => [1, 2, 3], - '$expected' => [2, 1, 3] + [1, 2, 3], + [2, 1, 3] ], ]; } - /** - * @dataProvider provideFunctionsWithNotEnoughArgs - */ + #[DataProvider('provideFunctionsWithNotEnoughArgs')] public function test_it_should_curry_if_not_enough_args_passed( callable $func, array $args @@ -59,20 +56,20 @@ public function test_it_should_curry_if_not_enough_args_passed( ); } - public function provideFunctionsWithNotEnoughArgs() + public static function provideFunctionsWithNotEnoughArgs() { return [ 'two arguments' => [ - '$func' => function ($a, $b) { + function ($a, $b) { return [$a, $b]; }, - '$args' => [], + [], ], 'three arguments' => [ - '$func' => function ($a, $b, $c) { + function ($a, $b, $c) { return [$a, $b, $c]; }, - '$args' => [1], + [1], ], ]; } diff --git a/test/Functional/FoldMTest.php b/test/Functional/FoldMTest.php index 1d26ae5..3a47304 100644 --- a/test/Functional/FoldMTest.php +++ b/test/Functional/FoldMTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use function Widmogrod\Functional\foldM; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; @@ -12,9 +13,7 @@ class FoldMTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_work_with_maybe( $list, $expected @@ -28,24 +27,24 @@ public function test_it_should_work_with_maybe( ); } - public function provideData() + public static function provideData() { return [ 'just' => [ - '$list' => fromIterable([1, 3, 5, 7]), - '$expected' => just(16) + fromIterable([1, 3, 5, 7]), + just(16) ], 'nothing' => [ - '$list' => fromIterable([1, 3, 42, 7]), - '$expected' => nothing(), + fromIterable([1, 3, 42, 7]), + nothing(), ], 'empty array' => [ - '$list' => fromNil(), - '$expected' => fromNil(), + fromNil(), + fromNil(), ], 'traversable' => [ - '$list' => fromIterable(new \ArrayIterator([1, 3, 5, 7])), - '$expected' => just(16) + fromIterable(new \ArrayIterator([1, 3, 5, 7])), + just(16) ], ]; } diff --git a/test/Functional/HeadTest.php b/test/Functional/HeadTest.php index d9acf4a..15d0363 100644 --- a/test/Functional/HeadTest.php +++ b/test/Functional/HeadTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; @@ -11,9 +12,7 @@ class HeadTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Listt $listt, $expected @@ -24,26 +23,24 @@ public function test_it_should_return_boxed_value( ); } - public function provideData() + public static function provideData() { return [ 'Should return head from finite array' => [ - '$listt' => fromIterable([1, 2, 3]), - '$expected' => 1, + fromIterable([1, 2, 3]), + 1, ], 'Should return head from finite iterator' => [ - '$listt' => fromIterable(new \ArrayIterator([1, 2, 3])), - '$expected' => 1, + fromIterable(new \ArrayIterator([1, 2, 3])), + 1, ], ]; } - /** - * @expectedException \Widmogrod\Primitive\EmptyListError - * @expectedExceptionMessage Cannot call head() on empty list - */ public function test_it_should_throw_exception_when_list_is_empty() { + $this->expectException(\Widmogrod\Primitive\EmptyListError::class); + $this->expectExceptionMessage('Cannot call head() on empty list'); head(fromNil()); } } diff --git a/test/Functional/IdentityTest.php b/test/Functional/IdentityTest.php index ec88c06..2e88b09 100644 --- a/test/Functional/IdentityTest.php +++ b/test/Functional/IdentityTest.php @@ -4,33 +4,32 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class IdentityTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_given_value( $value ) { $this->assertEquals($value, f\identity($value)); } - public function provideData() + public static function provideData() { return [ 'integer' => [ - '$value' => 1, + 1, ], 'string' => [ - '$value' => 'bar', + 'bar', ], 'list' => [ - '$value' => ['bar', 'baz'], + ['bar', 'baz'], ], 'map' => [ - '$value' => ['x' => 'bar', 'y' => 'baz'], + ['x' => 'bar', 'y' => 'baz'], ], ]; } diff --git a/test/Functional/InvokeTest.php b/test/Functional/InvokeTest.php index aee204e..eff3362 100644 --- a/test/Functional/InvokeTest.php +++ b/test/Functional/InvokeTest.php @@ -4,13 +4,12 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class InvokeTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it($method, $input, $output) { $curried = f\invoke($method); @@ -18,13 +17,16 @@ public function test_it($method, $input, $output) $this->assertEquals($output, $curried($input)); } - public function provideData() + public static function provideData() { return [ - 'should return value from method' => ['getString', $this, 'this-is-my-string'] + 'should return value from method' => ['getString', new InvokeTest2, 'this-is-my-string'] ]; } +} +class InvokeTest2 +{ public function getString() { return 'this-is-my-string'; diff --git a/test/Functional/JoinTest.php b/test/Functional/JoinTest.php index 03657cb..5d03621 100644 --- a/test/Functional/JoinTest.php +++ b/test/Functional/JoinTest.php @@ -5,6 +5,7 @@ namespace test\Functional; use FunctionalPHP\FantasyLand\Monad; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Identity; use Widmogrod\Monad\State; use const Widmogrod\Functional\identity; @@ -14,9 +15,7 @@ class JoinTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_remove_one_level_of_monadic_structure( Monad $monad, callable $run, @@ -26,23 +25,23 @@ public function test_it_should_remove_one_level_of_monadic_structure( $this->assertEquals($expected, $run($result)); } - public function provideData() + public static function provideData() { return [ 'Just (Just 1)' => [ - '$monad' => just(just(1)), - '$run' => identity, - '$value' => just(1), + just(just(1)), + identity, + just(1), ], 'Identity (Identity 1)' => [ - '$monad' => Identity::of(Identity::of(2)), - '$run' => identity, - '$value' => Identity::of(2), + Identity::of(Identity::of(2)), + identity, + Identity::of(2), ], 'State (State 1)' => [ - '$monad' => State\put(State\put(3)), - '$run' => flip(State\execState, 0), - '$value' => State\put(3), + State\put(State\put(3)), + flip(State\execState, 0), + State\put(3), ], ]; } diff --git a/test/Functional/LengthTest.php b/test/Functional/LengthTest.php index 3cc8709..ef1f264 100644 --- a/test/Functional/LengthTest.php +++ b/test/Functional/LengthTest.php @@ -5,15 +5,14 @@ namespace test\Functional; use FunctionalPHP\FantasyLand\Foldable; +use PHPUnit\Framework\Attributes\DataProvider; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Functional\length; class LengthTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Foldable $t, int $expected @@ -21,17 +20,17 @@ public function test_it_should_return_boxed_value( $this->assertEquals(length($t), ($expected)); } - public function provideData() + public static function provideData() { return [ 'Empty list should have length 0' => [ - '$t' => fromNil(), - '$expected' => 0, + fromNil(), + 0, ], 'Finite list should have length' => [ - '$t' => fromIterable([1, 2, 3, 4]), - '$expected' => 4, + fromIterable([1, 2, 3, 4]), + 4, ], ]; } diff --git a/test/Functional/LiftM2Test.php b/test/Functional/LiftM2Test.php index 2a18425..96d1270 100644 --- a/test/Functional/LiftM2Test.php +++ b/test/Functional/LiftM2Test.php @@ -5,6 +5,7 @@ namespace test\Functional; use FunctionalPHP\FantasyLand\Monad; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Common\ValueOfInterface; use Widmogrod\Functional as f; use Widmogrod\Monad\Either; @@ -13,9 +14,7 @@ class LiftM2Test extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider monadsProvider - */ + #[DataProvider('monadsProvider')] public function test_it_should_lift2M( Monad $ma, Monad $mb, @@ -31,14 +30,14 @@ public function test_it_should_lift2M( } } - public function monadsProvider() + public static function monadsProvider() { $sumIntegers = static function (int $a, int $b) { return $a + $b; }; $sameValueOf = f\curryN(2, function ($expected, ValueOfInterface $actual) { - $this->assertSame($expected, f\valueOf($actual)); + self::assertSame($expected, f\valueOf($actual)); }); return [ @@ -105,7 +104,7 @@ public function monadsProvider() $sumIntegers, IO::class, function (IO $io) { - $this->assertSame(3, $io->run()); + self::assertSame(3, $io->run()); } ] ]; diff --git a/test/Functional/PipeTest.php b/test/Functional/PipeTest.php index c1c07f6..69b23e2 100644 --- a/test/Functional/PipeTest.php +++ b/test/Functional/PipeTest.php @@ -4,31 +4,31 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class PipeTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_compose_and_inject_input_correctly( $functions, $value, $expected - ) { + ) + { $this->assertEquals( $expected, f\pipe($value, ...$functions) ); } - public function provideData() + public static function provideData() { return [ 'two function' => [ - '$functions' => ['strtolower', 'strtoupper'], - '$value' => 'aBcD', - '$expected' => 'ABCD' + ['strtolower', 'strtoupper'], + 'aBcD', + 'ABCD' ], ]; } diff --git a/test/Functional/PipelineTest.php b/test/Functional/PipelineTest.php index 1c0534e..ff7d89e 100644 --- a/test/Functional/PipelineTest.php +++ b/test/Functional/PipelineTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class PipelineTest extends \PHPUnit\Framework\TestCase @@ -13,14 +14,13 @@ public function test_it_should_retun_function_accepting_arguments() $this->assertInstanceOf(\Closure::class, f\pipeline('strtolower', 'strtoupper')); } - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_be_curried( $functions, $value, $expected - ) { + ) + { $fn = f\pipeline(...$functions); $this->assertEquals( $expected, @@ -28,13 +28,13 @@ public function test_it_should_be_curried( ); } - public function provideData() + public static function provideData() { return [ 'two function' => [ - '$functions' => ['strtolower', 'strtoupper'], - '$value' => 'aBcD', - '$expected' => 'ABCD' + ['strtolower', 'strtoupper'], + 'aBcD', + 'ABCD' ], ]; } diff --git a/test/Functional/PushTest.php b/test/Functional/PushTest.php index 462e1e6..3a156cc 100644 --- a/test/Functional/PushTest.php +++ b/test/Functional/PushTest.php @@ -4,13 +4,12 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class PushTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_append_array_with_array_values( $array, $value, @@ -19,28 +18,28 @@ public function test_it_should_append_array_with_array_values( $this->assertEquals($expected, f\push_($array, $value)); } - public function provideData() + public static function provideData() { return [ 'list' => [ - '$array' => ['foo'], - '$value' => ['bar', 'baz'], - '$expected' => ['foo', 'bar', 'baz'], + ['foo'], + ['bar', 'baz'], + ['foo', 'bar', 'baz'], ], 'map' => [ - '$array' => ['foo'], - '$value' => ['x' => 'bar', 'y' => 'baz'], - '$expected' => ['foo', 'bar', 'baz'], + ['foo'], + ['x' => 'bar', 'y' => 'baz'], + ['foo', 'bar', 'baz'], ], 'empty array' => [ - '$array' => ['foo'], - '$value' => [], - '$expected' => ['foo'], + ['foo'], + [], + ['foo'], ], 'list with null' => [ - '$array' => ['foo'], - '$value' => [null], - '$expected' => ['foo', null], + ['foo'], + [null], + ['foo', null], ], ]; } diff --git a/test/Functional/ReverseTest.php b/test/Functional/ReverseTest.php index 9174ed7..bb4cfbe 100644 --- a/test/Functional/ReverseTest.php +++ b/test/Functional/ReverseTest.php @@ -4,13 +4,12 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use function Widmogrod\Functional\reverse; class ReverseTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_create_function_that_accept_args_in_reverse_order( callable $function, array $args @@ -30,26 +29,26 @@ public function test_it_should_create_function_that_accept_args_in_reverse_order ); } - public function provideData() + public static function provideData() { return [ 'non argument function' => [ - '$function' => function () { + function () { return 1; }, - '$value' => [], + [], ], 'non argument function but with args' => [ - '$function' => function () { + function () { return 1; }, - '$value' => [1, 2, 3], + [1, 2, 3], ], 'many args' => [ - '$function' => function ($a, $b, $c, $d) { + function ($a, $b, $c, $d) { return ($a - $c) * pow($b, $d); }, - '$value' => [ + [ random_int(-10, 10), random_int(-10, 10), random_int(-10, 10), @@ -57,10 +56,10 @@ public function provideData() ], ], 'variadic args' => [ - '$function' => function (...$args) { + function (...$args) { return array_product($args); }, - '$value' => [ + [ random_int(-10, 10), random_int(-10, 10), random_int(-10, 10), diff --git a/test/Functional/SpanTest.php b/test/Functional/SpanTest.php index 40003fd..92bf0f1 100644 --- a/test/Functional/SpanTest.php +++ b/test/Functional/SpanTest.php @@ -5,6 +5,7 @@ namespace test\Functional; use Eris\TestTrait; +use PHPUnit\Framework\Attributes\DataProvider; use function Widmogrod\Functional\constt; use function Widmogrod\Functional\fromNil; use Widmogrod\Primitive\Listt; @@ -15,9 +16,7 @@ class SpanTest extends \PHPUnit\Framework\TestCase { use TestTrait; - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_spanned_list( callable $predicate, Listt $xs, @@ -41,7 +40,7 @@ public function test_it_should_return_spanned_list( ); } - public function provideData() + public static function provideData() { $lessThanTwo = function ($x) { return $x < 2; @@ -49,38 +48,38 @@ public function provideData() return [ 'span on empty list should be tuple of empty lists' => [ - '$predicate' => $lessThanTwo, - '$xs' => fromNil(), - '$expected' => [fromNil(), fromNil()], + $lessThanTwo, + fromNil(), + [fromNil(), fromNil()], ], 'span on finite list should be tuple of lists' => [ - '$predicate' => $lessThanTwo, - '$xs' => fromIterable([0, 1, 2, 3, 4]), - '$expected' => [fromIterable([0, 1]), fromIterable([2, 3, 4])], + $lessThanTwo, + fromIterable([0, 1, 2, 3, 4]), + [fromIterable([0, 1]), fromIterable([2, 3, 4])], ], 'span on finite list when predicate is always false should be:' => [ - '$predicate' => constt(false), - '$xs' => fromIterable([0, 1, 2, 3, 4]), - '$expected' => [fromNil(), fromIterable([0, 1, 2, 3, 4])], + constt(false), + fromIterable([0, 1, 2, 3, 4]), + [fromNil(), fromIterable([0, 1, 2, 3, 4])], ], 'span on finite list when predicate is always true should be:' => [ - '$predicate' => constt(true), - '$xs' => fromIterable([0, 1, 2, 3, 4]), - '$expected' => [fromIterable([0, 1, 2, 3, 4]), fromNil()], + constt(true), + fromIterable([0, 1, 2, 3, 4]), + [fromIterable([0, 1, 2, 3, 4]), fromNil()], ], ]; } -// -// public function test_it_should_work_on_infinite_lists() -// { -// $this->forAll( -// Generator\choose(1, 100), -// Generator\string(), -// Generator\string() -// )->then(function ($n, $a, $b) { -// $list = take($n, zip(repeat($a), repeat($b))); -// -// $this->assertEquals($n, length(filter(eql([$a, $b]), $list))); -// }); -// } + // + // public function test_it_should_work_on_infinite_lists() + // { + // $this->forAll( + // Generator\choose(1, 100), + // Generator\string(), + // Generator\string() + // )->then(function ($n, $a, $b) { + // $list = take($n, zip(repeat($a), repeat($b))); + // + // $this->assertEquals($n, length(filter(eql([$a, $b]), $list))); + // }); + // } } diff --git a/test/Functional/TailTest.php b/test/Functional/TailTest.php index 4b13e7c..b71418b 100644 --- a/test/Functional/TailTest.php +++ b/test/Functional/TailTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; @@ -11,9 +12,7 @@ class TailTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Listt $listt, Listt $expected @@ -21,26 +20,24 @@ public function test_it_should_return_boxed_value( $this->assertTrue(tail($listt)->equals($expected)); } - public function provideData() + public static function provideData() { return [ 'Should return tail from finite array' => [ - '$listt' => fromIterable([1, 2, 3]), - '$expected' => fromIterable([2, 3]), + fromIterable([1, 2, 3]), + fromIterable([2, 3]), ], 'Should return tail from finite iterator' => [ - '$listt' => fromIterable(new \ArrayIterator([1, 2, 3, 4, 5, 6])), - '$expected' => fromIterable([2, 3, 4, 5, 6]), + fromIterable(new \ArrayIterator([1, 2, 3, 4, 5, 6])), + fromIterable([2, 3, 4, 5, 6]), ], ]; } - /** - * @expectedException \Widmogrod\Primitive\EmptyListError - * @expectedExceptionMessage Cannot call tail() on empty list - */ public function test_it_should_throw_exception_when_list_is_empty() { + $this->expectException(\Widmogrod\Primitive\EmptyListError::class); + $this->expectExceptionMessage('Cannot call tail() on empty list'); tail(fromNil()); } } diff --git a/test/Functional/TakeTest.php b/test/Functional/TakeTest.php index c226edd..2fbbd27 100644 --- a/test/Functional/TakeTest.php +++ b/test/Functional/TakeTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; @@ -12,9 +13,7 @@ class TakeTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it( Listt $a, int $n, @@ -31,38 +30,38 @@ public function test_it( ); } - public function provideData() + public static function provideData() { return [ 'should return empty list from when input is empty list' => [ - '$a' => fromNil(), - '$n' => 1, - '$expected' => fromNil(), + fromNil(), + 1, + fromNil(), ], 'should empty list when n is zero' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => 0, - '$expected' => fromNil(), + fromIterable([1, 2, 3, 4, 5]), + 0, + fromNil(), ], 'should empty list when n is negative' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => random_int(-1000, -1), - '$expected' => fromNil(), + fromIterable([1, 2, 3, 4, 5]), + random_int(-1000, -1), + fromNil(), ], 'should return part of finite list' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => 3, - '$expected' => fromIterable([1, 2, 3]), + fromIterable([1, 2, 3, 4, 5]), + 3, + fromIterable([1, 2, 3]), ], 'should return whole list when take more than in the list' => [ - '$a' => fromIterable([1, 2, 3, 4, 5]), - '$n' => 3000, - '$expected' => fromIterable([1, 2, 3, 4, 5]), + fromIterable([1, 2, 3, 4, 5]), + 3000, + fromIterable([1, 2, 3, 4, 5]), ], 'should return part of infinite list' => [ - '$a' => repeat('a'), - '$n' => 3, - '$expected' => fromIterable(['a', 'a', 'a']), + repeat('a'), + 3, + fromIterable(['a', 'a', 'a']), ], ]; } diff --git a/test/Functional/TeeTest.php b/test/Functional/TeeTest.php index 7469a7d..a662397 100644 --- a/test/Functional/TeeTest.php +++ b/test/Functional/TeeTest.php @@ -4,39 +4,38 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; class TeeTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_be_curried( $function, $value - ) { + ) + { $curried = f\tee($function); $this->assertEquals($value, $curried($value)); } - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_input_value( $function, $value - ) { + ) + { $this->assertEquals($value, f\tee($function, $value)); } - public function provideData() + public static function provideData() { return [ 'add two' => [ - '$function' => function ($v) { + function ($v) { return 2 + $v; }, - '$value' => 1, + 1, ], ]; } diff --git a/test/Functional/UnzipTest.php b/test/Functional/UnzipTest.php index 8e57674..9b06958 100644 --- a/test/Functional/UnzipTest.php +++ b/test/Functional/UnzipTest.php @@ -6,6 +6,7 @@ use Eris\Generator; use Eris\TestTrait; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\eql; use function Widmogrod\Functional\filter; @@ -20,9 +21,7 @@ class UnzipTest extends \PHPUnit\Framework\TestCase { use TestTrait; - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_zipped_list( Listt $a, array $expected @@ -30,25 +29,24 @@ public function test_it_should_return_zipped_list( [$a, $b] = unzip($a); [$ea, $eb] = $expected; - $this->assertTrue($a->equals($ea)); $this->assertTrue($b->equals($eb)); } - public function provideData() + public static function provideData() { return [ 'unzipping of empty lists should be an tuple of empty lists' => [ - '$a' => fromNil(), - '$expected' => [fromNil(), fromNil()], + fromNil(), + [fromNil(), fromNil()], ], 'unzipping of lists should be an tuple of lists' => [ - '$a' => fromIterable([ + fromIterable([ [1, 'a'], [2, 'b'], [3, 'c'], ]), - '$expected' => [fromIterable([1, 2, 3]), fromIterable(['a', 'b', 'c'])], + [fromIterable([1, 2, 3]), fromIterable(['a', 'b', 'c'])], ], ]; } diff --git a/test/Functional/ValueOfTest.php b/test/Functional/ValueOfTest.php index 093c7ca..9c62b8a 100644 --- a/test/Functional/ValueOfTest.php +++ b/test/Functional/ValueOfTest.php @@ -4,6 +4,7 @@ namespace test\Functional; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Identity; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\valueOf; @@ -12,9 +13,7 @@ class ValueOfTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_boxed_value( $value, $expected @@ -25,36 +24,36 @@ public function test_it_should_return_boxed_value( ); } - public function provideData() + public static function provideData() { return [ 'Native int should be return as is' => [ - '$value' => 1023, - '$expected' => 1023, + 1023, + 1023, ], 'Native string should be return as is' => [ - '$value' => 'Something amazing', - '$expected' => 'Something amazing', + 'Something amazing', + 'Something amazing', ], 'Native array should be return as is' => [ - '$value' => [1, 2, 3], - '$expected' => [1, 2, 3], + [1, 2, 3], + [1, 2, 3], ], 'Identity 6' => [ - '$value' => Identity::of(6), - '$expected' => 6 + Identity::of(6), + 6 ], 'Just 6' => [ - '$value' => just(6), - '$expected' => 6 + just(6), + 6 ], 'Nothing' => [ - '$value' => nothing(), - '$expected' => null + nothing(), + null ], 'Listt' => [ - '$value' => fromIterable([1, 2, 3]), - '$expected' => [1, 2, 3] + fromIterable([1, 2, 3]), + [1, 2, 3] ], ]; } diff --git a/test/Functional/ZipTest.php b/test/Functional/ZipTest.php index 1b49416..fc2f1e8 100644 --- a/test/Functional/ZipTest.php +++ b/test/Functional/ZipTest.php @@ -6,6 +6,7 @@ use Eris\Generator; use Eris\TestTrait; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\eql; use function Widmogrod\Functional\filter; @@ -20,9 +21,7 @@ class ZipTest extends \PHPUnit\Framework\TestCase { use TestTrait; - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_it_should_return_zipped_list( Listt $a, Listt $b, @@ -39,37 +38,37 @@ public function test_it_should_return_zipped_list( ); } - public function provideData() + public static function provideData() { return [ 'zipping of two empty lists should be an empty list' => [ - '$a' => fromNil(), - '$b' => fromNil(), - '$expected' => fromNil(), + fromNil(), + fromNil(), + fromNil(), ], 'zipping of two lists when left is an empty list' => [ - '$a' => fromNil(), - '$b' => fromIterable([1, 2, 3, 4]), - '$expected' => fromNil(), + fromNil(), + fromIterable([1, 2, 3, 4]), + fromNil(), ], 'zipping of two lists when right is an empty list' => [ - '$a' => fromIterable([1, 2, 3, 4]), - '$b' => fromNil(), - '$expected' => fromNil(), + fromIterable([1, 2, 3, 4]), + fromNil(), + fromNil(), ], 'zipping of two lists when left is shorter list' => [ - '$a' => fromIterable([1, 2, 3]), - '$b' => fromIterable(['a', 'b', 'c', 'd']), - '$expected' => fromIterable([ + fromIterable([1, 2, 3]), + fromIterable(['a', 'b', 'c', 'd']), + fromIterable([ [1, 'a'], [2, 'b'], [3, 'c'] ]), ], 'zipping of two lists when right is shorter list' => [ - '$a' => fromIterable([1, 2, 3, 4]), - '$b' => fromIterable(['a', 'b', 'c']), - '$expected' => fromIterable([ + fromIterable([1, 2, 3, 4]), + fromIterable(['a', 'b', 'c']), + fromIterable([ [1, 'a'], [2, 'b'], [3, 'c'] diff --git a/test/Monad/EitherTest.php b/test/Monad/EitherTest.php index 12579b5..c520b49 100644 --- a/test/Monad/EitherTest.php +++ b/test/Monad/EitherTest.php @@ -6,6 +6,7 @@ use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; @@ -16,9 +17,7 @@ class EitherTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_maybe_monad_obeys_the_laws($return, $f, $g, $x) { MonadLaws::test( @@ -30,36 +29,34 @@ public function test_if_maybe_monad_obeys_the_laws($return, $f, $g, $x) ); } - public function provideData() + public static function provideData() { return [ 'Right' => [ - '$return' => Right::of, - '$f' => function ($x) { + Right::of, + function ($x) { return Right::of($x + 1); }, - '$g' => function ($x) { + function ($x) { return Right::of($x + 2); }, - '$x' => 10, + 10, ], // I don't know if Left should be tested? 'Left' => [ - '$return' => Left::of, - '$f' => function ($x) { + Left::of, + function ($x) { return Left::of($x); }, - '$g' => function ($x) { + function ($x) { return Left::of($x); }, - '$x' => 10, + 10, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -79,47 +76,45 @@ public function test_it_should_obey_applicative_laws( ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'Right' => [ - '$pure' => Either\pure, - '$u' => Right::of(function () { + Either\pure, + Right::of(function () { return 1; }), - '$v' => Right::of(function () { + Right::of(function () { return 5; }), - '$w' => Right::of(function () { + Right::of(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return $x + 400; }, - '$x' => 33 + 33 ], 'Left' => [ - '$pure' => Either\pure, - '$u' => Left::of(function () { + Either\pure, + Left::of(function () { return 1; }), - '$v' => Left::of(function () { + Left::of(function () { return 5; }), - '$w' => Left::of(function () { + Left::of(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return $x + 400; }, - '$x' => 33 + 33 ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, @@ -133,26 +128,26 @@ public function test_it_should_obey_functor_laws( ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'Right' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => Right::of(1), + Right::of(1), ], 'Left' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => Left::of(1), + Left::of(1), ], ]; } diff --git a/test/Monad/FreeTest.php b/test/Monad/FreeTest.php index 00373c0..a930cb3 100644 --- a/test/Monad/FreeTest.php +++ b/test/Monad/FreeTest.php @@ -9,6 +9,7 @@ use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Free\MonadFree; use Widmogrod\Monad\Free\Pure; use Widmogrod\Monad\Identity; @@ -19,9 +20,7 @@ class FreeTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, @@ -41,33 +40,31 @@ function (MonadFree $a, MonadFree $b, $message) { ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'Pure' => [ - '$f' => function (int $x) { + function (int $x) { return $x + 1; }, - '$g' => function (int $x) { + function (int $x) { return $x + 5; }, - '$x' => Pure::of(1), + Pure::of(1), ], 'Free' => [ - '$f' => function (int $x) { + function (int $x) { return $x + 1; }, - '$g' => function (int $x) { + function (int $x) { return $x + 5; }, - '$x' => liftF(Pure::of(1)), + liftF(Pure::of(1)), ], ]; } - /** - * @dataProvider provideMonadTestData - */ + #[DataProvider('provideMonadTestData')] public function test_it_should_obey_monad_laws($f, $g, $x) { MonadLaws::test( @@ -85,7 +82,7 @@ function (MonadFree $f, MonadFree $g, $message) { ); } - public function provideMonadTestData() + public static function provideMonadTestData() { $addOne = function (int $x) { return Pure::of($x + 1); @@ -96,16 +93,14 @@ public function provideMonadTestData() return [ 'Identity' => [ - '$f' => $addOne, - '$g' => $addTwo, - '$x' => 10, + $addOne, + $addTwo, + 10, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -131,24 +126,24 @@ function (MonadFree $a, MonadFree $b, $message) { ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'Pure' => [ - '$pure' => Pure::of, - '$u' => Pure::of(function () { + Pure::of, + Pure::of(function () { return 1; }), - '$v' => Pure::of(function () { + Pure::of(function () { return 5; }), - '$w' => Pure::of(function () { + Pure::of(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return 400 + $x; }, - '$x' => 33 + 33 ], ]; } diff --git a/test/Monad/IOTest.php b/test/Monad/IOTest.php index f39c642..3c71c9f 100644 --- a/test/Monad/IOTest.php +++ b/test/Monad/IOTest.php @@ -6,17 +6,16 @@ use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; -use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; +use PHPUnit\Framework\Attributes\DataProvider; +use Widmogrod\Functional as f; use Widmogrod\Monad\IO; class IOTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_io_monad_obeys_the_laws($f, $g, $x) { MonadLaws::test( @@ -38,7 +37,7 @@ function ($x) { ); } - public function provideData() + public static function provideData() { $addOne = function ($x) { return IO::of(function () use ($x) { @@ -53,16 +52,14 @@ public function provideData() return [ 'Identity' => [ - '$f' => $addOne, - '$g' => $addTwo, - '$x' => 10, + $addOne, + $addTwo, + 10, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -70,7 +67,8 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) { + ) + { ApplicativeLaws::test( function (IO $a, IO $b, $message) { $this->assertEquals( @@ -88,36 +86,35 @@ function (IO $a, IO $b, $message) { ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'IO' => [ - '$pure' => IO\pure, - '$u' => IO\pure(function () { + IO\pure, + IO\pure(function () { return 1; }), - '$v' => IO\pure(function () { + IO\pure(function () { return 5; }), - '$w' => IO\pure(function () { + IO\pure(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return 400 + $x; }, - '$x' => 33 + 33 ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) { + Functor $x + ) + { FunctorLaws::test( function (IO $a, IO $b, $message) { $this->assertEquals( @@ -132,17 +129,17 @@ function (IO $a, IO $b, $message) { ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'IO' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => IO::of(function () { + IO::of(function () { return 1; }), ], diff --git a/test/Monad/IdentityTest.php b/test/Monad/IdentityTest.php index 85ac494..6e0e13c 100644 --- a/test/Monad/IdentityTest.php +++ b/test/Monad/IdentityTest.php @@ -6,17 +6,16 @@ use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; -use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; +use PHPUnit\Framework\Attributes\DataProvider; +use Widmogrod\Functional as f; use Widmogrod\Monad\Identity; class IdentityTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_identity_monad_obeys_the_laws($f, $g, $x) { MonadLaws::test( @@ -28,7 +27,7 @@ public function test_if_identity_monad_obeys_the_laws($f, $g, $x) ); } - public function provideData() + public static function provideData() { $addOne = function ($x) { return Identity::of($x + 1); @@ -39,23 +38,22 @@ public function provideData() return [ 'Identity' => [ - '$f' => $addOne, - '$g' => $addTwo, - '$x' => 10, + $addOne, + $addTwo, + 10, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( Applicative $u, Applicative $v, Applicative $w, - callable $f, - $x - ) { + callable $f, + $x + ) + { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, Identity::of), @@ -67,35 +65,34 @@ public function test_it_should_obey_applicative_laws( ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'default' => [ - '$u' => Identity::of(function () { + Identity::of(function () { return 1; }), - '$v' => Identity::of(function () { + Identity::of(function () { return 5; }), - '$w' => Identity::of(function () { + Identity::of(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return $x + 400; }, - '$x' => 33 + 33 ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) { + Functor $x + ) + { FunctorLaws::test( [$this, 'assertEquals'], $f, @@ -104,17 +101,17 @@ public function test_it_should_obey_functor_laws( ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'Identity' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => Identity::of(123), + Identity::of(123), ], ]; } diff --git a/test/Monad/MaybeTest.php b/test/Monad/MaybeTest.php index b5deee8..b344b2e 100644 --- a/test/Monad/MaybeTest.php +++ b/test/Monad/MaybeTest.php @@ -6,11 +6,12 @@ use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; -use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use FunctionalPHP\FantasyLand\Helpful\MonoidLaws; +use PHPUnit\Framework\Attributes\DataProvider; +use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Nothing; @@ -18,9 +19,7 @@ class MaybeTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_maybe_monad_obeys_the_laws($return, $f, $g, $x) { MonadLaws::test( @@ -32,35 +31,33 @@ public function test_if_maybe_monad_obeys_the_laws($return, $f, $g, $x) ); } - public function provideData() + public static function provideData() { return [ 'Just' => [ - '$return' => Just::of, - '$f' => function ($x) { + Just::of, + function ($x) { return Just::of($x + 1); }, - '$g' => function ($x) { + function ($x) { return Just::of($x + 2); }, - '$x' => 10, + 10, ], 'Nothing' => [ - '$return' => Nothing::of, - '$f' => function ($x) { + Nothing::of, + function ($x) { return Nothing::of($x + 1); }, - '$g' => function ($x) { + function ($x) { return Nothing::of($x + 2); }, - '$x' => 10, + 10, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -68,7 +65,8 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) { + ) + { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, $pure), @@ -80,47 +78,45 @@ public function test_it_should_obey_applicative_laws( ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'Just' => [ - '$pure' => Maybe\pure, - '$u' => Just::of(function () { + Maybe\pure, + Just::of(function () { return 1; }), - '$v' => Just::of(function () { + Just::of(function () { return 5; }), - '$w' => Just::of(function () { + Just::of(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return $x + 400; }, - '$x' => 33 + 33 ], 'Nothing' => [ - '$pure' => Maybe\pure, - '$u' => Nothing::of(function () { + Maybe\pure, + Nothing::of(function () { return 1; }), - '$v' => Nothing::of(function () { + Nothing::of(function () { return 5; }), - '$w' => Nothing::of(function () { + Nothing::of(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return $x + 400; }, - '$x' => 33 + 33 ], ]; } - /** - * @dataProvider provideMonoidTestData - */ + #[DataProvider('provideMonoidTestData')] public function test_it_should_obey_monoid_laws($x, $y, $z) { MonoidLaws::test( @@ -131,40 +127,39 @@ public function test_it_should_obey_monoid_laws($x, $y, $z) ); } - public function provideMonoidTestData() + public static function provideMonoidTestData() { return [ 'Just' => [ - '$x' => Just::of(f\fromIterable([1])), - '$y' => Just::of(f\fromIterable([2])), - '$z' => Just::of(f\fromIterable([3])) + Just::of(f\fromIterable([1])), + Just::of(f\fromIterable([2])), + Just::of(f\fromIterable([3])) ], 'Nothing' => [ - '$x' => Nothing::mempty(), - '$y' => Nothing::mempty(), - '$z' => Nothing::mempty(), + Nothing::mempty(), + Nothing::mempty(), + Nothing::mempty(), ], 'Just String' => [ - '$x' => Just::of(Stringg::of("Hello")), - '$y' => Just::of(Stringg::of(" ")), - '$z' => Just::of(Stringg::of("World")) + Just::of(Stringg::of("Hello")), + Just::of(Stringg::of(" ")), + Just::of(Stringg::of("World")) ], 'Maybe String' => [ - '$x' => Just::of(Stringg::of("Hello")), - '$y' => Nothing::mempty(), - '$z' => Just::of(Stringg::of("World")) + Just::of(Stringg::of("Hello")), + Nothing::mempty(), + Just::of(Stringg::of("World")) ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) { + Functor $x + ) + { FunctorLaws::test( [$this, 'assertEquals'], $f, @@ -173,26 +168,26 @@ public function test_it_should_obey_functor_laws( ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'Just' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => Just::of(1), + Just::of(1), ], 'Nothing' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => Nothing::of(1), + Nothing::of(1), ], ]; } diff --git a/test/Monad/ReaderTest.php b/test/Monad/ReaderTest.php index 5805dbb..cf3a0be 100644 --- a/test/Monad/ReaderTest.php +++ b/test/Monad/ReaderTest.php @@ -9,13 +9,12 @@ use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Reader; class ReaderTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_reader_monad_obeys_the_laws($f, $g, $x, $env) { MonadLaws::test( @@ -33,7 +32,7 @@ function (Reader $a, Reader $b, $message) use ($env) { ); } - public function provideData() + public static function provideData() { $hello = function ($x) { return Reader\value($x + 1); @@ -44,17 +43,15 @@ public function provideData() return [ 'reader 0' => [ - '$f' => $hello, - '$g' => $hi, - '$x' => 54, - '$env' => 666, + $hello, + $hi, + 54, + 666, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -63,7 +60,8 @@ public function test_it_should_obey_applicative_laws( callable $f, $x, $reader - ) { + ) + { ApplicativeLaws::test( function (Reader $a, Reader $b, $message) use ($reader) { $this->assertEquals( @@ -81,38 +79,37 @@ function (Reader $a, Reader $b, $message) use ($reader) { ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'Reader' => [ - '$pure' => Reader\pure, - '$u' => Reader\pure(function () { + Reader\pure, + Reader\pure(function () { return 1; }), - '$v' => Reader\pure(function () { + Reader\pure(function () { return 5; }), - '$w' => Reader\pure(function () { + Reader\pure(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return 400 + $x; }, - '$x' => 33, - '$reader' => 3, + 33, + 3, ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x, - $reader - ) { + Functor $x, + $reader + ) + { FunctorLaws::test( function (Reader $a, Reader $b, $message) use ($reader) { $this->assertEquals( @@ -127,18 +124,18 @@ function (Reader $a, Reader $b, $message) use ($reader) { ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'Reader' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => Reader\value(3), - '$reader' => 'asd', + Reader\value(3), + 'asd', ], ]; } diff --git a/test/Monad/StateTest.php b/test/Monad/StateTest.php index cde0110..7c8ac2d 100644 --- a/test/Monad/StateTest.php +++ b/test/Monad/StateTest.php @@ -6,17 +6,16 @@ use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; -use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; +use PHPUnit\Framework\Attributes\DataProvider; +use Widmogrod\Functional as f; use Widmogrod\Monad\State; class StateTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_state_monad_obeys_the_laws($f, $g, $x, $state) { MonadLaws::test( @@ -34,7 +33,7 @@ function (State $a, State $b, $message) use ($state) { ); } - public function provideData() + public static function provideData() { $addOne = function ($x) { return State\value($x + 1); @@ -45,17 +44,15 @@ public function provideData() return [ 'state 0' => [ - '$f' => $addOne, - '$g' => $addTwo, - '$x' => 10, - '$state' => 0, + $addOne, + $addTwo, + 10, + 0, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -64,7 +61,8 @@ public function test_it_should_obey_applicative_laws( callable $f, $x, $state - ) { + ) + { ApplicativeLaws::test( function (State $a, State $b, $message) use ($state) { $this->assertEquals( @@ -82,38 +80,37 @@ function (State $a, State $b, $message) use ($state) { ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'State' => [ - '$pure' => State\pure, - '$u' => State\pure(function () { + State\pure, + State\pure(function () { return 1; }), - '$v' => State\pure(function ($x) { + State\pure(function ($x) { return 5; }), - '$w' => State\pure(function ($x) { + State\pure(function ($x) { return 7; }), - '$f' => function ($x) { + function ($x) { return 400 + $x; }, - '$x' => 33, - '$state' => 3, + 33, + 3, ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x, - $state - ) { + Functor $x, + $state + ) + { FunctorLaws::test( function (State $a, State $b, $message) use ($state) { $this->assertEquals( @@ -128,18 +125,18 @@ function (State $a, State $b, $message) use ($state) { ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'State' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => State\value(3), - '$state' => 'asd', + State\value(3), + 'asd', ], ]; } diff --git a/test/Monad/WriterTest.php b/test/Monad/WriterTest.php index 89f40d5..ee4c853 100644 --- a/test/Monad/WriterTest.php +++ b/test/Monad/WriterTest.php @@ -9,13 +9,12 @@ use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Monad\Writer; class WriterTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_writer_monad_obeys_the_laws($f, $g, $x) { MonadLaws::test( @@ -33,7 +32,7 @@ function (Writer $a, Writer $b, $message) { ); } - public function provideData() + public static function provideData() { $addOne = function ($x) { return Writer::of($x + 1); @@ -44,16 +43,14 @@ public function provideData() return [ 'writer 0' => [ - '$f' => $addOne, - '$g' => $addTwo, - '$x' => 10, + $addOne, + $addTwo, + 10, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -61,7 +58,8 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) { + ) + { ApplicativeLaws::test( function (Writer $a, Writer $b, $message) { $this->assertEquals( @@ -79,36 +77,35 @@ function (Writer $a, Writer $b, $message) { ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'Writer' => [ - '$pure' => Writer\pure, - '$u' => Writer\pure(function () { + Writer\pure, + Writer\pure(function () { return 1; }), - '$v' => Writer\pure(function () { + Writer\pure(function () { return 5; }), - '$w' => Writer\pure(function () { + Writer\pure(function () { return 7; }), - '$f' => function ($x) { + function ($x) { return 400 + $x; }, - '$x' => 33, + 33, ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) { + Functor $x + ) + { FunctorLaws::test( function (Writer $a, Writer $b, $message) { $this->assertEquals( @@ -123,17 +120,17 @@ function (Writer $a, Writer $b, $message) { ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'Writer' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => Writer\pure(3), + Writer\pure(3), ], ]; } diff --git a/test/Primitive/ListtTest.php b/test/Primitive/ListtTest.php index b81730d..c9cf2dd 100644 --- a/test/Primitive/ListtTest.php +++ b/test/Primitive/ListtTest.php @@ -8,6 +8,7 @@ use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; use FunctionalPHP\FantasyLand\Monoid; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; @@ -22,9 +23,7 @@ class ListtTest extends \PHPUnit\Framework\TestCase { use TestTrait; - /** - * @dataProvider provideData - */ + #[DataProvider('provideData')] public function test_if_list_obeys_the_laws($f, $g, $x) { MonadLaws::test( @@ -36,7 +35,7 @@ public function test_if_list_obeys_the_laws($f, $g, $x) ); } - public function provideData() + public static function provideData() { $addOne = function ($x) { return f\fromIterable([$x + 1]); @@ -47,16 +46,14 @@ public function provideData() return [ 'Listt' => [ - '$f' => $addOne, - '$g' => $addTwo, - '$x' => 10, + $addOne, + $addTwo, + 10, ], ]; } - /** - * @dataProvider provideApplicativeTestData - */ + #[DataProvider('provideApplicativeTestData')] public function test_it_should_obey_applicative_laws( $pure, Applicative $u, @@ -76,31 +73,29 @@ public function test_it_should_obey_applicative_laws( ); } - public function provideApplicativeTestData() + public static function provideApplicativeTestData() { return [ 'Listt' => [ - '$pure' => fromValue, - '$u' => f\fromIterable([function () { + fromValue, + f\fromIterable([function () { return 1; }]), - '$v' => f\fromIterable([function () { + f\fromIterable([function () { return 5; }]), - '$w' => f\fromIterable([function () { + f\fromIterable([function () { return 7; }]), - '$f' => function ($x) { + function ($x) { return $x + 400; }, - '$x' => 33 + 33 ], ]; } - /** - * @dataProvider provideFunctorTestData - */ + #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, @@ -114,24 +109,22 @@ public function test_it_should_obey_functor_laws( ); } - public function provideFunctorTestData() + public static function provideFunctorTestData() { return [ 'Listt' => [ - '$f' => function ($x) { + function ($x) { return $x + 1; }, - '$g' => function ($x) { + function ($x) { return $x + 5; }, - '$x' => f\fromIterable([1, 2, 3]), + f\fromIterable([1, 2, 3]), ], ]; } - /** - * @dataProvider provideRandomizedData - */ + #[DataProvider('provideRandomizedData')] public function test_it_should_obey_monoid_laws(Monoid $x, Monoid $y, Monoid $z) { MonoidLaws::test( @@ -142,18 +135,18 @@ public function test_it_should_obey_monoid_laws(Monoid $x, Monoid $y, Monoid $z) ); } - private function randomize() + public static function randomize() { return f\fromIterable(array_keys(array_fill(0, random_int(20, 100), null))); } - public function provideRandomizedData() + public static function provideRandomizedData() { return array_map(function () { return [ - $this->randomize(), - $this->randomize(), - $this->randomize(), + self::randomize(), + self::randomize(), + self::randomize(), ]; }, array_fill(0, 50, null)); } diff --git a/test/Primitive/ProductTest.php b/test/Primitive/ProductTest.php index 7e0f8a0..f12cf42 100644 --- a/test/Primitive/ProductTest.php +++ b/test/Primitive/ProductTest.php @@ -47,12 +47,10 @@ public function test_it_should_obay_monoid_laws() }); } - /** - * @expectedException \Widmogrod\Primitive\TypeMismatchError - * @expectedExceptionMessage Expected type is Widmogrod\Primitive\Product but given Widmogrod\Primitive\Stringg - */ public function test_it_should_reject_concat_on_different_type() { + $this->expectException(\Widmogrod\Primitive\TypeMismatchError::class); + $this->expectExceptionMessage('Expected type is Widmogrod\Primitive\Product but given Widmogrod\Primitive\Stringg'); $this->forAll( Generator\int(), Generator\string() diff --git a/test/Primitive/StringgTest.php b/test/Primitive/StringgTest.php index 41a854e..e1554ec 100644 --- a/test/Primitive/StringgTest.php +++ b/test/Primitive/StringgTest.php @@ -47,12 +47,10 @@ public function test_it_should_obey_monoid_laws() }); } - /** - * @expectedException \Widmogrod\Primitive\TypeMismatchError - * @expectedExceptionMessage Expected type is Widmogrod\Primitive\Stringg but given Widmogrod\Primitive\Product - */ public function test_it_should_reject_concat_on_different_type() { + $this->expectException(\Widmogrod\Primitive\TypeMismatchError::class); + $this->expectExceptionMessage('Expected type is Widmogrod\Primitive\Stringg but given Widmogrod\Primitive\Product'); $this->forAll( Generator\string(), Generator\int() diff --git a/test/Primitive/SumTest.php b/test/Primitive/SumTest.php index 3d29b2e..e242b33 100644 --- a/test/Primitive/SumTest.php +++ b/test/Primitive/SumTest.php @@ -47,13 +47,10 @@ public function test_it_should_obay_monoid_laws() }); } - - /** - * @expectedException \Widmogrod\Primitive\TypeMismatchError - * @expectedExceptionMessage Expected type is Widmogrod\Primitive\Sum but given Widmogrod\Primitive\Product - */ public function test_it_should_reject_concat_on_different_type() { + $this->expectException(\Widmogrod\Primitive\TypeMismatchError::class); + $this->expectExceptionMessage('Expected type is Widmogrod\Primitive\Sum but given Widmogrod\Primitive\Product'); $this->forAll( Generator\int(), Generator\string() diff --git a/test/Useful/MatchTest.php b/test/Useful/MatchTest.php index 269899c..ac5dc74 100644 --- a/test/Useful/MatchTest.php +++ b/test/Useful/MatchTest.php @@ -4,6 +4,7 @@ namespace test\Useful; +use PHPUnit\Framework\Attributes\DataProvider; use Widmogrod\Useful\PatternMatcher; use Widmogrod\Useful\PatternNotMatchedError; use function Widmogrod\Useful\matchPatterns; @@ -12,55 +13,53 @@ class MatchTest extends \PHPUnit\Framework\TestCase { - /** - * @dataProvider provideInvalidPatterns - */ + #[DataProvider('provideInvalidPatterns')] public function test_it_should_fail_on_not_matched_patterns( array $patterns, - $value, - $expectedMessage - ) { + $value, + $expectedMessage + ) + { $this->expectException(PatternNotMatchedError::class); $this->expectExceptionMessage($expectedMessage); matchPatterns($patterns, $value); } - public function provideInvalidPatterns() + public static function provideInvalidPatterns() { return [ 'Empty pattern list' => [ - '$patterns' => [], - '$value' => random_int(-1000, 1000), - '$expectedMessage' => 'Cannot match "integer" type. List of patterns is empty.', + [], + random_int(-1000, 1000), + 'Cannot match "integer" type. List of patterns is empty.', ], 'Value not in pattern list' => [ - '$patterns' => [ + [ self::class => identity, "RandomString" => identity, ], - '$value' => random_int(-1000, 1000), - '$expectedMessage' => 'Cannot match "integer" type. Defined patterns are: "test\Useful\MatchTest", "RandomString"', + random_int(-1000, 1000), + 'Cannot match "integer" type. Defined patterns are: "test\Useful\MatchTest", "RandomString"', ], 'Value not in tuple pattern list' => [ - '$patterns' => [ + [ [[self::class, \stdClass::class], identity], [["RandomString"], identity], ], - '$value' => [random_int(-1000, 1000)], - '$expectedMessage' => 'Cannot match "array" type. Defined patterns are: "0", "1"', + [random_int(-1000, 1000)], + 'Cannot match "array" type. Defined patterns are: "0", "1"', ], ]; } - /** - * @dataProvider providePatterns - */ + #[DataProvider('providePatterns')] public function test_it_should_match_given_value( array $patterns, - $value, - $expected - ) { + $value, + $expected + ) + { $result = matchPatterns($patterns, $value); $this->assertSame( $expected, @@ -68,7 +67,7 @@ public function test_it_should_match_given_value( ); } - public function providePatterns() + public static function providePatterns() { $std = new \stdClass(); $e = new \Exception(); @@ -76,40 +75,40 @@ public function providePatterns() return [ 'single pattern' => [ - '$patterns' => [ + [ \stdClass::class => identity, ], - '$value' => $std, - '$expected' => $std, + $std, + $std, ], 'single pattern fallback to any' => [ - '$patterns' => [ + [ \stdClass::class => identity, any => identity, ], - '$value' => $e, - '$expected' => $e, + $e, + $e, ], 'many patterns' => [ - '$patterns' => [ + [ \Exception::class => identity, self::class => identity, \stdClass::class => identity, ], - '$value' => $std, - '$expected' => $std, + $std, + $std, ], 'tuple patterns' => [ - '$patterns' => [ + [ [[\stdClass::class, \stdClass::class], function () { return func_get_args(); }], ], - '$value' => [$std, $std], - '$expected' => [$std, $std], + [$std, $std], + [$std, $std], ], 'tuple fallback to any patterns' => [ - '$patterns' => [ + [ [[\stdClass::class, \stdClass::class], function () { return func_get_args(); }], @@ -117,11 +116,11 @@ public function providePatterns() return ['any', func_get_args()]; }], ], - '$value' => [$std, $m], - '$expected' => ['any', [$std, $m]], + [$std, $m], + ['any', [$std, $m]], ], 'value as a PatternMatcher patterns' => [ - '$patterns' => [ + [ \Exception::class => identity, self::class => identity, \stdClass::class => identity, @@ -129,8 +128,8 @@ public function providePatterns() return $a + $b; } ], - '$value' => new MyPatternMatcher(100, 123), - '$expected' => 223, + new MyPatternMatcher(100, 123), + 223, ], ]; } From 390c579896f18337ad90961a5c203e00d312a1a7 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:07:44 +0100 Subject: [PATCH 04/18] fix: implicit nullables --- src/Functional/functions.php | 4 ++-- src/Functional/infinit.php | 2 +- src/Functional/miscellaneous.php | 5 ++--- src/Functional/predicates.php | 1 - src/Monad/Control/Doo/interpretation.php | 1 - src/Monad/Either/Left.php | 2 +- src/Monad/Either/Right.php | 2 +- src/Monad/Free/Free.php | 2 +- src/Monad/Free/Pure.php | 2 +- src/Monad/IO.php | 2 +- src/Monad/Identity.php | 2 +- src/Monad/Maybe/Just.php | 2 +- src/Monad/Maybe/Nothing.php | 2 +- src/Monad/Reader.php | 2 +- src/Monad/State.php | 2 +- src/Monad/Writer.php | 2 +- src/Primitive/Num.php | 2 +- src/Primitive/Stringg.php | 2 +- 18 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/Functional/functions.php b/src/Functional/functions.php index bfd10c0..f37d1b1 100644 --- a/src/Functional/functions.php +++ b/src/Functional/functions.php @@ -254,7 +254,7 @@ function reduce(callable $callable, $accumulator = null, ?Foldable $foldable = n * * @return mixed */ -function foldr(callable $callable, $accumulator = null, ?Foldable $foldable = null) +function foldr(callable $callback, mixed $initialValue = null, ?Foldable $inputFoldable = null) { return curryN(3, function ( callable $callable, @@ -341,7 +341,7 @@ function mcompose(callable $a, callable $b) * * @param callable $function * @param callable $catchFunction - * @param $value + * @param $value * * @return mixed */ diff --git a/src/Functional/infinit.php b/src/Functional/infinit.php index 2513754..2809925 100644 --- a/src/Functional/infinit.php +++ b/src/Functional/infinit.php @@ -45,7 +45,7 @@ function iterate(callable $fn, $a = null) * * repeat x is an infinite list, with x the value of every element. * - * @param $a + * @param $a * @return ListtCons */ function repeat($a) diff --git a/src/Functional/miscellaneous.php b/src/Functional/miscellaneous.php index 9c58d1b..81b7392 100644 --- a/src/Functional/miscellaneous.php +++ b/src/Functional/miscellaneous.php @@ -39,8 +39,8 @@ function identity($x) * [42,42,42,42] * ``` * - * @param $a - * @param $b + * @param $a + * @param $b * @return callable */ function constt($a, $b = null) @@ -50,7 +50,6 @@ function constt($a, $b = null) })(...func_get_args()); } - /** * @var callable */ diff --git a/src/Functional/predicates.php b/src/Functional/predicates.php index bb3c015..aac3b90 100644 --- a/src/Functional/predicates.php +++ b/src/Functional/predicates.php @@ -38,7 +38,6 @@ function lt($expected, $value = null) })(...func_get_args()); } - const orr = 'Widmogrod\Functional\orr'; /** diff --git a/src/Monad/Control/Doo/interpretation.php b/src/Monad/Control/Doo/interpretation.php index be6981c..4fd0f71 100644 --- a/src/Monad/Control/Doo/interpretation.php +++ b/src/Monad/Control/Doo/interpretation.php @@ -9,7 +9,6 @@ use Widmogrod\Monad\Control\Doo\Algebra\Let; use Widmogrod\Monad\Control\Doo\Registry\Registry; use Widmogrod\Monad\Free\MonadFree; -use Widmogrod\Monad\Free\Pure; use Widmogrod\Monad\Reader; use const Widmogrod\Monad\Reader\pure; use function Widmogrod\Functional\sequenceM; diff --git a/src/Monad/Either/Left.php b/src/Monad/Either/Left.php index b837f0c..de74b76 100644 --- a/src/Monad/Either/Left.php +++ b/src/Monad/Either/Left.php @@ -12,7 +12,7 @@ class Left implements Either use Common\PointedTrait; use Common\ValueOfTrait; - const of = 'Widmogrod\Monad\Either\Left::of'; + public const of = 'Widmogrod\Monad\Either\Left::of'; /** * @inheritdoc diff --git a/src/Monad/Either/Right.php b/src/Monad/Either/Right.php index bcd01be..efa8db3 100644 --- a/src/Monad/Either/Right.php +++ b/src/Monad/Either/Right.php @@ -12,7 +12,7 @@ class Right implements Either use Common\PointedTrait; use Common\ValueOfTrait; - const of = 'Widmogrod\Monad\Either\Right::of'; + public const of = 'Widmogrod\Monad\Either\Right::of'; /** * @inheritdoc diff --git a/src/Monad/Free/Free.php b/src/Monad/Free/Free.php index 415b504..7436470 100644 --- a/src/Monad/Free/Free.php +++ b/src/Monad/Free/Free.php @@ -14,7 +14,7 @@ */ class Free implements MonadFree { - const of = 'Widmogrod\Monad\Free\Free::of'; + public const of = 'Widmogrod\Monad\Free\Free::of'; /** * @var FantasyLand\Functor diff --git a/src/Monad/Free/Pure.php b/src/Monad/Free/Pure.php index a3ae118..d90de14 100644 --- a/src/Monad/Free/Pure.php +++ b/src/Monad/Free/Pure.php @@ -11,7 +11,7 @@ class Pure implements MonadFree { use Common\PointedTrait; - const of = 'Widmogrod\Monad\Free\Pure::of'; + public const of = 'Widmogrod\Monad\Free\Pure::of'; /** * @inheritdoc diff --git a/src/Monad/IO.php b/src/Monad/IO.php index ea38426..570405a 100644 --- a/src/Monad/IO.php +++ b/src/Monad/IO.php @@ -11,7 +11,7 @@ class IO implements FantasyLand\Monad, FantasyLand\Foldable { - const of = 'Widmogrod\Monad\IO::of'; + public const of = 'Widmogrod\Monad\IO::of'; use Common\PointedTrait; diff --git a/src/Monad/Identity.php b/src/Monad/Identity.php index 346169c..bc97a2b 100644 --- a/src/Monad/Identity.php +++ b/src/Monad/Identity.php @@ -11,7 +11,7 @@ class Identity implements FantasyLand\Monad, Common\ValueOfInterface { - const of = 'Widmogrod\Monad\Identity::of'; + public const of = 'Widmogrod\Monad\Identity::of'; use Common\PointedTrait; use Common\ValueOfTrait; diff --git a/src/Monad/Maybe/Just.php b/src/Monad/Maybe/Just.php index 7ded5fc..2da412a 100644 --- a/src/Monad/Maybe/Just.php +++ b/src/Monad/Maybe/Just.php @@ -13,7 +13,7 @@ class Just implements Maybe, PatternMatcher { use Common\PointedTrait; - const of = 'Widmogrod\Monad\Maybe\Just::of'; + public const of = 'Widmogrod\Monad\Maybe\Just::of'; /** * @inheritdoc diff --git a/src/Monad/Maybe/Nothing.php b/src/Monad/Maybe/Nothing.php index f0237dd..a275cb8 100644 --- a/src/Monad/Maybe/Nothing.php +++ b/src/Monad/Maybe/Nothing.php @@ -9,7 +9,7 @@ class Nothing implements Maybe, PatternMatcher { - const of = 'Widmogrod\Monad\Maybe\Nothing::of'; + public const of = 'Widmogrod\Monad\Maybe\Nothing::of'; /** * @inheritdoc diff --git a/src/Monad/Reader.php b/src/Monad/Reader.php index 209dda2..4428b2a 100644 --- a/src/Monad/Reader.php +++ b/src/Monad/Reader.php @@ -9,7 +9,7 @@ class Reader implements FantasyLand\Monad { - const of = 'Widmogrod\Monad\Reader::of'; + public const of = 'Widmogrod\Monad\Reader::of'; use Common\PointedTrait; diff --git a/src/Monad/State.php b/src/Monad/State.php index 8fb04be..e09bcca 100644 --- a/src/Monad/State.php +++ b/src/Monad/State.php @@ -9,7 +9,7 @@ class State implements FantasyLand\Monad { - const of = 'Widmogrod\Monad\State::of'; + public const of = 'Widmogrod\Monad\State::of'; use Common\PointedTrait; diff --git a/src/Monad/Writer.php b/src/Monad/Writer.php index 244eee6..ea2273f 100644 --- a/src/Monad/Writer.php +++ b/src/Monad/Writer.php @@ -9,7 +9,7 @@ class Writer implements FantasyLand\Monad { - const of = 'Widmogrod\Monad\Writer::of'; + public const of = 'Widmogrod\Monad\Writer::of'; public static function of($value, ?FantasyLand\Monoid $side = null) { diff --git a/src/Primitive/Num.php b/src/Primitive/Num.php index 9b1402f..1534433 100644 --- a/src/Primitive/Num.php +++ b/src/Primitive/Num.php @@ -12,7 +12,7 @@ class Num implements FantasyLand\Setoid, Common\ValueOfInterface { - const of = 'Widmogrod\Primitive\Num::of'; + public const of = 'Widmogrod\Primitive\Num::of'; use Common\PointedTrait; use Common\ValueOfTrait; diff --git a/src/Primitive/Stringg.php b/src/Primitive/Stringg.php index c8e837b..54c890c 100644 --- a/src/Primitive/Stringg.php +++ b/src/Primitive/Stringg.php @@ -13,7 +13,7 @@ class Stringg implements FantasyLand\Setoid, Common\ValueOfInterface { - const of = 'Widmogrod\Primitive\Stringg::of'; + public const of = 'Widmogrod\Primitive\Stringg::of'; use Common\PointedTrait; use Common\ValueOfTrait; From f554049d208ee514aa2926dd89f4f3a8acb17e63 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:07:58 +0100 Subject: [PATCH 05/18] chore: upgrade code fixer --- .php_cs => .php-cs-fixer.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) rename .php_cs => .php-cs-fixer.php (83%) diff --git a/.php_cs b/.php-cs-fixer.php similarity index 83% rename from .php_cs rename to .php-cs-fixer.php index 11c7fa5..8380ebf 100644 --- a/.php_cs +++ b/.php-cs-fixer.php @@ -1,8 +1,12 @@ exclude('vendor') ->in(__DIR__); -return PhpCsFixer\Config::create() + +return (new PhpCsFixer\Config()) ->setUsingCache(true) ->setRules([ '@PSR2' => true, @@ -14,7 +18,7 @@ 'indentation_type' => true, 'blank_line_after_namespace' => true, 'line_ending' => true, - 'lowercase_constants' => true, + 'constant_case' => ['case' => 'lower'], // Replaces lowercase_constants 'lowercase_keywords' => true, 'no_closing_tag' => true, 'single_line_after_imports' => true, @@ -23,7 +27,7 @@ 'whitespace_after_comma_in_array' => true, 'blank_line_after_opening_tag' => true, 'no_empty_statement' => true, - 'no_extra_consecutive_blank_lines' => true, + 'no_extra_blank_lines' => true, // Replaces no_extra_consecutive_blank_lines 'function_typehint_space' => true, 'no_leading_namespace_whitespace' => true, 'no_blank_lines_after_class_opening' => true, @@ -31,8 +35,7 @@ 'phpdoc_scalar' => true, 'phpdoc_types' => true, 'no_leading_import_slash' => true, - 'no_extra_consecutive_blank_lines' => ['use'], - 'blank_line_before_return' => true, + 'blank_line_before_statement' => ['statements' => ['return']], // Replaces blank_line_before_return 'self_accessor' => false, 'no_short_bool_cast' => true, 'no_trailing_comma_in_singleline_array' => true, From 91932feb4c96db6c1653cddd07660c52c2d13c52 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:08:52 +0100 Subject: [PATCH 06/18] chore: update dependencies and make php8 baseline --- composer.json | 8 +- composer.lock | 3391 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 2391 insertions(+), 1008 deletions(-) diff --git a/composer.json b/composer.json index 470005c..be16936 100644 --- a/composer.json +++ b/composer.json @@ -2,13 +2,13 @@ "name": "widmogrod/php-functional", "description": "Functors, Applicative and Monads are fascinating concept. Purpose of this library is to explore them in OOP PHP world.", "require": { - "php": "^7.1|^8.0", + "php": "^8.0", "functional-php/fantasy-land": "^1" }, "require-dev": { - "phpunit/phpunit": "^6", - "friendsofphp/php-cs-fixer": "^2", - "giorgiosironi/eris": "^0.9" + "phpunit/phpunit": "^11.5.1", + "friendsofphp/php-cs-fixer": "^v3.65.0", + "giorgiosironi/eris": "^1.0.0" }, "license": "MIT", "authors": [ diff --git a/composer.lock b/composer.lock index 3fe43bf..111cb0c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "722371fce21dbeed7ea53b65ff26950a", + "content-hash": "3ae68fe452bff514ea981caf9705df9d", "packages": [ { "name": "functional-php/fantasy-land", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/functional-php/fantasy-land.git", - "reference": "c855c856e70db81032a8a4fd17bd74a58d26a279" + "reference": "1e2366e68057bbc7a65d58dd663324eb9b299775" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/functional-php/fantasy-land/zipball/c855c856e70db81032a8a4fd17bd74a58d26a279", - "reference": "c855c856e70db81032a8a4fd17bd74a58d26a279", + "url": "https://api.github.com/repos/functional-php/fantasy-land/zipball/1e2366e68057bbc7a65d58dd663324eb9b299775", + "reference": "1e2366e68057bbc7a65d58dd663324eb9b299775", "shasum": "" }, "require": { @@ -30,12 +30,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "FunctionalPHP\\": "./src" - }, "files": [ "src/FantasyLand/functions.php" - ] + ], + "psr-4": { + "FunctionalPHP\\": "./src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -48,40 +48,40 @@ } ], "description": "Specification for interoperability of common algebraic structures in PHP", - "time": "2018-02-18T14:54:04+00:00" + "support": { + "issues": "https://github.com/functional-php/fantasy-land/issues", + "source": "https://github.com/functional-php/fantasy-land/tree/1.0.1" + }, + "time": "2021-01-19T18:06:19+00:00" } ], "packages-dev": [ { - "name": "composer/semver", - "version": "1.5.0", + "name": "clue/ndjson-react", + "version": "v1.3.0", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" + "php": ">=5.3", + "react/stream": "^1.2" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { "psr-4": { - "Composer\\Semver\\": "src" + "Clue\\React\\NDJson\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -90,55 +90,75 @@ ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "url": "https://clue.engineering/support", + "type": "custom" }, { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" + "url": "https://github.com/clue", + "type": "github" } ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2019-03-19T17:25:45+00:00" + "time": "2022-12-23T10:58:28+00:00" }, { - "name": "composer/xdebug-handler", - "version": "1.3.3", + "name": "composer/pcre", + "version": "3.3.2", "source": { "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f" + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0", - "psr/log": "^1.0" + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, "autoload": { "psr-4": { - "Composer\\XdebugHandler\\": "src" + "Composer\\Pcre\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -147,48 +167,68 @@ ], "authors": [ { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "Restarts a process without xdebug.", + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", "keywords": [ - "Xdebug", - "performance" + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } ], - "time": "2019-05-27T17:52:04+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { - "name": "doctrine/annotations", - "version": "v1.7.0", + "name": "composer/semver", + "version": "3.4.3", "source": { "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb" + "url": "https://github.com/composer/semver.git", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/fa4c4e861e809d6a1103bd620cce63ed91aedfeb", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", "shasum": "" }, "require": { - "doctrine/lexer": "1.*", - "php": "^7.1" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^7.5@dev" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + "Composer\\Semver\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -197,70 +237,77 @@ ], "authors": [ { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" }, { - "name": "Roman Borschel", - "email": "roman@code-factory.org" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" }, { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" }, { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" + "url": "https://github.com/composer", + "type": "github" }, { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2019-08-08T18:11:40+00:00" + "time": "2024-09-19T14:15:21+00:00" }, { - "name": "doctrine/instantiator", - "version": "1.2.0", + "name": "composer/xdebug-handler", + "version": "3.0.5", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { - "php": "^7.1" + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "Composer\\XdebugHandler\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -269,50 +316,115 @@ ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "description": "Restarts a process without Xdebug.", "keywords": [ - "constructor", - "instantiate" + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } ], - "time": "2019-03-17T17:37:11+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { - "name": "doctrine/lexer", - "version": "1.1.0", + "name": "evenement/evenement", + "version": "v3.0.2", "source": { "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea" + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e17f069ede36f7534b95adec71910ed1b49c74ea", - "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", "shasum": "" }, "require": { - "php": "^7.2" + "php": ">=7.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "phpunit/phpunit": "^9 || ^6" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" + "autoload": { + "psr-4": { + "Evenement\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "8520451a140d3f46ac33042715115e290cf5785f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", + "shasum": "" }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "Fidry\\CpuCoreCounter\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -321,79 +433,84 @@ ], "authors": [ { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" } ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "description": "Tiny utility to get the number of CPU cores.", "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } ], - "time": "2019-07-30T19:33:28+00:00" + "time": "2024-08-06T10:04:20+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.15.2", + "version": "v3.65.0", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c9d30fddfa3feb8b82663104864224f2ce7a3675" + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c9d30fddfa3feb8b82663104864224f2ce7a3675", - "reference": "c9d30fddfa3feb8b82663104864224f2ce7a3675", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f", "shasum": "" }, "require": { - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.2", - "doctrine/annotations": "^1.2", + "clue/ndjson-react": "^1.0", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-filter": "*", "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" + "fidry/cpu-core-counter": "^1.2", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.2", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", - "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", - "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3" + "facile-it/paraunit": "^1.3.1 || ^2.4", + "infection/infection": "^0.29.8", + "justinrainbow/json-schema": "^5.3 || ^6.0", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3", + "symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8", + "symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6" }, "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." }, "bin": [ "php-cs-fixer" @@ -403,16 +520,8 @@ "psr-4": { "PhpCsFixer\\": "src/" }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/TestCase.php" + "exclude-from-classmap": [ + "src/Fixer/Internal/*" ] }, "notification-url": "https://packagist.org/downloads/", @@ -430,51 +539,69 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-08-27T16:03:01+00:00" + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2024-11-25T00:39:24+00:00" }, { "name": "giorgiosironi/eris", - "version": "0.9.0", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/giorgiosironi/eris.git", - "reference": "538bbdaeb5679d094a33864fd54f85d6a4ffaa74" + "reference": "ffc757f08710b2b8fb1b30cff7b1cf48f5aba11d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/giorgiosironi/eris/zipball/538bbdaeb5679d094a33864fd54f85d6a4ffaa74", - "reference": "538bbdaeb5679d094a33864fd54f85d6a4ffaa74", + "url": "https://api.github.com/repos/giorgiosironi/eris/zipball/ffc757f08710b2b8fb1b30cff7b1cf48f5aba11d", + "reference": "ffc757f08710b2b8fb1b30cff7b1cf48f5aba11d", "shasum": "" }, "require": { - "php": ">=5.5", - "phpunit/phpunit": ">4,<7" + "php": "^8.1" }, "require-dev": { - "fabpot/php-cs-fixer": "^1.11.2", - "icomefromthenet/reverse-regex": "v0.0.6.3" + "friendsofphp/php-cs-fixer": "^3.0", + "ilario-pierbattista/reverse-regex": "^0.4.0", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.0.4", + "psalm/phar": "^5.4", + "rector/rector": "^0.18", + "sebastian/comparator": ">=2.1.3" }, "suggest": { - "icomefromthenet/reverse-regex": "v0.0.6.3 for the regex() Generator" + "icomefromthenet/reverse-regex": "v0.0.6.3 for the regex() Generator", + "ilario-pierbattista/reverse-regex": "0.3.1 for the regex() Generator (alternative to icomefromthenet/reverse-regex) ", + "phpunit/phpunit": "Standard way to run generated test cases" }, "type": "library", "autoload": { - "psr-4": { - "Eris\\": "src/" - }, "files": [ "src/Generator/functions.php" - ] + ], + "psr-4": { + "Eris\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Gabriele Lana", - "email": "gabriele.lana@gmail.com" - }, { "name": "Giorgio Sironi", "email": "info@giorgiosironi.com" @@ -482,44 +609,54 @@ { "name": "Mirko Bonadei", "email": "mirko.bonadei@gmail.com" + }, + { + "name": "Gabriele Lana", + "email": "gabriele.lana@gmail.com" } ], "description": "PHP library for property-based testing. Integrates with PHPUnit.", - "time": "2017-03-12T17:39:53+00:00" + "support": { + "issues": "https://github.com/giorgiosironi/eris/issues", + "source": "https://github.com/giorgiosironi/eris/tree/1.0.0" + }, + "time": "2024-12-07T08:21:20+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -533,77 +670,102 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2024-11-08T17:47:46+00:00" }, { - "name": "paragonie/random_compat", - "version": "v9.99.99", + "name": "nikic/php-parser", + "version": "v5.3.1", "source": { "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { - "php": "^7" + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" + "name": "Nikita Popov" } ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "description": "A PHP parser written in PHP", "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" + "parser", + "php" ], - "time": "2018-07-02T15:55:56+00:00" + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + }, + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phar-io/manifest", - "version": "1.0.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -633,24 +795,34 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", - "version": "1.0.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -680,30 +852,54 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" }, { - "name": "php-cs-fixer/diff", - "version": "v1.3.0", + "name": "phpunit/php-code-coverage", + "version": "11.0.8", "source": { "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^5.3.1", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "symfony/process": "^3.3" + "phpunit/phpunit": "^11.5.0" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "11.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -714,279 +910,335 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "SpacePossum" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "sebastian/diff v2 backport support for PHP5.6", - "homepage": "https://github.com/PHP-CS-Fixer", + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ - "diff" + "coverage", + "testing", + "xunit" ], - "time": "2018-02-15T16:58:55+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-12-11T12:34:27+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "name": "phpunit/php-file-iterator", + "version": "5.1.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "5.0-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" + "filesystem", + "iterator" ], - "time": "2017-09-11T18:02:19+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-08-27T05:02:59+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.1", + "name": "phpunit/php-invoker", + "version": "5.0.1", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "php": ">=8.2" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "ext-pcntl": "*", + "phpunit/phpunit": "^11.0" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-main": "5.0-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-04-30T17:48:53+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "name": "phpunit/php-text-template", + "version": "4.0.1", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": ">=8.2" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "4.0-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { - "name": "phpspec/prophecy", - "version": "1.8.1", + "name": "phpunit/php-timer", + "version": "7.0.1", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "php": ">=8.2" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-main": "7.0-dev" } }, "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2019-06-13T12:50:23+00:00" + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:09:35+00:00" }, { - "name": "phpunit/php-code-coverage", - "version": "5.3.2", + "name": "phpunit/phpunit", + "version": "11.5.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac" + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2b94d4f2450b9869fa64a46fd8a6a41997aef56a", + "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a", "shasum": "" }, "require": { "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" + "myclabs/deep-copy": "^1.12.1", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.7", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.1", + "sebastian/comparator": "^6.2.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.0", + "sebastian/exporter": "^6.3.0", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.0", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { - "ext-xdebug": "^2.5.5" + "ext-soap": "To be able to generate mocks based on WSDL files" }, + "bin": [ + "phpunit" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3.x-dev" + "dev-main": "11.5-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "classmap": [ "src/" ] @@ -998,375 +1250,670 @@ "authors": [ { "name": "Sebastian Bergmann", - "role": "lead", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", "keywords": [ - "coverage", + "phpunit", "testing", "xunit" ], - "time": "2018-04-06T15:36:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.1" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2024-12-11T10:52:48+00:00" }, { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "name": "psr/container", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Container\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "filesystem", - "iterator" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "time": "2017-11-27T13:52:08+00:00" + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Standard interfaces for event handling.", "keywords": [ - "template" + "events", + "psr", + "psr-14" ], - "time": "2015-06-21T13:50:34+00:00" + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" }, { - "name": "phpunit/php-timer", - "version": "1.0.9", + "name": "psr/log", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "3.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Log\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "timer" + "log", + "psr", + "psr-3" ], - "time": "2017-02-26T11:10:40+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "2.0.2", + "name": "react/cache", + "version": "v1.2.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": "^7.0" + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "React\\Cache\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "description": "Async, Promise-based cache interface for ReactPHP", "keywords": [ - "tokenizer" + "cache", + "caching", + "promise", + "reactphp" ], - "time": "2017-11-27T05:48:46+00:00" + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" }, { - "name": "phpunit/phpunit", - "version": "6.5.14", + "name": "react/child-process", + "version": "v0.6.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.9", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" }, "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" }, - "bin": [ - "phpunit" - ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5.x-dev" - } - }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "React\\ChildProcess\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "role": "lead", - "email": "sebastian@phpunit.de" + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", + "description": "Event-driven library for executing child processes with ReactPHP.", "keywords": [ - "phpunit", - "testing", - "xunit" + "event-driven", + "process", + "reactphp" ], - "time": "2019-02-01T05:22:47+00:00" + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.10", + "name": "react/dns", + "version": "v1.13.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" }, - "conflict": { - "phpunit/phpunit": "<6.0" + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^6.5.11" + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" }, "suggest": { - "ext-soap": "*" + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" }, + "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "description": "A lightweight implementation of CommonJS Promises/A for PHP", "keywords": [ - "mock", - "xunit" + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } ], - "abandoned": true, - "time": "2018-08-09T05:50:03+00:00" + "time": "2024-05-24T10:39:05+00:00" }, { - "name": "psr/container", - "version": "1.0.0", + "name": "react/socket", + "version": "v1.16.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "shasum": "" }, "require": { - "php": ">=5.3.0" + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "React\\Stream\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1375,92 +1922,187 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2024-06-11T12:45:25+00:00" }, { - "name": "psr/log", - "version": "1.1.0", + "name": "sebastian/cli-parser", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "3.0-dev" } }, "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:41:36+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2018-11-20T15:27:04+00:00" + "time": "2024-12-12T09:59:06+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1480,34 +2122,47 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "2.1.3", + "version": "6.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/diff": "^2.0 || ^3.0", - "sebastian/exporter": "^3.1" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -1520,6 +2175,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1531,10 +2190,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -1544,32 +2199,102 @@ "compare", "equality" ], - "time": "2018-02-01T13:46:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-10-31T05:30:08+00:00" + }, + { + "name": "sebastian/complexity", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "2.0.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "phpunit/phpunit": "^11.0", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1582,46 +2307,63 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2017-08-03T08:09:46+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "3.1.0", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^11.0" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -1640,40 +2382,51 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:54:44+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.1", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "06a9a5947f47b3029d76118eb5c22802e5869687" + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/06a9a5947f47b3029d76118eb5c22802e5869687", - "reference": "06a9a5947f47b3029d76118eb5c22802e5869687", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -1708,40 +2461,51 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], - "time": "2019-08-11T12:43:14+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-12-05T09:17:50+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" + "ext-dom": "*", + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1760,38 +2524,107 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:57:36+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1811,32 +2644,43 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1856,32 +2700,43 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1894,44 +2749,58 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:10:34+00:00" }, { - "name": "sebastian/resource-operations", - "version": "1.0.0", + "name": "sebastian/type", + "version": "5.1.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1946,34 +2815,46 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2024-09-17T13:12:04+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1994,57 +2875,115 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-10-09T05:16:32+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" }, { "name": "symfony/console", - "version": "v4.3.4", + "version": "v7.2.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "de63799239b3881b8a08f8481b22348f77ed7b36" + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/de63799239b3881b8a08f8481b22348f77ed7b36", - "reference": "de63799239b3881b8a08f8481b22348f77ed7b36", + "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": ">=8.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1" + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^6.4|^7.0" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3", - "symfony/process": "<3.3" + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "symfony/var-dumper": "^4.3" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -2067,54 +3006,137 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v7.2.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-12-11T03:49:26+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "time": "2019-08-26T08:26:39+00:00" + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.3.4", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "429d0a1451d4c9c4abe1959b2986b88794b9b7d2" + "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/429d0a1451d4c9c4abe1959b2986b88794b9b7d2", - "reference": "429d0a1451d4c9c4abe1959b2986b88794b9b7d2", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/910c5db85a5356d0fea57680defec4e99eb9c8c1", + "reference": "910c5db85a5356d0fea57680defec4e99eb9c8c1", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/event-dispatcher-contracts": "^1.1" + "php": ">=8.2", + "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<6.4", + "symfony/service-contracts": "<2.5" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/http-foundation": "^3.4|^4.0", - "symfony/service-contracts": "^1.1", - "symfony/stopwatch": "~3.4|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/error-handler": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" @@ -2137,35 +3159,53 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", - "time": "2019-08-26T08:55:16+00:00" + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.5", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "c61766f4440ca687de1084a5c00b08e167a2575c" + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c61766f4440ca687de1084a5c00b08e167a2575c", - "reference": "c61766f4440ca687de1084a5c00b08e167a2575c", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7642f5e970b672283b7823222ae8ef8bbc160b9f", + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f", "shasum": "" }, "require": { - "php": "^7.1.3" - }, - "suggest": { - "psr/event-dispatcher": "", - "symfony/event-dispatcher-implementation": "" + "php": ">=8.1", + "psr/event-dispatcher": "^1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -2197,32 +3237,48 @@ "interoperability", "standards" ], - "time": "2019-06-20T06:46:26+00:00" + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/filesystem", - "version": "v4.3.4", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263" + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } + "require-dev": { + "symfony/process": "^6.4|^7.0" }, + "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -2245,33 +3301,48 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", - "time": "2019-08-20T14:07:54+00:00" + "support": { + "source": "https://github.com/symfony/filesystem/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-25T15:15:23+00:00" }, { "name": "symfony/finder", - "version": "v4.3.4", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2" + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/86c1c929f0a4b24812e1eb109262fc3372c8e9f2", - "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2", + "url": "https://api.github.com/repos/symfony/finder/zipball/6de263e5868b9a137602dd1e33e4d48bfae99c49", + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=8.2" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" }, + "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" @@ -2294,33 +3365,46 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", - "time": "2019-08-14T12:26:46+00:00" + "support": { + "source": "https://github.com/symfony/finder/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-23T06:56:12+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.3.4", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "81c2e120522a42f623233968244baebd6b36cb6a" + "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/81c2e120522a42f623233968244baebd6b36cb6a", - "reference": "81c2e120522a42f623233968244baebd6b36cb6a", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/7da8fbac9dcfef75ffc212235d76b2754ce0cf50", + "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" @@ -2343,48 +3427,69 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony OptionsResolver Component", + "description": "Provides an improved replacement for the array_replace PHP function", "homepage": "https://symfony.com", "keywords": [ "config", "configuration", "options" ], - "time": "2019-08-08T09:29:19+00:00" + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-20T11:17:29+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.12.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.12-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2408,41 +3513,59 @@ "polyfill", "portable" ], - "time": "2019-08-06T08:03:45+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.12.0", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", - "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.12-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2458,48 +3581,69 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "grapheme", + "intl", "polyfill", "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-php70", - "version": "v1.12.0", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "54b4c428a0054e254223797d2713c31e08610831" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/54b4c428a0054e254223797d2713c31e08610831", - "reference": "54b4c428a0054e254223797d2713c31e08610831", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.12-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2518,45 +3662,148 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "intl", + "normalizer", "polyfill", "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-php72", - "version": "v1.12.0", + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "04ce3335667451138df4307d6a9b61565560199e" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", - "reference": "04ce3335667451138df4307d6a9b61565560199e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.12-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { "files": [ "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2564,6 +3811,10 @@ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2573,7 +3824,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2581,38 +3832,56 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-php73", - "version": "v1.12.0", + "name": "symfony/polyfill-php81", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/2ceb49eaccb9352bff54d22570276bb75ba4a188", - "reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.12-dev" + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2631,7 +3900,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2639,31 +3908,43 @@ "portable", "shim" ], - "time": "2019-08-06T08:03:45+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/process", - "version": "v4.3.4", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "e89969c00d762349f078db1128506f7f3dcc0d4a" + "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/e89969c00d762349f078db1128506f7f3dcc0d4a", - "reference": "e89969c00d762349f078db1128506f7f3dcc0d4a", + "url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", + "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=8.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" @@ -2686,41 +3967,66 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", - "time": "2019-08-26T08:26:39+00:00" + "support": { + "source": "https://github.com/symfony/process/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T14:24:19+00:00" }, { "name": "symfony/service-contracts", - "version": "v1.1.6", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3" + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ea7263d6b6d5f798b56a45a5b8d686725f2719a3", - "reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", "shasum": "" }, "require": { - "php": "^7.1.3", - "psr/container": "^1.0" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, - "suggest": { - "symfony/service-implementation": "" + "conflict": { + "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2746,32 +4052,44 @@ "interoperability", "standards" ], - "time": "2019-08-20T14:44:19+00:00" + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.3.4", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71" + "reference": "696f418b0d722a4225e1c3d95489d262971ca924" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/1e4ff456bd625be5032fac9be4294e60442e9b71", - "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/696f418b0d722a4225e1c3d95489d262971ca924", + "reference": "696f418b0d722a4225e1c3d95489d262971ca924", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/service-contracts": "^1.0" + "php": ">=8.2", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" @@ -2794,108 +4112,173 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Stopwatch Component", + "description": "Provides a way to profile code", "homepage": "https://symfony.com", - "time": "2019-08-07T11:52:19+00:00" + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" }, { - "name": "theseer/tokenizer", - "version": "1.1.3", + "name": "symfony/string", + "version": "v7.2.0", "source": { "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + "url": "https://github.com/symfony/string.git", + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82", + "reference": "446e0d146f991dde3e73f45f2c97a9faad773c82", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/emoji": "^7.1", + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.4|^7.0" }, "type": "library", "autoload": { - "classmap": [ - "src/" + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Arne Blankerts", - "role": "Developer", - "email": "arne@blankerts.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v7.2.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-13T13:31:26+00:00" }, { - "name": "webmozart/assert", - "version": "1.5.0", + "name": "theseer/tokenizer", + "version": "1.2.3", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } ], - "time": "2019-08-24T08:43:50+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.1" + "php": "^7.1|^8.0" }, - "platform-dev": [] + "platform-dev": {}, + "plugin-api-version": "2.6.0" } From 94ebe30e6bb857eb5dd642752310b29a54640903 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:09:13 +0100 Subject: [PATCH 07/18] chore: remove .travis.yml --- .travis.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b330e96..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: php - -dist: trusty - -php: - - 7.2 - - 7.3 - -matrix: - include: - - php: 7.2 - env: COVERAGE=yes - -cache: - directories: - - $HOME/.composer/cache - -before_script: - - composer self-update - - if [[ $COVERAGE == yes ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi - - if [[ $COVERAGE == yes ]]; then chmod +x ./cc-test-reporter; fi - - if [[ $COVERAGE == yes ]]; then ./cc-test-reporter before-build; fi - -install: - - composer install --prefer-source - -script: - - if [[ $COVERAGE != yes ]]; then composer test; fi - - if [[ $COVERAGE == yes ]]; then composer testc; fi - - if [[ $COVERAGE == yes ]]; then composer check-code; fi - -after_script: - - if [[ $COVERAGE == yes ]]; then ./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT; fi - -notifications: - email: false From ee5a075459a4f127959fe3482c153eb419e20c64 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:09:58 +0100 Subject: [PATCH 08/18] feat: GitHub action test only 8.0 and 8.4 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5543f9..f410d36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ 7.2, 7.3 ] + php: [ 8.0, 8.4 ] include: - - php: 7.2 + - php: 8.4 coverage: yes steps: - name: Checkout code From b58bb95081d21cdfed63d0dd86c48f3b883abd94 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:11:02 +0100 Subject: [PATCH 09/18] feat: GitHub action test only 8.3 and 8.4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f410d36..878cc84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ 8.0, 8.4 ] + php: [ 8.3, 8.4 ] include: - php: 8.4 coverage: yes From c7fe4ab191a716666ea6416f72e52cd4dc75fd4c Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:13:30 +0100 Subject: [PATCH 10/18] chore: format code style --- example/ApplicativeFunctorTest.php | 3 +- example/ApplicatorLiftTest.php | 3 +- example/ComplexErrorDrivenDevelopmentTest.php | 23 ++-- example/EitherMonadTest.php | 3 +- example/ExampleOfTraversableTest.php | 3 +- example/FreeBddStyleDSLTest.php | 8 +- example/FreeCalculatorTest.php | 10 +- example/FreeDooDSLTest.php | 3 +- example/FreeMonadTest.php | 7 +- example/FreeUnionTypeGeneratorTest.php | 10 +- example/FunctorCollectionTest.php | 3 +- example/ListComprehensionWithMonadTest.php | 3 +- example/MaybeMonadAndCollectionTest.php | 3 +- example/MaybeMonoidTest.php | 3 +- example/ParserTest.php | 24 ++-- example/ReaderMonadTest.php | 3 +- example/StateMonadTest.php | 3 +- example/WriterMonadTest.php | 3 +- src/Common/ValueOfTrait.php | 4 +- src/Functional/functions.php | 126 +++++++++--------- src/Functional/infinit.php | 17 +-- src/Functional/listt.php | 34 ++--- src/Functional/miscellaneous.php | 15 ++- src/Functional/monoid.php | 5 +- src/Functional/predicates.php | 12 +- src/Functional/setoid.php | 5 +- src/Functional/strings.php | 6 +- src/Functional/sublist.php | 25 ++-- src/Functional/zipping.php | 9 +- src/Monad/Control/Doo/Algebra/DooF.php | 1 + src/Monad/Control/Doo/Algebra/Let.php | 1 + .../Registry/CannotRedeclareVariableError.php | 5 +- src/Monad/Control/Doo/Registry/Registry.php | 7 +- .../Doo/Registry/VariableNotDeclaredError.php | 5 +- src/Monad/Control/Doo/interpretation.php | 8 +- src/Monad/Either/Either.php | 4 +- src/Monad/Either/Left.php | 2 +- src/Monad/Either/Right.php | 2 +- src/Monad/Either/functions.php | 25 ++-- src/Monad/Free/Free.php | 2 +- src/Monad/Free/MonadFree.php | 2 +- src/Monad/Free/Pure.php | 2 +- src/Monad/Free/functions.php | 4 +- src/Monad/IO.php | 2 +- src/Monad/IO/IOError.php | 4 +- src/Monad/IO/errors.php | 12 +- src/Monad/IO/functions.php | 18 +-- src/Monad/Identity.php | 2 +- src/Monad/Maybe/Just.php | 2 +- src/Monad/Maybe/Maybe.php | 2 +- src/Monad/Maybe/functions.php | 9 +- src/Monad/Reader.php | 2 +- src/Monad/Reader/functions.php | 2 +- src/Monad/State.php | 2 +- src/Monad/State/functions.php | 6 +- src/Primitive/EmptyListError.php | 4 +- src/Primitive/Listt.php | 4 +- src/Primitive/ListtCons.php | 8 +- src/Primitive/ListtNil.php | 9 +- src/Primitive/Num.php | 2 +- src/Primitive/Stringg.php | 2 +- src/Primitive/TypeMismatchError.php | 4 +- src/Useful/PatternMatcher.php | 2 +- src/Useful/PatternNotMatchedError.php | 4 +- src/Useful/SnapshotIterator.php | 4 +- src/Useful/match.php | 6 +- test/Functional/ApplicatorTest.php | 6 +- test/Functional/ComposeTest.php | 6 +- test/Functional/ConcatTest.php | 16 ++- test/Functional/ConsttTest.php | 3 +- test/Functional/CurryNTest.php | 5 +- test/Functional/CurryTest.php | 14 +- test/Functional/CycleTest.php | 5 +- test/Functional/DropWhileTest.php | 10 +- test/Functional/FilterMTest.php | 9 +- test/Functional/FilterTest.php | 9 +- test/Functional/FlipTest.php | 18 ++- test/Functional/FoldMTest.php | 9 +- test/Functional/FoldrTest.php | 3 +- test/Functional/HeadTest.php | 14 +- test/Functional/IdentityTest.php | 6 +- test/Functional/InvokeTest.php | 3 +- test/Functional/IterateTest.php | 5 +- test/Functional/JoinTest.php | 12 +- test/Functional/LengthTest.php | 8 +- test/Functional/LiftM2Test.php | 14 +- test/Functional/PipeTest.php | 3 +- test/Functional/PipelineTest.php | 6 +- test/Functional/PushTest.php | 6 +- test/Functional/ReduceTest.php | 3 +- test/Functional/RepeatTest.php | 3 +- test/Functional/ReplicateTest.php | 3 +- test/Functional/ReverseTest.php | 8 +- test/Functional/SpanTest.php | 22 +-- test/Functional/TailTest.php | 16 ++- test/Functional/TakeTest.php | 32 ++--- test/Functional/TeeTest.php | 3 +- test/Functional/UnzipTest.php | 10 +- test/Functional/ValueOfTest.php | 20 +-- test/Functional/ZipTest.php | 6 +- test/Monad/EitherTest.php | 23 ++-- test/Monad/FreeTest.php | 15 ++- test/Monad/IOTest.php | 3 +- test/Monad/IdentityTest.php | 3 +- test/Monad/MaybeTest.php | 3 +- test/Monad/ReaderTest.php | 3 +- test/Monad/StateTest.php | 3 +- test/Monad/WriterTest.php | 3 +- test/Primitive/ListtTest.php | 31 +++-- test/Primitive/NumTest.php | 5 +- test/Primitive/ProductTest.php | 6 +- test/Primitive/StringgTest.php | 6 +- test/Primitive/SumTest.php | 8 +- test/Useful/MatchTest.php | 27 ++-- 114 files changed, 591 insertions(+), 422 deletions(-) diff --git a/example/ApplicativeFunctorTest.php b/example/ApplicativeFunctorTest.php index f2ab915..b618f4b 100644 --- a/example/ApplicativeFunctorTest.php +++ b/example/ApplicativeFunctorTest.php @@ -4,10 +4,11 @@ namespace example; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\fromIterable; -class ApplicativeFunctorTest extends \PHPUnit\Framework\TestCase +class ApplicativeFunctorTest extends TestCase { public function test_it_should_apply_every_function_in_collection_with_every_item_in_second() { diff --git a/example/ApplicatorLiftTest.php b/example/ApplicatorLiftTest.php index 23f2a42..014e288 100644 --- a/example/ApplicatorLiftTest.php +++ b/example/ApplicatorLiftTest.php @@ -4,6 +4,7 @@ namespace example; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Primitive\Listt; @@ -12,7 +13,7 @@ function sum_($a, $b) return $a + $b; } -class ApplicatorLiftTest extends \PHPUnit\Framework\TestCase +class ApplicatorLiftTest extends TestCase { public function test_it_should_sum_all_from_one_list_with_elements_from_second() { diff --git a/example/ComplexErrorDrivenDevelopmentTest.php b/example/ComplexErrorDrivenDevelopmentTest.php index f678989..f94cdc6 100644 --- a/example/ComplexErrorDrivenDevelopmentTest.php +++ b/example/ComplexErrorDrivenDevelopmentTest.php @@ -4,6 +4,7 @@ require_once 'vendor/autoload.php'; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Either as E; @@ -52,7 +53,7 @@ function updateDatabaseStep(array $request) { return E\tryCatch( f\tee('updateDatabase'), - function (\Exception $e) { + function (Exception $e) { return $e->getMessage(); } )($request); @@ -74,7 +75,7 @@ function returnMessage(array $request) function returnFailure($data) { return [ - 'error' => (string) $data, + 'error' => (string)$data, ]; } @@ -88,7 +89,7 @@ function handleRequest(array $request) )($request); } -class ComplexErrorDrivenDevelopmentTest extends \PHPUnit\Framework\TestCase +class ComplexErrorDrivenDevelopmentTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_be_prepared_of_errors(array $request, $isError, $expected) @@ -107,36 +108,36 @@ public static function provideData() { return [ 'success case' => [ - [ + [ 'name' => 'Jone Doe', 'email' => 'test@example.com' ], false, - ['status' => 200], + ['status' => 200], ], 'username to short' => [ - [ + [ 'name' => '', 'email' => 'test@example.com' ], true, - ['error' => 'Request name is empty'], + ['error' => 'Request name is empty'], ], 'username to long' => [ - [ + [ 'name' => 'asd asdasdlaks askl djalskd jalskdjaslkdjasldjadsa asd', 'email' => 'test@example.com' ], true, - ['error' => 'Request name is to long'], + ['error' => 'Request name is to long'], ], 'email empty' => [ - [ + [ 'name' => 'Jone Doe', 'email' => '' ], true, - ['error' => 'Request e-mail is empty'], + ['error' => 'Request e-mail is empty'], ], ]; } diff --git a/example/EitherMonadTest.php b/example/EitherMonadTest.php index a1f2d5e..d03dcdd 100644 --- a/example/EitherMonadTest.php +++ b/example/EitherMonadTest.php @@ -4,6 +4,7 @@ namespace example; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Either; use Widmogrod\Monad\Either as e; @@ -15,7 +16,7 @@ function read($file) : Either\Left::of(sprintf('File "%s" does not exists', $file)); } -class EitherMonadTest extends \PHPUnit\Framework\TestCase +class EitherMonadTest extends TestCase { public function test_it_should_concat_content_of_two_files_only_when_files_exists() { diff --git a/example/ExampleOfTraversableTest.php b/example/ExampleOfTraversableTest.php index 84aa429..0cf2182 100644 --- a/example/ExampleOfTraversableTest.php +++ b/example/ExampleOfTraversableTest.php @@ -4,6 +4,7 @@ namespace example; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe as m; @@ -12,7 +13,7 @@ function value_is($x) return $x % 2 == 1 ? m\nothing() : m\just($x); } -class ExampleOfTraversableTest extends \PHPUnit\Framework\TestCase +class ExampleOfTraversableTest extends TestCase { public function test_it_traverse_just() { diff --git a/example/FreeBddStyleDSLTest.php b/example/FreeBddStyleDSLTest.php index 8314a10..5fc6552 100644 --- a/example/FreeBddStyleDSLTest.php +++ b/example/FreeBddStyleDSLTest.php @@ -4,16 +4,18 @@ namespace example; +use Exception; use FunctionalPHP\FantasyLand\Functor; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Free\MonadFree; use Widmogrod\Monad\Free\Pure; use Widmogrod\Monad\State; -use const Widmogrod\Monad\State\value; use function Widmogrod\Functional\curryN; use function Widmogrod\Functional\push_; use function Widmogrod\Monad\Free\foldFree; use function Widmogrod\Monad\Free\liftF; use function Widmogrod\Useful\matchPatterns; +use const Widmogrod\Monad\State\value; interface ScenarioF extends Functor { @@ -225,7 +227,7 @@ function matchRegexp(array $patterns, $value = null) } } - throw new \Exception(sprintf( + throw new Exception(sprintf( 'Cannot match "%s" to list of regexp %s', $value, implode(', ', array_keys($patterns)) @@ -236,7 +238,7 @@ function matchRegexp(array $patterns, $value = null) /** * Inspired by https://github.com/politrons/TestDSL */ -class FreeBddStyleDSLTest extends \PHPUnit\Framework\TestCase +class FreeBddStyleDSLTest extends TestCase { public function test_it_should_interpret_bdd_scenario() { diff --git a/example/FreeCalculatorTest.php b/example/FreeCalculatorTest.php index d8aad65..57d2e49 100644 --- a/example/FreeCalculatorTest.php +++ b/example/FreeCalculatorTest.php @@ -6,11 +6,13 @@ use FunctionalPHP\FantasyLand\Functor; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Free\MonadFree; use Widmogrod\Monad\Free\Pure; use Widmogrod\Monad\Identity; use Widmogrod\Primitive\Stringg; use Widmogrod\Useful\PatternMatcher; +use Widmogrod\Useful\PatternNotMatchedError; use function Widmogrod\Functional\bindM2; use function Widmogrod\Functional\compose; use function Widmogrod\Monad\Free\foldFree; @@ -197,7 +199,7 @@ function square(MonadFree $a): MonadFree * interpretInt :: ExpF -> Identity Free Int * * @return Identity - * @throws \Widmogrod\Useful\PatternNotMatchedError + * @throws PatternNotMatchedError */ function interpretInt(ExpF $f) { @@ -223,7 +225,7 @@ function interpretInt(ExpF $f) * interpretInt :: ExpF -> Identity Free Stringg * * @return Identity - * @throws \Widmogrod\Useful\PatternNotMatchedError + * @throws PatternNotMatchedError */ function interpretPrint(ExpF $f) { @@ -255,7 +257,7 @@ function interpretPrint(ExpF $f) * optimizeCalc :: ExpF -> ExpF * * @return Identity - * @throws \Widmogrod\Useful\PatternNotMatchedError + * @throws PatternNotMatchedError */ function optimizeCalc(ExpF $f) { @@ -277,7 +279,7 @@ function optimizeCalc(ExpF $f) ], $f); } -class FreeCalculatorTest extends \PHPUnit\Framework\TestCase +class FreeCalculatorTest extends TestCase { #[DataProvider('provideCalculations')] public function test_example_with_do_notation($calc, $expected) diff --git a/example/FreeDooDSLTest.php b/example/FreeDooDSLTest.php index ed27d2b..8b3196a 100644 --- a/example/FreeDooDSLTest.php +++ b/example/FreeDooDSLTest.php @@ -4,12 +4,13 @@ namespace example; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Identity; use function Widmogrod\Monad\Control\Doo\doo; use function Widmogrod\Monad\Control\Doo\in; use function Widmogrod\Monad\Control\Doo\let; -class FreeDooDSLTest extends \PHPUnit\Framework\TestCase +class FreeDooDSLTest extends TestCase { public function test_example_with_do_notation() { diff --git a/example/FreeMonadTest.php b/example/FreeMonadTest.php index c1d110a..caf7af7 100644 --- a/example/FreeMonadTest.php +++ b/example/FreeMonadTest.php @@ -6,16 +6,17 @@ use FunctionalPHP\FantasyLand\Functor; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Free as ff; use Widmogrod\Monad\Free\MonadFree; use Widmogrod\Monad\IO; use Widmogrod\Monad\State; use Widmogrod\Primitive\Listt; -use const Widmogrod\Monad\IO\pure; -use const Widmogrod\Monad\State\value; use function Widmogrod\Functional\fromNil; use function Widmogrod\Useful\matchPatterns; +use const Widmogrod\Monad\IO\pure; +use const Widmogrod\Monad\State\value; interface TeletypeF extends Functor { @@ -180,7 +181,7 @@ function echo_composition_() )(); } -class FreeMonadTest extends \PHPUnit\Framework\TestCase +class FreeMonadTest extends TestCase { #[DataProvider('provideEchoImplementation')] public function test_it_should_allow_to_interpret_as_a_state_monad(MonadFree $echo) diff --git a/example/FreeUnionTypeGeneratorTest.php b/example/FreeUnionTypeGeneratorTest.php index da9c9ca..9473a12 100644 --- a/example/FreeUnionTypeGeneratorTest.php +++ b/example/FreeUnionTypeGeneratorTest.php @@ -5,12 +5,14 @@ namespace example; use FunctionalPHP\FantasyLand\Functor; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Free\MonadFree; use Widmogrod\Monad\Free\Pure; use Widmogrod\Monad\Identity; use Widmogrod\Primitive\Listt; use Widmogrod\Primitive\Stringg; use Widmogrod\Useful\PatternMatcher; +use Widmogrod\Useful\PatternNotMatchedError; use function Widmogrod\Functional\compose; use function Widmogrod\Functional\curryN; use function Widmogrod\Functional\fromIterable; @@ -255,9 +257,9 @@ public function __toString() const interpretTypesAndGenerate = 'example\interpretTypesAndGenerate'; /** - * @param UnionF $f + * @param UnionF $f * @return Identity - * @throws \Widmogrod\Useful\PatternNotMatchedError + * @throws PatternNotMatchedError */ function interpretTypesAndGenerate(UnionF $f): Identity { @@ -283,9 +285,9 @@ function interpretTypesAndGenerate(UnionF $f): Identity return Identity::of($a)->map($next); } ], $f); -}; +} -class FreeUnionTypeGeneratorTest extends \PHPUnit\Framework\TestCase +class FreeUnionTypeGeneratorTest extends TestCase { public function test_example_1() { diff --git a/example/FunctorCollectionTest.php b/example/FunctorCollectionTest.php index 5b79df5..20674dc 100644 --- a/example/FunctorCollectionTest.php +++ b/example/FunctorCollectionTest.php @@ -4,9 +4,10 @@ namespace example; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\fromIterable; -class FunctorCollectionTest extends \PHPUnit\Framework\TestCase +class FunctorCollectionTest extends TestCase { public function test_it_should_return_new_map() { diff --git a/example/ListComprehensionWithMonadTest.php b/example/ListComprehensionWithMonadTest.php index 552d8cd..090a00e 100644 --- a/example/ListComprehensionWithMonadTest.php +++ b/example/ListComprehensionWithMonadTest.php @@ -4,10 +4,11 @@ namespace example; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromValue; -class ListComprehensionWithMonadTest extends \PHPUnit\Framework\TestCase +class ListComprehensionWithMonadTest extends TestCase { public function test_it_should_combine_two_lists() { diff --git a/example/MaybeMonadAndCollectionTest.php b/example/MaybeMonadAndCollectionTest.php index c0aa458..5bc9bb1 100644 --- a/example/MaybeMonadAndCollectionTest.php +++ b/example/MaybeMonadAndCollectionTest.php @@ -5,13 +5,14 @@ namespace example; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe; use function Widmogrod\Monad\Maybe\just; use function Widmogrod\Monad\Maybe\nothing; use const Widmogrod\Monad\Maybe\maybeNull; -class MaybeMonadAndCollectionTest extends \PHPUnit\Framework\TestCase +class MaybeMonadAndCollectionTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_extract_elements_which_exists($data) diff --git a/example/MaybeMonoidTest.php b/example/MaybeMonoidTest.php index d7dae04..23e6f2c 100644 --- a/example/MaybeMonoidTest.php +++ b/example/MaybeMonoidTest.php @@ -3,6 +3,7 @@ declare(strict_types=1); use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Maybe; @@ -12,7 +13,7 @@ use function Widmogrod\Monad\Maybe\maybeNull; use const Widmogrod\Monad\Maybe\maybeNull; -class MaybeMonoidTest extends \PHPUnit\Framework\TestCase +class MaybeMonoidTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_concat_only_strings_and_skip_nulls(array $data, array $expected, string $asString) diff --git a/example/ParserTest.php b/example/ParserTest.php index 669ce79..6cb9916 100644 --- a/example/ParserTest.php +++ b/example/ParserTest.php @@ -5,12 +5,14 @@ namespace example; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Identity; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Maybe; use Widmogrod\Primitive\EmptyListError; use Widmogrod\Primitive\Listt; use Widmogrod\Primitive\Stringg; +use function is_numeric; use function Widmogrod\Functional\append; use function Widmogrod\Functional\bind; use function Widmogrod\Functional\concatM; @@ -97,7 +99,7 @@ function matchP(callable $predicate, ?Listt $a = null) function numbersP(Listt $a) { return matchP(function (Stringg $s) { - return \is_numeric($s->extract()); + return is_numeric($s->extract()); }, $a); } @@ -295,7 +297,7 @@ function tokens(string $input): Listt return $tokens; } -class ParserTest extends \PHPUnit\Framework\TestCase +class ParserTest extends TestCase { public function test_generated_ast() { @@ -381,7 +383,7 @@ public function test_generated_ast() public function test_integration_with_free_calc() { $literal = tokenizeP(numbersP, function (Stringg $a) { - return int((int) $a->extract()); + return int((int)$a->extract()); }); $opAdd = tokenizeP(charP('+'), function (Stringg $a) { return sum; @@ -793,20 +795,20 @@ public static function provideGeneratedCode() { return [ 'data A = B deriving (Show)' => [ - 'data A = B deriving (Show)', - 'A.txt', + 'data A = B deriving (Show)', + 'A.txt', ], 'data Maybe a = Just a | Nothing' => [ - 'data Maybe a = Just a | Nothing', - 'Maybe.txt', + 'data Maybe a = Just a | Nothing', + 'Maybe.txt', ], 'data Either a b = Left a | Right b' => [ - 'data Either a b = Left a | Right b', - 'Either.txt', + 'data Either a b = Left a | Right b', + 'Either.txt', ], 'data FreeT f a = Pure a | Free f (FreeT f a)' => [ - 'data FreeT f a = Pure a | Free f (FreeT f a)', - 'FreeT.txt', + 'data FreeT f a = Pure a | Free f (FreeT f a)', + 'FreeT.txt', ], ]; } diff --git a/example/ReaderMonadTest.php b/example/ReaderMonadTest.php index f41f7c6..39b4ce0 100644 --- a/example/ReaderMonadTest.php +++ b/example/ReaderMonadTest.php @@ -4,6 +4,7 @@ namespace example; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Reader as R; function hello($name) @@ -19,7 +20,7 @@ function ask($content) }); } -class ReaderMonadTest extends \PHPUnit\Framework\TestCase +class ReaderMonadTest extends TestCase { public function test_it_should_pass_the_name_around() { diff --git a/example/StateMonadTest.php b/example/StateMonadTest.php index d7366fa..67c1c6f 100644 --- a/example/StateMonadTest.php +++ b/example/StateMonadTest.php @@ -5,6 +5,7 @@ namespace example; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Maybe; use Widmogrod\Monad\State as S; @@ -89,7 +90,7 @@ function retrieveRelated($productName) }); } -class StateMonadTest extends \PHPUnit\Framework\TestCase +class StateMonadTest extends TestCase { #[DataProvider('provideData')] public function test_demonstrate_state_monad($expectedProducts) diff --git a/example/WriterMonadTest.php b/example/WriterMonadTest.php index 88edea2..f3abfc8 100644 --- a/example/WriterMonadTest.php +++ b/example/WriterMonadTest.php @@ -4,11 +4,12 @@ namespace example; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Writer as W; use Widmogrod\Primitive\Stringg as S; -class WriterMonadTest extends \PHPUnit\Framework\TestCase +class WriterMonadTest extends TestCase { public function test_it_should_filter_with_logs() { diff --git a/src/Common/ValueOfTrait.php b/src/Common/ValueOfTrait.php index b45bef1..f4b3f92 100644 --- a/src/Common/ValueOfTrait.php +++ b/src/Common/ValueOfTrait.php @@ -4,6 +4,8 @@ namespace Widmogrod\Common; +use function Widmogrod\Functional\valueOf; + trait ValueOfTrait { /** @@ -13,6 +15,6 @@ trait ValueOfTrait */ public function extract() { - return \Widmogrod\Functional\valueOf($this->value); + return valueOf($this->value); } } diff --git a/src/Functional/functions.php b/src/Functional/functions.php index f37d1b1..1783005 100644 --- a/src/Functional/functions.php +++ b/src/Functional/functions.php @@ -4,11 +4,14 @@ namespace Widmogrod\Functional; +use Closure; +use Exception; use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Foldable; use FunctionalPHP\FantasyLand\Functor; use FunctionalPHP\FantasyLand\Monad; use FunctionalPHP\FantasyLand\Traversable; +use ReflectionFunction; use Widmogrod\Common\ValueOfInterface; use Widmogrod\Primitive\Listt; use Widmogrod\Primitive\ListtCons; @@ -21,7 +24,7 @@ /** * applicator :: a -> (a -> b) -> b * - * @param mixed $x + * @param mixed $x * @param callable $f * * @return mixed @@ -42,7 +45,7 @@ function applicator($x, ?callable $f = null) * invoke :: a -> #{a: (_ -> b)} -> b * * @param string $method - * @param mixed $object + * @param mixed $object * * @return mixed */ @@ -56,9 +59,9 @@ function invoke($method, $object = null) /** * Curry function * - * @param int $numberOfArguments + * @param int $numberOfArguments * @param callable $function - * @param array $args + * @param array $args * * @return callable */ @@ -77,13 +80,13 @@ function curryN($numberOfArguments, callable $function, array $args = []) * Curry function * * @param callable $function - * @param array $args + * @param array $args * * @return callable */ function curry(callable $function, array $args = []) { - $reflectionOfFunction = new \ReflectionFunction(\Closure::fromCallable($function)); + $reflectionOfFunction = new ReflectionFunction(Closure::fromCallable($function)); $numberOfArguments = count($reflectionOfFunction->getParameters()); // We cant expect more arguments than are defined in function @@ -121,9 +124,9 @@ function valueOf($value) * Call $function with $value and return $value * * @param callable $function - * @param mixed $value + * @param mixed $value * - * @return \Closure + * @return Closure */ function tee(callable $function, $value = null) { @@ -144,9 +147,9 @@ function tee(callable $function, $value = null) * * Call $function with arguments in reversed order * - * @return \Closure - * * @param callable $function + * @return Closure + * */ function reverse(callable $function) { @@ -163,10 +166,10 @@ function reverse(callable $function) /** * map :: Functor f => (a -> b) -> f a -> f b * - * @return mixed|\Closure - * * @param callable $transformation - * @param Functor $value + * @param Functor $value + * @return mixed|Closure + * */ function map(callable $transformation, ?Functor $value = null) { @@ -183,10 +186,10 @@ function map(callable $transformation, ?Functor $value = null) /** * bind :: Monad m => (a -> m b) -> m a -> m b * - * @return mixed|\Closure - * * @param callable $function - * @param Monad $value + * @param Monad $value + * @return mixed|Closure + * */ function bind(callable $function, ?Monad $value = null) { @@ -220,8 +223,8 @@ function join(Monad $monad): Monad /** * reduce :: Foldable t => (b -> a -> b) -> b -> t a -> b * - * @param callable $callable Binary function ($accumulator, $value) - * @param mixed $accumulator + * @param callable $callable Binary function ($accumulator, $value) + * @param mixed $accumulator * @param Foldable $foldable * * @return mixed @@ -230,7 +233,7 @@ function reduce(callable $callable, $accumulator = null, ?Foldable $foldable = n { return curryN(3, function ( callable $callable, - $accumulator, + $accumulator, Foldable $foldable ) { return $foldable->reduce($callable, $accumulator); @@ -248,8 +251,8 @@ function reduce(callable $callable, $accumulator = null, ?Foldable $foldable = n * Foldr is expresed by foldl (reduce) so it loose some properties. * For more reading please read this article https://wiki.haskell.org/Foldl_as_foldr * - * @param callable $callable Binary function ($value, $accumulator) - * @param mixed $accumulator + * @param callable $callable Binary function ($value, $accumulator) + * @param mixed $accumulator * @param Foldable $foldable * * @return mixed @@ -258,7 +261,7 @@ function foldr(callable $callback, mixed $initialValue = null, ?Foldable $inputF { return curryN(3, function ( callable $callable, - $accumulator, + $accumulator, Foldable $foldable ) { return reduce( @@ -280,7 +283,7 @@ function foldr(callable $callback, mixed $initialValue = null, ?Foldable $inputF * @param callable $predicate * @param Foldable $list * - * @return Foldable|\Closure + * @return Foldable|Closure */ function filter(callable $predicate, ?Foldable $list = null) { @@ -305,7 +308,7 @@ function filter(callable $predicate, ?Foldable $list = null) * @param callable $a * @param callable $b,... * - * @return \Closure func($mValue) : mixed + * @return Closure func($mValue) : mixed */ function mpipeline(callable $a, callable $b) { @@ -326,7 +329,7 @@ function mpipeline(callable $a, callable $b) * @param callable $a * @param callable $b,... * - * @return \Closure func($mValue) : mixed + * @return Closure func($mValue) : mixed */ function mcompose(callable $a, callable $b) { @@ -350,7 +353,7 @@ function tryCatch(callable $function, callable $catchFunction, $value) return curryN(3, function (callable $function, callable $catchFunction, $value) { try { return $function($value); - } catch (\Exception $e) { + } catch (Exception $e) { return $catchFunction($e); } })(...func_get_args()); @@ -364,11 +367,11 @@ function tryCatch(callable $function, callable $catchFunction, $value) /** * reThrow :: Exception e => e -> a * - * @param \Exception $e + * @param Exception $e * - * @throws \Exception + * @throws Exception */ -function reThrow(\Exception $e) +function reThrow(Exception $e) { throw $e; } @@ -388,16 +391,17 @@ function reThrow(\Exception $e) * liftM2 (+) (Just 1) Nothing = Nothing * * @param callable $transformation - * @param Monad $ma - * @param Monad $mb + * @param Monad $ma + * @param Monad $mb * - * @return Monad|\Closure + * @return Monad|Closure */ function liftM2( ?callable $transformation = null, - ?Monad $ma = null, - ?Monad $mb = null -) { + ?Monad $ma = null, + ?Monad $mb = null +) +{ return call_user_func_array( liftA2, func_get_args() @@ -413,22 +417,23 @@ function liftM2( * bindM2 :: Monad m => (a -> b -> m c) -> m a -> m b -> m c * * @param callable $transformation - * @param Monad $ma - * @param Monad $mb + * @param Monad $ma + * @param Monad $mb * - * @return Monad|\Closure + * @return Monad|Closure */ function bindM2( ?callable $transformation = null, - ?Monad $ma = null, - ?Monad $mb = null -) { + ?Monad $ma = null, + ?Monad $mb = null +) +{ return curryN( 3, function ( callable $transformation, - Monad $ma, - Monad $mb + Monad $ma, + Monad $mb ) { return $ma->bind(function ($a) use ($mb, $transformation) { return $mb->bind(function ($b) use ($a, $transformation) { @@ -447,19 +452,20 @@ function ( /** * liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c * - * @param callable $transformation + * @param callable $transformation * @param Applicative $fa * @param Applicative $fb * - * @return Applicative|\Closure + * @return Applicative|Closure */ function liftA2( - ?callable $transformation = null, + ?callable $transformation = null, ?Applicative $fa = null, ?Applicative $fb = null -) { +) +{ return curryN(3, function ( - callable $transformation, + callable $transformation, Applicative $fa, Applicative $fb ) { @@ -489,7 +495,7 @@ function liftA2( * @param Monad $a * @param Monad $b * - * @return Monad|\Closure + * @return Monad|Closure */ function sequenceM(Monad $a, ?Monad $b = null): Monad { @@ -514,15 +520,15 @@ function sequenceM(Monad $a, ?Monad $b = null): Monad * * Map each element of a structure to an action, evaluate these actions from left to right, and collect the results * - * @param callable $transformation (a -> f b) - * @param Traversable $t t a + * @param callable $transformation (a -> f b) + * @param Traversable $t t a * - * @return \Closure|Applicative f (t b) + * @return Closure|Applicative f (t b) */ function traverse(callable $transformation, ?Traversable $t = null) { return curryN(2, function ( - callable $transformation, + callable $transformation, Traversable $t ) { return $t->traverse($transformation); @@ -537,16 +543,16 @@ function traverse(callable $transformation, ?Traversable $t = null) * foldr :: (a -> b -> b) -> b -> t a -> b * liftA2 :: (a -> b -> c) -> f a -> f b -> f c *``` - * @param callable $f (a -> m Bool) + * @param callable $f (a -> m Bool) * @param Foldable $xs [a] * - * @return \Closure|Monad m [a] + * @return Closure|Monad m [a] */ function filterM(callable $f, ?Foldable $xs = null) { return curryN(2, function ( callable $f, - $xs + $xs ) { $result = foldr(function ($x, $ys) use ($f) { $y = $f($x); @@ -579,8 +585,8 @@ function filterM(callable $f, ?Foldable $xs = null) * foldr :: (a -> b -> b) -> b -> t a -> b * ``` * - * @param callable $f (a -> b -> m a) - * @param null $z0 + * @param callable $f (a -> b -> m a) + * @param null $z0 * @param Foldable $xs [b] * * @return mixed m a @@ -589,8 +595,8 @@ function foldM(callable $f, $z0 = null, ?Foldable $xs = null) { return curryN(3, function ( callable $f, - $z0, - $xs + $z0, + $xs ) { $result = foldr(function ($x, $k) use ($f, $z0) { if ($k === null) { diff --git a/src/Functional/infinit.php b/src/Functional/infinit.php index 2809925..58091f9 100644 --- a/src/Functional/infinit.php +++ b/src/Functional/infinit.php @@ -4,6 +4,7 @@ namespace Widmogrod\Functional; +use Closure; use Widmogrod\Primitive\EmptyListError; use Widmogrod\Primitive\Listt; use Widmogrod\Primitive\ListtCons; @@ -22,9 +23,9 @@ * ```haskell * iterate f x == [x, f x, f (f x), ...] * ``` - * @param callable $fn - * @param mixed $a - * @return Listt|\Closure + * @param callable $fn + * @param mixed $a + * @return Listt|Closure */ function iterate(callable $fn, $a = null) { @@ -66,9 +67,9 @@ function repeat($a) * replicate n x is a list of length n with x the value of every element. * It is an instance of the more general genericReplicate, in which n may be of any integral type. * - * @param int $n - * @param mixed $a - * @return Listt|\Closure + * @param int $n + * @param mixed $a + * @return Listt|Closure */ function replicate(int $n, $a = null): Listt { @@ -87,7 +88,7 @@ function replicate(int $n, $a = null): Listt * * cycle ties a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists. * - * @param Listt $xs + * @param Listt $xs * @return Listt * @throws EmptyListError */ @@ -97,7 +98,7 @@ function cycle(Listt $xs): Listt throw new EmptyListError(__FUNCTION__); } - $cycle = function (Listt $xs, Listt $cycled) use (&$cycle) : Listt { + $cycle = function (Listt $xs, Listt $cycled) use (&$cycle): Listt { if ($cycled instanceof ListtNil) { return cycle($xs); } diff --git a/src/Functional/listt.php b/src/Functional/listt.php index 7146106..8473a38 100644 --- a/src/Functional/listt.php +++ b/src/Functional/listt.php @@ -4,7 +4,11 @@ namespace Widmogrod\Functional; +use ArrayObject; +use Closure; use FunctionalPHP\FantasyLand\Foldable; +use IteratorAggregate; +use Widmogrod\Primitive\EmptyListError; use Widmogrod\Primitive\Listt; use Widmogrod\Primitive\ListtCons; use Widmogrod\Useful\SnapshotIterator; @@ -19,16 +23,16 @@ * * Adapt any native PHP value that is iterable into Listt. * - * @param iterable $i + * @param iterable $i * @return Listt */ function fromIterable(iterable $i): Listt { if (is_array($i)) { - $i = new \ArrayObject($i); + $i = new ArrayObject($i); } - if ($i instanceof \IteratorAggregate) { + if ($i instanceof IteratorAggregate) { $i = $i->getIterator(); } @@ -42,7 +46,7 @@ function fromIterable(iterable $i): Listt * Utility function. Must not be used directly. * Use fromValue() or fromIterable() * - * @param SnapshotIterator $i + * @param SnapshotIterator $i * @return Listt */ function fromSnapshotIterator(SnapshotIterator $i): Listt @@ -69,7 +73,7 @@ function fromSnapshotIterator(SnapshotIterator $i): Listt * * Create list containing only one value. * - * @param mixed $value + * @param mixed $value * @return Listt */ function fromValue($value): Listt @@ -128,9 +132,9 @@ function concat(Foldable $xs): Listt /** * prepend :: a -> [a] -> [a] * - * @param mixed $x - * @param Listt $xs - * @return Listt|\Closure + * @param mixed $x + * @param Listt $xs + * @return Listt|Closure */ function prepend($x, ?Listt $xs = null) { @@ -156,8 +160,8 @@ function prepend($x, ?Listt $xs = null) * * If the first list is not finite, the result is the first list. * - * @param Listt $a - * @param Listt|null $b + * @param Listt $a + * @param Listt|null $b * @return Listt|callable */ function append(Listt $a, ?Listt $b = null) @@ -177,9 +181,9 @@ function append(Listt $a, ?Listt $b = null) * * Extract the first element of a list, which must be non-empty. * - * @param Listt $l + * @param Listt $l * @return mixed - * @throws \Widmogrod\Primitive\EmptyListError + * @throws EmptyListError */ function head(Listt $l) { @@ -196,9 +200,9 @@ function head(Listt $l) * * Extract the elements after the head of a list, which must be non-empty. * - * @param Listt $l + * @param Listt $l * @return Listt - * @throws \Widmogrod\Primitive\EmptyListError + * @throws EmptyListError */ function tail(Listt $l) { @@ -217,7 +221,7 @@ function tail(Listt $l) * The default implementation is optimized for structures that are similar to cons-lists, * because there is no general way to do better. * - * @param Foldable $t + * @param Foldable $t * @return int */ function length(Foldable $t): int diff --git a/src/Functional/miscellaneous.php b/src/Functional/miscellaneous.php index 81b7392..af05ea3 100644 --- a/src/Functional/miscellaneous.php +++ b/src/Functional/miscellaneous.php @@ -4,6 +4,8 @@ namespace Widmogrod\Functional; +use Closure; + /** * @var callable */ @@ -69,7 +71,7 @@ function constt($a, $b = null) * @param callable $a * @param callable $b,... * - * @return \Closure func($value) : mixed + * @return Closure func($value) : mixed */ function compose(callable $a, callable $b) { @@ -93,7 +95,7 @@ function compose(callable $a, callable $b) * @param callable $a * @param callable $b,... * - * @return \Closure func($value) : mixed + * @return Closure func($value) : mixed */ function pipeline(callable $a, callable $b) { @@ -121,16 +123,17 @@ function pipeline(callable $a, callable $b) * strtoupper(strtolower('aBc')) ≡ 'ABC' * * - * @param mixed $in - * @param callable $fab - * @param callable ...$fbc + * @param mixed $in + * @param callable $fab + * @param callable ...$fbc * @return mixed */ function pipe( $in, callable $fab, callable ...$fbc -) { +) +{ $callables = count($fbc) > 0 ? $fbc : [identity]; diff --git a/src/Functional/monoid.php b/src/Functional/monoid.php index 59b90cd..9bf9263 100644 --- a/src/Functional/monoid.php +++ b/src/Functional/monoid.php @@ -4,6 +4,7 @@ namespace Widmogrod\Functional; +use Closure; use FunctionalPHP\FantasyLand\Monoid; use FunctionalPHP\FantasyLand\Semigroup; @@ -26,10 +27,10 @@ function emptyM(Monoid $a): Monoid /** * concatM :: a -> a -> a * - * @param Semigroup $a + * @param Semigroup $a * @param Semigroup|null $b * - * @return Semigroup|\Closure + * @return Semigroup|Closure */ function concatM(Semigroup $a, ?Semigroup $b = null) { diff --git a/src/Functional/predicates.php b/src/Functional/predicates.php index aac3b90..51a585a 100644 --- a/src/Functional/predicates.php +++ b/src/Functional/predicates.php @@ -4,6 +4,8 @@ namespace Widmogrod\Functional; +use Closure; + const eql = 'Widmogrod\Functional\eql'; /** @@ -12,7 +14,7 @@ * @param mixed $expected * @param mixed $value * - * @return bool|\Closure + * @return bool|Closure */ function eql($expected, $value = null) { @@ -29,7 +31,7 @@ function eql($expected, $value = null) * @param mixed $expected * @param mixed $value * - * @return bool|\Closure + * @return bool|Closure */ function lt($expected, $value = null) { @@ -43,11 +45,11 @@ function lt($expected, $value = null) /** * orr :: (a -> Bool) -> (a -> Bool) -> a -> Bool * - * @param callable $predicateA + * @param callable $predicateA * @param callable|null $predicateB - * @param mixed $value + * @param mixed $value * - * @return bool|\Closure + * @return bool|Closure */ function orr(callable $predicateA, ?callable $predicateB = null, $value = null) { diff --git a/src/Functional/setoid.php b/src/Functional/setoid.php index b07bd79..a91bfc1 100644 --- a/src/Functional/setoid.php +++ b/src/Functional/setoid.php @@ -4,6 +4,7 @@ namespace Widmogrod\Functional; +use Closure; use FunctionalPHP\FantasyLand\Setoid; const equal = 'Widmogrod\Functional\equal'; @@ -14,11 +15,11 @@ * @param Setoid $a * @param Setoid $b * - * @return bool|\Closure + * @return bool|Closure */ function equal(Setoid $a, ?Setoid $b = null) { - return curryN(2, function (Setoid $a, Setoid $b):bool { + return curryN(2, function (Setoid $a, Setoid $b): bool { return $a->equals($b); })(...func_get_args()); } diff --git a/src/Functional/strings.php b/src/Functional/strings.php index 31f4e7f..314b1af 100644 --- a/src/Functional/strings.php +++ b/src/Functional/strings.php @@ -4,15 +4,17 @@ namespace Widmogrod\Functional; +use Closure; + const concatStrings = 'Widmogrod\Functional\concatStrings'; /** * concatStrings :: String -> String -> String * - * @param string $a + * @param string $a * @param string|null $b * - * @return string|\Closure + * @return string|Closure */ function concatStrings($a, $b = null) { diff --git a/src/Functional/sublist.php b/src/Functional/sublist.php index eb1faec..4fd07ae 100644 --- a/src/Functional/sublist.php +++ b/src/Functional/sublist.php @@ -4,6 +4,7 @@ namespace Widmogrod\Functional; +use Closure; use Widmogrod\Primitive\EmptyListError; use Widmogrod\Primitive\Listt; use Widmogrod\Primitive\ListtCons; @@ -19,9 +20,9 @@ * * take n, applied to a list xs, returns the prefix of xs of length n, or xs itself if n > length xs: * - * @param int $n - * @param Listt $xs - * @return Listt|\Closure + * @param int $n + * @param Listt $xs + * @return Listt|Closure */ function take(int $n, ?Listt $xs = null) { @@ -45,9 +46,9 @@ function take(int $n, ?Listt $xs = null) * drop :: Int -> [a] -> [a] * * drop n xs returns the suffix of xs after the first n elements, or [] if n > length xs: - * @param int $n - * @param Listt $xs - * @return Listt|\Closure + * @param int $n + * @param Listt $xs + * @return Listt|Closure */ function drop(int $n, ?Listt $xs = null) { @@ -80,9 +81,9 @@ function drop(int $n, ?Listt $xs = null) * | otherwise = xs * ``` * - * @param callable $predicate - * @param Listt $xs - * @return Listt|\Closure + * @param callable $predicate + * @param Listt $xs + * @return Listt|Closure */ function dropWhile(callable $predicate, ?Listt $xs = null) { @@ -122,9 +123,9 @@ function dropWhile(callable $predicate, ?Listt $xs = null) * where first element is longest prefix (possibly empty) of xs of elements * that satisfy p and second element is the remainder of the list * - * @param callable $predicate - * @param Listt $xs - * @return array|\Closure + * @param callable $predicate + * @param Listt $xs + * @return array|Closure */ function span(callable $predicate, ?Listt $xs = null) { diff --git a/src/Functional/zipping.php b/src/Functional/zipping.php index 8f46496..6f1ba91 100644 --- a/src/Functional/zipping.php +++ b/src/Functional/zipping.php @@ -4,6 +4,7 @@ namespace Widmogrod\Functional; +use Closure; use Widmogrod\Primitive\EmptyListError; use Widmogrod\Primitive\Listt; use Widmogrod\Primitive\ListtCons; @@ -19,9 +20,9 @@ * zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded. * zip is right-lazy: * - * @param Listt $xs - * @param Listt|null $ys - * @return Listt|\Closure + * @param Listt $xs + * @param Listt|null $ys + * @return Listt|Closure */ function zip(Listt $xs, ?Listt $ys = null) { @@ -52,7 +53,7 @@ function zip(Listt $xs, ?Listt $ys = null) * * unzip transforms a list of pairs into a list of first components and a list of second components. * - * @param Listt $xs + * @param Listt $xs * @return array */ function unzip(Listt $xs): array diff --git a/src/Monad/Control/Doo/Algebra/DooF.php b/src/Monad/Control/Doo/Algebra/DooF.php index a4739d3..3106a7a 100644 --- a/src/Monad/Control/Doo/Algebra/DooF.php +++ b/src/Monad/Control/Doo/Algebra/DooF.php @@ -1,6 +1,7 @@ Reader Registry MonadFree * - * @param DooF $f + * @param DooF $f * @return Reader * - * @throws \Widmogrod\Useful\PatternNotMatchedError + * @throws PatternNotMatchedError */ function interpretation(DooF $f) { diff --git a/src/Monad/Either/Either.php b/src/Monad/Either/Either.php index 457d13b..849e80b 100644 --- a/src/Monad/Either/Either.php +++ b/src/Monad/Either/Either.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad\Either; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; interface Either extends FantasyLand\Monad, @@ -14,7 +14,7 @@ interface Either extends /** * Depending on if is Left or is Right then it apply corresponding function * - * @param callable $left (a -> b) + * @param callable $left (a -> b) * @param callable $right (c -> b) * * @return mixed b diff --git a/src/Monad/Either/Left.php b/src/Monad/Either/Left.php index de74b76..8e56d9c 100644 --- a/src/Monad/Either/Left.php +++ b/src/Monad/Either/Left.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad\Either; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class Left implements Either { diff --git a/src/Monad/Either/Right.php b/src/Monad/Either/Right.php index efa8db3..8b02f01 100644 --- a/src/Monad/Either/Right.php +++ b/src/Monad/Either/Right.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad\Either; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class Right implements Either { diff --git a/src/Monad/Either/functions.php b/src/Monad/Either/functions.php index 460df68..8991c8f 100644 --- a/src/Monad/Either/functions.php +++ b/src/Monad/Either/functions.php @@ -4,6 +4,7 @@ namespace Widmogrod\Monad\Either; +use Closure; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe; @@ -56,9 +57,9 @@ function left($value) * * either :: (a -> c) -> (b -> c) -> Either a b -> c * - * @param callable $left (a -> c) - * @param callable $right (b -> c) - * @param Either $either Either a b + * @param callable $left (a -> c) + * @param callable $right (b -> c) + * @param Either $either Either a b * * @return mixed c */ @@ -78,9 +79,9 @@ function either(callable $left, ?callable $right = null, ?Either $either = null) * * @param callable $left * @param callable $right - * @param Either $either + * @param Either $either * - * @return Left|Right|\Closure + * @return Left|Right|Closure */ function doubleMap(callable $left, ?callable $right = null, ?Either $either = null) { @@ -100,11 +101,11 @@ function doubleMap(callable $left, ?callable $right = null, ?Either $either = nu * * tryCatch :: Exception e => (a -> b) -> (e -> c) -> a -> Either c b * - * @param callable $function (a -> b) + * @param callable $function (a -> b) * @param callable $catchFunction (e -> c) - * @param mixed $value a + * @param mixed $value a * - * @return Either|\Closure + * @return Either|Closure */ function tryCatch(?callable $function = null, ?callable $catchFunction = null, $value = null) { @@ -136,8 +137,8 @@ function toMaybe(Either $either) /** * fromLeft :: a -> Either a b -> a * - * @param mixed $a - * @param Either $either + * @param mixed $a + * @param Either $either * @return mixed */ function fromLeft($a, ?Either $either = null) @@ -152,8 +153,8 @@ function fromLeft($a, ?Either $either = null) /** * fromRight :: b -> Either a b -> b * - * @param mixed $a - * @param Either $either + * @param mixed $a + * @param Either $either * @return mixed */ function fromRight($a, ?Either $either = null) diff --git a/src/Monad/Free/Free.php b/src/Monad/Free/Free.php index 7436470..7fd8d07 100644 --- a/src/Monad/Free/Free.php +++ b/src/Monad/Free/Free.php @@ -113,7 +113,7 @@ public function map(callable $go): FantasyLand\Functor */ public function foldFree(callable $f, callable $return): FantasyLand\Monad { - return $f($this->f)->bind(function (MonadFree $next) use ($f, $return) : FantasyLand\Monad { + return $f($this->f)->bind(function (MonadFree $next) use ($f, $return): FantasyLand\Monad { return $next->foldFree($f, $return); }); } diff --git a/src/Monad/Free/MonadFree.php b/src/Monad/Free/MonadFree.php index 6f789b9..ce0e704 100644 --- a/src/Monad/Free/MonadFree.php +++ b/src/Monad/Free/MonadFree.php @@ -15,7 +15,7 @@ interface MonadFree extends FantasyLand\Monad * foldFree f (Free as) = f as >>= foldFree f * ``` * - * @param callable $f (f x -> m x) + * @param callable $f (f x -> m x) * @param callable $return * * @return FantasyLand\Monad diff --git a/src/Monad/Free/Pure.php b/src/Monad/Free/Pure.php index d90de14..59b317e 100644 --- a/src/Monad/Free/Pure.php +++ b/src/Monad/Free/Pure.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad\Free; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class Pure implements MonadFree { diff --git a/src/Monad/Free/functions.php b/src/Monad/Free/functions.php index 049810a..694bc21 100644 --- a/src/Monad/Free/functions.php +++ b/src/Monad/Free/functions.php @@ -33,9 +33,9 @@ function liftF(Functor $f): MonadFree * foldFree f (Free as) = f as >>= foldFree f * ``` * - * @param callable $interpreter (f x => m x) + * @param callable $interpreter (f x => m x) * @param MonadFree $free - * @param callable $return + * @param callable $return * * @return Monad|callable */ diff --git a/src/Monad/IO.php b/src/Monad/IO.php index 570405a..902df04 100644 --- a/src/Monad/IO.php +++ b/src/Monad/IO.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class IO implements FantasyLand\Monad, diff --git a/src/Monad/IO/IOError.php b/src/Monad/IO/IOError.php index fb0b4db..a5d4ae9 100644 --- a/src/Monad/IO/IOError.php +++ b/src/Monad/IO/IOError.php @@ -4,6 +4,8 @@ namespace Widmogrod\Monad\IO; -class IOError extends \Exception +use Exception; + +class IOError extends Exception { } diff --git a/src/Monad/IO/errors.php b/src/Monad/IO/errors.php index 9cc76e7..75b1d34 100644 --- a/src/Monad/IO/errors.php +++ b/src/Monad/IO/errors.php @@ -4,6 +4,8 @@ namespace Widmogrod\Monad\IO; +use Closure; +use Exception; use Widmogrod\Functional as f; use Widmogrod\Monad as M; use Widmogrod\Monad\Either as E; @@ -29,11 +31,11 @@ function userError($error) * * throwIO :: Exception e -> IO a * - * @param \Exception $e + * @param Exception $e * * @return M\IO */ -function throwIO(\Exception $e) +function throwIO(Exception $e) { return M\IO::of(function () use ($e) { throw $e; @@ -45,10 +47,10 @@ function throwIO(\Exception $e) /** * tryCatch :: Exception e => IO a -> (e -> IO a) -> IO a * - * @param M\IO $io + * @param M\IO $io * @param callable $catchFunction * - * @return M\IO|\Closure + * @return M\IO|Closure */ function tryCatch(?M\IO $io = null, ?callable $catchFunction = null) { @@ -56,7 +58,7 @@ function tryCatch(?M\IO $io = null, ?callable $catchFunction = null) return M\IO::of(function () use ($io, $catchFunction) { try { return $io->run(); - } catch (\Exception $e) { + } catch (Exception $e) { return $catchFunction($e); } }); diff --git a/src/Monad/IO/functions.php b/src/Monad/IO/functions.php index 2a88de6..5f521e8 100644 --- a/src/Monad/IO/functions.php +++ b/src/Monad/IO/functions.php @@ -29,9 +29,9 @@ function pure($f) * until :: (a -> Bool) -> (a -> b -> b) -> b -> IO a -> IO b * * @param callable $predicate (a -> Bool) - * @param callable $do (a -> b -> a) - * @param mixed $base b - * @param M\IO $ioValue IO a + * @param callable $do (a -> b -> a) + * @param mixed $base b + * @param M\IO $ioValue IO a * * @return M\IO */ @@ -53,9 +53,9 @@ function until(callable $predicate, callable $do, $base, M\IO $ioValue) const getChar = 'Widmogrod\Monad\IO\getChar'; /** + * @return M\IO * @throws IOError * - * @return M\IO */ function getChar() { @@ -75,9 +75,9 @@ function getChar() /** * getLine :: IO String * + * @return M\IO * @throws IOError * - * @return M\IO */ function getLine() { @@ -107,9 +107,9 @@ function putStrLn($string) * * @param $fileName * + * @return M\IO * @throws IOError * - * @return M\IO */ function readFile($fileName) { @@ -135,9 +135,9 @@ function readFile($fileName) * @param string $fileName * @param string $content * + * @return M\IO * @throws IOError * - * @return M\IO */ function writeFile($fileName, $content) { @@ -162,9 +162,9 @@ function writeFile($fileName, $content) * * Computation getArgs returns a list of the program's command line arguments (not including the program name). * + * @return M\IO * @throws IOError * - * @return M\IO */ function getArgs() { @@ -186,9 +186,9 @@ function getArgs() * * @param string $name * + * @return M\IO * @throws IOError * - * @return M\IO */ function getEnv($name) { diff --git a/src/Monad/Identity.php b/src/Monad/Identity.php index bc97a2b..f3d636b 100644 --- a/src/Monad/Identity.php +++ b/src/Monad/Identity.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class Identity implements FantasyLand\Monad, diff --git a/src/Monad/Maybe/Just.php b/src/Monad/Maybe/Just.php index 2da412a..b3048aa 100644 --- a/src/Monad/Maybe/Just.php +++ b/src/Monad/Maybe/Just.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad\Maybe; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; use Widmogrod\Primitive\TypeMismatchError; use Widmogrod\Useful\PatternMatcher; diff --git a/src/Monad/Maybe/Maybe.php b/src/Monad/Maybe/Maybe.php index 281c6f7..28d4657 100644 --- a/src/Monad/Maybe/Maybe.php +++ b/src/Monad/Maybe/Maybe.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad\Maybe; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; interface Maybe extends FantasyLand\Monad, diff --git a/src/Monad/Maybe/functions.php b/src/Monad/Maybe/functions.php index 11ef56f..c58aad7 100644 --- a/src/Monad/Maybe/functions.php +++ b/src/Monad/Maybe/functions.php @@ -4,6 +4,7 @@ namespace Widmogrod\Monad\Maybe; +use Closure; use Widmogrod\Functional as f; const pure = 'Widmogrod\Monad\Maybe\pure'; @@ -33,9 +34,9 @@ function nothing() const just = 'Widmogrod\Monad\Maybe\just'; /** + * @param mixed $value * @return Just * - * @param mixed $value */ function just($value) { @@ -47,11 +48,11 @@ function just($value) /** * maybe :: b -> (a -> b) -> Maybe a -> b * - * @param null $default + * @param null $default * @param callable $fn - * @param Maybe $maybe + * @param Maybe $maybe * - * @return mixed|\Closure + * @return mixed|Closure */ function maybe($default, ?callable $fn = null, ?Maybe $maybe = null) { diff --git a/src/Monad/Reader.php b/src/Monad/Reader.php index 4428b2a..c634a25 100644 --- a/src/Monad/Reader.php +++ b/src/Monad/Reader.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class Reader implements FantasyLand\Monad { diff --git a/src/Monad/Reader/functions.php b/src/Monad/Reader/functions.php index c8f4bc0..90bfa94 100644 --- a/src/Monad/Reader/functions.php +++ b/src/Monad/Reader/functions.php @@ -66,7 +66,7 @@ function value($value) * Unwrap a reader monad computation as a function. * * @param M\Reader $reader - * @param mixed $env + * @param mixed $env * * @return mixed */ diff --git a/src/Monad/State.php b/src/Monad/State.php index e09bcca..49c2fa9 100644 --- a/src/Monad/State.php +++ b/src/Monad/State.php @@ -4,8 +4,8 @@ namespace Widmogrod\Monad; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class State implements FantasyLand\Monad { diff --git a/src/Monad/State/functions.php b/src/Monad/State/functions.php index 3fb0b5d..1d26f47 100644 --- a/src/Monad/State/functions.php +++ b/src/Monad/State/functions.php @@ -139,7 +139,7 @@ function modify(callable $transformation) * Unwrap a state monad computation as a function. * * @param M\State $state - * @param mixed $initialState + * @param mixed $initialState * * @return mixed */ @@ -156,7 +156,7 @@ function runState(M\State $state, $initialState) * Evaluate a state computation with the given initial state and return the final value, discarding the final state. * * @param M\State $state - * @param mixed $initialState + * @param mixed $initialState * * @return mixed */ @@ -173,7 +173,7 @@ function evalState(M\State $state, $initialState) * Evaluate a state computation with the given initial state and return the final state, discarding the final value. * * @param M\State $state - * @param mixed $initialState + * @param mixed $initialState * * @return mixed */ diff --git a/src/Primitive/EmptyListError.php b/src/Primitive/EmptyListError.php index 7f31abb..8b0df59 100644 --- a/src/Primitive/EmptyListError.php +++ b/src/Primitive/EmptyListError.php @@ -4,7 +4,9 @@ namespace Widmogrod\Primitive; -class EmptyListError extends \Exception +use Exception; + +class EmptyListError extends Exception { public function __construct(string $method) { diff --git a/src/Primitive/Listt.php b/src/Primitive/Listt.php index e343ca2..e561d87 100644 --- a/src/Primitive/Listt.php +++ b/src/Primitive/Listt.php @@ -4,8 +4,8 @@ namespace Widmogrod\Primitive; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; /** * data List a = Nil | Cons a (List a) @@ -30,7 +30,7 @@ public function head(); /** * tail :: [a] -> [a] * - * @return \Widmogrod\Primitive\Listt + * @return Listt * * @throws EmptyListError */ diff --git a/src/Primitive/ListtCons.php b/src/Primitive/ListtCons.php index 23b6dba..425fc83 100644 --- a/src/Primitive/ListtCons.php +++ b/src/Primitive/ListtCons.php @@ -4,11 +4,13 @@ namespace Widmogrod\Primitive; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use IteratorAggregate; +use Traversable; +use Widmogrod\Common; use Widmogrod\Functional as f; -class ListtCons implements Listt, \IteratorAggregate +class ListtCons implements Listt, IteratorAggregate { public const of = 'Widmogrod\Primitive\ListtCons::of'; @@ -35,7 +37,7 @@ public function __construct(callable $next) /** * @inheritdoc */ - public function getIterator(): \Traversable + public function getIterator(): Traversable { $tail = $this; do { diff --git a/src/Primitive/ListtNil.php b/src/Primitive/ListtNil.php index 5155ec1..d60b97e 100644 --- a/src/Primitive/ListtNil.php +++ b/src/Primitive/ListtNil.php @@ -4,10 +4,13 @@ namespace Widmogrod\Primitive; +use ArrayObject; use FunctionalPHP\FantasyLand; +use IteratorAggregate; +use Traversable; use Widmogrod\Common; -class ListtNil implements Listt, \IteratorAggregate +class ListtNil implements Listt, IteratorAggregate { use Common\PointedTrait; @@ -127,8 +130,8 @@ public function tail(): Listt /** * @inheritdoc */ - public function getIterator(): \Traversable + public function getIterator(): Traversable { - return new \ArrayObject(); + return new ArrayObject(); } } diff --git a/src/Primitive/Num.php b/src/Primitive/Num.php index 1534433..bc8df97 100644 --- a/src/Primitive/Num.php +++ b/src/Primitive/Num.php @@ -4,8 +4,8 @@ namespace Widmogrod\Primitive; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class Num implements FantasyLand\Pointed, diff --git a/src/Primitive/Stringg.php b/src/Primitive/Stringg.php index 54c890c..4812f1b 100644 --- a/src/Primitive/Stringg.php +++ b/src/Primitive/Stringg.php @@ -4,8 +4,8 @@ namespace Widmogrod\Primitive; -use Widmogrod\Common; use FunctionalPHP\FantasyLand; +use Widmogrod\Common; class Stringg implements FantasyLand\Pointed, diff --git a/src/Primitive/TypeMismatchError.php b/src/Primitive/TypeMismatchError.php index cc1c8aa..3162f23 100644 --- a/src/Primitive/TypeMismatchError.php +++ b/src/Primitive/TypeMismatchError.php @@ -4,7 +4,9 @@ namespace Widmogrod\Primitive; -class TypeMismatchError extends \Exception +use Exception; + +class TypeMismatchError extends Exception { public function __construct($value, $expected) { diff --git a/src/Useful/PatternMatcher.php b/src/Useful/PatternMatcher.php index a155ab5..5f886fa 100644 --- a/src/Useful/PatternMatcher.php +++ b/src/Useful/PatternMatcher.php @@ -8,7 +8,7 @@ interface PatternMatcher { /** * should be used with conjuction - * @param callable $fn + * @param callable $fn * @return mixed */ public function patternMatched(callable $fn); diff --git a/src/Useful/PatternNotMatchedError.php b/src/Useful/PatternNotMatchedError.php index fd81420..5427451 100644 --- a/src/Useful/PatternNotMatchedError.php +++ b/src/Useful/PatternNotMatchedError.php @@ -4,7 +4,9 @@ namespace Widmogrod\Useful; -class PatternNotMatchedError extends \Exception +use Exception; + +class PatternNotMatchedError extends Exception { public static function cannotMatch($value, array $patterns): self { diff --git a/src/Useful/SnapshotIterator.php b/src/Useful/SnapshotIterator.php index bb7ea19..d15e067 100644 --- a/src/Useful/SnapshotIterator.php +++ b/src/Useful/SnapshotIterator.php @@ -4,7 +4,9 @@ namespace Widmogrod\Useful; -class SnapshotIterator extends \IteratorIterator +use IteratorIterator; + +class SnapshotIterator extends IteratorIterator { private $inMemoryValid; private $inMemoryCurrent; diff --git a/src/Useful/match.php b/src/Useful/match.php index f01a8cb..a05ce9b 100644 --- a/src/Useful/match.php +++ b/src/Useful/match.php @@ -20,11 +20,11 @@ /** * match :: #{ Pattern -> (a -> b)} -> a -> b * - * @param array $patterns - * @param mixed $value + * @param array $patterns + * @param mixed $value + * @return mixed * @throws PatternNotMatchedError * - * @return mixed */ function matchPatterns(array $patterns, $value = null) { diff --git a/test/Functional/ApplicatorTest.php b/test/Functional/ApplicatorTest.php index d09869b..d904dd0 100644 --- a/test/Functional/ApplicatorTest.php +++ b/test/Functional/ApplicatorTest.php @@ -4,10 +4,12 @@ namespace test\Functional; +use ArgumentCountError; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\applicator; -class ApplicatorTest extends \PHPUnit\Framework\TestCase +class ApplicatorTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_apply_value_as_a_argument_to_a_function( @@ -24,7 +26,7 @@ public function test_it_should_apply_value_as_a_argument_to_a_function( public function test_it_should_fail_when_function_requires_more_arguments() { - $this->expectException(\ArgumentCountError::class); + $this->expectException(ArgumentCountError::class); $this->expectExceptionMessage('Too few arguments to function'); applicator(1, function (int $i, string $a): int { return 10 + $i; diff --git a/test/Functional/ComposeTest.php b/test/Functional/ComposeTest.php index 13c5365..3ea8ea5 100644 --- a/test/Functional/ComposeTest.php +++ b/test/Functional/ComposeTest.php @@ -4,14 +4,16 @@ namespace test\Functional; +use Closure; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class ComposeTest extends \PHPUnit\Framework\TestCase +class ComposeTest extends TestCase { public function test_it_should_retun_function_accepting_arguments() { - $this->assertInstanceOf(\Closure::class, f\compose('strtolower', 'strtoupper')); + $this->assertInstanceOf(Closure::class, f\compose('strtolower', 'strtoupper')); } #[DataProvider('provideData')] diff --git a/test/Functional/ConcatTest.php b/test/Functional/ConcatTest.php index 7d40482..001a0a4 100644 --- a/test/Functional/ConcatTest.php +++ b/test/Functional/ConcatTest.php @@ -5,17 +5,19 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Nothing; -class ConcatTest extends \PHPUnit\Framework\TestCase +class ConcatTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_concat_values_to_array( $value, $expected - ) { + ) + { $this->assertEquals($expected, f\concat($value)); } @@ -39,21 +41,21 @@ public static function provideData() f\fromIterable(['c', 3]) ]), ]), - f\fromIterable([ + f\fromIterable([ f\fromIterable(['a', 1]), f\fromIterable(['b', 2]), f\fromIterable(['c', 3]) ]), ], 'list of lists of lists with some noregulatives' => [ - f\fromIterable([ + f\fromIterable([ f\fromIterable([ f\fromIterable(['a', 1]), f\fromIterable(['b', 2]), ]), f\fromIterable(['c', 3]) ]), - f\fromIterable([ + f\fromIterable([ f\fromIterable(['a', 1]), f\fromIterable(['b', 2]), 'c', @@ -62,11 +64,11 @@ public static function provideData() ], 'Just of lists' => [ Just::of(f\fromIterable(['a', 1, 3])), - f\fromIterable(['a', 1, 3]), + f\fromIterable(['a', 1, 3]), ], 'Nothing of lists' => [ Nothing::mempty(), - f\fromNil() + f\fromNil() ], ]; } diff --git a/test/Functional/ConsttTest.php b/test/Functional/ConsttTest.php index 2d6e2d1..b4f82a9 100644 --- a/test/Functional/ConsttTest.php +++ b/test/Functional/ConsttTest.php @@ -6,9 +6,10 @@ use Eris\Generator; use Eris\TestTrait; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\constt; -class ConsttTest extends \PHPUnit\Framework\TestCase +class ConsttTest extends TestCase { use TestTrait; diff --git a/test/Functional/CurryNTest.php b/test/Functional/CurryNTest.php index 886cebb..4ecfe04 100644 --- a/test/Functional/CurryNTest.php +++ b/test/Functional/CurryNTest.php @@ -5,9 +5,10 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class CurryNTest extends \PHPUnit\Framework\TestCase +class CurryNTest extends TestCase { #[DataProvider('provideArgumentsWithFunctions')] public function test_it_should_return_function_event_if_function_not_accept_arguments( @@ -16,7 +17,7 @@ public function test_it_should_return_function_event_if_function_not_accept_argu $default ) { - $this->assertIsCallable( f\curryN($numberOfArguments, $function, $default)); + $this->assertIsCallable(f\curryN($numberOfArguments, $function, $default)); } public static function provideArgumentsWithFunctions() diff --git a/test/Functional/CurryTest.php b/test/Functional/CurryTest.php index aa8b852..113fce5 100644 --- a/test/Functional/CurryTest.php +++ b/test/Functional/CurryTest.php @@ -4,16 +4,19 @@ namespace test\Functional; +use Closure; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class CurryTest extends \PHPUnit\Framework\TestCase +class CurryTest extends TestCase { #[DataProvider('provideFunctionToCurry')] public function test_it_should_detect_automatically_number_of_arguments_to_curry( $fn, $resultAfterCurries - ) { + ) + { $times = 0; $curried = f\curry($fn); @@ -61,7 +64,8 @@ function ($a, $b = null) { public function test_it_curry_with_lest_arguments_if_defaults_are_provided( $result, $function - ) { + ) + { $this->assertEquals( $result, $function() @@ -108,8 +112,8 @@ public function test_it_curry_every_type_of_callable(callable $callable) { $curried = f\curry($callable); - $this->assertInstanceOf(\Closure::class, $curried); - $this->assertInstanceOf(\Closure::class, $curried(1)); + $this->assertInstanceOf(Closure::class, $curried); + $this->assertInstanceOf(Closure::class, $curried(1)); $this->assertSame([1, 2], $curried(1)(2)); } diff --git a/test/Functional/CycleTest.php b/test/Functional/CycleTest.php index 503027b..e340954 100644 --- a/test/Functional/CycleTest.php +++ b/test/Functional/CycleTest.php @@ -6,14 +6,15 @@ use Eris\Generator; use Eris\TestTrait; -use const Widmogrod\Functional\identity; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\cycle; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\iterate; use function Widmogrod\Functional\length; use function Widmogrod\Functional\take; +use const Widmogrod\Functional\identity; -class CycleTest extends \PHPUnit\Framework\TestCase +class CycleTest extends TestCase { use TestTrait; diff --git a/test/Functional/DropWhileTest.php b/test/Functional/DropWhileTest.php index de9a934..91bcb51 100644 --- a/test/Functional/DropWhileTest.php +++ b/test/Functional/DropWhileTest.php @@ -5,20 +5,22 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\dropWhile; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Functional\lt; -class DropWhileTest extends \PHPUnit\Framework\TestCase +class DropWhileTest extends TestCase { #[DataProvider('provideData')] public function test_it( - Listt $a, + Listt $a, callable $fn, - Listt $expected - ) { + Listt $expected + ) + { $result = dropWhile($fn, $a); $r = print_r($result->extract(), true); diff --git a/test/Functional/FilterMTest.php b/test/Functional/FilterMTest.php index 77723b5..e20fad9 100644 --- a/test/Functional/FilterMTest.php +++ b/test/Functional/FilterMTest.php @@ -4,19 +4,22 @@ namespace test\Functional; +use ArrayIterator; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\filterM; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Monad\Maybe\just; -class FilterMTest extends \PHPUnit\Framework\TestCase +class FilterMTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_filter_with_maybe( $list, $expected - ) { + ) + { $filter = function ($i) { return just($i % 2 == 1); }; @@ -39,7 +42,7 @@ public static function provideData() fromNil() ], 'traversable' => [ - fromIterable(new \ArrayIterator([1, 2, 3, 4, 5])), + fromIterable(new ArrayIterator([1, 2, 3, 4, 5])), just(fromIterable([1, 3, 5])), ], ]; diff --git a/test/Functional/FilterTest.php b/test/Functional/FilterTest.php index 205f18f..af3ddeb 100644 --- a/test/Functional/FilterTest.php +++ b/test/Functional/FilterTest.php @@ -4,18 +4,21 @@ namespace test\Functional; +use ArrayIterator; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\filter; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; -class FilterTest extends \PHPUnit\Framework\TestCase +class FilterTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_filter_with_maybe( $list, $expected - ) { + ) + { $filter = function (int $i): bool { return $i % 2 === 1; }; @@ -38,7 +41,7 @@ public static function provideData() fromNil() ], 'traversable' => [ - fromIterable(new \ArrayIterator([1, 2, 3, 4, 5])), + fromIterable(new ArrayIterator([1, 2, 3, 4, 5])), fromIterable([1, 3, 5]), ], ]; diff --git a/test/Functional/FlipTest.php b/test/Functional/FlipTest.php index 8369591..61a146a 100644 --- a/test/Functional/FlipTest.php +++ b/test/Functional/FlipTest.php @@ -4,17 +4,20 @@ namespace test\Functional; +use Closure; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class FlipTest extends \PHPUnit\Framework\TestCase +class FlipTest extends TestCase { #[DataProvider('provideFunctions')] public function test_it_should_flip_func_arguments( callable $func, - array $args, - $expected - ) { + array $args, + $expected + ) + { $flipped = f\flip($func); $this->assertEquals( @@ -46,12 +49,13 @@ function ($a, $b, $c) { #[DataProvider('provideFunctionsWithNotEnoughArgs')] public function test_it_should_curry_if_not_enough_args_passed( callable $func, - array $args - ) { + array $args + ) + { $curried = f\curry($func); $this->assertInstanceOf( - \Closure::class, + Closure::class, $curried(...$args) ); } diff --git a/test/Functional/FoldMTest.php b/test/Functional/FoldMTest.php index 3a47304..5ceca21 100644 --- a/test/Functional/FoldMTest.php +++ b/test/Functional/FoldMTest.php @@ -4,20 +4,23 @@ namespace test\Functional; +use ArrayIterator; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\foldM; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Monad\Maybe\just; use function Widmogrod\Monad\Maybe\nothing; -class FoldMTest extends \PHPUnit\Framework\TestCase +class FoldMTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_work_with_maybe( $list, $expected - ) { + ) + { $addSingleDigit = function ($acc, $i) { return $i > 9 ? nothing() : just($acc + $i); }; @@ -43,7 +46,7 @@ public static function provideData() fromNil(), ], 'traversable' => [ - fromIterable(new \ArrayIterator([1, 3, 5, 7])), + fromIterable(new ArrayIterator([1, 3, 5, 7])), just(16) ], ]; diff --git a/test/Functional/FoldrTest.php b/test/Functional/FoldrTest.php index 59bc251..f419561 100644 --- a/test/Functional/FoldrTest.php +++ b/test/Functional/FoldrTest.php @@ -4,9 +4,10 @@ namespace test\Functional; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class FoldrTest extends \PHPUnit\Framework\TestCase +class FoldrTest extends TestCase { public function test_foldr() { diff --git a/test/Functional/HeadTest.php b/test/Functional/HeadTest.php index 15d0363..1111937 100644 --- a/test/Functional/HeadTest.php +++ b/test/Functional/HeadTest.php @@ -4,19 +4,23 @@ namespace test\Functional; +use ArrayIterator; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; +use Widmogrod\Primitive\EmptyListError; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Functional\head; -class HeadTest extends \PHPUnit\Framework\TestCase +class HeadTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Listt $listt, - $expected - ) { + $expected + ) + { $this->assertSame( $expected, head($listt) @@ -31,7 +35,7 @@ public static function provideData() 1, ], 'Should return head from finite iterator' => [ - fromIterable(new \ArrayIterator([1, 2, 3])), + fromIterable(new ArrayIterator([1, 2, 3])), 1, ], ]; @@ -39,7 +43,7 @@ public static function provideData() public function test_it_should_throw_exception_when_list_is_empty() { - $this->expectException(\Widmogrod\Primitive\EmptyListError::class); + $this->expectException(EmptyListError::class); $this->expectExceptionMessage('Cannot call head() on empty list'); head(fromNil()); } diff --git a/test/Functional/IdentityTest.php b/test/Functional/IdentityTest.php index 2e88b09..5e5506f 100644 --- a/test/Functional/IdentityTest.php +++ b/test/Functional/IdentityTest.php @@ -5,14 +5,16 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class IdentityTest extends \PHPUnit\Framework\TestCase +class IdentityTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_return_given_value( $value - ) { + ) + { $this->assertEquals($value, f\identity($value)); } diff --git a/test/Functional/InvokeTest.php b/test/Functional/InvokeTest.php index eff3362..5dddaf4 100644 --- a/test/Functional/InvokeTest.php +++ b/test/Functional/InvokeTest.php @@ -5,9 +5,10 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class InvokeTest extends \PHPUnit\Framework\TestCase +class InvokeTest extends TestCase { #[DataProvider('provideData')] public function test_it($method, $input, $output) diff --git a/test/Functional/IterateTest.php b/test/Functional/IterateTest.php index 4b61ec6..a8bb70b 100644 --- a/test/Functional/IterateTest.php +++ b/test/Functional/IterateTest.php @@ -6,13 +6,14 @@ use Eris\Generator; use Eris\TestTrait; -use const Widmogrod\Functional\identity; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\iterate; use function Widmogrod\Functional\length; use function Widmogrod\Functional\reduce; use function Widmogrod\Functional\take; +use const Widmogrod\Functional\identity; -class IterateTest extends \PHPUnit\Framework\TestCase +class IterateTest extends TestCase { use TestTrait; diff --git a/test/Functional/JoinTest.php b/test/Functional/JoinTest.php index 5d03621..30cba3c 100644 --- a/test/Functional/JoinTest.php +++ b/test/Functional/JoinTest.php @@ -6,21 +6,23 @@ use FunctionalPHP\FantasyLand\Monad; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Identity; use Widmogrod\Monad\State; -use const Widmogrod\Functional\identity; use function Widmogrod\Functional\flip; use function Widmogrod\Functional\join; use function Widmogrod\Monad\Maybe\just; +use const Widmogrod\Functional\identity; -class JoinTest extends \PHPUnit\Framework\TestCase +class JoinTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_remove_one_level_of_monadic_structure( - Monad $monad, + Monad $monad, callable $run, - $expected - ) { + $expected + ) + { $result = join($monad); $this->assertEquals($expected, $run($result)); } diff --git a/test/Functional/LengthTest.php b/test/Functional/LengthTest.php index ef1f264..9ae2345 100644 --- a/test/Functional/LengthTest.php +++ b/test/Functional/LengthTest.php @@ -6,17 +6,19 @@ use FunctionalPHP\FantasyLand\Foldable; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Functional\length; -class LengthTest extends \PHPUnit\Framework\TestCase +class LengthTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Foldable $t, - int $expected - ) { + int $expected + ) + { $this->assertEquals(length($t), ($expected)); } diff --git a/test/Functional/LiftM2Test.php b/test/Functional/LiftM2Test.php index 96d1270..7e516d9 100644 --- a/test/Functional/LiftM2Test.php +++ b/test/Functional/LiftM2Test.php @@ -6,22 +6,24 @@ use FunctionalPHP\FantasyLand\Monad; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Common\ValueOfInterface; use Widmogrod\Functional as f; use Widmogrod\Monad\Either; use Widmogrod\Monad\IO; use Widmogrod\Monad\Maybe; -class LiftM2Test extends \PHPUnit\Framework\TestCase +class LiftM2Test extends TestCase { #[DataProvider('monadsProvider')] public function test_it_should_lift2M( - Monad $ma, - Monad $mb, - callable $transformation, - string $expectedFQCN, + Monad $ma, + Monad $mb, + callable $transformation, + string $expectedFQCN, ?callable $valueAssertion = null - ) { + ) + { $mc = f\liftM2($transformation, $ma, $mb); $this->assertInstanceOf($expectedFQCN, $mc); diff --git a/test/Functional/PipeTest.php b/test/Functional/PipeTest.php index 69b23e2..5f218eb 100644 --- a/test/Functional/PipeTest.php +++ b/test/Functional/PipeTest.php @@ -5,9 +5,10 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class PipeTest extends \PHPUnit\Framework\TestCase +class PipeTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_compose_and_inject_input_correctly( diff --git a/test/Functional/PipelineTest.php b/test/Functional/PipelineTest.php index ff7d89e..fc64d9b 100644 --- a/test/Functional/PipelineTest.php +++ b/test/Functional/PipelineTest.php @@ -4,14 +4,16 @@ namespace test\Functional; +use Closure; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class PipelineTest extends \PHPUnit\Framework\TestCase +class PipelineTest extends TestCase { public function test_it_should_retun_function_accepting_arguments() { - $this->assertInstanceOf(\Closure::class, f\pipeline('strtolower', 'strtoupper')); + $this->assertInstanceOf(Closure::class, f\pipeline('strtolower', 'strtoupper')); } #[DataProvider('provideData')] diff --git a/test/Functional/PushTest.php b/test/Functional/PushTest.php index 3a156cc..627a1bb 100644 --- a/test/Functional/PushTest.php +++ b/test/Functional/PushTest.php @@ -5,16 +5,18 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class PushTest extends \PHPUnit\Framework\TestCase +class PushTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_append_array_with_array_values( $array, $value, $expected - ) { + ) + { $this->assertEquals($expected, f\push_($array, $value)); } diff --git a/test/Functional/ReduceTest.php b/test/Functional/ReduceTest.php index b2cebd3..25f992c 100644 --- a/test/Functional/ReduceTest.php +++ b/test/Functional/ReduceTest.php @@ -4,9 +4,10 @@ namespace test\Functional; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class ReduceTest extends \PHPUnit\Framework\TestCase +class ReduceTest extends TestCase { public function test_reduce() { diff --git a/test/Functional/RepeatTest.php b/test/Functional/RepeatTest.php index 78677a5..aa355f6 100644 --- a/test/Functional/RepeatTest.php +++ b/test/Functional/RepeatTest.php @@ -6,13 +6,14 @@ use Eris\Generator; use Eris\TestTrait; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\eql; use function Widmogrod\Functional\filter; use function Widmogrod\Functional\length; use function Widmogrod\Functional\repeat; use function Widmogrod\Functional\take; -class RepeatTest extends \PHPUnit\Framework\TestCase +class RepeatTest extends TestCase { use TestTrait; diff --git a/test/Functional/ReplicateTest.php b/test/Functional/ReplicateTest.php index d84e748..26f1d38 100644 --- a/test/Functional/ReplicateTest.php +++ b/test/Functional/ReplicateTest.php @@ -6,12 +6,13 @@ use Eris\Generator; use Eris\TestTrait; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\eql; use function Widmogrod\Functional\filter; use function Widmogrod\Functional\length; use function Widmogrod\Functional\replicate; -class ReplicateTest extends \PHPUnit\Framework\TestCase +class ReplicateTest extends TestCase { use TestTrait; diff --git a/test/Functional/ReverseTest.php b/test/Functional/ReverseTest.php index bb4cfbe..196a10c 100644 --- a/test/Functional/ReverseTest.php +++ b/test/Functional/ReverseTest.php @@ -5,15 +5,17 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use function Widmogrod\Functional\reverse; -class ReverseTest extends \PHPUnit\Framework\TestCase +class ReverseTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_create_function_that_accept_args_in_reverse_order( callable $function, - array $args - ) { + array $args + ) + { $reversed = reverse($function); $original = reverse($reversed); diff --git a/test/Functional/SpanTest.php b/test/Functional/SpanTest.php index 92bf0f1..1c03b24 100644 --- a/test/Functional/SpanTest.php +++ b/test/Functional/SpanTest.php @@ -6,22 +6,24 @@ use Eris\TestTrait; use PHPUnit\Framework\Attributes\DataProvider; -use function Widmogrod\Functional\constt; -use function Widmogrod\Functional\fromNil; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Listt; +use function Widmogrod\Functional\constt; use function Widmogrod\Functional\fromIterable; +use function Widmogrod\Functional\fromNil; use function Widmogrod\Functional\span; -class SpanTest extends \PHPUnit\Framework\TestCase +class SpanTest extends TestCase { use TestTrait; #[DataProvider('provideData')] public function test_it_should_return_spanned_list( callable $predicate, - Listt $xs, - array $expected - ) { + Listt $xs, + array $expected + ) + { [$left, $right] = span($predicate, $xs); [$eleft, $eright] = $expected; @@ -50,22 +52,22 @@ public static function provideData() 'span on empty list should be tuple of empty lists' => [ $lessThanTwo, fromNil(), - [fromNil(), fromNil()], + [fromNil(), fromNil()], ], 'span on finite list should be tuple of lists' => [ $lessThanTwo, fromIterable([0, 1, 2, 3, 4]), - [fromIterable([0, 1]), fromIterable([2, 3, 4])], + [fromIterable([0, 1]), fromIterable([2, 3, 4])], ], 'span on finite list when predicate is always false should be:' => [ constt(false), fromIterable([0, 1, 2, 3, 4]), - [fromNil(), fromIterable([0, 1, 2, 3, 4])], + [fromNil(), fromIterable([0, 1, 2, 3, 4])], ], 'span on finite list when predicate is always true should be:' => [ constt(true), fromIterable([0, 1, 2, 3, 4]), - [fromIterable([0, 1, 2, 3, 4]), fromNil()], + [fromIterable([0, 1, 2, 3, 4]), fromNil()], ], ]; } diff --git a/test/Functional/TailTest.php b/test/Functional/TailTest.php index b71418b..a6d7252 100644 --- a/test/Functional/TailTest.php +++ b/test/Functional/TailTest.php @@ -4,19 +4,23 @@ namespace test\Functional; +use ArrayIterator; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; +use Widmogrod\Primitive\EmptyListError; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Functional\tail; -class TailTest extends \PHPUnit\Framework\TestCase +class TailTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Listt $listt, Listt $expected - ) { + ) + { $this->assertTrue(tail($listt)->equals($expected)); } @@ -25,18 +29,18 @@ public static function provideData() return [ 'Should return tail from finite array' => [ fromIterable([1, 2, 3]), - fromIterable([2, 3]), + fromIterable([2, 3]), ], 'Should return tail from finite iterator' => [ - fromIterable(new \ArrayIterator([1, 2, 3, 4, 5, 6])), - fromIterable([2, 3, 4, 5, 6]), + fromIterable(new ArrayIterator([1, 2, 3, 4, 5, 6])), + fromIterable([2, 3, 4, 5, 6]), ], ]; } public function test_it_should_throw_exception_when_list_is_empty() { - $this->expectException(\Widmogrod\Primitive\EmptyListError::class); + $this->expectException(EmptyListError::class); $this->expectExceptionMessage('Cannot call tail() on empty list'); tail(fromNil()); } diff --git a/test/Functional/TakeTest.php b/test/Functional/TakeTest.php index 2fbbd27..db963b8 100644 --- a/test/Functional/TakeTest.php +++ b/test/Functional/TakeTest.php @@ -5,20 +5,22 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\fromNil; use function Widmogrod\Functional\repeat; use function Widmogrod\Functional\take; -class TakeTest extends \PHPUnit\Framework\TestCase +class TakeTest extends TestCase { #[DataProvider('provideData')] public function test_it( Listt $a, - int $n, + int $n, Listt $expected - ) { + ) + { $result = take($n, $a); $r = print_r($result->extract(), true); @@ -35,33 +37,33 @@ public static function provideData() return [ 'should return empty list from when input is empty list' => [ fromNil(), - 1, - fromNil(), + 1, + fromNil(), ], 'should empty list when n is zero' => [ fromIterable([1, 2, 3, 4, 5]), - 0, - fromNil(), + 0, + fromNil(), ], 'should empty list when n is negative' => [ fromIterable([1, 2, 3, 4, 5]), - random_int(-1000, -1), - fromNil(), + random_int(-1000, -1), + fromNil(), ], 'should return part of finite list' => [ fromIterable([1, 2, 3, 4, 5]), - 3, - fromIterable([1, 2, 3]), + 3, + fromIterable([1, 2, 3]), ], 'should return whole list when take more than in the list' => [ fromIterable([1, 2, 3, 4, 5]), - 3000, - fromIterable([1, 2, 3, 4, 5]), + 3000, + fromIterable([1, 2, 3, 4, 5]), ], 'should return part of infinite list' => [ repeat('a'), - 3, - fromIterable(['a', 'a', 'a']), + 3, + fromIterable(['a', 'a', 'a']), ], ]; } diff --git a/test/Functional/TeeTest.php b/test/Functional/TeeTest.php index a662397..6fb0c1d 100644 --- a/test/Functional/TeeTest.php +++ b/test/Functional/TeeTest.php @@ -5,9 +5,10 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; -class TeeTest extends \PHPUnit\Framework\TestCase +class TeeTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_be_curried( diff --git a/test/Functional/UnzipTest.php b/test/Functional/UnzipTest.php index 9b06958..7d53773 100644 --- a/test/Functional/UnzipTest.php +++ b/test/Functional/UnzipTest.php @@ -7,6 +7,7 @@ use Eris\Generator; use Eris\TestTrait; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\eql; use function Widmogrod\Functional\filter; @@ -17,7 +18,7 @@ use function Widmogrod\Functional\take; use function Widmogrod\Functional\unzip; -class UnzipTest extends \PHPUnit\Framework\TestCase +class UnzipTest extends TestCase { use TestTrait; @@ -25,7 +26,8 @@ class UnzipTest extends \PHPUnit\Framework\TestCase public function test_it_should_return_zipped_list( Listt $a, array $expected - ) { + ) + { [$a, $b] = unzip($a); [$ea, $eb] = $expected; @@ -38,7 +40,7 @@ public static function provideData() return [ 'unzipping of empty lists should be an tuple of empty lists' => [ fromNil(), - [fromNil(), fromNil()], + [fromNil(), fromNil()], ], 'unzipping of lists should be an tuple of lists' => [ fromIterable([ @@ -46,7 +48,7 @@ public static function provideData() [2, 'b'], [3, 'c'], ]), - [fromIterable([1, 2, 3]), fromIterable(['a', 'b', 'c'])], + [fromIterable([1, 2, 3]), fromIterable(['a', 'b', 'c'])], ], ]; } diff --git a/test/Functional/ValueOfTest.php b/test/Functional/ValueOfTest.php index 9c62b8a..36774e0 100644 --- a/test/Functional/ValueOfTest.php +++ b/test/Functional/ValueOfTest.php @@ -5,19 +5,21 @@ namespace test\Functional; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Identity; use function Widmogrod\Functional\fromIterable; use function Widmogrod\Functional\valueOf; use function Widmogrod\Monad\Maybe\just; use function Widmogrod\Monad\Maybe\nothing; -class ValueOfTest extends \PHPUnit\Framework\TestCase +class ValueOfTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_return_boxed_value( $value, $expected - ) { + ) + { $this->assertSame( $expected, valueOf($value) @@ -29,31 +31,31 @@ public static function provideData() return [ 'Native int should be return as is' => [ 1023, - 1023, + 1023, ], 'Native string should be return as is' => [ 'Something amazing', - 'Something amazing', + 'Something amazing', ], 'Native array should be return as is' => [ [1, 2, 3], - [1, 2, 3], + [1, 2, 3], ], 'Identity 6' => [ Identity::of(6), - 6 + 6 ], 'Just 6' => [ just(6), - 6 + 6 ], 'Nothing' => [ nothing(), - null + null ], 'Listt' => [ fromIterable([1, 2, 3]), - [1, 2, 3] + [1, 2, 3] ], ]; } diff --git a/test/Functional/ZipTest.php b/test/Functional/ZipTest.php index fc2f1e8..b2e039d 100644 --- a/test/Functional/ZipTest.php +++ b/test/Functional/ZipTest.php @@ -7,6 +7,7 @@ use Eris\Generator; use Eris\TestTrait; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Listt; use function Widmogrod\Functional\eql; use function Widmogrod\Functional\filter; @@ -17,7 +18,7 @@ use function Widmogrod\Functional\take; use function Widmogrod\Functional\zip; -class ZipTest extends \PHPUnit\Framework\TestCase +class ZipTest extends TestCase { use TestTrait; @@ -26,7 +27,8 @@ public function test_it_should_return_zipped_list( Listt $a, Listt $b, Listt $expected - ) { + ) + { $result = zip($a, $b); $r = print_r($result->extract(), true); diff --git a/test/Monad/EitherTest.php b/test/Monad/EitherTest.php index c520b49..c223608 100644 --- a/test/Monad/EitherTest.php +++ b/test/Monad/EitherTest.php @@ -6,16 +6,17 @@ use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; -use PHPUnit\Framework\Attributes\DataProvider; -use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; +use Widmogrod\Functional as f; use Widmogrod\Monad\Either; use Widmogrod\Monad\Either\Left; use Widmogrod\Monad\Either\Right; -class EitherTest extends \PHPUnit\Framework\TestCase +class EitherTest extends TestCase { #[DataProvider('provideData')] public function test_if_maybe_monad_obeys_the_laws($return, $f, $g, $x) @@ -33,7 +34,7 @@ public static function provideData() { return [ 'Right' => [ - Right::of, + Right::of, function ($x) { return Right::of($x + 1); }, @@ -44,7 +45,7 @@ function ($x) { ], // I don't know if Left should be tested? 'Left' => [ - Left::of, + Left::of, function ($x) { return Left::of($x); }, @@ -64,7 +65,8 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) { + ) + { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, $pure), @@ -84,7 +86,7 @@ public static function provideApplicativeTestData() Right::of(function () { return 1; }), - Right::of(function () { + Right::of(function () { return 5; }), Right::of(function () { @@ -100,7 +102,7 @@ function ($x) { Left::of(function () { return 1; }), - Left::of(function () { + Left::of(function () { return 5; }), Left::of(function () { @@ -118,8 +120,9 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) { + Functor $x + ) + { FunctorLaws::test( [$this, 'assertEquals'], $f, diff --git a/test/Monad/FreeTest.php b/test/Monad/FreeTest.php index a930cb3..55024dc 100644 --- a/test/Monad/FreeTest.php +++ b/test/Monad/FreeTest.php @@ -10,22 +10,24 @@ use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Free\MonadFree; use Widmogrod\Monad\Free\Pure; use Widmogrod\Monad\Identity; -use const Widmogrod\Functional\identity; use function Widmogrod\Functional\curryN; use function Widmogrod\Monad\Free\foldFree; use function Widmogrod\Monad\Free\liftF; +use const Widmogrod\Functional\identity; -class FreeTest extends \PHPUnit\Framework\TestCase +class FreeTest extends TestCase { #[DataProvider('provideFunctorTestData')] public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) { + Functor $x + ) + { FunctorLaws::test( function (MonadFree $a, MonadFree $b, $message) { $this->assertEquals( @@ -108,7 +110,8 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) { + ) + { ApplicativeLaws::test( function (MonadFree $a, MonadFree $b, $message) { $this->assertEquals( @@ -137,7 +140,7 @@ public static function provideApplicativeTestData() Pure::of(function () { return 5; }), - Pure::of(function () { + Pure::of(function () { return 7; }), function ($x) { diff --git a/test/Monad/IOTest.php b/test/Monad/IOTest.php index 3c71c9f..1698c97 100644 --- a/test/Monad/IOTest.php +++ b/test/Monad/IOTest.php @@ -10,10 +10,11 @@ use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\IO; -class IOTest extends \PHPUnit\Framework\TestCase +class IOTest extends TestCase { #[DataProvider('provideData')] public function test_if_io_monad_obeys_the_laws($f, $g, $x) diff --git a/test/Monad/IdentityTest.php b/test/Monad/IdentityTest.php index 6e0e13c..6b2680a 100644 --- a/test/Monad/IdentityTest.php +++ b/test/Monad/IdentityTest.php @@ -10,10 +10,11 @@ use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Identity; -class IdentityTest extends \PHPUnit\Framework\TestCase +class IdentityTest extends TestCase { #[DataProvider('provideData')] public function test_if_identity_monad_obeys_the_laws($f, $g, $x) diff --git a/test/Monad/MaybeTest.php b/test/Monad/MaybeTest.php index b344b2e..21fbe4a 100644 --- a/test/Monad/MaybeTest.php +++ b/test/Monad/MaybeTest.php @@ -11,13 +11,14 @@ use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use FunctionalPHP\FantasyLand\Helpful\MonoidLaws; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\Maybe; use Widmogrod\Monad\Maybe\Just; use Widmogrod\Monad\Maybe\Nothing; use Widmogrod\Primitive\Stringg; -class MaybeTest extends \PHPUnit\Framework\TestCase +class MaybeTest extends TestCase { #[DataProvider('provideData')] public function test_if_maybe_monad_obeys_the_laws($return, $f, $g, $x) diff --git a/test/Monad/ReaderTest.php b/test/Monad/ReaderTest.php index cf3a0be..e6e3de7 100644 --- a/test/Monad/ReaderTest.php +++ b/test/Monad/ReaderTest.php @@ -10,9 +10,10 @@ use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Reader; -class ReaderTest extends \PHPUnit\Framework\TestCase +class ReaderTest extends TestCase { #[DataProvider('provideData')] public function test_if_reader_monad_obeys_the_laws($f, $g, $x, $env) diff --git a/test/Monad/StateTest.php b/test/Monad/StateTest.php index 7c8ac2d..d1ed1e2 100644 --- a/test/Monad/StateTest.php +++ b/test/Monad/StateTest.php @@ -10,10 +10,11 @@ use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Functional as f; use Widmogrod\Monad\State; -class StateTest extends \PHPUnit\Framework\TestCase +class StateTest extends TestCase { #[DataProvider('provideData')] public function test_if_state_monad_obeys_the_laws($f, $g, $x, $state) diff --git a/test/Monad/WriterTest.php b/test/Monad/WriterTest.php index ee4c853..544aee2 100644 --- a/test/Monad/WriterTest.php +++ b/test/Monad/WriterTest.php @@ -10,9 +10,10 @@ use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; use Widmogrod\Monad\Writer; -class WriterTest extends \PHPUnit\Framework\TestCase +class WriterTest extends TestCase { #[DataProvider('provideData')] public function test_if_writer_monad_obeys_the_laws($f, $g, $x) diff --git a/test/Primitive/ListtTest.php b/test/Primitive/ListtTest.php index c9cf2dd..c52c03d 100644 --- a/test/Primitive/ListtTest.php +++ b/test/Primitive/ListtTest.php @@ -7,19 +7,20 @@ use Eris\TestTrait; use FunctionalPHP\FantasyLand\Applicative; use FunctionalPHP\FantasyLand\Functor; -use FunctionalPHP\FantasyLand\Monoid; -use PHPUnit\Framework\Attributes\DataProvider; -use Widmogrod\Functional as f; use FunctionalPHP\FantasyLand\Helpful\ApplicativeLaws; use FunctionalPHP\FantasyLand\Helpful\FunctorLaws; use FunctionalPHP\FantasyLand\Helpful\MonadLaws; use FunctionalPHP\FantasyLand\Helpful\MonoidLaws; -use const Widmogrod\Functional\fromValue; +use FunctionalPHP\FantasyLand\Monoid; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; +use Widmogrod\Functional as f; use function Eris\Generator\choose; use function Eris\Generator\vector; use function Widmogrod\Functional\fromNil; +use const Widmogrod\Functional\fromValue; -class ListtTest extends \PHPUnit\Framework\TestCase +class ListtTest extends TestCase { use TestTrait; @@ -61,7 +62,8 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) { + ) + { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, $pure), @@ -77,17 +79,17 @@ public static function provideApplicativeTestData() { return [ 'Listt' => [ - fromValue, - f\fromIterable([function () { + fromValue, + f\fromIterable([function () { return 1; }]), - f\fromIterable([function () { + f\fromIterable([function () { return 5; }]), - f\fromIterable([function () { + f\fromIterable([function () { return 7; }]), - function ($x) { + function ($x) { return $x + 400; }, 33 @@ -99,8 +101,9 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) { + Functor $x + ) + { FunctorLaws::test( [$this, 'assertEquals'], $f, @@ -113,7 +116,7 @@ public static function provideFunctorTestData() { return [ 'Listt' => [ - function ($x) { + function ($x) { return $x + 1; }, function ($x) { diff --git a/test/Primitive/NumTest.php b/test/Primitive/NumTest.php index c7c478a..9625f8c 100644 --- a/test/Primitive/NumTest.php +++ b/test/Primitive/NumTest.php @@ -4,12 +4,13 @@ namespace test\Primitive; -use Eris\TestTrait; use Eris\Generator; +use Eris\TestTrait; use FunctionalPHP\FantasyLand\Helpful\SetoidLaws; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Num; -class NumTest extends \PHPUnit\Framework\TestCase +class NumTest extends TestCase { use TestTrait; diff --git a/test/Primitive/ProductTest.php b/test/Primitive/ProductTest.php index f12cf42..0baba97 100644 --- a/test/Primitive/ProductTest.php +++ b/test/Primitive/ProductTest.php @@ -8,10 +8,12 @@ use Eris\TestTrait; use FunctionalPHP\FantasyLand\Helpful\MonoidLaws; use FunctionalPHP\FantasyLand\Helpful\SetoidLaws; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Product; use Widmogrod\Primitive\Stringg; +use Widmogrod\Primitive\TypeMismatchError; -class ProductTest extends \PHPUnit\Framework\TestCase +class ProductTest extends TestCase { use TestTrait; @@ -49,7 +51,7 @@ public function test_it_should_obay_monoid_laws() public function test_it_should_reject_concat_on_different_type() { - $this->expectException(\Widmogrod\Primitive\TypeMismatchError::class); + $this->expectException(TypeMismatchError::class); $this->expectExceptionMessage('Expected type is Widmogrod\Primitive\Product but given Widmogrod\Primitive\Stringg'); $this->forAll( Generator\int(), diff --git a/test/Primitive/StringgTest.php b/test/Primitive/StringgTest.php index e1554ec..a62e3e4 100644 --- a/test/Primitive/StringgTest.php +++ b/test/Primitive/StringgTest.php @@ -8,10 +8,12 @@ use Eris\TestTrait; use FunctionalPHP\FantasyLand\Helpful\MonoidLaws; use FunctionalPHP\FantasyLand\Helpful\SetoidLaws; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Product; use Widmogrod\Primitive\Stringg; +use Widmogrod\Primitive\TypeMismatchError; -class StringgTest extends \PHPUnit\Framework\TestCase +class StringgTest extends TestCase { use TestTrait; @@ -49,7 +51,7 @@ public function test_it_should_obey_monoid_laws() public function test_it_should_reject_concat_on_different_type() { - $this->expectException(\Widmogrod\Primitive\TypeMismatchError::class); + $this->expectException(TypeMismatchError::class); $this->expectExceptionMessage('Expected type is Widmogrod\Primitive\Stringg but given Widmogrod\Primitive\Product'); $this->forAll( Generator\string(), diff --git a/test/Primitive/SumTest.php b/test/Primitive/SumTest.php index e242b33..d085871 100644 --- a/test/Primitive/SumTest.php +++ b/test/Primitive/SumTest.php @@ -4,14 +4,16 @@ namespace test\Primitive; -use Eris\TestTrait; use Eris\Generator; +use Eris\TestTrait; use FunctionalPHP\FantasyLand\Helpful\MonoidLaws; use FunctionalPHP\FantasyLand\Helpful\SetoidLaws; +use PHPUnit\Framework\TestCase; use Widmogrod\Primitive\Product; use Widmogrod\Primitive\Sum; +use Widmogrod\Primitive\TypeMismatchError; -class SumTest extends \PHPUnit\Framework\TestCase +class SumTest extends TestCase { use TestTrait; @@ -49,7 +51,7 @@ public function test_it_should_obay_monoid_laws() public function test_it_should_reject_concat_on_different_type() { - $this->expectException(\Widmogrod\Primitive\TypeMismatchError::class); + $this->expectException(TypeMismatchError::class); $this->expectExceptionMessage('Expected type is Widmogrod\Primitive\Sum but given Widmogrod\Primitive\Product'); $this->forAll( Generator\int(), diff --git a/test/Useful/MatchTest.php b/test/Useful/MatchTest.php index ac5dc74..c295da9 100644 --- a/test/Useful/MatchTest.php +++ b/test/Useful/MatchTest.php @@ -4,14 +4,17 @@ namespace test\Useful; +use Exception; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\TestCase; +use stdClass; use Widmogrod\Useful\PatternMatcher; use Widmogrod\Useful\PatternNotMatchedError; use function Widmogrod\Useful\matchPatterns; use const Widmogrod\Functional\identity; use const Widmogrod\Useful\any; -class MatchTest extends \PHPUnit\Framework\TestCase +class MatchTest extends TestCase { #[DataProvider('provideInvalidPatterns')] public function test_it_should_fail_on_not_matched_patterns( @@ -44,7 +47,7 @@ public static function provideInvalidPatterns() ], 'Value not in tuple pattern list' => [ [ - [[self::class, \stdClass::class], identity], + [[self::class, stdClass::class], identity], [["RandomString"], identity], ], [random_int(-1000, 1000)], @@ -69,21 +72,21 @@ public function test_it_should_match_given_value( public static function providePatterns() { - $std = new \stdClass(); - $e = new \Exception(); + $std = new stdClass(); + $e = new Exception(); $m = new MyPatternMatcher(100, 123); return [ 'single pattern' => [ [ - \stdClass::class => identity, + stdClass::class => identity, ], $std, $std, ], 'single pattern fallback to any' => [ [ - \stdClass::class => identity, + stdClass::class => identity, any => identity, ], $e, @@ -91,16 +94,16 @@ public static function providePatterns() ], 'many patterns' => [ [ - \Exception::class => identity, + Exception::class => identity, self::class => identity, - \stdClass::class => identity, + stdClass::class => identity, ], $std, $std, ], 'tuple patterns' => [ [ - [[\stdClass::class, \stdClass::class], function () { + [[stdClass::class, stdClass::class], function () { return func_get_args(); }], ], @@ -109,7 +112,7 @@ public static function providePatterns() ], 'tuple fallback to any patterns' => [ [ - [[\stdClass::class, \stdClass::class], function () { + [[stdClass::class, stdClass::class], function () { return func_get_args(); }], [[any, any], function () { @@ -121,9 +124,9 @@ public static function providePatterns() ], 'value as a PatternMatcher patterns' => [ [ - \Exception::class => identity, + Exception::class => identity, self::class => identity, - \stdClass::class => identity, + stdClass::class => identity, MyPatternMatcher::class => function ($a, $b) { return $a + $b; } From 75c891ca6652bd8f39adb8b10bae432c7a0fa0a2 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:14:52 +0100 Subject: [PATCH 11/18] chore: composer.json min requirement php 8.3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index be16936..6138641 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "widmogrod/php-functional", "description": "Functors, Applicative and Monads are fascinating concept. Purpose of this library is to explore them in OOP PHP world.", "require": { - "php": "^8.0", + "php": ">=8.3", "functional-php/fantasy-land": "^1" }, "require-dev": { From 5017026c918c1daedc7f99c61370e8cdf98c49f2 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:15:18 +0100 Subject: [PATCH 12/18] chore: run code fixer on codebase --- example/ComplexErrorDrivenDevelopmentTest.php | 2 +- example/FreeUnionTypeGeneratorTest.php | 2 +- example/ParserTest.php | 2 +- example/StateMonadTest.php | 2 +- src/Functional/functions.php | 87 +++++++++---------- src/Functional/infinit.php | 10 +-- src/Functional/listt.php | 20 ++--- src/Functional/miscellaneous.php | 9 +- src/Functional/monoid.php | 2 +- src/Functional/predicates.php | 4 +- src/Functional/strings.php | 2 +- src/Functional/sublist.php | 16 ++-- src/Functional/zipping.php | 6 +- src/Monad/Control/Doo/Registry/Registry.php | 6 +- src/Monad/Control/Doo/interpretation.php | 2 +- src/Monad/Either/Either.php | 2 +- src/Monad/Either/functions.php | 20 ++--- src/Monad/Free/MonadFree.php | 2 +- src/Monad/Free/functions.php | 4 +- src/Monad/IO/errors.php | 2 +- src/Monad/IO/functions.php | 6 +- src/Monad/Maybe/functions.php | 6 +- src/Monad/Reader/functions.php | 2 +- src/Monad/State/functions.php | 6 +- src/Useful/PatternMatcher.php | 2 +- src/Useful/match.php | 4 +- test/Functional/ApplicatorTest.php | 3 +- test/Functional/ComposeTest.php | 3 +- test/Functional/ConcatTest.php | 3 +- test/Functional/CurryNTest.php | 15 ++-- test/Functional/CurryTest.php | 6 +- test/Functional/DropTest.php | 5 +- test/Functional/DropWhileTest.php | 7 +- test/Functional/FilterMTest.php | 3 +- test/Functional/FilterTest.php | 3 +- test/Functional/FlipTest.php | 12 ++- test/Functional/FoldMTest.php | 3 +- test/Functional/HeadTest.php | 5 +- test/Functional/IdentityTest.php | 3 +- test/Functional/JoinTest.php | 7 +- test/Functional/LengthTest.php | 5 +- test/Functional/LiftM2Test.php | 11 ++- test/Functional/PipeTest.php | 3 +- test/Functional/PipelineTest.php | 3 +- test/Functional/PushTest.php | 3 +- test/Functional/ReverseTest.php | 5 +- test/Functional/SpanTest.php | 7 +- test/Functional/TailTest.php | 3 +- test/Functional/TakeTest.php | 5 +- test/Functional/TeeTest.php | 6 +- test/Functional/UnzipTest.php | 3 +- test/Functional/ValueOfTest.php | 3 +- test/Functional/ZipTest.php | 3 +- test/Monad/EitherTest.php | 8 +- test/Monad/FreeTest.php | 8 +- test/Monad/IOTest.php | 8 +- test/Monad/IdentityTest.php | 12 ++- test/Monad/MaybeTest.php | 8 +- test/Monad/ReaderTest.php | 10 +-- test/Monad/StateTest.php | 10 +-- test/Monad/WriterTest.php | 8 +- test/Primitive/ListtTest.php | 8 +- test/Useful/MatchTest.php | 14 ++- 63 files changed, 201 insertions(+), 259 deletions(-) diff --git a/example/ComplexErrorDrivenDevelopmentTest.php b/example/ComplexErrorDrivenDevelopmentTest.php index f94cdc6..f830cad 100644 --- a/example/ComplexErrorDrivenDevelopmentTest.php +++ b/example/ComplexErrorDrivenDevelopmentTest.php @@ -75,7 +75,7 @@ function returnMessage(array $request) function returnFailure($data) { return [ - 'error' => (string)$data, + 'error' => (string) $data, ]; } diff --git a/example/FreeUnionTypeGeneratorTest.php b/example/FreeUnionTypeGeneratorTest.php index 9473a12..e422b30 100644 --- a/example/FreeUnionTypeGeneratorTest.php +++ b/example/FreeUnionTypeGeneratorTest.php @@ -257,7 +257,7 @@ public function __toString() const interpretTypesAndGenerate = 'example\interpretTypesAndGenerate'; /** - * @param UnionF $f + * @param UnionF $f * @return Identity * @throws PatternNotMatchedError */ diff --git a/example/ParserTest.php b/example/ParserTest.php index 6cb9916..b3366be 100644 --- a/example/ParserTest.php +++ b/example/ParserTest.php @@ -383,7 +383,7 @@ public function test_generated_ast() public function test_integration_with_free_calc() { $literal = tokenizeP(numbersP, function (Stringg $a) { - return int((int)$a->extract()); + return int((int) $a->extract()); }); $opAdd = tokenizeP(charP('+'), function (Stringg $a) { return sum; diff --git a/example/StateMonadTest.php b/example/StateMonadTest.php index 67c1c6f..249ade5 100644 --- a/example/StateMonadTest.php +++ b/example/StateMonadTest.php @@ -23,7 +23,7 @@ public function get($key); /** * @param string $key - * @param mixed $value + * @param mixed $value * * @return self */ diff --git a/src/Functional/functions.php b/src/Functional/functions.php index 1783005..0a48d44 100644 --- a/src/Functional/functions.php +++ b/src/Functional/functions.php @@ -24,7 +24,7 @@ /** * applicator :: a -> (a -> b) -> b * - * @param mixed $x + * @param mixed $x * @param callable $f * * @return mixed @@ -45,7 +45,7 @@ function applicator($x, ?callable $f = null) * invoke :: a -> #{a: (_ -> b)} -> b * * @param string $method - * @param mixed $object + * @param mixed $object * * @return mixed */ @@ -59,9 +59,9 @@ function invoke($method, $object = null) /** * Curry function * - * @param int $numberOfArguments + * @param int $numberOfArguments * @param callable $function - * @param array $args + * @param array $args * * @return callable */ @@ -80,7 +80,7 @@ function curryN($numberOfArguments, callable $function, array $args = []) * Curry function * * @param callable $function - * @param array $args + * @param array $args * * @return callable */ @@ -124,7 +124,7 @@ function valueOf($value) * Call $function with $value and return $value * * @param callable $function - * @param mixed $value + * @param mixed $value * * @return Closure */ @@ -147,7 +147,7 @@ function tee(callable $function, $value = null) * * Call $function with arguments in reversed order * - * @param callable $function + * @param callable $function * @return Closure * */ @@ -166,8 +166,8 @@ function reverse(callable $function) /** * map :: Functor f => (a -> b) -> f a -> f b * - * @param callable $transformation - * @param Functor $value + * @param callable $transformation + * @param Functor $value * @return mixed|Closure * */ @@ -186,8 +186,8 @@ function map(callable $transformation, ?Functor $value = null) /** * bind :: Monad m => (a -> m b) -> m a -> m b * - * @param callable $function - * @param Monad $value + * @param callable $function + * @param Monad $value * @return mixed|Closure * */ @@ -223,8 +223,8 @@ function join(Monad $monad): Monad /** * reduce :: Foldable t => (b -> a -> b) -> b -> t a -> b * - * @param callable $callable Binary function ($accumulator, $value) - * @param mixed $accumulator + * @param callable $callable Binary function ($accumulator, $value) + * @param mixed $accumulator * @param Foldable $foldable * * @return mixed @@ -233,7 +233,7 @@ function reduce(callable $callable, $accumulator = null, ?Foldable $foldable = n { return curryN(3, function ( callable $callable, - $accumulator, + $accumulator, Foldable $foldable ) { return $foldable->reduce($callable, $accumulator); @@ -251,8 +251,8 @@ function reduce(callable $callable, $accumulator = null, ?Foldable $foldable = n * Foldr is expresed by foldl (reduce) so it loose some properties. * For more reading please read this article https://wiki.haskell.org/Foldl_as_foldr * - * @param callable $callable Binary function ($value, $accumulator) - * @param mixed $accumulator + * @param callable $callable Binary function ($value, $accumulator) + * @param mixed $accumulator * @param Foldable $foldable * * @return mixed @@ -261,7 +261,7 @@ function foldr(callable $callback, mixed $initialValue = null, ?Foldable $inputF { return curryN(3, function ( callable $callable, - $accumulator, + $accumulator, Foldable $foldable ) { return reduce( @@ -391,17 +391,16 @@ function reThrow(Exception $e) * liftM2 (+) (Just 1) Nothing = Nothing * * @param callable $transformation - * @param Monad $ma - * @param Monad $mb + * @param Monad $ma + * @param Monad $mb * * @return Monad|Closure */ function liftM2( ?callable $transformation = null, - ?Monad $ma = null, - ?Monad $mb = null -) -{ + ?Monad $ma = null, + ?Monad $mb = null +) { return call_user_func_array( liftA2, func_get_args() @@ -417,23 +416,22 @@ function liftM2( * bindM2 :: Monad m => (a -> b -> m c) -> m a -> m b -> m c * * @param callable $transformation - * @param Monad $ma - * @param Monad $mb + * @param Monad $ma + * @param Monad $mb * * @return Monad|Closure */ function bindM2( ?callable $transformation = null, - ?Monad $ma = null, - ?Monad $mb = null -) -{ + ?Monad $ma = null, + ?Monad $mb = null +) { return curryN( 3, function ( callable $transformation, - Monad $ma, - Monad $mb + Monad $ma, + Monad $mb ) { return $ma->bind(function ($a) use ($mb, $transformation) { return $mb->bind(function ($b) use ($a, $transformation) { @@ -452,20 +450,19 @@ function ( /** * liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c * - * @param callable $transformation + * @param callable $transformation * @param Applicative $fa * @param Applicative $fb * * @return Applicative|Closure */ function liftA2( - ?callable $transformation = null, + ?callable $transformation = null, ?Applicative $fa = null, ?Applicative $fb = null -) -{ +) { return curryN(3, function ( - callable $transformation, + callable $transformation, Applicative $fa, Applicative $fb ) { @@ -520,15 +517,15 @@ function sequenceM(Monad $a, ?Monad $b = null): Monad * * Map each element of a structure to an action, evaluate these actions from left to right, and collect the results * - * @param callable $transformation (a -> f b) - * @param Traversable $t t a + * @param callable $transformation (a -> f b) + * @param Traversable $t t a * * @return Closure|Applicative f (t b) */ function traverse(callable $transformation, ?Traversable $t = null) { return curryN(2, function ( - callable $transformation, + callable $transformation, Traversable $t ) { return $t->traverse($transformation); @@ -543,7 +540,7 @@ function traverse(callable $transformation, ?Traversable $t = null) * foldr :: (a -> b -> b) -> b -> t a -> b * liftA2 :: (a -> b -> c) -> f a -> f b -> f c *``` - * @param callable $f (a -> m Bool) + * @param callable $f (a -> m Bool) * @param Foldable $xs [a] * * @return Closure|Monad m [a] @@ -552,7 +549,7 @@ function filterM(callable $f, ?Foldable $xs = null) { return curryN(2, function ( callable $f, - $xs + $xs ) { $result = foldr(function ($x, $ys) use ($f) { $y = $f($x); @@ -585,8 +582,8 @@ function filterM(callable $f, ?Foldable $xs = null) * foldr :: (a -> b -> b) -> b -> t a -> b * ``` * - * @param callable $f (a -> b -> m a) - * @param null $z0 + * @param callable $f (a -> b -> m a) + * @param null $z0 * @param Foldable $xs [b] * * @return mixed m a @@ -595,8 +592,8 @@ function foldM(callable $f, $z0 = null, ?Foldable $xs = null) { return curryN(3, function ( callable $f, - $z0, - $xs + $z0, + $xs ) { $result = foldr(function ($x, $k) use ($f, $z0) { if ($k === null) { diff --git a/src/Functional/infinit.php b/src/Functional/infinit.php index 58091f9..52d8206 100644 --- a/src/Functional/infinit.php +++ b/src/Functional/infinit.php @@ -23,8 +23,8 @@ * ```haskell * iterate f x == [x, f x, f (f x), ...] * ``` - * @param callable $fn - * @param mixed $a + * @param callable $fn + * @param mixed $a * @return Listt|Closure */ function iterate(callable $fn, $a = null) @@ -67,8 +67,8 @@ function repeat($a) * replicate n x is a list of length n with x the value of every element. * It is an instance of the more general genericReplicate, in which n may be of any integral type. * - * @param int $n - * @param mixed $a + * @param int $n + * @param mixed $a * @return Listt|Closure */ function replicate(int $n, $a = null): Listt @@ -88,7 +88,7 @@ function replicate(int $n, $a = null): Listt * * cycle ties a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists. * - * @param Listt $xs + * @param Listt $xs * @return Listt * @throws EmptyListError */ diff --git a/src/Functional/listt.php b/src/Functional/listt.php index 8473a38..3af9da8 100644 --- a/src/Functional/listt.php +++ b/src/Functional/listt.php @@ -23,7 +23,7 @@ * * Adapt any native PHP value that is iterable into Listt. * - * @param iterable $i + * @param iterable $i * @return Listt */ function fromIterable(iterable $i): Listt @@ -46,7 +46,7 @@ function fromIterable(iterable $i): Listt * Utility function. Must not be used directly. * Use fromValue() or fromIterable() * - * @param SnapshotIterator $i + * @param SnapshotIterator $i * @return Listt */ function fromSnapshotIterator(SnapshotIterator $i): Listt @@ -73,7 +73,7 @@ function fromSnapshotIterator(SnapshotIterator $i): Listt * * Create list containing only one value. * - * @param mixed $value + * @param mixed $value * @return Listt */ function fromValue($value): Listt @@ -132,8 +132,8 @@ function concat(Foldable $xs): Listt /** * prepend :: a -> [a] -> [a] * - * @param mixed $x - * @param Listt $xs + * @param mixed $x + * @param Listt $xs * @return Listt|Closure */ function prepend($x, ?Listt $xs = null) @@ -160,8 +160,8 @@ function prepend($x, ?Listt $xs = null) * * If the first list is not finite, the result is the first list. * - * @param Listt $a - * @param Listt|null $b + * @param Listt $a + * @param Listt|null $b * @return Listt|callable */ function append(Listt $a, ?Listt $b = null) @@ -181,7 +181,7 @@ function append(Listt $a, ?Listt $b = null) * * Extract the first element of a list, which must be non-empty. * - * @param Listt $l + * @param Listt $l * @return mixed * @throws EmptyListError */ @@ -200,7 +200,7 @@ function head(Listt $l) * * Extract the elements after the head of a list, which must be non-empty. * - * @param Listt $l + * @param Listt $l * @return Listt * @throws EmptyListError */ @@ -221,7 +221,7 @@ function tail(Listt $l) * The default implementation is optimized for structures that are similar to cons-lists, * because there is no general way to do better. * - * @param Foldable $t + * @param Foldable $t * @return int */ function length(Foldable $t): int diff --git a/src/Functional/miscellaneous.php b/src/Functional/miscellaneous.php index af05ea3..c9331de 100644 --- a/src/Functional/miscellaneous.php +++ b/src/Functional/miscellaneous.php @@ -123,17 +123,16 @@ function pipeline(callable $a, callable $b) * strtoupper(strtolower('aBc')) ≡ 'ABC' * * - * @param mixed $in - * @param callable $fab - * @param callable ...$fbc + * @param mixed $in + * @param callable $fab + * @param callable ...$fbc * @return mixed */ function pipe( $in, callable $fab, callable ...$fbc -) -{ +) { $callables = count($fbc) > 0 ? $fbc : [identity]; diff --git a/src/Functional/monoid.php b/src/Functional/monoid.php index 9bf9263..e90f362 100644 --- a/src/Functional/monoid.php +++ b/src/Functional/monoid.php @@ -27,7 +27,7 @@ function emptyM(Monoid $a): Monoid /** * concatM :: a -> a -> a * - * @param Semigroup $a + * @param Semigroup $a * @param Semigroup|null $b * * @return Semigroup|Closure diff --git a/src/Functional/predicates.php b/src/Functional/predicates.php index 51a585a..3f3b913 100644 --- a/src/Functional/predicates.php +++ b/src/Functional/predicates.php @@ -45,9 +45,9 @@ function lt($expected, $value = null) /** * orr :: (a -> Bool) -> (a -> Bool) -> a -> Bool * - * @param callable $predicateA + * @param callable $predicateA * @param callable|null $predicateB - * @param mixed $value + * @param mixed $value * * @return bool|Closure */ diff --git a/src/Functional/strings.php b/src/Functional/strings.php index 314b1af..fe25199 100644 --- a/src/Functional/strings.php +++ b/src/Functional/strings.php @@ -11,7 +11,7 @@ /** * concatStrings :: String -> String -> String * - * @param string $a + * @param string $a * @param string|null $b * * @return string|Closure diff --git a/src/Functional/sublist.php b/src/Functional/sublist.php index 4fd07ae..ab98731 100644 --- a/src/Functional/sublist.php +++ b/src/Functional/sublist.php @@ -20,8 +20,8 @@ * * take n, applied to a list xs, returns the prefix of xs of length n, or xs itself if n > length xs: * - * @param int $n - * @param Listt $xs + * @param int $n + * @param Listt $xs * @return Listt|Closure */ function take(int $n, ?Listt $xs = null) @@ -46,8 +46,8 @@ function take(int $n, ?Listt $xs = null) * drop :: Int -> [a] -> [a] * * drop n xs returns the suffix of xs after the first n elements, or [] if n > length xs: - * @param int $n - * @param Listt $xs + * @param int $n + * @param Listt $xs * @return Listt|Closure */ function drop(int $n, ?Listt $xs = null) @@ -81,8 +81,8 @@ function drop(int $n, ?Listt $xs = null) * | otherwise = xs * ``` * - * @param callable $predicate - * @param Listt $xs + * @param callable $predicate + * @param Listt $xs * @return Listt|Closure */ function dropWhile(callable $predicate, ?Listt $xs = null) @@ -123,8 +123,8 @@ function dropWhile(callable $predicate, ?Listt $xs = null) * where first element is longest prefix (possibly empty) of xs of elements * that satisfy p and second element is the remainder of the list * - * @param callable $predicate - * @param Listt $xs + * @param callable $predicate + * @param Listt $xs * @return array|Closure */ function span(callable $predicate, ?Listt $xs = null) diff --git a/src/Functional/zipping.php b/src/Functional/zipping.php index 6f1ba91..cd0f4c1 100644 --- a/src/Functional/zipping.php +++ b/src/Functional/zipping.php @@ -20,8 +20,8 @@ * zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded. * zip is right-lazy: * - * @param Listt $xs - * @param Listt|null $ys + * @param Listt $xs + * @param Listt|null $ys * @return Listt|Closure */ function zip(Listt $xs, ?Listt $ys = null) @@ -53,7 +53,7 @@ function zip(Listt $xs, ?Listt $ys = null) * * unzip transforms a list of pairs into a list of first components and a list of second components. * - * @param Listt $xs + * @param Listt $xs * @return array */ function unzip(Listt $xs): array diff --git a/src/Monad/Control/Doo/Registry/Registry.php b/src/Monad/Control/Doo/Registry/Registry.php index f680819..3e5acea 100644 --- a/src/Monad/Control/Doo/Registry/Registry.php +++ b/src/Monad/Control/Doo/Registry/Registry.php @@ -9,7 +9,7 @@ class Registry private $data = []; /** - * @param string $name + * @param string $name * @return mixed * @throws VariableNotDeclaredError */ @@ -23,8 +23,8 @@ public function get(string $name) } /** - * @param string $name - * @param mixed $value + * @param string $name + * @param mixed $value * @return mixed * @throws CannotRedeclareVariableError */ diff --git a/src/Monad/Control/Doo/interpretation.php b/src/Monad/Control/Doo/interpretation.php index f752615..407f2ae 100644 --- a/src/Monad/Control/Doo/interpretation.php +++ b/src/Monad/Control/Doo/interpretation.php @@ -26,7 +26,7 @@ /** * interpretationOfDoo :: DooF f -> Reader Registry MonadFree * - * @param DooF $f + * @param DooF $f * @return Reader * * @throws PatternNotMatchedError diff --git a/src/Monad/Either/Either.php b/src/Monad/Either/Either.php index 849e80b..25deca3 100644 --- a/src/Monad/Either/Either.php +++ b/src/Monad/Either/Either.php @@ -14,7 +14,7 @@ interface Either extends /** * Depending on if is Left or is Right then it apply corresponding function * - * @param callable $left (a -> b) + * @param callable $left (a -> b) * @param callable $right (c -> b) * * @return mixed b diff --git a/src/Monad/Either/functions.php b/src/Monad/Either/functions.php index 8991c8f..cf853da 100644 --- a/src/Monad/Either/functions.php +++ b/src/Monad/Either/functions.php @@ -57,9 +57,9 @@ function left($value) * * either :: (a -> c) -> (b -> c) -> Either a b -> c * - * @param callable $left (a -> c) - * @param callable $right (b -> c) - * @param Either $either Either a b + * @param callable $left (a -> c) + * @param callable $right (b -> c) + * @param Either $either Either a b * * @return mixed c */ @@ -79,7 +79,7 @@ function either(callable $left, ?callable $right = null, ?Either $either = null) * * @param callable $left * @param callable $right - * @param Either $either + * @param Either $either * * @return Left|Right|Closure */ @@ -101,9 +101,9 @@ function doubleMap(callable $left, ?callable $right = null, ?Either $either = nu * * tryCatch :: Exception e => (a -> b) -> (e -> c) -> a -> Either c b * - * @param callable $function (a -> b) + * @param callable $function (a -> b) * @param callable $catchFunction (e -> c) - * @param mixed $value a + * @param mixed $value a * * @return Either|Closure */ @@ -137,8 +137,8 @@ function toMaybe(Either $either) /** * fromLeft :: a -> Either a b -> a * - * @param mixed $a - * @param Either $either + * @param mixed $a + * @param Either $either * @return mixed */ function fromLeft($a, ?Either $either = null) @@ -153,8 +153,8 @@ function fromLeft($a, ?Either $either = null) /** * fromRight :: b -> Either a b -> b * - * @param mixed $a - * @param Either $either + * @param mixed $a + * @param Either $either * @return mixed */ function fromRight($a, ?Either $either = null) diff --git a/src/Monad/Free/MonadFree.php b/src/Monad/Free/MonadFree.php index ce0e704..6f789b9 100644 --- a/src/Monad/Free/MonadFree.php +++ b/src/Monad/Free/MonadFree.php @@ -15,7 +15,7 @@ interface MonadFree extends FantasyLand\Monad * foldFree f (Free as) = f as >>= foldFree f * ``` * - * @param callable $f (f x -> m x) + * @param callable $f (f x -> m x) * @param callable $return * * @return FantasyLand\Monad diff --git a/src/Monad/Free/functions.php b/src/Monad/Free/functions.php index 694bc21..049810a 100644 --- a/src/Monad/Free/functions.php +++ b/src/Monad/Free/functions.php @@ -33,9 +33,9 @@ function liftF(Functor $f): MonadFree * foldFree f (Free as) = f as >>= foldFree f * ``` * - * @param callable $interpreter (f x => m x) + * @param callable $interpreter (f x => m x) * @param MonadFree $free - * @param callable $return + * @param callable $return * * @return Monad|callable */ diff --git a/src/Monad/IO/errors.php b/src/Monad/IO/errors.php index 75b1d34..10e3c1d 100644 --- a/src/Monad/IO/errors.php +++ b/src/Monad/IO/errors.php @@ -47,7 +47,7 @@ function throwIO(Exception $e) /** * tryCatch :: Exception e => IO a -> (e -> IO a) -> IO a * - * @param M\IO $io + * @param M\IO $io * @param callable $catchFunction * * @return M\IO|Closure diff --git a/src/Monad/IO/functions.php b/src/Monad/IO/functions.php index 5f521e8..c83c6d0 100644 --- a/src/Monad/IO/functions.php +++ b/src/Monad/IO/functions.php @@ -29,9 +29,9 @@ function pure($f) * until :: (a -> Bool) -> (a -> b -> b) -> b -> IO a -> IO b * * @param callable $predicate (a -> Bool) - * @param callable $do (a -> b -> a) - * @param mixed $base b - * @param M\IO $ioValue IO a + * @param callable $do (a -> b -> a) + * @param mixed $base b + * @param M\IO $ioValue IO a * * @return M\IO */ diff --git a/src/Monad/Maybe/functions.php b/src/Monad/Maybe/functions.php index c58aad7..6a6fe53 100644 --- a/src/Monad/Maybe/functions.php +++ b/src/Monad/Maybe/functions.php @@ -34,7 +34,7 @@ function nothing() const just = 'Widmogrod\Monad\Maybe\just'; /** - * @param mixed $value + * @param mixed $value * @return Just * */ @@ -48,9 +48,9 @@ function just($value) /** * maybe :: b -> (a -> b) -> Maybe a -> b * - * @param null $default + * @param null $default * @param callable $fn - * @param Maybe $maybe + * @param Maybe $maybe * * @return mixed|Closure */ diff --git a/src/Monad/Reader/functions.php b/src/Monad/Reader/functions.php index 90bfa94..c8f4bc0 100644 --- a/src/Monad/Reader/functions.php +++ b/src/Monad/Reader/functions.php @@ -66,7 +66,7 @@ function value($value) * Unwrap a reader monad computation as a function. * * @param M\Reader $reader - * @param mixed $env + * @param mixed $env * * @return mixed */ diff --git a/src/Monad/State/functions.php b/src/Monad/State/functions.php index 1d26f47..3fb0b5d 100644 --- a/src/Monad/State/functions.php +++ b/src/Monad/State/functions.php @@ -139,7 +139,7 @@ function modify(callable $transformation) * Unwrap a state monad computation as a function. * * @param M\State $state - * @param mixed $initialState + * @param mixed $initialState * * @return mixed */ @@ -156,7 +156,7 @@ function runState(M\State $state, $initialState) * Evaluate a state computation with the given initial state and return the final value, discarding the final state. * * @param M\State $state - * @param mixed $initialState + * @param mixed $initialState * * @return mixed */ @@ -173,7 +173,7 @@ function evalState(M\State $state, $initialState) * Evaluate a state computation with the given initial state and return the final state, discarding the final value. * * @param M\State $state - * @param mixed $initialState + * @param mixed $initialState * * @return mixed */ diff --git a/src/Useful/PatternMatcher.php b/src/Useful/PatternMatcher.php index 5f886fa..a155ab5 100644 --- a/src/Useful/PatternMatcher.php +++ b/src/Useful/PatternMatcher.php @@ -8,7 +8,7 @@ interface PatternMatcher { /** * should be used with conjuction - * @param callable $fn + * @param callable $fn * @return mixed */ public function patternMatched(callable $fn); diff --git a/src/Useful/match.php b/src/Useful/match.php index a05ce9b..7a6f3c3 100644 --- a/src/Useful/match.php +++ b/src/Useful/match.php @@ -20,8 +20,8 @@ /** * match :: #{ Pattern -> (a -> b)} -> a -> b * - * @param array $patterns - * @param mixed $value + * @param array $patterns + * @param mixed $value * @return mixed * @throws PatternNotMatchedError * diff --git a/test/Functional/ApplicatorTest.php b/test/Functional/ApplicatorTest.php index d904dd0..b7a4428 100644 --- a/test/Functional/ApplicatorTest.php +++ b/test/Functional/ApplicatorTest.php @@ -16,8 +16,7 @@ public function test_it_should_apply_value_as_a_argument_to_a_function( $value, callable $fn, $expected - ) - { + ) { $this->assertSame( $expected, applicator($value, $fn) diff --git a/test/Functional/ComposeTest.php b/test/Functional/ComposeTest.php index 3ea8ea5..0a69583 100644 --- a/test/Functional/ComposeTest.php +++ b/test/Functional/ComposeTest.php @@ -21,8 +21,7 @@ public function test_it_should_be_curried( $functions, $value, $expected - ) - { + ) { $fn = f\compose(...$functions); $this->assertEquals( $expected, diff --git a/test/Functional/ConcatTest.php b/test/Functional/ConcatTest.php index 001a0a4..a0dc90b 100644 --- a/test/Functional/ConcatTest.php +++ b/test/Functional/ConcatTest.php @@ -16,8 +16,7 @@ class ConcatTest extends TestCase public function test_it_should_concat_values_to_array( $value, $expected - ) - { + ) { $this->assertEquals($expected, f\concat($value)); } diff --git a/test/Functional/CurryNTest.php b/test/Functional/CurryNTest.php index 4ecfe04..dab9aab 100644 --- a/test/Functional/CurryNTest.php +++ b/test/Functional/CurryNTest.php @@ -15,8 +15,7 @@ public function test_it_should_return_function_event_if_function_not_accept_argu $numberOfArguments, $function, $default - ) - { + ) { $this->assertIsCallable(f\curryN($numberOfArguments, $function, $default)); } @@ -53,16 +52,14 @@ public static function provideArgumentsWithFunctions() #[DataProvider('provideCurriedSumFunction')] public function test_it_should_evaluate_curried_function_if_number_of_arguments_is_fulfilled( callable $curriedSum - ) - { + ) { $this->assertSame(3, $curriedSum(1, 2)); } #[DataProvider('provideCurriedSumFunction')] public function test_it_should_be_able_to_curry_multiple_times( callable $curriedSum - ) - { + ) { $addOne = $curriedSum(1); $this->assertSame(2, $addOne(1)); $this->assertSame(3, $addOne(2)); @@ -72,8 +69,7 @@ public function test_it_should_be_able_to_curry_multiple_times( #[DataProvider('provideCurriedSumFunction')] public function test_it_should_be_able_to_curry_few_variants_and_evaluate_them( callable $curriedSum - ) - { + ) { $addOne = $curriedSum(1); $addTwo = $curriedSum(2); @@ -103,8 +99,7 @@ public static function provideCurriedSumFunction() #[DataProvider('provideCurriedReturnArgsFunction')] public function test_it_should_be_able_to_curry_even_if_more_arguments_is_applied( callable $returnArgs - ) - { + ) { $this->assertSame([1, 2, 3], $returnArgs(1, 2, 3)); } diff --git a/test/Functional/CurryTest.php b/test/Functional/CurryTest.php index 113fce5..15d1628 100644 --- a/test/Functional/CurryTest.php +++ b/test/Functional/CurryTest.php @@ -15,8 +15,7 @@ class CurryTest extends TestCase public function test_it_should_detect_automatically_number_of_arguments_to_curry( $fn, $resultAfterCurries - ) - { + ) { $times = 0; $curried = f\curry($fn); @@ -64,8 +63,7 @@ function ($a, $b = null) { public function test_it_curry_with_lest_arguments_if_defaults_are_provided( $result, $function - ) - { + ) { $this->assertEquals( $result, $function() diff --git a/test/Functional/DropTest.php b/test/Functional/DropTest.php index d9889a2..5589093 100644 --- a/test/Functional/DropTest.php +++ b/test/Functional/DropTest.php @@ -16,10 +16,9 @@ class DropTest extends TestCase #[DataProvider('provideData')] public function test_it( Listt $a, - int $n, + int $n, Listt $expected - ) - { + ) { $result = drop($n, $a); $r = print_r($result->extract(), true); diff --git a/test/Functional/DropWhileTest.php b/test/Functional/DropWhileTest.php index 91bcb51..c781c48 100644 --- a/test/Functional/DropWhileTest.php +++ b/test/Functional/DropWhileTest.php @@ -16,11 +16,10 @@ class DropWhileTest extends TestCase { #[DataProvider('provideData')] public function test_it( - Listt $a, + Listt $a, callable $fn, - Listt $expected - ) - { + Listt $expected + ) { $result = dropWhile($fn, $a); $r = print_r($result->extract(), true); diff --git a/test/Functional/FilterMTest.php b/test/Functional/FilterMTest.php index e20fad9..84fb0f5 100644 --- a/test/Functional/FilterMTest.php +++ b/test/Functional/FilterMTest.php @@ -18,8 +18,7 @@ class FilterMTest extends TestCase public function test_it_should_filter_with_maybe( $list, $expected - ) - { + ) { $filter = function ($i) { return just($i % 2 == 1); }; diff --git a/test/Functional/FilterTest.php b/test/Functional/FilterTest.php index af3ddeb..9975898 100644 --- a/test/Functional/FilterTest.php +++ b/test/Functional/FilterTest.php @@ -17,8 +17,7 @@ class FilterTest extends TestCase public function test_it_should_filter_with_maybe( $list, $expected - ) - { + ) { $filter = function (int $i): bool { return $i % 2 === 1; }; diff --git a/test/Functional/FlipTest.php b/test/Functional/FlipTest.php index 61a146a..416a8e9 100644 --- a/test/Functional/FlipTest.php +++ b/test/Functional/FlipTest.php @@ -14,10 +14,9 @@ class FlipTest extends TestCase #[DataProvider('provideFunctions')] public function test_it_should_flip_func_arguments( callable $func, - array $args, - $expected - ) - { + array $args, + $expected + ) { $flipped = f\flip($func); $this->assertEquals( @@ -49,9 +48,8 @@ function ($a, $b, $c) { #[DataProvider('provideFunctionsWithNotEnoughArgs')] public function test_it_should_curry_if_not_enough_args_passed( callable $func, - array $args - ) - { + array $args + ) { $curried = f\curry($func); $this->assertInstanceOf( diff --git a/test/Functional/FoldMTest.php b/test/Functional/FoldMTest.php index 5ceca21..7505080 100644 --- a/test/Functional/FoldMTest.php +++ b/test/Functional/FoldMTest.php @@ -19,8 +19,7 @@ class FoldMTest extends TestCase public function test_it_should_work_with_maybe( $list, $expected - ) - { + ) { $addSingleDigit = function ($acc, $i) { return $i > 9 ? nothing() : just($acc + $i); }; diff --git a/test/Functional/HeadTest.php b/test/Functional/HeadTest.php index 1111937..ff39fe3 100644 --- a/test/Functional/HeadTest.php +++ b/test/Functional/HeadTest.php @@ -18,9 +18,8 @@ class HeadTest extends TestCase #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Listt $listt, - $expected - ) - { + $expected + ) { $this->assertSame( $expected, head($listt) diff --git a/test/Functional/IdentityTest.php b/test/Functional/IdentityTest.php index 5e5506f..cfa0da8 100644 --- a/test/Functional/IdentityTest.php +++ b/test/Functional/IdentityTest.php @@ -13,8 +13,7 @@ class IdentityTest extends TestCase #[DataProvider('provideData')] public function test_it_should_return_given_value( $value - ) - { + ) { $this->assertEquals($value, f\identity($value)); } diff --git a/test/Functional/JoinTest.php b/test/Functional/JoinTest.php index 30cba3c..89cf69f 100644 --- a/test/Functional/JoinTest.php +++ b/test/Functional/JoinTest.php @@ -18,11 +18,10 @@ class JoinTest extends TestCase { #[DataProvider('provideData')] public function test_it_should_remove_one_level_of_monadic_structure( - Monad $monad, + Monad $monad, callable $run, - $expected - ) - { + $expected + ) { $result = join($monad); $this->assertEquals($expected, $run($result)); } diff --git a/test/Functional/LengthTest.php b/test/Functional/LengthTest.php index 9ae2345..bd1b03a 100644 --- a/test/Functional/LengthTest.php +++ b/test/Functional/LengthTest.php @@ -16,9 +16,8 @@ class LengthTest extends TestCase #[DataProvider('provideData')] public function test_it_should_return_boxed_value( Foldable $t, - int $expected - ) - { + int $expected + ) { $this->assertEquals(length($t), ($expected)); } diff --git a/test/Functional/LiftM2Test.php b/test/Functional/LiftM2Test.php index 7e516d9..aafad1c 100644 --- a/test/Functional/LiftM2Test.php +++ b/test/Functional/LiftM2Test.php @@ -17,13 +17,12 @@ class LiftM2Test extends TestCase { #[DataProvider('monadsProvider')] public function test_it_should_lift2M( - Monad $ma, - Monad $mb, - callable $transformation, - string $expectedFQCN, + Monad $ma, + Monad $mb, + callable $transformation, + string $expectedFQCN, ?callable $valueAssertion = null - ) - { + ) { $mc = f\liftM2($transformation, $ma, $mb); $this->assertInstanceOf($expectedFQCN, $mc); diff --git a/test/Functional/PipeTest.php b/test/Functional/PipeTest.php index 5f218eb..72f7134 100644 --- a/test/Functional/PipeTest.php +++ b/test/Functional/PipeTest.php @@ -15,8 +15,7 @@ public function test_it_should_compose_and_inject_input_correctly( $functions, $value, $expected - ) - { + ) { $this->assertEquals( $expected, f\pipe($value, ...$functions) diff --git a/test/Functional/PipelineTest.php b/test/Functional/PipelineTest.php index fc64d9b..d4581fd 100644 --- a/test/Functional/PipelineTest.php +++ b/test/Functional/PipelineTest.php @@ -21,8 +21,7 @@ public function test_it_should_be_curried( $functions, $value, $expected - ) - { + ) { $fn = f\pipeline(...$functions); $this->assertEquals( $expected, diff --git a/test/Functional/PushTest.php b/test/Functional/PushTest.php index 627a1bb..4069d2d 100644 --- a/test/Functional/PushTest.php +++ b/test/Functional/PushTest.php @@ -15,8 +15,7 @@ public function test_it_should_append_array_with_array_values( $array, $value, $expected - ) - { + ) { $this->assertEquals($expected, f\push_($array, $value)); } diff --git a/test/Functional/ReverseTest.php b/test/Functional/ReverseTest.php index 196a10c..b2f82f0 100644 --- a/test/Functional/ReverseTest.php +++ b/test/Functional/ReverseTest.php @@ -13,9 +13,8 @@ class ReverseTest extends TestCase #[DataProvider('provideData')] public function test_it_should_create_function_that_accept_args_in_reverse_order( callable $function, - array $args - ) - { + array $args + ) { $reversed = reverse($function); $original = reverse($reversed); diff --git a/test/Functional/SpanTest.php b/test/Functional/SpanTest.php index 1c03b24..8b79e21 100644 --- a/test/Functional/SpanTest.php +++ b/test/Functional/SpanTest.php @@ -20,10 +20,9 @@ class SpanTest extends TestCase #[DataProvider('provideData')] public function test_it_should_return_spanned_list( callable $predicate, - Listt $xs, - array $expected - ) - { + Listt $xs, + array $expected + ) { [$left, $right] = span($predicate, $xs); [$eleft, $eright] = $expected; diff --git a/test/Functional/TailTest.php b/test/Functional/TailTest.php index a6d7252..dfb6622 100644 --- a/test/Functional/TailTest.php +++ b/test/Functional/TailTest.php @@ -19,8 +19,7 @@ class TailTest extends TestCase public function test_it_should_return_boxed_value( Listt $listt, Listt $expected - ) - { + ) { $this->assertTrue(tail($listt)->equals($expected)); } diff --git a/test/Functional/TakeTest.php b/test/Functional/TakeTest.php index db963b8..20d6f35 100644 --- a/test/Functional/TakeTest.php +++ b/test/Functional/TakeTest.php @@ -17,10 +17,9 @@ class TakeTest extends TestCase #[DataProvider('provideData')] public function test_it( Listt $a, - int $n, + int $n, Listt $expected - ) - { + ) { $result = take($n, $a); $r = print_r($result->extract(), true); diff --git a/test/Functional/TeeTest.php b/test/Functional/TeeTest.php index 6fb0c1d..f759899 100644 --- a/test/Functional/TeeTest.php +++ b/test/Functional/TeeTest.php @@ -14,8 +14,7 @@ class TeeTest extends TestCase public function test_it_should_be_curried( $function, $value - ) - { + ) { $curried = f\tee($function); $this->assertEquals($value, $curried($value)); } @@ -24,8 +23,7 @@ public function test_it_should_be_curried( public function test_it_should_return_input_value( $function, $value - ) - { + ) { $this->assertEquals($value, f\tee($function, $value)); } diff --git a/test/Functional/UnzipTest.php b/test/Functional/UnzipTest.php index 7d53773..fafadff 100644 --- a/test/Functional/UnzipTest.php +++ b/test/Functional/UnzipTest.php @@ -26,8 +26,7 @@ class UnzipTest extends TestCase public function test_it_should_return_zipped_list( Listt $a, array $expected - ) - { + ) { [$a, $b] = unzip($a); [$ea, $eb] = $expected; diff --git a/test/Functional/ValueOfTest.php b/test/Functional/ValueOfTest.php index 36774e0..725520d 100644 --- a/test/Functional/ValueOfTest.php +++ b/test/Functional/ValueOfTest.php @@ -18,8 +18,7 @@ class ValueOfTest extends TestCase public function test_it_should_return_boxed_value( $value, $expected - ) - { + ) { $this->assertSame( $expected, valueOf($value) diff --git a/test/Functional/ZipTest.php b/test/Functional/ZipTest.php index b2e039d..a6a1df2 100644 --- a/test/Functional/ZipTest.php +++ b/test/Functional/ZipTest.php @@ -27,8 +27,7 @@ public function test_it_should_return_zipped_list( Listt $a, Listt $b, Listt $expected - ) - { + ) { $result = zip($a, $b); $r = print_r($result->extract(), true); diff --git a/test/Monad/EitherTest.php b/test/Monad/EitherTest.php index c223608..b7ab615 100644 --- a/test/Monad/EitherTest.php +++ b/test/Monad/EitherTest.php @@ -65,8 +65,7 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) - { + ) { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, $pure), @@ -120,9 +119,8 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) - { + Functor $x + ) { FunctorLaws::test( [$this, 'assertEquals'], $f, diff --git a/test/Monad/FreeTest.php b/test/Monad/FreeTest.php index 55024dc..0c61e5d 100644 --- a/test/Monad/FreeTest.php +++ b/test/Monad/FreeTest.php @@ -25,9 +25,8 @@ class FreeTest extends TestCase public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) - { + Functor $x + ) { FunctorLaws::test( function (MonadFree $a, MonadFree $b, $message) { $this->assertEquals( @@ -110,8 +109,7 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) - { + ) { ApplicativeLaws::test( function (MonadFree $a, MonadFree $b, $message) { $this->assertEquals( diff --git a/test/Monad/IOTest.php b/test/Monad/IOTest.php index 1698c97..199476f 100644 --- a/test/Monad/IOTest.php +++ b/test/Monad/IOTest.php @@ -68,8 +68,7 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) - { + ) { ApplicativeLaws::test( function (IO $a, IO $b, $message) { $this->assertEquals( @@ -113,9 +112,8 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) - { + Functor $x + ) { FunctorLaws::test( function (IO $a, IO $b, $message) { $this->assertEquals( diff --git a/test/Monad/IdentityTest.php b/test/Monad/IdentityTest.php index 6b2680a..230a52a 100644 --- a/test/Monad/IdentityTest.php +++ b/test/Monad/IdentityTest.php @@ -51,10 +51,9 @@ public function test_it_should_obey_applicative_laws( Applicative $u, Applicative $v, Applicative $w, - callable $f, - $x - ) - { + callable $f, + $x + ) { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, Identity::of), @@ -91,9 +90,8 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) - { + Functor $x + ) { FunctorLaws::test( [$this, 'assertEquals'], $f, diff --git a/test/Monad/MaybeTest.php b/test/Monad/MaybeTest.php index 21fbe4a..95c087b 100644 --- a/test/Monad/MaybeTest.php +++ b/test/Monad/MaybeTest.php @@ -66,8 +66,7 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) - { + ) { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, $pure), @@ -158,9 +157,8 @@ public static function provideMonoidTestData() public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) - { + Functor $x + ) { FunctorLaws::test( [$this, 'assertEquals'], $f, diff --git a/test/Monad/ReaderTest.php b/test/Monad/ReaderTest.php index e6e3de7..224f247 100644 --- a/test/Monad/ReaderTest.php +++ b/test/Monad/ReaderTest.php @@ -61,8 +61,7 @@ public function test_it_should_obey_applicative_laws( callable $f, $x, $reader - ) - { + ) { ApplicativeLaws::test( function (Reader $a, Reader $b, $message) use ($reader) { $this->assertEquals( @@ -107,10 +106,9 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x, - $reader - ) - { + Functor $x, + $reader + ) { FunctorLaws::test( function (Reader $a, Reader $b, $message) use ($reader) { $this->assertEquals( diff --git a/test/Monad/StateTest.php b/test/Monad/StateTest.php index d1ed1e2..b768ecd 100644 --- a/test/Monad/StateTest.php +++ b/test/Monad/StateTest.php @@ -62,8 +62,7 @@ public function test_it_should_obey_applicative_laws( callable $f, $x, $state - ) - { + ) { ApplicativeLaws::test( function (State $a, State $b, $message) use ($state) { $this->assertEquals( @@ -108,10 +107,9 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x, - $state - ) - { + Functor $x, + $state + ) { FunctorLaws::test( function (State $a, State $b, $message) use ($state) { $this->assertEquals( diff --git a/test/Monad/WriterTest.php b/test/Monad/WriterTest.php index 544aee2..e742c82 100644 --- a/test/Monad/WriterTest.php +++ b/test/Monad/WriterTest.php @@ -59,8 +59,7 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) - { + ) { ApplicativeLaws::test( function (Writer $a, Writer $b, $message) { $this->assertEquals( @@ -104,9 +103,8 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) - { + Functor $x + ) { FunctorLaws::test( function (Writer $a, Writer $b, $message) { $this->assertEquals( diff --git a/test/Primitive/ListtTest.php b/test/Primitive/ListtTest.php index c52c03d..3a5a1fc 100644 --- a/test/Primitive/ListtTest.php +++ b/test/Primitive/ListtTest.php @@ -62,8 +62,7 @@ public function test_it_should_obey_applicative_laws( Applicative $w, callable $f, $x - ) - { + ) { ApplicativeLaws::test( [$this, 'assertEquals'], f\curryN(1, $pure), @@ -101,9 +100,8 @@ function ($x) { public function test_it_should_obey_functor_laws( callable $f, callable $g, - Functor $x - ) - { + Functor $x + ) { FunctorLaws::test( [$this, 'assertEquals'], $f, diff --git a/test/Useful/MatchTest.php b/test/Useful/MatchTest.php index c295da9..3b27789 100644 --- a/test/Useful/MatchTest.php +++ b/test/Useful/MatchTest.php @@ -19,10 +19,9 @@ class MatchTest extends TestCase #[DataProvider('provideInvalidPatterns')] public function test_it_should_fail_on_not_matched_patterns( array $patterns, - $value, - $expectedMessage - ) - { + $value, + $expectedMessage + ) { $this->expectException(PatternNotMatchedError::class); $this->expectExceptionMessage($expectedMessage); @@ -59,10 +58,9 @@ public static function provideInvalidPatterns() #[DataProvider('providePatterns')] public function test_it_should_match_given_value( array $patterns, - $value, - $expected - ) - { + $value, + $expected + ) { $result = matchPatterns($patterns, $value); $this->assertSame( $expected, From f2517665441bcfccdfd44f04a2345654744448dd Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:22:50 +0100 Subject: [PATCH 13/18] chore: code coverage config refresh --- .github/workflows/ci.yml | 4 ++++ phpunit.xml.dist | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 878cc84..24ca8c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,10 +50,14 @@ jobs: - name: Run tests with coverage if: ${{ matrix.coverage == 'yes' }} run: composer testc + env: + XDEBUG_MODE: coverage - name: Code checks if: ${{ matrix.coverage == 'yes' }} run: composer check-code + env: + XDEBUG_MODE: coverage - name: Upload test coverage (if applicable) if: ${{ matrix.coverage == 'yes' }} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5702446..a0420a0 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,4 +1,3 @@ - @@ -18,9 +17,9 @@ ./example/ - - - ./src/ - - + + + ./src + + From b577fbf9361749537ead637f890fe3b3090340ee Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:40:18 +0100 Subject: [PATCH 14/18] chore: refresh phpunit.xml.dist --- .gitignore | 1 + phpunit.xml.dist | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7f2a0b2..cbefc53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor/ .idea .php_cs.cache +.phpunit.cache diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a0420a0..e787b85 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,17 @@ + + xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" + bootstrap="vendor/autoload.php" + cacheDirectory=".phpunit.cache" + executionOrder="depends,defects" + shortenArraysForExportThreshold="10" + requireCoverageMetadata="false" + beStrictAboutCoverageMetadata="true" + beStrictAboutOutputDuringTests="true" + displayDetailsOnPhpunitDeprecations="true" + failOnPhpunitDeprecation="false" + failOnRisky="true" + failOnWarning="true"> ./test/Functional @@ -18,8 +30,15 @@ + + + + + - ./src + src - + From dd9f6a00032fa0de4288afa5bddf903dcdf6c963 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 19:49:45 +0100 Subject: [PATCH 15/18] fix: minimum php version for code fixer --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24ca8c1..49b29ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,7 @@ jobs: run: composer check-code env: XDEBUG_MODE: coverage + PHP_CS_FIXER_IGNORE_ENV: true - name: Upload test coverage (if applicable) if: ${{ matrix.coverage == 'yes' }} From 41283c21d0016c29ef43497cd2c727b17e7b00d2 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 20:10:56 +0100 Subject: [PATCH 16/18] fix: wrong exit code --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49b29ed..9e4329c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,4 +62,4 @@ jobs: - name: Upload test coverage (if applicable) if: ${{ matrix.coverage == 'yes' }} - run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code ${{ steps.test.outcome }} + run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code 0 From 24e7eccff3a326c73745255f6a3f8c6d55b0f86c Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 20:15:54 +0100 Subject: [PATCH 17/18] fix: gh workflow - add secret --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e4329c..ed6d2d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,6 @@ name: PHP Test and Coverage - +env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} on: pull_request: push: From f8a9b2229fe12cb485834713fe04cf1f83d193f9 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 18 Dec 2024 20:16:41 +0100 Subject: [PATCH 18/18] fix: inject secret to env at right moment --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed6d2d9..05c69d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,4 @@ name: PHP Test and Coverage -env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} on: pull_request: push: @@ -64,3 +62,5 @@ jobs: - name: Upload test coverage (if applicable) if: ${{ matrix.coverage == 'yes' }} run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code 0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}