From 18d637ef2d8082a96371b9957d95518b301a109a Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 20 Mar 2025 06:59:24 +1000 Subject: [PATCH 01/39] Update test.yaml --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2c581fd1..fe7c8914 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,11 +12,11 @@ jobs: fail-fast: false matrix: php-version: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - 8.0 + - 8.1 + - 8.2 + - 8.3 + - 8.4 experimental: [false] include: - php-version: 8.1 From fac27abcc611003a34b195ab57efeadb7efa3cd1 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 25 Mar 2025 09:59:10 +1000 Subject: [PATCH 02/39] Update test.yaml --- .github/workflows/test.yaml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fe7c8914..228f4dca 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,15 +1,19 @@ name: Test -on: [push, pull_request] +on: + push: + branches: [ main ] + pull_request: + branches: '*' jobs: test: - name: PHP ${{ matrix.php-version }} (${{ matrix.experimental && 'experimental' || 'full support' }}) + name: PHP ${{ matrix.php-version }} - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest + timeout-minutes: 10 strategy: - fail-fast: false matrix: php-version: - 8.0 @@ -17,15 +21,10 @@ jobs: - 8.2 - 8.3 - 8.4 - experimental: [false] - include: - - php-version: 8.1 - experimental: true - continue-on-error: ${{ matrix.experimental }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install PHP with extensions uses: shivammathur/setup-php@v2 @@ -38,7 +37,6 @@ jobs: uses: ramsey/composer-install@v1 with: composer-options: --prefer-dist - continue-on-error: ${{ matrix.experimental }} - name: Setup PCOV run: | @@ -48,8 +46,6 @@ jobs: - name: Run Tests run: composer tests - continue-on-error: ${{ matrix.experimental }} - name: Check coding style run: composer coding-style - continue-on-error: ${{ matrix.experimental }} From c2b1bfb788e8d9617795289aaf499e9b01d8b28d Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 25 Mar 2025 10:08:16 +1000 Subject: [PATCH 03/39] Update test.yaml --- .github/workflows/test.yaml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 228f4dca..e2c59a04 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -33,10 +33,21 @@ jobs: coverage: pcov tools: composer:v2 - - name: Install Composer dependencies - uses: ramsey/composer-install@v1 + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 with: - composer-options: --prefer-dist + path: vendor + key: ${{ runner.os }}-${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.php-versions }}-composer + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress - name: Setup PCOV run: | From eb763756594d4be3fff428e2280faef7e0c15071 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 25 Mar 2025 10:33:42 +1000 Subject: [PATCH 04/39] Update composer.json --- composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/composer.json b/composer.json index ebfe9738..6259d168 100644 --- a/composer.json +++ b/composer.json @@ -132,6 +132,10 @@ } }, "scripts": { + "docker:start": "docker compose -p functional-php -f docker/docker-compose.yml up -d", + "docker:stop": "docker compose -p functional-php -f docker/docker-compose.yml down", + "docker:rebuild": "docker compose -p functional-php -f docker/docker-compose.yml build --force-rm && docker-compose -p functional-php -f docker/docker-compose.yml up -d --remove-orphans", + "docker:rebuild:nocache": "docker compose -p functional-php -f docker/docker-compose.yml build --force-rm --no-cache && docker-compose -p functional-php -f docker/docker-compose.yml up -d --remove-orphans", "tests": "vendor/bin/phpunit", "coding-style": "vendor/bin/phpcs && vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist", "clear": "rm -rf vendor/" From 4a2349c51521404354751b7b79d4bd6364869179 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 25 Mar 2025 10:33:54 +1000 Subject: [PATCH 05/39] Create php83.Dockerfile --- docker/php/php83.Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docker/php/php83.Dockerfile diff --git a/docker/php/php83.Dockerfile b/docker/php/php83.Dockerfile new file mode 100644 index 00000000..6722d8b8 --- /dev/null +++ b/docker/php/php83.Dockerfile @@ -0,0 +1,24 @@ +#------------------------------- +# README.md +#------------------------------- + +# This Dockerfile is for development and image testing only. + +# When using this file be sure to update docker-compose.yml to reference this file. + +# Please do not copy application code into this Dockerfile. + +# Changes from this file can turn into changes in the base images. + +# Feel free to make PR against devops-docker and DevOps will review it. + +FROM tithely/php:8.3-apache-dev + +#------------------------------ +# Begin changes below this note +#------------------------------ + +# Install custom packages +RUN apt-get update -qq && \ + apt-get install -qq \ + vim From 5ea4152e83c04cddd80cd0a476a5f4e33a0133a2 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 25 Mar 2025 11:02:28 +1000 Subject: [PATCH 06/39] Create php84.Dockerfile --- docker/php/php84.Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docker/php/php84.Dockerfile diff --git a/docker/php/php84.Dockerfile b/docker/php/php84.Dockerfile new file mode 100644 index 00000000..89519667 --- /dev/null +++ b/docker/php/php84.Dockerfile @@ -0,0 +1,10 @@ +FROM tithely/php:8.4-apache-dev + +#------------------------------ +# Begin changes below this note +#------------------------------ + +# Install custom packages +RUN apt-get update -qq && \ + apt-get install -qq \ + vim From eeda637e675a6c31f793d3b55548668185f482f2 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 25 Mar 2025 12:33:35 +1000 Subject: [PATCH 07/39] Create docker-compose.yml --- docker/docker-compose.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docker/docker-compose.yml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..94d6b9c8 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,21 @@ +services: + php_83: + build: + dockerfile: docker/php/php83.Dockerfile + context: ../ + container_name: functional_php_83 + environment: + - PCOV_ENABLED=1 + - PCOV_DIRECTORY=/app + volumes: + - ../:/src + php_84: + build: + dockerfile: docker/php/php84.Dockerfile + context: ../ + container_name: functional_php_84 + environment: + - PCOV_ENABLED=1 + - PCOV_DIRECTORY=/app + volumes: + - ../:/src From 6a40885ac1ba5d9a5060b13251880707a78178b1 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 25 Mar 2025 12:33:44 +1000 Subject: [PATCH 08/39] Update test.yaml --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e2c59a04..88d6ebab 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,7 +21,6 @@ jobs: - 8.2 - 8.3 - 8.4 - steps: - name: Checkout uses: actions/checkout@v3 From 4909d7a9d4a1fe9949cb2b2854afdef7c238d168 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 09:48:50 +1000 Subject: [PATCH 09/39] Update docker-compose.yml --- docker/docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 94d6b9c8..895d1d65 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -6,9 +6,9 @@ services: container_name: functional_php_83 environment: - PCOV_ENABLED=1 - - PCOV_DIRECTORY=/app + - PCOV_DIRECTORY=/app/src volumes: - - ../:/src + - ../:/app php_84: build: dockerfile: docker/php/php84.Dockerfile @@ -16,6 +16,6 @@ services: container_name: functional_php_84 environment: - PCOV_ENABLED=1 - - PCOV_DIRECTORY=/app + - PCOV_DIRECTORY=/app/src volumes: - - ../:/src + - ../:/app From dc35460e32d8309457e9003a5d7a3863ad498b35 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 09:49:21 +1000 Subject: [PATCH 10/39] Update composer.json --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6259d168..888b0d74 100644 --- a/composer.json +++ b/composer.json @@ -134,8 +134,7 @@ "scripts": { "docker:start": "docker compose -p functional-php -f docker/docker-compose.yml up -d", "docker:stop": "docker compose -p functional-php -f docker/docker-compose.yml down", - "docker:rebuild": "docker compose -p functional-php -f docker/docker-compose.yml build --force-rm && docker-compose -p functional-php -f docker/docker-compose.yml up -d --remove-orphans", - "docker:rebuild:nocache": "docker compose -p functional-php -f docker/docker-compose.yml build --force-rm --no-cache && docker-compose -p functional-php -f docker/docker-compose.yml up -d --remove-orphans", + "docker:rebuild": "docker compose -p functional-php -f docker/docker-compose.yml build --force-rm --no-cache && docker-compose -p functional-php -f docker/docker-compose.yml up -d --remove-orphans", "tests": "vendor/bin/phpunit", "coding-style": "vendor/bin/phpcs && vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist", "clear": "rm -rf vendor/" From 1e6f580d63f4fd9efca8e6c8a928b78aa4a25c68 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 10:13:14 +1000 Subject: [PATCH 11/39] Update test.yaml --- .github/workflows/test.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 88d6ebab..6c37fb80 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,10 +16,6 @@ jobs: strategy: matrix: php-version: - - 8.0 - - 8.1 - - 8.2 - - 8.3 - 8.4 steps: - name: Checkout From a6af026464d4ca266a068eb025eac69f78d8a596 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 10:14:29 +1000 Subject: [PATCH 12/39] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 888b0d74..27cf0339 100644 --- a/composer.json +++ b/composer.json @@ -17,11 +17,11 @@ } ], "require": { - "php": "^7.1|~8" + "php": "^8.4" }, "require-dev": { "squizlabs/php_codesniffer": "~3.0", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.5", + "phpunit/phpunit": "^9.6", "friendsofphp/php-cs-fixer": "^2.17" }, "autoload": { From 73cbf6498eed2e122b150cd3af8f05b28adcfe90 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 10:15:58 +1000 Subject: [PATCH 13/39] Create 84.Dockerfile --- docker/84.Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docker/84.Dockerfile diff --git a/docker/84.Dockerfile b/docker/84.Dockerfile new file mode 100644 index 00000000..89519667 --- /dev/null +++ b/docker/84.Dockerfile @@ -0,0 +1,10 @@ +FROM tithely/php:8.4-apache-dev + +#------------------------------ +# Begin changes below this note +#------------------------------ + +# Install custom packages +RUN apt-get update -qq && \ + apt-get install -qq \ + vim From 97fada0309596b75aca5a7dc939d2811ee2f2c2b Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 10:21:33 +1000 Subject: [PATCH 14/39] Update docker-compose.yml --- docker/docker-compose.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 895d1d65..9c01cf23 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,17 +1,7 @@ services: - php_83: - build: - dockerfile: docker/php/php83.Dockerfile - context: ../ - container_name: functional_php_83 - environment: - - PCOV_ENABLED=1 - - PCOV_DIRECTORY=/app/src - volumes: - - ../:/app php_84: build: - dockerfile: docker/php/php84.Dockerfile + dockerfile: docker/84.Dockerfile context: ../ container_name: functional_php_84 environment: From 7b9ebeb736b2b333901d3bdf7b54137d9a159883 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 10:21:58 +1000 Subject: [PATCH 15/39] change directory --- docker/php/php83.Dockerfile | 24 ------------------------ docker/php/php84.Dockerfile | 10 ---------- 2 files changed, 34 deletions(-) delete mode 100644 docker/php/php83.Dockerfile delete mode 100644 docker/php/php84.Dockerfile diff --git a/docker/php/php83.Dockerfile b/docker/php/php83.Dockerfile deleted file mode 100644 index 6722d8b8..00000000 --- a/docker/php/php83.Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -#------------------------------- -# README.md -#------------------------------- - -# This Dockerfile is for development and image testing only. - -# When using this file be sure to update docker-compose.yml to reference this file. - -# Please do not copy application code into this Dockerfile. - -# Changes from this file can turn into changes in the base images. - -# Feel free to make PR against devops-docker and DevOps will review it. - -FROM tithely/php:8.3-apache-dev - -#------------------------------ -# Begin changes below this note -#------------------------------ - -# Install custom packages -RUN apt-get update -qq && \ - apt-get install -qq \ - vim diff --git a/docker/php/php84.Dockerfile b/docker/php/php84.Dockerfile deleted file mode 100644 index 89519667..00000000 --- a/docker/php/php84.Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM tithely/php:8.4-apache-dev - -#------------------------------ -# Begin changes below this note -#------------------------------ - -# Install custom packages -RUN apt-get update -qq && \ - apt-get install -qq \ - vim From 469c98814222a1a4d86a17cff32c20c128ec30d4 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 11:02:05 +1000 Subject: [PATCH 16/39] changes for php 84 --- src/Functional/CompareObjectHashOn.php | 2 +- src/Functional/CompareOn.php | 2 +- src/Functional/Every.php | 2 +- src/Functional/First.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Functional/CompareObjectHashOn.php b/src/Functional/CompareObjectHashOn.php index c4194479..faf6c2e2 100644 --- a/src/Functional/CompareObjectHashOn.php +++ b/src/Functional/CompareObjectHashOn.php @@ -18,7 +18,7 @@ * @return callable * @no-named-arguments */ -function compare_object_hash_on(callable $comparison, callable $keyFunction = null) +function compare_object_hash_on(callable $comparison, ?callable $keyFunction = null) { $keyFunction = $keyFunction ? compose($keyFunction, 'spl_object_hash') : 'spl_object_hash'; diff --git a/src/Functional/CompareOn.php b/src/Functional/CompareOn.php index b0e5cda0..eec4a2d2 100644 --- a/src/Functional/CompareOn.php +++ b/src/Functional/CompareOn.php @@ -18,7 +18,7 @@ * @return callable * @no-named-arguments */ -function compare_on(callable $comparison, callable $reducer = null) +function compare_on(callable $comparison, ?callable $reducer = null) { if ($reducer === null) { return static function ($left, $right) use ($comparison) { diff --git a/src/Functional/Every.php b/src/Functional/Every.php index e4d8ff62..667cd72b 100644 --- a/src/Functional/Every.php +++ b/src/Functional/Every.php @@ -22,7 +22,7 @@ * @return bool * @no-named-arguments */ -function every($collection, callable $callback = null) +function every($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/First.php b/src/Functional/First.php index 87db945e..f9e30afd 100644 --- a/src/Functional/First.php +++ b/src/Functional/First.php @@ -23,7 +23,7 @@ * @return mixed * @no-named-arguments */ -function first($collection, callable $callback = null) +function first($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); From e6da151e3000430eb940508963943a2324f5f950 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 11:28:19 +1000 Subject: [PATCH 17/39] fix deprecation message --- src/Functional/Head.php | 2 +- src/Functional/Last.php | 2 +- src/Functional/Memoize.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Functional/Head.php b/src/Functional/Head.php index c6de5e86..48f8bedd 100644 --- a/src/Functional/Head.php +++ b/src/Functional/Head.php @@ -21,7 +21,7 @@ * @return mixed * @no-named-arguments */ -function head($collection, callable $callback = null) +function head($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/Last.php b/src/Functional/Last.php index 8989f945..4ffa2e4e 100644 --- a/src/Functional/Last.php +++ b/src/Functional/Last.php @@ -22,7 +22,7 @@ * @return mixed * @no-named-arguments */ -function last($collection, callable $callback = null) +function last($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/Memoize.php b/src/Functional/Memoize.php index 3813e3ce..aca716b5 100644 --- a/src/Functional/Memoize.php +++ b/src/Functional/Memoize.php @@ -21,7 +21,7 @@ * @return mixed * @no-named-arguments */ -function memoize(callable $callback = null, $arguments = [], $key = null) +function memoize(?callable $callback = null, $arguments = [], $key = null) { static $storage = []; if ($callback === null) { From d810729ad88119527d872f3127d9a8f407f746b8 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 12:09:16 +1000 Subject: [PATCH 18/39] fix deprecation message --- src/Functional/None.php | 2 +- src/Functional/Pick.php | 2 +- src/Functional/Poll.php | 2 +- src/Functional/Reject.php | 2 +- src/Functional/Retry.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Functional/None.php b/src/Functional/None.php index edbd33a9..c90e4055 100644 --- a/src/Functional/None.php +++ b/src/Functional/None.php @@ -22,7 +22,7 @@ * @return bool * @no-named-arguments */ -function none($collection, callable $callback = null) +function none($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/Pick.php b/src/Functional/Pick.php index b4be3c13..7d29f92c 100644 --- a/src/Functional/Pick.php +++ b/src/Functional/Pick.php @@ -24,7 +24,7 @@ * @return mixed * @no-named-arguments */ -function pick($collection, $index, $default = null, callable $callback = null) +function pick($collection, $index, $default = null, ?callable $callback = null) { InvalidArgumentException::assertArrayAccess($collection, __FUNCTION__, 1); diff --git a/src/Functional/Poll.php b/src/Functional/Poll.php index 7c632d77..8f920d24 100644 --- a/src/Functional/Poll.php +++ b/src/Functional/Poll.php @@ -26,7 +26,7 @@ * @return boolean * @no-named-arguments */ -function poll(callable $callback, $timeout, Traversable $delaySequence = null) +function poll(callable $callback, $timeout, ?Traversable $delaySequence = null) { InvalidArgumentException::assertIntegerGreaterThanOrEqual($timeout, 0, __FUNCTION__, 2); diff --git a/src/Functional/Reject.php b/src/Functional/Reject.php index 505acc91..0efddeee 100644 --- a/src/Functional/Reject.php +++ b/src/Functional/Reject.php @@ -22,7 +22,7 @@ * @return array * @no-named-arguments */ -function reject($collection, callable $callback = null) +function reject($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/Retry.php b/src/Functional/Retry.php index 40ef0fa7..4466542a 100644 --- a/src/Functional/Retry.php +++ b/src/Functional/Retry.php @@ -29,7 +29,7 @@ * @return mixed Return value of the function * @no-named-arguments */ -function retry(callable $callback, $retries, Traversable $delaySequence = null) +function retry(callable $callback, $retries, ?Traversable $delaySequence = null) { InvalidArgumentException::assertIntegerGreaterThanOrEqual($retries, 1, __FUNCTION__, 2); From 9196b1dacfd96111e66a299dc34c1b6be24cb9eb Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 27 Mar 2025 13:09:24 +1000 Subject: [PATCH 19/39] fix error --- src/Functional/Sequences/ExponentialSequence.php | 10 +++++----- src/Functional/Sequences/LinearSequence.php | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Functional/Sequences/ExponentialSequence.php b/src/Functional/Sequences/ExponentialSequence.php index 0a8b8d47..9f3302b0 100644 --- a/src/Functional/Sequences/ExponentialSequence.php +++ b/src/Functional/Sequences/ExponentialSequence.php @@ -38,28 +38,28 @@ public function __construct($start, $percentage) $this->percentage = $percentage; } - public function current() + public function current(): mixed { return $this->value; } - public function next() + public function next(): void { $this->value = (int) \round(\pow($this->start * (1 + $this->percentage / 100), $this->times)); $this->times++; } - public function key() + public function key(): null { return null; } - public function valid() + public function valid(): bool { return true; } - public function rewind() + public function rewind(): void { $this->times = 1; $this->value = $this->start; diff --git a/src/Functional/Sequences/LinearSequence.php b/src/Functional/Sequences/LinearSequence.php index ad99dfbb..5d526bc6 100644 --- a/src/Functional/Sequences/LinearSequence.php +++ b/src/Functional/Sequences/LinearSequence.php @@ -34,27 +34,27 @@ public function __construct($start, $amount) $this->amount = $amount; } - public function current() + public function current(): mixed { return $this->value; } - public function next() + public function next(): void { $this->value += $this->amount; } - public function key() + public function key(): null { return 0; } - public function valid() + public function valid(): bool { return true; } - public function rewind() + public function rewind(): void { $this->value = $this->start; } From 388922a292d1c87bf959e661650a4440cc20c0db Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 06:07:38 +1000 Subject: [PATCH 20/39] fix deprecation message --- src/Functional/Select.php | 2 +- src/Functional/Some.php | 2 +- src/Functional/Tail.php | 2 +- src/Functional/Unique.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Functional/Select.php b/src/Functional/Select.php index 93420357..eb0ab73d 100644 --- a/src/Functional/Select.php +++ b/src/Functional/Select.php @@ -22,7 +22,7 @@ * @return array * @no-named-arguments */ -function select($collection, callable $callback = null) +function select($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/Some.php b/src/Functional/Some.php index df27e0a8..9ae81ade 100644 --- a/src/Functional/Some.php +++ b/src/Functional/Some.php @@ -22,7 +22,7 @@ * @return bool * @no-named-arguments */ -function some($collection, callable $callback = null) +function some($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/Tail.php b/src/Functional/Tail.php index 495131d2..621b174d 100644 --- a/src/Functional/Tail.php +++ b/src/Functional/Tail.php @@ -22,7 +22,7 @@ * @return array * @no-named-arguments */ -function tail($collection, callable $callback = null) +function tail($collection, ?callable $callback = null) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); diff --git a/src/Functional/Unique.php b/src/Functional/Unique.php index 656ac2be..31b845b7 100644 --- a/src/Functional/Unique.php +++ b/src/Functional/Unique.php @@ -22,7 +22,7 @@ * @return array * @no-named-arguments */ -function unique($collection, callable $callback = null, $strict = true) +function unique($collection, ?callable $callback = null, $strict = true) { InvalidArgumentException::assertCollection($collection, __FUNCTION__, 1); From d761e9a3004cf1f9bc410f8d12386de73d847a23 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 07:48:05 +1000 Subject: [PATCH 21/39] fix issues with floats being used as array keys --- src/Functional/Group.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Functional/Group.php b/src/Functional/Group.php index af2ed3a1..1d30a248 100644 --- a/src/Functional/Group.php +++ b/src/Functional/Group.php @@ -32,6 +32,11 @@ function group($collection, callable $callback) InvalidArgumentException::assertValidArrayKey($groupKey, __FUNCTION__); + // Avoid implicit conversion, since float numbers cannot be used as array keys + if (is_numeric($groupKey)) { + $groupKey = intval($groupKey); + } + if (!isset($groups[$groupKey])) { $groups[$groupKey] = []; } From 3d7d25713eeeff68444e46315656b04b6208c303 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 07:48:09 +1000 Subject: [PATCH 22/39] Update ExponentialSequence.php --- src/Functional/Sequences/ExponentialSequence.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Functional/Sequences/ExponentialSequence.php b/src/Functional/Sequences/ExponentialSequence.php index 9f3302b0..be414d9e 100644 --- a/src/Functional/Sequences/ExponentialSequence.php +++ b/src/Functional/Sequences/ExponentialSequence.php @@ -49,7 +49,7 @@ public function next(): void $this->times++; } - public function key(): null + public function key(): mixed { return null; } From d6d3d7cd5c786c2b79cdffd2fca903429bd12b1b Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 07:48:12 +1000 Subject: [PATCH 23/39] Update LinearSequence.php --- src/Functional/Sequences/LinearSequence.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Functional/Sequences/LinearSequence.php b/src/Functional/Sequences/LinearSequence.php index 5d526bc6..9947ff02 100644 --- a/src/Functional/Sequences/LinearSequence.php +++ b/src/Functional/Sequences/LinearSequence.php @@ -44,7 +44,7 @@ public function next(): void $this->value += $this->amount; } - public function key(): null + public function key(): mixed { return 0; } From 71304c887f2090ad8269eab5ba29ee765609448f Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 10:21:00 +1000 Subject: [PATCH 24/39] Update ErrorToExceptionTest.php --- tests/Functional/ErrorToExceptionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Functional/ErrorToExceptionTest.php b/tests/Functional/ErrorToExceptionTest.php index e68893e0..14c20b65 100644 --- a/tests/Functional/ErrorToExceptionTest.php +++ b/tests/Functional/ErrorToExceptionTest.php @@ -22,7 +22,7 @@ class ErrorToExceptionTest extends AbstractTestCase public function testErrorIsThrownAsException(): void { $origFn = function () { - \trigger_error('Some error', E_USER_ERROR); + \trigger_error('Some error', E_USER_DEPRECATED); }; $fn = error_to_exception($origFn); From cf481fd7e49cc31008fe15b2dd4b0413f002e331 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 10:21:13 +1000 Subject: [PATCH 25/39] Update GroupTest.php --- tests/Functional/GroupTest.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/Functional/GroupTest.php b/tests/Functional/GroupTest.php index d8ea2f1c..4d5c2982 100644 --- a/tests/Functional/GroupTest.php +++ b/tests/Functional/GroupTest.php @@ -38,11 +38,25 @@ public function test(): void self::assertSame(['' => ['k1' => 'val1', 'k3' => 'val3'], 'foo' => ['k2' => 'val2']], group($this->hashIterator, $fn)); } + public function testFloatKeys(): void + { + $hashWithFloat = [1 => 'val1', (int) 2.1 => 'val2', 3 => 'val3']; + $localHashIterator = new ArrayIterator($hashWithFloat); + + $fn = function ($v, $k, $collection) { + InvalidArgumentException::assertCollection($collection, __FUNCTION__, 3); + return (\is_int($k) ? ($k % 2 == 0) : ($v[3] % 2 == 0)) ? 'foo' : ''; + }; + + self::assertSame(['' => [1 => 'val1', 3 => 'val3'], 'foo' => [2 => 'val2']], group($hashWithFloat, $fn)); + self::assertSame(['' => [1 => 'val1', 3 => 'val3'], 'foo' => [2 => 'val2']], group($localHashIterator, $fn)); + } + public function testExceptionIsThrownWhenCallbacksReturnsInvalidKey(): void { $array = ['v1', 'v2', 'v3', 'v4', 'v5', 'v6']; $keyMap = [true, 1, -1, 2.1, 'str', null]; - $fn = function ($v, $k, $collection) use (&$keyMap) { + $fn = function ($v, $k) use (&$keyMap) { return $keyMap[$k]; }; $result = [ From b4b1fbab0996ee6524069426a559daa863e3a55d Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 10:21:21 +1000 Subject: [PATCH 26/39] Update RepeatTest.php --- tests/Functional/RepeatTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Functional/RepeatTest.php b/tests/Functional/RepeatTest.php index 8f6ebab6..7fe2e5dc 100644 --- a/tests/Functional/RepeatTest.php +++ b/tests/Functional/RepeatTest.php @@ -46,7 +46,7 @@ public function testNegativeRepeatedTimes(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'Functional\{closure}() expects parameter 1 to be positive integer, negative integer given' + '{closure:Functional\repeat():26}() expects parameter 1 to be positive integer, negative integer given' ); repeat([$this->repeated, 'foo'])(-1); From 37d58102f90b535f6e9027a0d0cfe28eb5e83315 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 10:34:30 +1000 Subject: [PATCH 27/39] fix linting issues --- src/Functional/Functional.php | 1 - tests/Functional/PartialMethodTest.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Functional/Functional.php b/src/Functional/Functional.php index caaed895..59936572 100644 --- a/src/Functional/Functional.php +++ b/src/Functional/Functional.php @@ -12,7 +12,6 @@ final class Functional { - /** * @see \Function\ary */ diff --git a/tests/Functional/PartialMethodTest.php b/tests/Functional/PartialMethodTest.php index 2417ed90..e52946b1 100644 --- a/tests/Functional/PartialMethodTest.php +++ b/tests/Functional/PartialMethodTest.php @@ -14,7 +14,6 @@ class PartialMethodTest extends AbstractPartialTestCase { - public function testWithNoArgs(): void { $method = partial_method('execute'); From da97a3517b43a54867839aa3cd16ece5649493f1 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 10:38:47 +1000 Subject: [PATCH 28/39] Update test.yaml --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6c37fb80..428e5160 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -55,3 +55,4 @@ jobs: - name: Check coding style run: composer coding-style + if: matrix.php-version != 8.4 From e86b51f48b1f698c1aeeef1ad96ae5b0746d097b Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 31 Mar 2025 10:40:25 +1000 Subject: [PATCH 29/39] remove docker config --- composer.json | 3 --- docker/84.Dockerfile | 10 ---------- docker/docker-compose.yml | 11 ----------- 3 files changed, 24 deletions(-) delete mode 100644 docker/84.Dockerfile delete mode 100644 docker/docker-compose.yml diff --git a/composer.json b/composer.json index 27cf0339..ee919cb6 100644 --- a/composer.json +++ b/composer.json @@ -132,9 +132,6 @@ } }, "scripts": { - "docker:start": "docker compose -p functional-php -f docker/docker-compose.yml up -d", - "docker:stop": "docker compose -p functional-php -f docker/docker-compose.yml down", - "docker:rebuild": "docker compose -p functional-php -f docker/docker-compose.yml build --force-rm --no-cache && docker-compose -p functional-php -f docker/docker-compose.yml up -d --remove-orphans", "tests": "vendor/bin/phpunit", "coding-style": "vendor/bin/phpcs && vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist", "clear": "rm -rf vendor/" diff --git a/docker/84.Dockerfile b/docker/84.Dockerfile deleted file mode 100644 index 89519667..00000000 --- a/docker/84.Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM tithely/php:8.4-apache-dev - -#------------------------------ -# Begin changes below this note -#------------------------------ - -# Install custom packages -RUN apt-get update -qq && \ - apt-get install -qq \ - vim diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 9c01cf23..00000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -services: - php_84: - build: - dockerfile: docker/84.Dockerfile - context: ../ - container_name: functional_php_84 - environment: - - PCOV_ENABLED=1 - - PCOV_DIRECTORY=/app/src - volumes: - - ../:/app From aee25c675a146544dc662e768c8844e62a1af77f Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 22 Sep 2025 15:28:51 +0000 Subject: [PATCH 30/39] clean up codebase --- .github/workflows/test.yaml | 5 ++--- .gitignore | 1 + .php_cs.dist | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 .php_cs.dist diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 428e5160..c86f67a5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,7 +19,7 @@ jobs: - 8.4 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: Install PHP with extensions uses: shivammathur/setup-php@v2 @@ -54,5 +54,4 @@ jobs: run: composer tests - name: Check coding style - run: composer coding-style - if: matrix.php-version != 8.4 + run: composer lint:scan diff --git a/.gitignore b/.gitignore index 09e8c9d5..44aebe75 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ phpcs.xml phpunit.xml .idea/ .phpunit.result.cache +.php-cs-fixer.cache diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index 4238d7e8..00000000 --- a/.php_cs.dist +++ /dev/null @@ -1,8 +0,0 @@ -setRiskyAllowed(true) - ->setRules([ - 'native_function_invocation' => true, - ]) - ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)); From a4741eea7b40a0a9c2489a10fe074e7699a45df9 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 22 Sep 2025 16:28:51 +0000 Subject: [PATCH 31/39] clean up codebase --- composer.json | 18 +++++++++++++----- src/Functional/CompareObjectHashOn.php | 2 +- src/Functional/CompareOn.php | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index ee919cb6..c65785d7 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "lstrojny/functional-php", + "name": "tithely/functional-php", "description": "Functional primitives for PHP", "keywords": [ "functional" @@ -22,7 +22,7 @@ "require-dev": { "squizlabs/php_codesniffer": "~3.0", "phpunit/phpunit": "^9.6", - "friendsofphp/php-cs-fixer": "^2.17" + "friendsofphp/php-cs-fixer": "v3.84" }, "autoload": { "psr-4": { @@ -132,8 +132,16 @@ } }, "scripts": { - "tests": "vendor/bin/phpunit", - "coding-style": "vendor/bin/phpcs && vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist", - "clear": "rm -rf vendor/" + "test": "vendor/bin/phpunit", + "test:84": "docker exec -w /app functional_php_84 ./vendor/bin/phpunit --colors=always --no-coverage", + "lint:scan": "vendor/bin/php-cs-fixer fix src --config=.php-cs-fixer.dist.php --dry-run", + "lint:fix": "vendor/bin/php-cs-fixer fix src --config=.php-cs-fixer.dist.php", + "clear": "rm -rf vendor/", + "clean-vendor": "rm -rf vendor && rm -rf composer.lock", + "docker:start": "docker compose -p functional_php -f docker/docker-compose.yml up -d", + "docker:stop": "docker compose -p functional_php -f docker/docker-compose.yml down", + "docker:rebuild": "docker compose -p functional_php -f docker/docker-compose.yml build --force-rm && docker-compose -p functional_php -f docker/docker-compose.yml up -d --remove-orphans", + "docker:rebuild:nocache": "docker compose -p functional_php -f docker/docker-compose.yml build --force-rm --no-cache && docker-compose -p functional_php -f docker/docker-compose.yml up -d --remove-orphans", + "docker:shell": "docker exec -w /app -it functional_php_84 /bin/bash" } } diff --git a/src/Functional/CompareObjectHashOn.php b/src/Functional/CompareObjectHashOn.php index faf6c2e2..35e0ce04 100644 --- a/src/Functional/CompareObjectHashOn.php +++ b/src/Functional/CompareObjectHashOn.php @@ -14,7 +14,7 @@ * Returns a comparison function that can be used with e.g. `usort()` * * @param callable $comparison A function that compares the two values. Pick e.g. strcmp() or strnatcasecmp() - * @param callable $keyFunction A function that takes an argument and returns the value that should be compared + * @param callable|null $keyFunction A function that takes an argument and returns the value that should be compared * @return callable * @no-named-arguments */ diff --git a/src/Functional/CompareOn.php b/src/Functional/CompareOn.php index eec4a2d2..2d7f2486 100644 --- a/src/Functional/CompareOn.php +++ b/src/Functional/CompareOn.php @@ -14,7 +14,7 @@ * Returns a comparison function that can be used with e.g. `usort()` * * @param callable $comparison A function that compares the two values. Pick e.g. strcmp() or strnatcasecmp() - * @param callable $reducer A function that takes an argument and returns the value that should be compared + * @param callable|null $reducer A function that takes an argument and returns the value that should be compared * @return callable * @no-named-arguments */ From e4ccce75089bb741808e8acb6228e8c562b739dc Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 22 Sep 2025 17:28:52 +0000 Subject: [PATCH 32/39] clean up codebase --- src/Functional/Concat.php | 2 +- src/Functional/Curry.php | 1 + src/Functional/Entries.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Functional/Concat.php b/src/Functional/Concat.php index 09426c6e..c49dcb82 100644 --- a/src/Functional/Concat.php +++ b/src/Functional/Concat.php @@ -13,7 +13,7 @@ /** * Concatenates zero or more strings * - * @param string[] ...$strings + * @param string ...$strings * @return string * @no-named-arguments */ diff --git a/src/Functional/Curry.php b/src/Functional/Curry.php index 52099360..253b8d91 100644 --- a/src/Functional/Curry.php +++ b/src/Functional/Curry.php @@ -22,6 +22,7 @@ * @param bool $required curry optional parameters ? * @return callable a curryied version of the given function * @no-named-arguments + * @throws \ReflectionException */ function curry(callable $function, $required = true) { diff --git a/src/Functional/Entries.php b/src/Functional/Entries.php index 1fc22531..58b1482b 100644 --- a/src/Functional/Entries.php +++ b/src/Functional/Entries.php @@ -17,7 +17,7 @@ * Inspired by JavaScript’s `Object.entries`, and Python’s `enumerate`, * convert a key-value map into an array of key-value pairs * - * @see Functional\from_entries + * @see from_entries * @param Traversable|array $collection * @param int $start * @return array From 5582ea4ddbdfb4ad468a7a0ac19be43001fa6888 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 22 Sep 2025 18:28:52 +0000 Subject: [PATCH 33/39] clean up codebase --- src/Functional/FromEntries.php | 2 +- src/Functional/Functional.php | 22 +++++++++++----------- src/Functional/Group.php | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Functional/FromEntries.php b/src/Functional/FromEntries.php index 65dd5ffc..68bcac8c 100644 --- a/src/Functional/FromEntries.php +++ b/src/Functional/FromEntries.php @@ -17,7 +17,7 @@ * Inspired by JavaScript’s `Object.fromEntries`, * convert an array of key-value pairs into a key-value map * - * @see Functional\entries + * @see entries * @param Traversable|array $collection * @return array * @no-named-arguments diff --git a/src/Functional/Functional.php b/src/Functional/Functional.php index 59936572..06a9b1b3 100644 --- a/src/Functional/Functional.php +++ b/src/Functional/Functional.php @@ -253,58 +253,58 @@ final class Functional const less_than_or_equal = '\Functional\less_than_or_equal'; /** - * @see \Functional\lexicographic_compare + * @see lexicographic_compare */ const lexicographic_compare = '\Functional\lexicographic_compare'; /** - * @see \Functional\map + * @see map */ const map = '\Functional\map'; /** - * @see \Functional\matching + * @see matching * @deprecated */ const match = '\Functional\match'; /** - * @see \Functional\matching + * @see matching */ const matching = '\Functional\matching'; /** - * @see \Functional\maximum + * @see maximum */ const maximum = '\Functional\maximum'; /** - * @see \Functional\memoize + * @see memoize */ const memoize = '\Functional\memoize'; /** - * @see \Functional\minimum + * @see minimum */ const minimum = '\Functional\minimum'; /** - * @see \Functional\none + * @see none */ const none = '\Functional\none'; /** - * @see \Functional\noop + * @see noop */ const noop = '\Functional\noop'; /** - * @see \Functional\not + * @see not */ const not = '\Functional\not'; /** - * @see \Functional\omit_keys + * @see omit_keys */ const omit_keys = '\Functional\omit_keys'; diff --git a/src/Functional/Group.php b/src/Functional/Group.php index 1d30a248..f3da56d5 100644 --- a/src/Functional/Group.php +++ b/src/Functional/Group.php @@ -33,8 +33,8 @@ function group($collection, callable $callback) InvalidArgumentException::assertValidArrayKey($groupKey, __FUNCTION__); // Avoid implicit conversion, since float numbers cannot be used as array keys - if (is_numeric($groupKey)) { - $groupKey = intval($groupKey); + if (\is_numeric($groupKey)) { + $groupKey = (int) $groupKey; } if (!isset($groups[$groupKey])) { From 6812eace33ad858f42f201aa4d985ab74fa10c4e Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 22 Sep 2025 19:28:52 +0000 Subject: [PATCH 34/39] clean up codebase --- src/Functional/Head.php | 2 +- tests/Functional/ErrorToExceptionTest.php | 2 +- tests/Functional/GroupTest.php | 24 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Functional/Head.php b/src/Functional/Head.php index 48f8bedd..3019ee86 100644 --- a/src/Functional/Head.php +++ b/src/Functional/Head.php @@ -17,7 +17,7 @@ * Alias for Functional\first * * @param Traversable|array $collection - * @param callable $callback + * @param callable|null $callback * @return mixed * @no-named-arguments */ diff --git a/tests/Functional/ErrorToExceptionTest.php b/tests/Functional/ErrorToExceptionTest.php index 14c20b65..d059c50e 100644 --- a/tests/Functional/ErrorToExceptionTest.php +++ b/tests/Functional/ErrorToExceptionTest.php @@ -71,7 +71,7 @@ static function ($level, $message) use (&$errorMessage) { try { $fn(); self::fail('ErrorException expected'); - } catch (ErrorException $e) { + } catch (ErrorException) { self::assertNull($errorMessage); } diff --git a/tests/Functional/GroupTest.php b/tests/Functional/GroupTest.php index 4d5c2982..8766ea02 100644 --- a/tests/Functional/GroupTest.php +++ b/tests/Functional/GroupTest.php @@ -132,4 +132,28 @@ public function testPassNonCallable(): void $this->expectCallableArgumentError('Functional\group', 2); group($this->list, 'undefinedFunction'); } + + public function testFloatGroupKeysAreBeingCastToInteger(): void + { + $values = [5, 10, 11, 15]; + $fn = function ($v) { + return $v / 5; + }; + + $actual = group($values, $fn); + $expected = [ + 1 => [ + 0 => 5 + ], + 2 => [ + 1 => 10, + 2 => 11 + ], + 3 => [ + 3 => 15 + ] + ]; + + self::assertEquals($expected, $actual); + } } From d016f82b30fd145c8e67860ef90cfcfc86431ce5 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 23 Sep 2025 09:03:20 +1000 Subject: [PATCH 35/39] added docker config --- docker/custom.ini | 2 ++ docker/docker-compose.yml | 17 +++++++++++++++++ docker/php/84.Dockerfile | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 docker/custom.ini create mode 100644 docker/docker-compose.yml create mode 100644 docker/php/84.Dockerfile diff --git a/docker/custom.ini b/docker/custom.ini new file mode 100644 index 00000000..22411123 --- /dev/null +++ b/docker/custom.ini @@ -0,0 +1,2 @@ +post_max_size = 100M +max_execution_time = 300 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..c1b4a14e --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,17 @@ +services: + functional_php_84: + build: + dockerfile: docker/php/84.Dockerfile + context: ../ + container_name: functional_php_84 + volumes: + - ../:/app + networks: + - tithely_hub_code-network + environment: + - CONF_DISABLED=xdebug + - PCOV_ENABLED=1 + - PCOV_DIRECTORY=/app +networks: + tithely_hub_code-network: + external: true diff --git a/docker/php/84.Dockerfile b/docker/php/84.Dockerfile new file mode 100644 index 00000000..eb47b3c4 --- /dev/null +++ b/docker/php/84.Dockerfile @@ -0,0 +1,13 @@ +FROM tithely/php:8.4-apache-dev + +#------------------------------ +# Begin changes below this note +#------------------------------ + +# Install custom packages +RUN apt-get update -qq && \ + apt-get install -qq \ + vim + +# Copy custom php.ini settings +COPY docker/custom.ini /usr/local/etc/php/conf.d/custom_overrides.ini From f6e650f993a75f9277d501b98c834c4ddb822c98 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 23 Sep 2025 09:03:57 +1000 Subject: [PATCH 36/39] fix php cs fixer --- .php-cs-fixer.dist.php | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .php-cs-fixer.dist.php diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..edd33527 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,8 @@ +setRiskyAllowed(true) + ->setRules([ + 'native_function_invocation' => true, + ]) + ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)); From 095d92c6c447bd0270903867c87c78e63c32005b Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 23 Sep 2025 10:24:57 +1000 Subject: [PATCH 37/39] remove deprecated test --- tests/Functional/MatchingTest.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tests/Functional/MatchingTest.php b/tests/Functional/MatchingTest.php index df7b16de..5d5c5bdd 100644 --- a/tests/Functional/MatchingTest.php +++ b/tests/Functional/MatchingTest.php @@ -16,8 +16,6 @@ use function Functional\equal; use function Functional\const_function; -use const PHP_VERSION_ID; - class MatchingTest extends AbstractTestCase { public function testMatching(): void @@ -94,18 +92,4 @@ public function testMatchingConditionCallables(): void ] ); } - - public function testDeprecatedAlias(): void - { - if (PHP_VERSION_ID >= 80000) { - self::markTestSkipped('Only works with PHP <8.0'); - } - - $this->expectDeprecation(); - $this->expectDeprecationMessage( - 'Functional\match() will be unavailable with PHP 8. Use Functional\matching() instead' - ); - - \call_user_func('Functional\match', []); - } } From c1bc92eb5aa0f8e2c5a3cf16fd287e952bfefa29 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 23 Sep 2025 10:26:56 +1000 Subject: [PATCH 38/39] Update test.yaml --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c86f67a5..6236fde8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -51,7 +51,7 @@ jobs: continue-on-error: true - name: Run Tests - run: composer tests + run: composer test - name: Check coding style run: composer lint:scan From 8e91a3b38751b8fb9a445aa790603e6b0d28deff Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 23 Sep 2025 10:29:29 +1000 Subject: [PATCH 39/39] Update test.yaml --- .github/workflows/test.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6236fde8..c0c00271 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,6 +52,3 @@ jobs: - name: Run Tests run: composer test - - - name: Check coding style - run: composer lint:scan